Browse Source

feat:超级订阅和大会员 管理员权限

wangshan 2 years ago
parent
commit
aa5a8fc611
2 changed files with 25 additions and 11 deletions
  1. 21 7
      entity/user.go
  2. 4 4
      rpc/etc/usercenter.yaml

+ 21 - 7
entity/user.go

@@ -87,6 +87,14 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
 		registerTime = userPowers.Free.Registedate
 		//大会员
 		member := userPowers.Member
+		//超级订阅
+		vip := userPowers.Vip
+		//企业信息
+		entInfo := userPowers.Ent
+		//商机管理
+		entNiche := userPowers.Entniche
+		//免费用户
+		free := userPowers.Free
 		if member.Status > 0 || ConfigJson.BigMemberOff {
 			if member.Status > 0 {
 				UserPowerMap["0"] = int(member.Status)
@@ -99,8 +107,6 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
 				}
 			}
 		}
-		//超级订阅
-		vip := userPowers.Vip
 		if vip.Status > 0 {
 			if registerTime < vip.EndTime {
 				registerTime = vip.EndTime
@@ -111,6 +117,11 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
 			if vip.Upgrade > 0 && member.Status < 1 {
 				UserPowerMap["202"] = int(vip.Status)
 			}
+			if entInfo.EntRoleId == 1 {
+				UserPowerMap["203"] = 1 //企业管理员
+			} else if entInfo.EntRoleId == 2 {
+				UserPowerMap["204"] = 1 //部门管理员
+			}
 		}
 		//企业信息
 		if m.EntId > 0 {
@@ -120,9 +131,6 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
 				UserPowerMap["901"] = 1
 			}
 		}
-		entInfo := userPowers.Ent
-		//商机管理
-		entNiche := userPowers.Entniche
 		if entNiche.Status > 0 && entNiche.IsEntPower > 0 {
 			//entInfo.EntRoleId 1:企业管理员 2:部门管理员
 			//管理员 entInfo.EntRoleId>0 并不一定 entNiche.IsEntPower==1,entNiche.IsEntPower==0 也有权限(已废除)
@@ -169,8 +177,6 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
 				//}
 			}
 		}
-		//免费用户
-		free := userPowers.Free
 		if free.IsFree {
 			UserPowerMap["300"] = 1
 			if free.IsUpgrade {
@@ -184,6 +190,14 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
 			UserPowerMap["400"] = 1
 		}
 		//人员行为统计菜单-1、购买大会员且创建了企业的管理员;2、新版商机管理管理员;3、商机管理服务管理员
+		if member.Status > 0 {
+			UserPowerMap["50"] = 1 //
+			if entInfo.EntRoleId == 1 {
+				UserPowerMap["58"] = 1 //企业管理员
+			} else if entInfo.EntRoleId == 2 {
+				UserPowerMap["59"] = 1 // 部门管理员
+			}
+		}
 		if entInfo.EntRoleId > 0 && member.Status > 0 {
 			UserPowerMap["50"] = 1
 		}

+ 4 - 4
rpc/etc/usercenter.yaml

@@ -13,17 +13,17 @@ CalleeId: usercenter.rpc
 ResourceEtcdConf:
   Etcd:
     Hosts:
-      - 192.168.3.206:2379
+      - 192.168.3.149:2379
     Key: resource.rpc
 PowersEtcdConf:
   Etcd:
     Hosts:
-      - 192.168.3.206:2379
+      - 192.168.3.149:2379
     Key: powercheck.rpc
 Node: 1
 Mysql:
   dbName: jianyu
-  address: 192.168.3.11:3366
+  address: 192.168.3.149:3306
   userName: root
   passWord: Topnet123
   maxOpenConns: 5
@@ -45,7 +45,7 @@ CheckEntIsExpire: 00:00
 DoMain: https://jybx-webtest.jydev.jianyu360.com
 Timeout: 5000
 RedisAddrees:
-  - newother=192.168.3.206:1712
+  - newother=192.168.3.149:1712
 RedisOutTime: 61 #工作桌面redis缓存时间
 InternalTime: 121 #用户权限 redis 缓存时间
 Mongo: