Explorar el Código

feat:p562 rpc 初始化常用功能调整

fuwencai hace 1 año
padre
commit
d899ee4ebe
Se han modificado 2 ficheros con 54 adiciones y 5 borrados
  1. 5 5
      rpc/etc/usercenter.yaml
  2. 49 0
      service/workDesktop.go

+ 5 - 5
rpc/etc/usercenter.yaml

@@ -13,12 +13,12 @@ CalleeId: usercenter.rpc
 ResourceEtcdConf:
   Etcd:
     Hosts:
-      - 192.168.3.206:2379
+      - 192.168.3.207:2379
     Key: resource.rpc
 PowersEtcdConf:
   Etcd:
     Hosts:
-      - 192.168.3.206:2379
+      - 192.168.3.207:2379
     Key: powercheck.rpc
 Node: 1
 Mysql:
@@ -52,14 +52,14 @@ Mongo:
   Main:
     dbName: qfw
     size: 50
-    address: 192.168.3.206:27080
+    address: 192.168.3.149:27180
   Log:
     dbName: qfw
     size: 50
-    address: 192.168.3.206:27080
+    address: 192.168.3.149:27180
 BigMemberOff: false #大会员权益表是否开放给其他用户
 CommonlySize: 0 #常用功能数量
-CommonlyIds: 47,51,63,65,524 #默认常用功能
+CommonlyIds: 47,51,63,524,55,163,165,167,515 #默认常用功能
 UserRolePower: #需要初始化的用户角色
   - 大会员
   - 商机管理

+ 49 - 0
service/workDesktop.go

@@ -54,8 +54,57 @@ func RenewWorkDesktopMenuModeOrCommonly(in *WorkDesktopComprehensiveReq) (r *Wor
 			}
 		} else {
 			if entity.ConfigJson.CommonlyIds != "" && len(strings.Split(entity.ConfigJson.CommonlyIds, ",")) > 0 {
+				// 判断用户身份
 				var ids []string
+				var (
+					entId, _        = strconv.ParseInt(in.EntId, 10, 64)
+					newUserId, _    = strconv.ParseInt(in.NewUserId, 10, 64)
+					entUserId, _    = strconv.ParseInt(in.EntUserId, 10, 64)
+					accountId, _    = strconv.ParseInt(in.AccountId, 10, 64)
+					entAccountId, _ = strconv.ParseInt(in.EntAccountId, 10, 64)
+					positionType, _ = strconv.ParseInt(in.PositionType, 10, 64)
+					positionId, _   = strconv.ParseInt(in.PositionId, 10, 64)
+				)
+				userInfoRpc := entity.UserInfoRpc{
+					AppId:        in.AppId,
+					UserId:       in.UserId,
+					BaseUserId:   newUserId,
+					EntId:        entId,
+					EntUserId:    entUserId,
+					AccountId:    accountId,
+					EntAccountId: entAccountId,
+					PositionType: positionType,
+					PositionId:   positionId,
+					MgoUserId:    in.MgoUserId,
+				}
+				userPowers := userInfoRpc.GetUserPowers()
+
 				for _, v := range strings.Split(entity.ConfigJson.CommonlyIds, ",") {
+					//  p562 我的订阅判断用户身份
+					if userPowers != nil {
+						if v == "163" { // 我的订阅(大会员)
+							if userPowers.Member.Status <= 0 {
+								continue
+							}
+						} else if v == "165" { // 我的订阅(超级订阅)
+							if userPowers.Vip.Status <= 0 {
+								continue
+							}
+						} else if v == "55" { // 我的订阅(商机管理)新版
+							if userPowers.Entniche.Status <= 0 || userPowers.Entniche.IsNew <= 0 {
+								continue
+							}
+						} else if v == "515" { // 我的订阅(商机管理)老版
+							if userPowers.Entniche.Status <= 0 || userPowers.Entniche.IsNew > 0 {
+								continue
+							}
+						} else if v == "167" { // 我的订阅
+							if userPowers.Vip.Status > 0 || userPowers.Member.Status > 0 || userPowers.Entniche.Status > 0 {
+								continue
+							}
+						}
+					}
+
 					ids = append(ids, encrypt.SE.EncodeString(v))
 				}
 				in.MenuIds = strings.Join(ids, ",")