wangchuanjin 2 年 前
コミット
83d258cda7
1 ファイル変更23 行追加4 行削除
  1. 23 4
      compatible/compatible.go

+ 23 - 4
compatible/compatible.go

@@ -8,6 +8,7 @@ import (
 	. "app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jybase/mysql"
 	. "app.yhyue.com/moapp/jypkg/middleground"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 )
 
 type Compatible struct {
@@ -29,8 +30,27 @@ func NewCompatible(mgo *MongodbSim, baseService, mainMysql *mysql.Mysql, middleg
 	}
 }
 
-//查询
+//根据mgo库user表_id,或者企业身份的职位id查询
+//根据mgo库user表_id,或者企业身份的职位id查询
 func (c *Compatible) Select(id string, fd interface{}) *map[string]interface{} {
+	var identity *pb.Identity
+	if !IsObjectIdHex(id) {
+		identity = c.Middleground.UserCenter.IdentityByPositionId(util.Int64All(id))
+	}
+	return c.selectDo(id, identity, fd)
+}
+
+//根据mgo库user表_id,或者企业身份的职位id查询
+func (c *Compatible) SelectByEntUserId(id string, fd interface{}) *map[string]interface{} {
+	var identity *pb.Identity
+	if !IsObjectIdHex(id) {
+		identity = c.Middleground.UserCenter.IdentityByEntUserId(util.Int64All(id))
+	}
+	return c.selectDo(id, identity, fd)
+}
+
+//
+func (c *Compatible) selectDo(id string, identity *pb.Identity, fd interface{}) *map[string]interface{} {
 	field := ObjToOth(fd)
 	user := map[string]interface{}{}
 	if field == nil || len(*field) == 0 {
@@ -43,13 +63,12 @@ func (c *Compatible) Select(id string, fd interface{}) *map[string]interface{} {
 			user = *temp
 		}
 	} else {
-		identity := c.Middleground.UserCenter.IdentityByPositionId(util.Int64All(id))
 		if identity == nil {
 			return &user
 		}
 		if identity.UserId > 0 {
 			ufd := map[string]interface{}{}
-			for _, k := range []string{"s_m_openid", "s_phone", "s_m_phone", "s_unionid", "s_headimage", "s_headimageurl", "s_nickname", "l_registedate", "s_appversion", "i_ispush", "s_jyname"} {
+			for _, k := range []string{"s_m_openid", "s_phone", "s_m_phone", "s_unionid", "s_headimage", "s_headimageurl", "s_nickname", "l_registedate", "s_appversion", "i_ispush", "s_jyname", "s_jpushid", "s_opushid", "s_appponetype", "i_applystatus"} {
 				if v, ok := (*field)[k]; ok {
 					ufd[k] = v
 				}
@@ -110,7 +129,7 @@ func (c *Compatible) Select(id string, fd interface{}) *map[string]interface{} {
 	return &user
 }
 
-//更新
+//根据mgo库user表_id,或者企业身份的职位id更新
 func (c *Compatible) Update(id string, update map[string]interface{}) bool {
 	if IsObjectIdHex(id) {
 		return c.Mgo.UpdateById("user", id, update)