|
@@ -20,6 +20,7 @@ import (
|
|
|
//工作桌面--常用功能更新
|
|
|
//工作桌面--常用功能列表
|
|
|
func RenewWorkDesktopMenuModeOrCommonly(in *WorkDesktopComprehensiveReq) (r *WorkDesktopComprehensiveResp) {
|
|
|
+ in.UserId = MC.If(in.PositionId != "", in.PositionId, in.UserId).(string) //职位id替换原userId
|
|
|
r = &WorkDesktopComprehensiveResp{}
|
|
|
switch in.ActionMode {
|
|
|
case "commonlyRenew": //常用功能更新
|
|
@@ -31,17 +32,19 @@ func RenewWorkDesktopMenuModeOrCommonly(in *WorkDesktopComprehensiveReq) (r *Wor
|
|
|
case "commonlyList":
|
|
|
//查询常用功能列表
|
|
|
in.ActionMode = "commonlyRenew"
|
|
|
- //existingData := entity.BaseMysql.SelectBySql(`SELECT value FROM `+entity.WorkCommonly+` WHERE base_userid = ? AND appid = ? AND field = ? AND platform = ? ORDER BY id DESC `, in.NewUserId, in.AppId, in.ActionMode, in.Platform)
|
|
|
- //常用功能不再分平台,来自需求
|
|
|
- existingData := entity.BaseMysql.SelectBySql(`SELECT value FROM `+entity.WorkCommonly+` WHERE base_userid = ? AND appid = ? AND field = ? ORDER BY id DESC `, in.NewUserId, in.AppId, in.ActionMode)
|
|
|
var (
|
|
|
pIds []string
|
|
|
)
|
|
|
+ //常用功能查看
|
|
|
+ existingData := entity.BaseMysql.SelectBySql(`SELECT value FROM `+entity.WorkCommonly+` WHERE base_userid = ? AND appid = ? AND field = ? AND userid = ? ORDER BY id DESC `, in.NewUserId, in.AppId, in.ActionMode, in.UserId)
|
|
|
+ if existingData == nil || len(*existingData) == 0 {
|
|
|
+ //P278原查询逻辑
|
|
|
+ existingData = entity.BaseMysql.SelectBySql(`SELECT value FROM `+entity.WorkCommonly+` WHERE base_userid = ? AND appid = ? AND field = ? ORDER BY id DESC `, in.NewUserId, in.AppId, in.ActionMode)
|
|
|
+ }
|
|
|
if existingData != nil && len(*existingData) > 0 {
|
|
|
eData := (*existingData)[0]
|
|
|
if MC.ObjToString(eData["value"]) != "" {
|
|
|
for _, pv := range strings.Split(MC.ObjToString(eData["value"]), ",") {
|
|
|
- //params = append(params, "?")
|
|
|
if pv == "" {
|
|
|
continue
|
|
|
}
|
|
@@ -226,20 +229,23 @@ func GetWorkDesktopMenuMode(in *WorkDesktopMenuInfoReq) (str string, err error)
|
|
|
|
|
|
// GetWordDesktopMenuTree 获取工作桌面菜单树
|
|
|
func GetWordDesktopMenuTree(in *WorkDesktopMenuInfoReq) ([]*pb.MenuList, error) {
|
|
|
- if in.EntId != "" {
|
|
|
- //判断商机管理用户是否切换企业
|
|
|
- userEntIdKey := fmt.Sprintf(entity.UserEntIdKey, in.AppId, time.Now().Day(), in.UserId)
|
|
|
- redisEntId := redis.GetInt(entity.RedisCode, userEntIdKey)
|
|
|
- entId, err := strconv.Atoi(in.EntId)
|
|
|
- if err == nil && int64(redisEntId) >= 0 && redisEntId != entId {
|
|
|
- //商机管理用户切换企业---清除用户权限缓存&&清除用户菜单缓存
|
|
|
- entity.ClearUserPowerFunc(in.UserId, in.AppId, in.EntId)
|
|
|
- }
|
|
|
- }
|
|
|
+ //P278 身份切换 此处逻辑已不需要
|
|
|
+ //if in.EntId != "" {
|
|
|
+ // //判断商机管理用户是否切换企业
|
|
|
+ // userEntIdKey := fmt.Sprintf(entity.UserEntIdKey, in.AppId, time.Now().Day(), in.UserId)
|
|
|
+ // redisEntId := redis.GetInt(entity.RedisCode, userEntIdKey)
|
|
|
+ // entId, err := strconv.Atoi(in.EntId)
|
|
|
+ // if err == nil && int64(redisEntId) >= 0 && redisEntId != entId {
|
|
|
+ // //商机管理用户切换企业---清除用户权限缓存&&清除用户菜单缓存
|
|
|
+ // entity.ClearUserPowerFunc(in.UserId, in.AppId, in.EntId)
|
|
|
+ // }
|
|
|
+ //}
|
|
|
t1 := time.Now()
|
|
|
- //redis缓存
|
|
|
- var menuList []*pb.MenuList
|
|
|
- RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId, in.EntId)
|
|
|
+ //菜单redis缓存
|
|
|
+ var (
|
|
|
+ menuList []*pb.MenuList
|
|
|
+ )
|
|
|
+ RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
|
|
|
logx.Info("RedisMenuKey:", RedisMenuKey)
|
|
|
menuBytes, err := redis.GetBytes(entity.RedisCode, RedisMenuKey)
|
|
|
if in.WorkStatus == 0 && err == nil && len(*menuBytes) > 0 {
|
|
@@ -255,7 +261,7 @@ func GetWordDesktopMenuTree(in *WorkDesktopMenuInfoReq) ([]*pb.MenuList, error)
|
|
|
positionId, _ := strconv.ParseInt(in.PositionId, 10, 64)
|
|
|
wdm := &entity.WorkDesktopMenu{
|
|
|
MenuTree: []*entity.JYMenu{},
|
|
|
- UserId: in.UserId,
|
|
|
+ UserId: in.UserId, //userId 会取消,职位id
|
|
|
NewUserId: newUserId,
|
|
|
AppId: in.AppId,
|
|
|
EntId: entId,
|