Browse Source

Merge branch 'dev/v2.9.28_wh' of jianyu/ent_new into feature/v2.9.28

zhangxinlei1996 1 year ago
parent
commit
8c75438878
1 changed files with 27 additions and 5 deletions
  1. 27 5
      entniche_new/src/service/subscribe/subscribe.go

+ 27 - 5
entniche_new/src/service/subscribe/subscribe.go

@@ -984,11 +984,11 @@ func (ac *Action) Get_key() {
 	return
 	return
 }
 }
 
 
-// 关键词{"_id" : ObjectId("5e69cd765484c8457bf06006")}
+//Update_key 修改关键词
 func (ac *Action) Update_key() {
 func (ac *Action) Update_key() {
 	entId := qutil.IntAll(ac.GetSession("entId"))
 	entId := qutil.IntAll(ac.GetSession("entId"))
-	entUserId := qutil.IntAll(ac.GetSession("entUserId"))
-	entInfo := VarCurrentUser.EntInfo(entId, entUserId)
+	// entUserId := qutil.IntAll(ac.GetSession("entUserId"))
+	// entInfo := VarCurrentUser.EntInfo(entId, entUserId)
 	vSwitch := ac.GetString("vSwitch")
 	vSwitch := ac.GetString("vSwitch")
 	i_type := 0
 	i_type := 0
 	if vSwitch == "m" || vSwitch == "v" {
 	if vSwitch == "m" || vSwitch == "v" {
@@ -1014,11 +1014,34 @@ func (ac *Action) Update_key() {
 		//新的分类名
 		//新的分类名
 		new_item := []string{}
 		new_item := []string{}
 		if keywords != nil {
 		if keywords != nil {
-			for _, v := range qutil.ObjArrToMapArr(keywords["a_items"].([]interface{})) {
+			key_aitems := qutil.ObjArrToMapArr(keywords["a_items"].([]interface{}))
+			for k, v := range key_aitems {
 				if v["s_item"] != nil {
 				if v["s_item"] != nil {
 					new_item = append(new_item, qutil.ObjToString(v["s_item"]))
 					new_item = append(new_item, qutil.ObjToString(v["s_item"]))
 				}
 				}
+				if v["a_key"] != nil {
+					akey := qutil.ObjArrToMapArr(v["a_key"].([]interface{}))
+					for kk, vv := range akey {
+						if vv["key"] != nil {
+							keys := qutil.ObjArrToStringArr(vv["key"].([]interface{}))
+							if len(keys) >= 1 {
+								kws := keys[0]
+								kwsArr := strings.Split(kws, " ")
+								if len(kwsArr) > 1 {
+									firstElement := kwsArr[0]
+									remainingElements := kwsArr[1:len(kwsArr)]
+									vv["appendkey"] = remainingElements
+									vv["key"] = []string{firstElement}
+								}
+							}
+						}
+						akey[kk] = vv
+					}
+					key_aitems[k]["a_key"] = akey
+				}
 			}
 			}
+			log.Println(key_aitems)
+			keywords["a_items"] = key_aitems
 			//分类名重复
 			//分类名重复
 			isrep := isRepeat(new_item)
 			isrep := isRepeat(new_item)
 			if isrep {
 			if isrep {
@@ -1029,7 +1052,6 @@ func (ac *Action) Update_key() {
 			//分类名有分发规则
 			//分类名有分发规则
 			distribute_items := []string{}
 			distribute_items := []string{}
 			list_items, _ := util.MQFW.Find(util.Entniche_distribute, map[string]interface{}{
 			list_items, _ := util.MQFW.Find(util.Entniche_distribute, map[string]interface{}{
-				"i_deptid": entInfo.Dept.Id,
 				"i_entid":  entId,
 				"i_entid":  entId,
 				"i_status": 0,
 				"i_status": 0,
 			}, nil, nil, false, -1, -1)
 			}, nil, nil, false, -1, -1)