|
@@ -61,7 +61,7 @@ func (this *KeyWordsSet) UpdateKeyWords() map[string]interface{} {
|
|
|
case "DC": //删除分类
|
|
|
return DeleteClass(types, this.ClassifyIndex, this.UserId, this.Session)
|
|
|
case "directSubKWS": //搜索列表直接订阅关键词
|
|
|
- return directSubKWS(types, this.KeyWordName, this.UserId, this.Session,this.MatchWay)
|
|
|
+ return directSubKWS(types, this.KeyWordName, this.UserId, this.Session, this.MatchWay)
|
|
|
}
|
|
|
} else {
|
|
|
this.ClassifyIndex = "0"
|
|
@@ -101,6 +101,7 @@ func directSubKWSFree(types string, keys string, session *httpsession.Session) m
|
|
|
} else {
|
|
|
//无关键词 直接添加
|
|
|
if ok := config.Compatible.Update(userId, bson.M{"$set": bson.M{
|
|
|
+ "i_ts_guide": 1,
|
|
|
fmt.Sprintf("%s.a_key", types): bson.A{
|
|
|
bson.M{
|
|
|
"key": bson.A{keys},
|
|
@@ -560,23 +561,23 @@ func (this *UpdateOther) UpdateOther() map[string]interface{} {
|
|
|
}
|
|
|
setMap := func() map[string]interface{} {
|
|
|
switch this.PageType {
|
|
|
- case "projectMatch": //项目匹配
|
|
|
- return UpdateProjectMatch(types, this.Pmindex)
|
|
|
- case "saveSeniorset": //关键词匹配方式
|
|
|
- return UpdateSaveSeniorset(types, this.Matchtype)
|
|
|
- case "infoType": //信息类型
|
|
|
- return UpdateInfoType(types, this.InfoTypeArr)
|
|
|
- case "other_buyerclass":
|
|
|
- return UpdateOtherBuyerClass(types, this.OtherBuyerclass)
|
|
|
- case "keytip": //关键词升级弹窗提示(一个用户只提示一次)
|
|
|
- return UpdateKeyTip(types)
|
|
|
- case "amount": //金额匹配
|
|
|
- return UpdateAmount(types, this.Matchtype)
|
|
|
- case "i_switch":
|
|
|
- return UpdateSwitch(types, this.Matchtype)
|
|
|
- case "matchmode": //项目匹配
|
|
|
- return UpdateMatchmode(types, this.Matchtype)
|
|
|
- }
|
|
|
+ case "projectMatch": //项目匹配
|
|
|
+ return UpdateProjectMatch(types, this.Pmindex)
|
|
|
+ case "saveSeniorset": //关键词匹配方式
|
|
|
+ return UpdateSaveSeniorset(types, this.Matchtype)
|
|
|
+ case "infoType": //信息类型
|
|
|
+ return UpdateInfoType(types, this.InfoTypeArr)
|
|
|
+ case "other_buyerclass":
|
|
|
+ return UpdateOtherBuyerClass(types, this.OtherBuyerclass)
|
|
|
+ case "keytip": //关键词升级弹窗提示(一个用户只提示一次)
|
|
|
+ return UpdateKeyTip(types)
|
|
|
+ case "amount": //金额匹配
|
|
|
+ return UpdateAmount(types, this.Matchtype)
|
|
|
+ case "i_switch":
|
|
|
+ return UpdateSwitch(types, this.Matchtype)
|
|
|
+ case "matchmode": //项目匹配
|
|
|
+ return UpdateMatchmode(types, this.Matchtype)
|
|
|
+ }
|
|
|
return nil
|
|
|
}()
|
|
|
flag := true
|
|
@@ -609,9 +610,9 @@ func UpdateProjectMatch(types string, pmindex int) map[string]interface{} {
|
|
|
}
|
|
|
|
|
|
func UpdateSaveSeniorset(types string, matchtype string) map[string]interface{} {
|
|
|
- return map[string]interface{}{
|
|
|
- types + ".i_matchmode": strings.Split(matchtype, ","),
|
|
|
- }
|
|
|
+ return map[string]interface{}{
|
|
|
+ types + ".i_matchmode": strings.Split(matchtype, ","),
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func UpdateInfoType(types string, infotype string) map[string]interface{} {
|
|
@@ -628,41 +629,41 @@ func UpdateInfoType(types string, infotype string) map[string]interface{} {
|
|
|
|
|
|
func UpdateOtherBuyerClass(types string, other int) map[string]interface{} {
|
|
|
return map[string]interface{}{
|
|
|
- types + ".i_matchbuyerclass_other": other,
|
|
|
- }
|
|
|
+ types + ".i_matchbuyerclass_other": other,
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// UpdateKeyTip 关键词升级提示
|
|
|
func UpdateKeyTip(types string) map[string]interface{} {
|
|
|
- return map[string]interface{}{
|
|
|
- types + ".b_keytip": true,
|
|
|
- }
|
|
|
+ return map[string]interface{}{
|
|
|
+ types + ".b_keytip": true,
|
|
|
+ }
|
|
|
}
|
|
|
func UpdateAmount(types, matchtype string) map[string]interface{} {
|
|
|
- return map[string]interface{}{
|
|
|
- types + ".amount": matchtype,
|
|
|
- }
|
|
|
+ return map[string]interface{}{
|
|
|
+ types + ".amount": matchtype,
|
|
|
+ }
|
|
|
}
|
|
|
func UpdateSwitch(types, matchtype string) map[string]interface{} {
|
|
|
- return map[string]interface{}{
|
|
|
- types + ".i_switch": gconv.Int64(matchtype),
|
|
|
- }
|
|
|
+ return map[string]interface{}{
|
|
|
+ types + ".i_switch": gconv.Int64(matchtype),
|
|
|
+ }
|
|
|
}
|
|
|
func UpdateMatchmode(types, matchtype string) map[string]interface{} {
|
|
|
- return map[string]interface{}{
|
|
|
- types + ".i_matchmode": strings.Split(matchtype, ","),
|
|
|
- }
|
|
|
+ return map[string]interface{}{
|
|
|
+ types + ".i_matchmode": strings.Split(matchtype, ","),
|
|
|
+ }
|
|
|
}
|
|
|
-func directSubKWS(updateItems string, keys string, userId string, session *httpsession.Session,matchWay int) map[string]interface{} {
|
|
|
- flag := "n"
|
|
|
- data := config.Compatible.Select(userId, fmt.Sprintf(`{"%s":1}`, updateItems))
|
|
|
- var repleat = false
|
|
|
- var classify_index = -1
|
|
|
- var kwsCount = 0
|
|
|
- if len([]rune(keys)) > 20 {
|
|
|
- keys = qutil.SubString(keys, 0, 20)
|
|
|
- }
|
|
|
- if data != nil && len(*data) > 0 && keys != "" {
|
|
|
+func directSubKWS(updateItems string, keys string, userId string, session *httpsession.Session, matchWay int) map[string]interface{} {
|
|
|
+ flag := "n"
|
|
|
+ data := config.Compatible.Select(userId, fmt.Sprintf(`{"%s":1}`, updateItems))
|
|
|
+ var repleat = false
|
|
|
+ var classify_index = -1
|
|
|
+ var kwsCount = 0
|
|
|
+ if len([]rune(keys)) > 20 {
|
|
|
+ keys = qutil.SubString(keys, 0, 20)
|
|
|
+ }
|
|
|
+ if data != nil && len(*data) > 0 && keys != "" {
|
|
|
updateObj, _ := (*data)[updateItems].(map[string]interface{})
|
|
|
if updateObj["a_items"] != nil {
|
|
|
a_items := updateObj["a_items"].([]interface{})
|
|
@@ -690,8 +691,8 @@ func directSubKWS(updateItems string, keys string, userId string, session *https
|
|
|
classify_index = len(a_items)
|
|
|
}
|
|
|
} else {
|
|
|
- //无关键词 直接添加
|
|
|
- if ok := config.Compatible.Update(userId, bson.M{"$set": bson.M{fmt.Sprintf("%s.a_items", updateItems): bson.A{bson.M{"s_item": "未分类",
|
|
|
+ //无关键词 直接添加 更新
|
|
|
+ if ok := config.Compatible.Update(userId, bson.M{"$set": bson.M{"i_ts_guide": 1, fmt.Sprintf("%s.a_items", updateItems): bson.A{bson.M{"s_item": "未分类",
|
|
|
"a_key": bson.A{bson.M{"key": bson.A{keys}, "matchway": matchWay}},
|
|
|
"l_modifydate": time.Now().Unix()}}}}); ok {
|
|
|
flag = "y"
|