|
@@ -53,8 +53,8 @@ func AutoUserPowerInfo(userId, baseUserId, appId string, internalTime int, bigMe
|
|
|
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
|
|
|
- //domainBool = false //第一版领域化权限判断
|
|
|
+ isFree = true
|
|
|
+ domainBool = false //第一版领域化权限判断
|
|
|
)
|
|
|
phone, _ := MC.If((*data)["s_phone"] != nil, (*data)["s_phone"], (*data)["s_m_phone"]).(string)
|
|
|
if phone != "" {
|
|
@@ -94,7 +94,7 @@ func AutoUserPowerInfo(userId, baseUserId, appId string, internalTime int, bigMe
|
|
|
if memberStatus := MC.IntAll((*data)["i_member_status"]); memberStatus > 0 || bigMemberOff {
|
|
|
userId := userId
|
|
|
if memberStatus > 0 {
|
|
|
- //domainBool = true
|
|
|
+ domainBool = true
|
|
|
isFree = false
|
|
|
UserPowerMap["0"] = memberStatus
|
|
|
//是否是子账号 而且 子账号被启用
|
|
@@ -112,7 +112,7 @@ func AutoUserPowerInfo(userId, baseUserId, appId string, internalTime int, bigMe
|
|
|
}
|
|
|
//VIP用户
|
|
|
if vipStatus := MC.IntAll((*data)["i_vip_status"]); vipStatus > 0 {
|
|
|
- //domainBool = true
|
|
|
+ domainBool = true
|
|
|
isFree = false
|
|
|
UserPowerMap["200"] = vipStatus
|
|
|
if vipSet := MC.ObjToMap((*data)["o_vipjy"]); vipSet != nil {
|
|
@@ -144,12 +144,12 @@ func AutoUserPowerInfo(userId, baseUserId, appId string, internalTime int, bigMe
|
|
|
//1:是否是大会员或者超级订阅用户 否:提示购买到超级订阅购买页; 是>-2
|
|
|
//2:判断用户是否留资 否:提示用去留资;是:>-3
|
|
|
//3:资源中台获取用户权限码判断是否有权限 否:提示用户去联系客服
|
|
|
- //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 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)
|
|
@@ -195,7 +195,7 @@ func UserRolePowerInit(strs []string) {
|
|
|
}
|
|
|
|
|
|
//
|
|
|
-func CheckCapitalResources(menu *JYMenu, baseUserId, appId string, entId, entUserId int64) (title, content, confirmUrl, confirmText string, usable bool) {
|
|
|
+func CheckCapitalResources(menu *JYMenu, baseUserId, appId string, entId, entUserId int64, b bool) (title, content, confirmUrl, confirmText string, usable bool) {
|
|
|
OverallLock.Lock()
|
|
|
if UserCapitals[baseUserId] == nil {
|
|
|
UserCapitals[baseUserId] = map[string]int{}
|
|
@@ -212,6 +212,7 @@ func CheckCapitalResources(menu *JYMenu, baseUserId, appId string, entId, entUse
|
|
|
)
|
|
|
//用户是否需要留资
|
|
|
if menu.CapitalCode != "" {
|
|
|
+ capitalBool = false
|
|
|
for _, cv := range strings.Split(menu.CapitalCode, ",") {
|
|
|
userCapital := UserCapitals[baseUserId]
|
|
|
if userCapital[cv] < 0 {
|
|
@@ -224,6 +225,7 @@ func CheckCapitalResources(menu *JYMenu, baseUserId, appId string, entId, entUse
|
|
|
if c := BaseMysql.CountBySql(`SELECT COUNT(id) FROM `+CapitalRetention+` WHERE source = ? AND user_id = ? AND appid = ?`, cv, baseUserId, appId); c > 0 {
|
|
|
userCapital[cv] = 1
|
|
|
capitalBool = true
|
|
|
+ break
|
|
|
} else {
|
|
|
userCapital[cv] = -1
|
|
|
}
|
|
@@ -232,31 +234,39 @@ func CheckCapitalResources(menu *JYMenu, baseUserId, appId string, entId, entUse
|
|
|
} else {
|
|
|
capitalBool = true
|
|
|
}
|
|
|
- //资源中台--- 无权限弹窗信息为空
|
|
|
- if menu.PermissionCode != "" {
|
|
|
- for _, pv := range strings.Split(menu.PermissionCode, ",") {
|
|
|
- userPermission := UserPermissions[baseUserId]
|
|
|
- if userPermission[pv] == 0 {
|
|
|
- userPermission[pv] = -1
|
|
|
- powerList := GetResources(appId, baseUserId, entId, entUserId)
|
|
|
- if len(powerList) > 0 {
|
|
|
- for _, plv := range powerList {
|
|
|
- userPermission[plv] = 1
|
|
|
+ //大会员超级订阅用户 才有权限去验证是否有医疗权限
|
|
|
+ if b {
|
|
|
+ //资源中台--- 无权限弹窗信息为默认信息(先留资)
|
|
|
+ if menu.PermissionCode != "" {
|
|
|
+ permissionBool = false
|
|
|
+ if menu.CapitalCode != "" && capitalBool {
|
|
|
+ for _, pv := range strings.Split(menu.PermissionCode, ",") {
|
|
|
+ userPermission := UserPermissions[baseUserId]
|
|
|
+ if userPermission[pv] == 0 {
|
|
|
+ userPermission[pv] = -1
|
|
|
+ powerList := GetResources(appId, baseUserId, entId, entUserId)
|
|
|
+ if len(powerList) > 0 {
|
|
|
+ for _, plv := range powerList {
|
|
|
+ userPermission[plv] = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if userPermission[pv] < 0 {
|
|
|
+ //自定义弹窗
|
|
|
+ title = menu.AdditionalInfo.Title
|
|
|
+ content = menu.AdditionalInfo.Content
|
|
|
+ confirmUrl = menu.AdditionalInfo.ConfirmUrl
|
|
|
+ confirmText = menu.AdditionalInfo.ConfirmText
|
|
|
+ } else {
|
|
|
+ title = ""
|
|
|
+ permissionBool = true
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if userPermission[pv] < 0 {
|
|
|
- //自定义弹窗
|
|
|
- title = menu.AdditionalInfo.Title
|
|
|
- content = menu.AdditionalInfo.Content
|
|
|
- confirmUrl = menu.AdditionalInfo.ConfirmUrl
|
|
|
- confirmText = menu.AdditionalInfo.ConfirmText
|
|
|
- } else {
|
|
|
- permissionBool = true
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ permissionBool = true
|
|
|
}
|
|
|
- } else {
|
|
|
- permissionBool = true
|
|
|
}
|
|
|
usable = capitalBool && permissionBool
|
|
|
UserLock[baseUserId].Unlock()
|