|
@@ -15,7 +15,6 @@ import (
|
|
"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
|
|
"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
|
|
|
|
|
|
qutil "app.yhyue.com/moapp/jybase/common"
|
|
qutil "app.yhyue.com/moapp/jybase/common"
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/httpsession"
|
|
|
|
"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
|
|
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
@@ -37,11 +36,11 @@ type KeyWordsSet struct {
|
|
DeleteKey string //删除的关键词 json字符串{"0":"1,2","2":"0,3"} key:分类名称索引 value:分类名称下的关键词索引
|
|
DeleteKey string //删除的关键词 json字符串{"0":"1,2","2":"0,3"} key:分类名称索引 value:分类名称下的关键词索引
|
|
EntId int
|
|
EntId int
|
|
EntUserId int
|
|
EntUserId int
|
|
- Session *httpsession.Session
|
|
|
|
|
|
+ SessionMap map[string]interface{}
|
|
}
|
|
}
|
|
|
|
|
|
func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
|
|
func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
|
|
- power := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
|
|
|
|
|
|
+ power := jy.GetBigVipUserBaseMsgBySessVal(this.SessionMap, *config.Middleground)
|
|
if this.Type == "m" && power.Status < 0 {
|
|
if this.Type == "m" && power.Status < 0 {
|
|
return map[string]interface{}{"flag": false, "msg": "暂无权限"}
|
|
return map[string]interface{}{"flag": false, "msg": "暂无权限"}
|
|
}
|
|
}
|
|
@@ -55,33 +54,33 @@ func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
|
|
if this.Type != "f" && (power.Status > 0 || power.VipStatus > 0) {
|
|
if this.Type != "f" && (power.Status > 0 || power.VipStatus > 0) {
|
|
switch this.ActionType {
|
|
switch this.ActionType {
|
|
case "SK": //保存/修改关键词
|
|
case "SK": //保存/修改关键词
|
|
- return AddKeyWords(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session, this.Matchmode)
|
|
|
|
|
|
+ return AddKeyWords(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.SessionMap, this.Matchmode)
|
|
case "DK": //删除关键词
|
|
case "DK": //删除关键词
|
|
- return DeleteKeyWords(types, this.DeleteKey, this.UserId, this.Session)
|
|
|
|
|
|
+ return DeleteKeyWords(types, this.DeleteKey, this.UserId, this.SessionMap)
|
|
case "SC": //保存/修改分类
|
|
case "SC": //保存/修改分类
|
|
- return AddClass(types, this.ClassifyIndex, this.ClassifyName, this.UserId, this.Session)
|
|
|
|
|
|
+ return AddClass(types, this.ClassifyIndex, this.ClassifyName, this.UserId, this.SessionMap)
|
|
case "DC": //删除分类
|
|
case "DC": //删除分类
|
|
- return DeleteClass(types, this.ClassifyIndex, this.UserId, this.Session)
|
|
|
|
|
|
+ return DeleteClass(types, this.ClassifyIndex, this.UserId, this.SessionMap)
|
|
case "directSubKWS": //搜索列表直接订阅关键词
|
|
case "directSubKWS": //搜索列表直接订阅关键词
|
|
- return directSubKWS(types, this.KeyWordName, this.UserId, this.Session, this.MatchWay)
|
|
|
|
|
|
+ return directSubKWS(types, this.KeyWordName, this.UserId, this.SessionMap, this.MatchWay)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
this.ClassifyIndex = "0"
|
|
this.ClassifyIndex = "0"
|
|
this.ClassifyName = "未分类"
|
|
this.ClassifyName = "未分类"
|
|
switch this.ActionType {
|
|
switch this.ActionType {
|
|
case "SK": //保存/修改关键词
|
|
case "SK": //保存/修改关键词
|
|
- return AddKeyWordsFree(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.Session)
|
|
|
|
|
|
+ return AddKeyWordsFree(types, this.UserId, this.ClassifyIndex, this.ClassifyName, this.KeyWordIndex, this.KeyWordName, this.KeyWordsCount, this.NotKeyWord, this.AppendKeyWord, this.MatchWay, this.SessionMap)
|
|
case "DK": //删除关键词
|
|
case "DK": //删除关键词
|
|
- return DeleteKeyWordsFree(types, this.DeleteKey, this.Session)
|
|
|
|
|
|
+ return DeleteKeyWordsFree(types, this.DeleteKey, this.SessionMap)
|
|
case "directSubKWS": //搜索列表直接订阅关键词
|
|
case "directSubKWS": //搜索列表直接订阅关键词
|
|
- return directSubKWSFree(types, this.KeyWordName, this.Session)
|
|
|
|
|
|
+ return directSubKWSFree(types, this.KeyWordName, this.SessionMap)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return map[string]interface{}{"flag": true, "msg": ""}
|
|
return map[string]interface{}{"flag": true, "msg": ""}
|
|
}
|
|
}
|
|
|
|
|
|
-func directSubKWSFree(types string, keys string, session *httpsession.Session) map[string]interface{} {
|
|
|
|
- userId := qutil.ObjToString(session.Get("userId"))
|
|
|
|
|
|
+func directSubKWSFree(types string, keys string, sessionMap map[string]interface{}) map[string]interface{} {
|
|
|
|
+ userId := qutil.ObjToString(sessionMap["userId"])
|
|
var repleat = false
|
|
var repleat = false
|
|
var kwsCount = 0
|
|
var kwsCount = 0
|
|
if len([]rune(keys)) > 20 {
|
|
if len([]rune(keys)) > 20 {
|
|
@@ -153,7 +152,7 @@ func directSubKWSFree(types string, keys string, session *httpsession.Session) m
|
|
}
|
|
}
|
|
if flag == "y" {
|
|
if flag == "y" {
|
|
//清楚缓存
|
|
//清楚缓存
|
|
- positionId := fmt.Sprint(qutil.Int64All(session.Get("positionId")))
|
|
|
|
|
|
+ positionId := fmt.Sprint(qutil.Int64All(sessionMap["positionId"]))
|
|
jy.ClearBigVipUserPower(positionId)
|
|
jy.ClearBigVipUserPower(positionId)
|
|
config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
|
|
config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
|
|
PositionId: positionId,
|
|
PositionId: positionId,
|
|
@@ -165,11 +164,11 @@ func directSubKWSFree(types string, keys string, session *httpsession.Session) m
|
|
}
|
|
}
|
|
|
|
|
|
// 免费用户删除关键词
|
|
// 免费用户删除关键词
|
|
-func DeleteKeyWordsFree(types, deletekey string, session *httpsession.Session) map[string]interface{} {
|
|
|
|
|
|
+func DeleteKeyWordsFree(types, deletekey string, sessionMap map[string]interface{}) map[string]interface{} {
|
|
//免费用户只有一个分类
|
|
//免费用户只有一个分类
|
|
var index = "0"
|
|
var index = "0"
|
|
- userId := qutil.ObjToString(session.Get("userId"))
|
|
|
|
- dMap, err := util.JsonToMap(deletekey)
|
|
|
|
|
|
+ userId := qutil.ObjToString(sessionMap["userId"])
|
|
|
|
+ dMap, err := util.JsonToMap(deletekey) //{"0":"0"}
|
|
newMap, saveData := []interface{}{}, map[string]interface{}{}
|
|
newMap, saveData := []interface{}{}, map[string]interface{}{}
|
|
if err == nil && len(dMap) > 0 {
|
|
if err == nil && len(dMap) > 0 {
|
|
data := config.Compatible.Select(userId, `{"`+types+`":1}`)
|
|
data := config.Compatible.Select(userId, `{"`+types+`":1}`)
|
|
@@ -193,13 +192,13 @@ func DeleteKeyWordsFree(types, deletekey string, session *httpsession.Session) m
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
"$set": saveData,
|
|
"$set": saveData,
|
|
})
|
|
})
|
|
- SetLog(userId, types, 0, session)
|
|
|
|
|
|
+ SetLog(userId, types, 0, sessionMap)
|
|
}
|
|
}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
}
|
|
}
|
|
|
|
|
|
// 免费用户修改 保存关键词
|
|
// 免费用户修改 保存关键词
|
|
-func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, session *httpsession.Session) map[string]interface{} {
|
|
|
|
|
|
+func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, sessionMap map[string]interface{}) map[string]interface{} {
|
|
flag := true
|
|
flag := true
|
|
data := config.Compatible.Select(userId, `{"`+types+`":1}`)
|
|
data := config.Compatible.Select(userId, `{"`+types+`":1}`)
|
|
saveData := map[string]interface{}{}
|
|
saveData := map[string]interface{}{}
|
|
@@ -255,6 +254,11 @@ func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywor
|
|
saveData[types+".a_key."+keywordsIndex+".notkey"] = notKeyword
|
|
saveData[types+".a_key."+keywordsIndex+".notkey"] = notKeyword
|
|
saveData[types+".a_key."+keywordsIndex+".matchway"] = matchWay
|
|
saveData[types+".a_key."+keywordsIndex+".matchway"] = matchWay
|
|
saveData[types+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
|
|
saveData[types+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
|
|
|
|
+ if gconv.Bool(sessionMap["isHelpSub"]) {
|
|
|
|
+ if v := FreeIsInTsGuide(userId, 1); v != 0 {
|
|
|
|
+ saveData["i_ts_guide"] = v
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if len(saveData) > 0 {
|
|
if len(saveData) > 0 {
|
|
@@ -262,11 +266,10 @@ func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywor
|
|
ok = config.Compatible.Update(userId, map[string]interface{}{
|
|
ok = config.Compatible.Update(userId, map[string]interface{}{
|
|
"$set": saveData,
|
|
"$set": saveData,
|
|
})
|
|
})
|
|
-
|
|
|
|
if ok {
|
|
if ok {
|
|
flag = true
|
|
flag = true
|
|
//清楚缓存
|
|
//清楚缓存
|
|
- positionId := fmt.Sprint(qutil.Int64All(session.Get("positionId")))
|
|
|
|
|
|
+ positionId := fmt.Sprint(qutil.Int64All(sessionMap["positionId"]))
|
|
jy.ClearBigVipUserPower(positionId)
|
|
jy.ClearBigVipUserPower(positionId)
|
|
config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
|
|
config.Middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
|
|
PositionId: positionId,
|
|
PositionId: positionId,
|
|
@@ -275,25 +278,27 @@ func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywor
|
|
config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
|
|
config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
|
|
//判断是新增
|
|
//判断是新增
|
|
if (keywordCount == "" || keywordCount == "0") || (keywordCount == keywordsIndex || qutil.Int64All(keywordCount) == qutil.Int64All(keywordsIndex)+1) {
|
|
if (keywordCount == "" || keywordCount == "0") || (keywordCount == keywordsIndex || qutil.Int64All(keywordCount) == qutil.Int64All(keywordsIndex)+1) {
|
|
- //设置关键词送积分
|
|
|
|
- jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(session.Get("mgoUserId")), jy.Jywx_node1, map[string]interface{}{
|
|
|
|
- "code": 1015, //首次订阅
|
|
|
|
- "types": "subscribeKeyWords",
|
|
|
|
- "num": 50,
|
|
|
|
- "baseUserId": session.Get("base_user_id"),
|
|
|
|
- "positionId": positionId,
|
|
|
|
- })
|
|
|
|
|
|
+ if !gconv.Bool(sessionMap["isHelpSub"]) {
|
|
|
|
+ //设置关键词送积分
|
|
|
|
+ jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(sessionMap["mgoUserId"]), jy.Jywx_node1, map[string]interface{}{
|
|
|
|
+ "code": 1015, //首次订阅
|
|
|
|
+ "types": "subscribeKeyWords",
|
|
|
|
+ "num": 50,
|
|
|
|
+ "baseUserId": sessionMap["base_user_id"],
|
|
|
|
+ "positionId": positionId,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- SetLog(userId, types, 0, session)
|
|
|
|
|
|
+ SetLog(userId, types, 0, sessionMap)
|
|
}
|
|
}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
}
|
|
}
|
|
|
|
|
|
// 保存/修改关键词
|
|
// 保存/修改关键词
|
|
-func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, session *httpsession.Session, matchmode string) map[string]interface{} {
|
|
|
|
|
|
+func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordName, keywordCount string, notKeyword, appendKeyword []string, matchWay int, sessionMap map[string]interface{}, matchmode string) map[string]interface{} {
|
|
flag := true
|
|
flag := true
|
|
- positionType := qutil.Int64All(session.Get("positionType"))
|
|
|
|
|
|
+ positionType := qutil.Int64All(sessionMap["positionType"])
|
|
data := config.Compatible.Select(userId, `{"`+types+`.a_items":1}`)
|
|
data := config.Compatible.Select(userId, `{"`+types+`.a_items":1}`)
|
|
saveData := map[string]interface{}{}
|
|
saveData := map[string]interface{}{}
|
|
if data != nil && len(*data) > 0 {
|
|
if data != nil && len(*data) > 0 {
|
|
@@ -356,32 +361,34 @@ func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordNam
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
"$set": saveData,
|
|
"$set": saveData,
|
|
})
|
|
})
|
|
- SetLog(userId, types, positionType, session)
|
|
|
|
- //判断是新增
|
|
|
|
- if (keywordCount == "" || keywordCount == "0") || (keywordCount == keywordsIndex || qutil.Int64All(keywordCount) == qutil.Int64All(keywordsIndex)+1) {
|
|
|
|
- //设置关键词送积分
|
|
|
|
- err := jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(session.Get("mgoUserId")), jy.Jywx_node1, map[string]interface{}{
|
|
|
|
- "code": 1015, //首次订阅
|
|
|
|
- "types": "subscribeKeyWords",
|
|
|
|
- "num": 50,
|
|
|
|
- "baseUserId": session.Get("base_user_id"),
|
|
|
|
- "positionId": session.Get("positionId"),
|
|
|
|
- })
|
|
|
|
- if err != nil {
|
|
|
|
- log.Println("nsq队列写入失败-->", err, "task", session.Get("phone"))
|
|
|
|
- }
|
|
|
|
- //首次设置关键词 赠送一次抽奖机会
|
|
|
|
- err = jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "lottery_draw_task", qutil.ObjToString(session.Get("userId")), jy.Jywx_node1, map[string]interface{}{
|
|
|
|
- "phone": session.Get("phone"),
|
|
|
|
- "userId": session.Get("userId"),
|
|
|
|
- "mgoUserId": session.Get("mgoUserId"),
|
|
|
|
- "positionId": session.Get("positionId"),
|
|
|
|
- "activeId": 16,
|
|
|
|
- "taskInfoId": consts.TaskIdSetKey,
|
|
|
|
- "nickName": session.Get("nickName"),
|
|
|
|
- })
|
|
|
|
- if err != nil {
|
|
|
|
- log.Println("nsq队列写入失败-->", err, "lottery_draw_task", consts.TaskIdSetKey, session.Get("phone"))
|
|
|
|
|
|
+ SetLog(userId, types, positionType, sessionMap)
|
|
|
|
+ if !gconv.Bool(sessionMap["isHelpSub"]) {
|
|
|
|
+ //判断是新增
|
|
|
|
+ if (keywordCount == "" || keywordCount == "0") || (keywordCount == keywordsIndex || qutil.Int64All(keywordCount) == qutil.Int64All(keywordsIndex)+1) {
|
|
|
|
+ //设置关键词送积分
|
|
|
|
+ err := jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "task", qutil.ObjToString(sessionMap["mgoUserId"]), jy.Jywx_node1, map[string]interface{}{
|
|
|
|
+ "code": 1015, //首次订阅
|
|
|
|
+ "types": "subscribeKeyWords",
|
|
|
|
+ "num": 50,
|
|
|
|
+ "baseUserId": sessionMap["base_user_id"],
|
|
|
|
+ "positionId": sessionMap["positionId"],
|
|
|
|
+ })
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("nsq队列写入失败-->", err, "task", sessionMap["phone"])
|
|
|
|
+ }
|
|
|
|
+ //首次设置关键词 赠送一次抽奖机会
|
|
|
|
+ err = jy.Publish(db.Mgo_Log, config.Config.Nsq, config.Config.NsqTopic, "lottery_draw_task", qutil.ObjToString(sessionMap["userId"]), jy.Jywx_node1, map[string]interface{}{
|
|
|
|
+ "phone": sessionMap["phone"],
|
|
|
|
+ "userId": sessionMap["userId"],
|
|
|
|
+ "mgoUserId": sessionMap["mgoUserId"],
|
|
|
|
+ "positionId": sessionMap["positionId"],
|
|
|
|
+ "activeId": 16,
|
|
|
|
+ "taskInfoId": consts.TaskIdSetKey,
|
|
|
|
+ "nickName": sessionMap["nickName"],
|
|
|
|
+ })
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("nsq队列写入失败-->", err, "lottery_draw_task", consts.TaskIdSetKey, sessionMap["phone"])
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -389,7 +396,7 @@ func AddKeyWords(types, userId, classIndex, className, keywordsIndex, keywordNam
|
|
}
|
|
}
|
|
|
|
|
|
// 删除关键词可以批量
|
|
// 删除关键词可以批量
|
|
-func DeleteKeyWords(types, deletekey, userId string, session *httpsession.Session) map[string]interface{} {
|
|
|
|
|
|
+func DeleteKeyWords(types, deletekey, userId string, sessionMap map[string]interface{}) map[string]interface{} {
|
|
flag := true
|
|
flag := true
|
|
dMap, err := util.JsonToMap(deletekey)
|
|
dMap, err := util.JsonToMap(deletekey)
|
|
newMap, saveData := []interface{}{}, map[string]interface{}{}
|
|
newMap, saveData := []interface{}{}, map[string]interface{}{}
|
|
@@ -430,13 +437,13 @@ func DeleteKeyWords(types, deletekey, userId string, session *httpsession.Sessio
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
"$set": saveData,
|
|
"$set": saveData,
|
|
})
|
|
})
|
|
- SetLog(userId, types, 0, session)
|
|
|
|
|
|
+ SetLog(userId, types, 0, sessionMap)
|
|
}
|
|
}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
}
|
|
}
|
|
|
|
|
|
// 删除分类【可以批量删除】
|
|
// 删除分类【可以批量删除】
|
|
-func DeleteClass(types, classIndex, userId string, session *httpsession.Session) map[string]interface{} {
|
|
|
|
|
|
+func DeleteClass(types, classIndex, userId string, sessionMap map[string]interface{}) map[string]interface{} {
|
|
flag := true
|
|
flag := true
|
|
items, saveData := []interface{}{}, map[string]interface{}{}
|
|
items, saveData := []interface{}{}, map[string]interface{}{}
|
|
m := map[string]bool{}
|
|
m := map[string]bool{}
|
|
@@ -459,13 +466,13 @@ func DeleteClass(types, classIndex, userId string, session *httpsession.Session)
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
"$set": saveData,
|
|
"$set": saveData,
|
|
})
|
|
})
|
|
- SetLog(userId, types, 0, session)
|
|
|
|
|
|
+ SetLog(userId, types, 0, sessionMap)
|
|
}
|
|
}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
}
|
|
}
|
|
|
|
|
|
// 创建分类名
|
|
// 创建分类名
|
|
-func AddClass(types, classIndex, className, userId string, session *httpsession.Session) map[string]interface{} {
|
|
|
|
|
|
+func AddClass(types, classIndex, className, userId string, sessionMap map[string]interface{}) map[string]interface{} {
|
|
flag := true
|
|
flag := true
|
|
saveData := map[string]interface{}{}
|
|
saveData := map[string]interface{}{}
|
|
data := config.Compatible.Select(userId, `{"`+types+`.a_items":1}`)
|
|
data := config.Compatible.Select(userId, `{"`+types+`.a_items":1}`)
|
|
@@ -503,7 +510,7 @@ func AddClass(types, classIndex, className, userId string, session *httpsession.
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
flag = config.Compatible.Update(userId, map[string]interface{}{
|
|
"$set": saveData,
|
|
"$set": saveData,
|
|
})
|
|
})
|
|
- SetLog(userId, types, 0, session)
|
|
|
|
|
|
+ SetLog(userId, types, 0, sessionMap)
|
|
}
|
|
}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
|
|
|
|
@@ -559,16 +566,16 @@ type UpdateOther struct {
|
|
OtherBuyerclass int //其它采购单位
|
|
OtherBuyerclass int //其它采购单位
|
|
EntId int
|
|
EntId int
|
|
EntUserId int
|
|
EntUserId int
|
|
- Session *httpsession.Session
|
|
|
|
|
|
+ SessionMap map[string]interface{}
|
|
}
|
|
}
|
|
|
|
|
|
func (this *UpdateOther) UpdateOther() map[string]interface{} {
|
|
func (this *UpdateOther) UpdateOther() map[string]interface{} {
|
|
- power := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
|
|
|
|
|
|
+ power := jy.GetBigVipUserBaseMsgBySessVal(this.SessionMap, *config.Middleground)
|
|
if this.Type == "m" && power.Status < 0 {
|
|
if this.Type == "m" && power.Status < 0 {
|
|
return map[string]interface{}{"flag": false, "msg": "暂无权限"}
|
|
return map[string]interface{}{"flag": false, "msg": "暂无权限"}
|
|
}
|
|
}
|
|
- positionType := qutil.Int64All(this.Session.Get("positionType"))
|
|
|
|
- positionId := fmt.Sprint(qutil.Int64All(this.Session.Get("positionId")))
|
|
|
|
|
|
+ positionType := qutil.Int64All(this.SessionMap["positionType"])
|
|
|
|
+ positionId := fmt.Sprint(qutil.Int64All(this.SessionMap["positionId"]))
|
|
types := "o_jy"
|
|
types := "o_jy"
|
|
if this.Type == "m" {
|
|
if this.Type == "m" {
|
|
types = "o_member_jy"
|
|
types = "o_member_jy"
|
|
@@ -613,7 +620,7 @@ func (this *UpdateOther) UpdateOther() map[string]interface{} {
|
|
})
|
|
})
|
|
config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
|
|
config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
|
|
}
|
|
}
|
|
- SetLog(this.UserId, types, positionType, this.Session)
|
|
|
|
|
|
+ SetLog(this.UserId, types, positionType, this.SessionMap)
|
|
}
|
|
}
|
|
|
|
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
return map[string]interface{}{"flag": flag, "msg": ""}
|
|
@@ -670,7 +677,7 @@ func UpdateMatchmode(types, matchtype string) map[string]interface{} {
|
|
types + ".i_matchmode": strings.Split(matchtype, ","),
|
|
types + ".i_matchmode": strings.Split(matchtype, ","),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-func directSubKWS(updateItems string, keys string, userId string, session *httpsession.Session, matchWay int) map[string]interface{} {
|
|
|
|
|
|
+func directSubKWS(updateItems string, keys string, userId string, sessionMap map[string]interface{}, matchWay int) map[string]interface{} {
|
|
flag := "n"
|
|
flag := "n"
|
|
data := config.Compatible.Select(userId, fmt.Sprintf(`{"%s":1}`, updateItems))
|
|
data := config.Compatible.Select(userId, fmt.Sprintf(`{"%s":1}`, updateItems))
|
|
var repleat = false
|
|
var repleat = false
|
|
@@ -749,11 +756,11 @@ func directSubKWS(updateItems string, keys string, userId string, session *https
|
|
}
|
|
}
|
|
|
|
|
|
// 订阅设置记录
|
|
// 订阅设置记录
|
|
-func SetLog(userid, types string, power int64, session *httpsession.Session) {
|
|
|
|
|
|
+func SetLog(userid, types string, power int64, sessionMap map[string]interface{}) {
|
|
if power == 1 {
|
|
if power == 1 {
|
|
query := map[string]interface{}{
|
|
query := map[string]interface{}{
|
|
- "i_userid": qutil.IntAll(session.Get("entUserId")),
|
|
|
|
- "i_entid": qutil.IntAll(session.Get("entId")),
|
|
|
|
|
|
+ "i_userid": qutil.IntAll(sessionMap["entUserId"]),
|
|
|
|
+ "i_entid": qutil.IntAll(sessionMap["entId"]),
|
|
"i_type": 1,
|
|
"i_type": 1,
|
|
}
|
|
}
|
|
res, _ := db.Mgo.FindOne("entniche_rule", query)
|
|
res, _ := db.Mgo.FindOne("entniche_rule", query)
|