|
@@ -20,6 +20,7 @@ const (
|
|
|
UserPowerRedisKey = "jy_userpowerredis_%s_%d_%s"
|
|
|
UserEntIdKey = "jy_userentid_%s_%d_%s"
|
|
|
UserRegisterTime = "jy_userregistertime_%s"
|
|
|
+ EntnicheWaitEmpower = "entniche_wait_empower"
|
|
|
)
|
|
|
|
|
|
type UserInfo struct {
|
|
@@ -66,44 +67,44 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
|
|
|
isFree = true
|
|
|
//第一版领域化权限判断 ;第二版:超级订阅||大会员 到期时间超过90天
|
|
|
//商机管理服务 前提是超级订阅、大会员、医械通
|
|
|
- domainBool = false
|
|
|
- registerTime int64 = 0
|
|
|
- powerSource = 0
|
|
|
+ domainBool = false
|
|
|
+ registerTime int64 = 0
|
|
|
+ powerSource = 0
|
|
|
+ entnichePower = false //企业级服务 企业管理员
|
|
|
)
|
|
|
phone, _ := MC.If((*data)["s_phone"] != nil, (*data)["s_phone"], (*data)["s_m_phone"]).(string)
|
|
|
if phone != "" {
|
|
|
- //同一个手机号 多个商机管理角色 其中一个是企业管理员或者部门管理员 查的时候按角色权重排序
|
|
|
- entNicheInfos := Mysql.SelectBySql(`SELECT i.isNew,i.power_source,r.role_id,u.ent_id FROM (entniche_user u LEFT JOIN entniche_user_role r ON r.user_id = u.id) LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone = ? and u.power=1 and i.status=1 ORDER BY r.role_id,i.isNew DESC`, phone)
|
|
|
- //商机管理用户信息判断
|
|
|
- if entNicheInfos != nil && len(*entNicheInfos) > 0 {
|
|
|
- isFree = false
|
|
|
- for _, entNicheInfo := range *entNicheInfos {
|
|
|
- //判断是否是当前企业
|
|
|
- ent_id := MC.Int64All(entNicheInfo["ent_id"])
|
|
|
- if m.EntId > 0 && ent_id != m.EntId {
|
|
|
- continue
|
|
|
- }
|
|
|
- //商机管理服务 P259需求
|
|
|
- if powerSource == 0 {
|
|
|
+ //当前企业id
|
|
|
+ if m.EntId > 0 {
|
|
|
+ entNicheInfos := Mysql.SelectBySql(`SELECT i.status,i.isNew,i.power_source,r.role_id,u.power FROM (entniche_user u LEFT JOIN entniche_user_role r ON r.user_id = u.id) LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone = ? and i.id = ? ORDER BY r.role_id,i.isNew DESC`, phone, m.EntId)
|
|
|
+ //商机管理用户信息判断
|
|
|
+ if entNicheInfos != nil && len(*entNicheInfos) > 0 {
|
|
|
+ isFree = false
|
|
|
+ entNicheInfo := (*entNicheInfos)[0]
|
|
|
+ //判断是否是企业级服务管理员
|
|
|
+ entnichePower = MC.IntAll(entNicheInfo["role_id"]) == 2
|
|
|
+ //商机管理
|
|
|
+ if MC.IntAll(entNicheInfo["status"]) == 1 && MC.IntAll(entNicheInfo["power"]) == 1 {
|
|
|
+ //商机管理服务 P259需求
|
|
|
powerSource = MC.IntAll(entNicheInfo["power_source"])
|
|
|
- }
|
|
|
- //entNicheInfo := (*entNicheInfos)[0]
|
|
|
- switch MC.IntAll(entNicheInfo["isNew"]) {
|
|
|
- case 1: //新版商机管理
|
|
|
- UserPowerMap["110"] = 1
|
|
|
- switch MC.IntAll(entNicheInfo["role_id"]) {
|
|
|
- case 1: //部门管理员
|
|
|
- UserPowerMap["111"] = 1
|
|
|
- case 2: //企业管理员
|
|
|
- UserPowerMap["112"] = 1
|
|
|
- }
|
|
|
- case 0: //老版商机管理
|
|
|
- UserPowerMap["100"] = 1
|
|
|
- switch MC.IntAll(entNicheInfo["role_id"]) {
|
|
|
- case 1: //部门管理员
|
|
|
- UserPowerMap["101"] = 1
|
|
|
- case 2: //企业管理员
|
|
|
- UserPowerMap["102"] = 1
|
|
|
+ //entNicheInfo := (*entNicheInfos)[0]
|
|
|
+ switch MC.IntAll(entNicheInfo["isNew"]) {
|
|
|
+ case 1: //新版商机管理
|
|
|
+ UserPowerMap["110"] = 1
|
|
|
+ switch MC.IntAll(entNicheInfo["role_id"]) {
|
|
|
+ case 1: //部门管理员
|
|
|
+ UserPowerMap["111"] = 1
|
|
|
+ case 2: //企业管理员
|
|
|
+ UserPowerMap["112"] = 1
|
|
|
+ }
|
|
|
+ case 0: //老版商机管理
|
|
|
+ UserPowerMap["100"] = 1
|
|
|
+ switch MC.IntAll(entNicheInfo["role_id"]) {
|
|
|
+ case 1: //部门管理员
|
|
|
+ UserPowerMap["101"] = 1
|
|
|
+ case 2: //企业管理员
|
|
|
+ UserPowerMap["102"] = 1
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -168,6 +169,10 @@ func (m *WorkDesktopMenu) AutoUserPowerInfo() map[string]int {
|
|
|
}
|
|
|
//客户管理服务(商机管理服务) [前提:大会员、超级订阅、医械通用户]
|
|
|
UserPowerMap["600"] = MC.If(powerSource > 0 && domainBool, 1, 0).(int)
|
|
|
+ //必须是企业管理员-&-购买了企业级应用服务
|
|
|
+ if c := Mysql.CountBySql(fmt.Sprintf(`SELECT COUNT(id) FROM %s WHERE ent_id = ? AND TO_DAYS(end_time) >= TO_DAYS(NOW())`, EntnicheWaitEmpower), m.EntId); c > 0 && entnichePower {
|
|
|
+ UserPowerMap["700"] = 1
|
|
|
+ }
|
|
|
//领域化产品权限
|
|
|
//第一版:必须是大会员或者超级订阅用户 且留资 留资表:capital_retention;source = 'medical_domain',未留资提示留资信息
|
|
|
//第二版:调资源中台rpc获取用户是否有使用领域化产品的权限 无权限则去购买
|