|
@@ -1439,6 +1439,7 @@ func MergeKws(userId string) {
|
|
|
"$set": 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()},
|
|
|
})
|
|
|
log.Println(a)
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1890,6 +1891,14 @@ func GetNameList(name string) (rs *[]map[string]interface{}) {
|
|
|
func UpdateRule(entId int, update map[string]interface{}, phone string) bool {
|
|
|
ok := false
|
|
|
if entId > 0 && phone != "" {
|
|
|
+ //查找之前数据是否存在
|
|
|
+ userData := util.JysqlDB.FindOne("entniche_user", map[string]interface{}{
|
|
|
+ "ent_id": entId,
|
|
|
+ "phone": phone,
|
|
|
+ }, `id`, "")
|
|
|
+ if userData == nil {
|
|
|
+ return false
|
|
|
+ }
|
|
|
up1, up2 := map[string]interface{}{}, map[string]interface{}{}
|
|
|
var tp int
|
|
|
for k, v := range update {
|
|
@@ -1928,12 +1937,21 @@ func UpdateRule(entId int, update map[string]interface{}, phone string) bool {
|
|
|
}
|
|
|
}
|
|
|
ok1, ok2 := false, false
|
|
|
- userData := util.JysqlDB.FindOne("entniche_user", map[string]interface{}{
|
|
|
- "ent_id": entId,
|
|
|
- "phone": phone,
|
|
|
- }, `id`, "")
|
|
|
- if userData == nil {
|
|
|
- return false
|
|
|
+ //查看之前是否有数据
|
|
|
+ data, ok := util.MQFW.Find("entniche_rule", map[string]interface{}{
|
|
|
+ "i_entid": entId,
|
|
|
+ "i_userid": (*userData)["id"],
|
|
|
+ "i_type": tp,
|
|
|
+ }, `{"i_time":-1}`, nil, false, -1, -1)
|
|
|
+ if ok && len(*data) == 0 {
|
|
|
+ up3 := map[string]interface{}{
|
|
|
+ "$set": map[string]interface{}{"o_entniche.i_matchway": 1, "o_entniche.i_ratemode": 1, "o_entniche.i_wxpush": 1, "o_entniche.i_apppush": 1, "o_entniche.i_projectmatch": 0, "o_entniche.a_infotype": []string{}, "o_entniche.a_items": []string{}, "o_entniche.l_modifydate": time.Now().Unix()},
|
|
|
+ }
|
|
|
+ util.MQFW.Update("entniche_rule", map[string]interface{}{
|
|
|
+ "i_entid": entId,
|
|
|
+ "i_userid": (*userData)["id"],
|
|
|
+ "i_type": tp,
|
|
|
+ }, up3, true, false)
|
|
|
}
|
|
|
if len(up1) > 0 {
|
|
|
ok1 = util.MQFW.Update("ent_user", map[string]interface{}{
|
|
@@ -1948,9 +1966,13 @@ func UpdateRule(entId int, update map[string]interface{}, phone string) bool {
|
|
|
"i_type": tp,
|
|
|
}, up2, true, false)
|
|
|
}
|
|
|
+ //默认数据处理
|
|
|
+
|
|
|
return ok1 || ok2
|
|
|
}
|
|
|
- return ok}
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
var productMap = map[string]interface{}{
|
|
|
"1": "广告",
|
|
|
"2": "结构化数据",
|