|
@@ -17,6 +17,7 @@ const (
|
|
|
RedisMenuKey = "jy_workdesktopmenu_%s_%s_%s"
|
|
|
UserPowerRedisKey = "jy_userpowerredis_%s_%d_%s"
|
|
|
UserEntIdKey = "jy_userentid_%s_%d_%s"
|
|
|
+ CapitalRetention = "capital_retention"
|
|
|
)
|
|
|
|
|
|
/*
|
|
@@ -24,7 +25,7 @@ const (
|
|
|
*测试用例放的地方不对 待调整
|
|
|
*/
|
|
|
//用户权限 初始化
|
|
|
-func AutoUserPowerInfo(userId, appId string, internalTime int, bigMemberOff bool, entId int64) map[string]int {
|
|
|
+func AutoUserPowerInfo(userId, baseUserId, appId string, internalTime int, bigMemberOff bool, entId int64) map[string]int {
|
|
|
/*
|
|
|
* 商机管理--》新版商机管理vs老版商机管理
|
|
|
* 大会员--》bigmember_service
|
|
@@ -43,7 +44,10 @@ func AutoUserPowerInfo(userId, appId string, internalTime int, bigMemberOff bool
|
|
|
//查询用户信息
|
|
|
data, ok := Mgo.FindById("user", userId, `{"s_phone":1,"s_m_phone":1,i_member_status":1,"s_member_mainid":1,"i_member_sub_status":1,"i_vip_status":1,"o_vipjy":1,"o_jy":1,"l_registedate":1}`)
|
|
|
if ok && *data != nil && len(*data) > 0 {
|
|
|
- var isFree = true
|
|
|
+ var (
|
|
|
+ isFree = true
|
|
|
+ domainBool = false //第一版领域化权限判断
|
|
|
+ )
|
|
|
phone, _ := MC.If((*data)["s_phone"] != nil, (*data)["s_phone"], (*data)["s_m_phone"]).(string)
|
|
|
if phone != "" {
|
|
|
//同一个手机号 多个商机管理角色 其中一个是企业管理员或者部门管理员 查的时候按角色权重排序
|
|
@@ -82,6 +86,7 @@ func AutoUserPowerInfo(userId, appId string, internalTime int, bigMemberOff bool
|
|
|
if memberStatus := MC.IntAll((*data)["i_member_status"]); memberStatus > 0 || bigMemberOff {
|
|
|
userId := userId
|
|
|
if memberStatus > 0 {
|
|
|
+ domainBool = true
|
|
|
isFree = false
|
|
|
UserPowerMap["0"] = memberStatus
|
|
|
//是否是子账号 而且 子账号被启用
|
|
@@ -99,6 +104,7 @@ func AutoUserPowerInfo(userId, appId string, internalTime int, bigMemberOff bool
|
|
|
}
|
|
|
//VIP用户
|
|
|
if vipStatus := MC.IntAll((*data)["i_vip_status"]); vipStatus > 0 {
|
|
|
+ domainBool = true
|
|
|
isFree = false
|
|
|
UserPowerMap["200"] = vipStatus
|
|
|
if vipSet := MC.ObjToMap((*data)["o_vipjy"]); vipSet != nil {
|
|
@@ -123,6 +129,15 @@ func AutoUserPowerInfo(userId, appId string, internalTime int, bigMemberOff bool
|
|
|
if Mysql.CountBySql(`select count(*) from privatedata where phone = ?`, phone) > 0 {
|
|
|
UserPowerMap["400"] = 1
|
|
|
}
|
|
|
+ //领域化产品权限
|
|
|
+ //第一版:必须是大会员或者超级订阅用户 且留资 留资表:capital_retention;source = 'medical_domain',未留资提示留资信息
|
|
|
+ //第二版:调资源中台rpc获取用户是否有使用领域化产品的权限 无权限则去购买
|
|
|
+ if domainBool {
|
|
|
+ c := BaseMysql.CountBySql(`SELECT COUNT(id) FROM `+CapitalRetention+` WHERE source = 'medical_domain' AND user_id = ? AND appid = ?`, baseUserId, appId)
|
|
|
+ if c > 0 {
|
|
|
+ UserPowerMap["500"] = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if UserPowerMap != nil {
|
|
|
bytes, err := json.Marshal(UserPowerMap)
|