Browse Source

delete Log

zhangxinlei1996 4 years ago
parent
commit
a89ba38206
1 changed files with 11 additions and 38 deletions
  1. 11 38
      src/jfw/modules/subscribepay/src/service/afterPay.go

+ 11 - 38
src/jfw/modules/subscribepay/src/service/afterPay.go

@@ -33,7 +33,6 @@ type AfterPay struct {
 	directSubKWS   xweb.Mapper `xweb:"/afterPay/directSubKWS"`   //搜索列表直接订阅关键词
 	fastImport     xweb.Mapper `xweb:"/afterPay/fastImport"`     //快速导入关键词
 	modification   xweb.Mapper `xweb:"/afterPay/modification"`   //关键词修改记录
-	ts             xweb.Mapper `xweb:"/ts"`
 }
 
 func (a *AfterPay) Modification() error {
@@ -386,8 +385,6 @@ func (a *AfterPay) SetUserInfo() error {
 			addtion_kws := a.GetSlice("addition_kws")
 			//排除词
 			not_kws := a.GetSlice("not_kws")
-			//
-
 			// 单个关键词匹配方事 0:精准匹配 1:模糊匹配
 			match_way, _ := a.GetInteger("match_way")
 			//是否是首次添加关键词
@@ -469,8 +466,9 @@ func (a *AfterPay) SetUserInfo() error {
 							}
 						}
 						var _key = make(map[string]interface{})
-						_key["key"] = _kws
-						_key["appendkey"] = addtion_kws
+						newKws := []string{_kws[0]}
+						_key["key"] = newKws
+						_key["appendkey"] = append(addtion_kws, _kws[1:]...)
 						_key["notkey"] = not_kws
 						_key["matchway"] = match_way
 						if kwscount != "0" {
@@ -480,12 +478,11 @@ func (a *AfterPay) SetUserInfo() error {
 							} else {
 								//修改关键词
 								saveData["o_vipjy.a_items."+classify_index+".s_item"] = classify_name
-								saveData["o_vipjy.a_items."+classify_index+".a_key."+kws_index+".key"] = _kws
-								saveData["o_vipjy.a_items."+classify_index+".a_key."+kws_index+".appendkey"] = addtion_kws
+								saveData["o_vipjy.a_items."+classify_index+".a_key."+kws_index+".key"] = newKws
+								saveData["o_vipjy.a_items."+classify_index+".a_key."+kws_index+".appendkey"] = append(addtion_kws, _kws[1:]...)
 								saveData["o_vipjy.a_items."+classify_index+".a_key."+kws_index+".notkey"] = not_kws
 								saveData["o_vipjy.a_items."+classify_index+".a_key."+kws_index+".matchway"] = match_way
 							}
-
 						} else {
 							//首次添加分类和关键词
 							var a_key = make([]map[string]interface{}, 1)
@@ -722,10 +719,11 @@ func (a *AfterPay) GetUserInfo() error {
 
 //关键词判重
 func KeyWordsRepeat(obj map[string]interface{}, aitems []interface{}) bool {
-	log.Println("$$$")
 	key, _ := obj["key"].([]string)
 	notkey, _ := obj["notkey"].([]string)
 	matchway, _ := obj["matchway"].(int)
+	appendkey, _ := obj["appendkey"].([]string)
+
 	// 录入的关键词
 	for _, v := range aitems {
 		if items, ok := v.(map[string]interface{}); ok && len(items) > 0 {
@@ -734,16 +732,17 @@ func KeyWordsRepeat(obj map[string]interface{}, aitems []interface{}) bool {
 					for _, n := range qutil.ObjArrToMapArr(vv.([]interface{})) {
 						db_not := []string{}
 						db_key := []string{}
+						db_append := []string{}
 						if n["key"] != nil {
 							db_key = qutil.ObjArrToStringArr(n["key"].([]interface{}))
 						}
 						if n["notkey"] != nil {
 							db_not = qutil.ObjArrToStringArr(n["notkey"].([]interface{}))
 						}
-						if n["appendkey"] != nil { //没有附加词 已改为匹配模式  附加词默认拼接至关键词后边
-							db_key = append(db_key, qutil.ObjArrToStringArr(n["appendkey"].([]interface{}))...)
+						if n["appendkey"] != nil {
+							db_append = qutil.ObjArrToStringArr(n["appendkey"].([]interface{}))
 						}
-						if StringArrEqual(key, db_key) && StringArrEqual(notkey, db_not) && qutil.IntAllDef(n["matchway"], 0) == matchway {
+						if StringArrEqual(key, db_key) && StringArrEqual(notkey, db_not) && qutil.IntAllDef(n["matchway"], 0) == matchway && StringArrEqual(appendkey, db_append) {
 							return true
 						}
 					}
@@ -767,32 +766,6 @@ func isRepeat(slice1 []string) bool {
 	return false
 }
 
-func (this *AfterPay) Ts() {
-	userId := this.GetSession("userId").(string)
-	data, ok := util.MQFW.FindById("user", userId, `{"o_jy":1,"o_vipjy":1}`)
-	var o_vipjy map[string]interface{}
-	if ok && data != nil && len(*data) > 0 {
-		o_vipjy, _ = (*data)["o_vipjy"].(map[string]interface{})
-		a_items, _ := o_vipjy["a_items"].([]interface{})
-		m := bson.M{}
-		if a_items == nil { //首次
-			m = bson.M{"o_vipjy.i_matchway": 1, "o_vipjy.i_ratemode": 1, "o_vipjy.i_wxpush": 1, "o_vipjy.i_apppush": 1, "o_vipjy.i_projectmatch": 0, "o_vipjy.a_infotype": []string{}, "o_vipjy.a_items": []string{}, "o_vipjy.l_modifydate": time.Now().Unix()}
-
-		} else {
-			//免费用户试用超级订阅
-			wxpush := o_vipjy["i_wxpush"]
-			apppush := o_vipjy["i_apppush"]
-			if wxpush == nil && apppush == nil {
-				m = bson.M{"o_vipjy.i_ratemode": 1, "o_vipjy.i_wxpush": 1, "o_vipjy.i_apppush": 1, "o_vipjy.i_projectmatch": 0, "o_vipjy.l_modifydate": time.Now().Unix()}
-			}
-		}
-		a := util.MQFW.UpdateById("user", userId, bson.M{
-			"$set": m,
-		})
-		log.Println(a)
-	}
-}
-
 // jsonStr转map
 func JsonToMap(jsonStr string) (map[string]interface{}, error) {
 	m := map[string]interface{}{}