|
@@ -256,7 +256,7 @@ func (ac *Action) Distribute_add() {
|
|
if len(distribute_ruleMap) > 0 {
|
|
if len(distribute_ruleMap) > 0 {
|
|
if distribute_ruleMap["area"] != nil {
|
|
if distribute_ruleMap["area"] != nil {
|
|
areabl := false
|
|
areabl := false
|
|
- for k, _ := range *qutil.ObjToMap(distribute_ruleMap["area"]) {
|
|
|
|
|
|
+ for k := range *qutil.ObjToMap(distribute_ruleMap["area"]) {
|
|
if k == "全国" {
|
|
if k == "全国" {
|
|
areabl = true
|
|
areabl = true
|
|
}
|
|
}
|
|
@@ -292,6 +292,10 @@ func (ac *Action) Distribute_add() {
|
|
ac.ServeJson(Result{Data: M{"status": 0}})
|
|
ac.ServeJson(Result{Data: M{"status": 0}})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ //保存分发
|
|
|
|
+ distribute_rule["rule_id"] = id
|
|
|
|
+ distribute_rule["createtime"] = time.Now().Unix()
|
|
|
|
+ util.Mgo_Log.Save("district_log", distribute_rule)
|
|
persons, _ := distribute_ruleMap["persons"].([]interface{})
|
|
persons, _ := distribute_ruleMap["persons"].([]interface{})
|
|
if len(persons) > 0 {
|
|
if len(persons) > 0 {
|
|
array := []string{}
|
|
array := []string{}
|
|
@@ -434,7 +438,7 @@ func (ac *Action) Distribute_update() {
|
|
if update_map != nil && update_map["id"] != nil {
|
|
if update_map != nil && update_map["id"] != nil {
|
|
if update_map["area"] != nil {
|
|
if update_map["area"] != nil {
|
|
areabl := false
|
|
areabl := false
|
|
- for k, _ := range *qutil.ObjToMap(update_map["area"]) {
|
|
|
|
|
|
+ for k := range *qutil.ObjToMap(update_map["area"]) {
|
|
if k == "全国" {
|
|
if k == "全国" {
|
|
areabl = true
|
|
areabl = true
|
|
}
|
|
}
|
|
@@ -461,6 +465,15 @@ func (ac *Action) Distribute_update() {
|
|
"o_district": distribute_rule["o_district"],
|
|
"o_district": distribute_rule["o_district"],
|
|
"a_buyerclass": distribute_rule["a_buyerclass"],
|
|
"a_buyerclass": distribute_rule["a_buyerclass"],
|
|
}}) {
|
|
}}) {
|
|
|
|
+ //保存分发
|
|
|
|
+ util.Mgo_Log.Save("district_log", map[string]interface{}{
|
|
|
|
+ "rule_id": rule_id,
|
|
|
|
+ "a_items": distribute_rule["a_items"],
|
|
|
|
+ "o_area": distribute_rule["o_area"],
|
|
|
|
+ "o_district": distribute_rule["o_district"],
|
|
|
|
+ "a_buyerclass": distribute_rule["a_buyerclass"],
|
|
|
|
+ "createtime": time.Now().Unix(),
|
|
|
|
+ })
|
|
status = 1
|
|
status = 1
|
|
}
|
|
}
|
|
persons, _ := update_map["persons"].([]interface{})
|
|
persons, _ := update_map["persons"].([]interface{})
|
|
@@ -691,8 +704,8 @@ func UpdateAreaForDistribute(productType string, userId, entId int, area interfa
|
|
mdata, ok := util.MQFW.Find(`user`, map[string]interface{}{
|
|
mdata, ok := util.MQFW.Find(`user`, map[string]interface{}{
|
|
"i_appid": 2,
|
|
"i_appid": 2,
|
|
"$or": []map[string]interface{}{
|
|
"$or": []map[string]interface{}{
|
|
- map[string]interface{}{"s_phone": phone},
|
|
|
|
- map[string]interface{}{"s_m_phone": phone}},
|
|
|
|
|
|
+ {"s_phone": phone},
|
|
|
|
+ {"s_m_phone": phone}},
|
|
}, nil, `{"_id":1}`, false, -1, -1)
|
|
}, nil, `{"_id":1}`, false, -1, -1)
|
|
if ok && mdata != nil && len(*mdata) > 0 {
|
|
if ok && mdata != nil && len(*mdata) > 0 {
|
|
i_type := 0
|
|
i_type := 0
|
|
@@ -704,7 +717,6 @@ func UpdateAreaForDistribute(productType string, userId, entId int, area interfa
|
|
if uid == "" {
|
|
if uid == "" {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
-
|
|
|
|
ruleData, ok2 := util.MQFW.Find(`entniche_rule`, map[string]interface{}{
|
|
ruleData, ok2 := util.MQFW.Find(`entniche_rule`, map[string]interface{}{
|
|
"i_userid": userId,
|
|
"i_userid": userId,
|
|
"i_entid": entId,
|
|
"i_entid": entId,
|
|
@@ -713,15 +725,6 @@ func UpdateAreaForDistribute(productType string, userId, entId int, area interfa
|
|
if !ok2 || mdata == nil || len(*ruleData) == 0 {
|
|
if !ok2 || mdata == nil || len(*ruleData) == 0 {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
- o_entniche, _ := v["o_entniche"].(map[string]interface{})
|
|
|
|
- util.Mgo_Log.Save("ovipjy_log", map[string]interface{}{
|
|
|
|
- "userid": uid,
|
|
|
|
- "type": types,
|
|
|
|
- "ovipjy": o_entniche,
|
|
|
|
- "o_member_jy": o_entniche,
|
|
|
|
- "createtime": time.Now().Unix(),
|
|
|
|
- "from": "distribute", //用于区分是分发设置的
|
|
|
|
- })
|
|
|
|
//个人订阅
|
|
//个人订阅
|
|
util.MQFW.Update("entniche_rule", map[string]interface{}{
|
|
util.MQFW.Update("entniche_rule", map[string]interface{}{
|
|
"i_userid": userId,
|
|
"i_userid": userId,
|
|
@@ -733,6 +736,20 @@ func UpdateAreaForDistribute(productType string, userId, entId int, area interfa
|
|
"o_entniche.o_area": area,
|
|
"o_entniche.o_area": area,
|
|
"o_entniche.o_district": district,
|
|
"o_entniche.o_district": district,
|
|
}}, true, false)
|
|
}}, true, false)
|
|
|
|
+ ruleData, ok2 = util.MQFW.Find(`entniche_rule`, map[string]interface{}{
|
|
|
|
+ "i_userid": userId,
|
|
|
|
+ "i_entid": entId,
|
|
|
|
+ "i_type": i_type,
|
|
|
|
+ }, nil, `{"o_entniche":1}`, false, -1, -1)
|
|
|
|
+ o_entniche, _ := (*ruleData)[0]["o_entniche"].(map[string]interface{})
|
|
|
|
+ util.Mgo_Log.Save("ovipjy_log", map[string]interface{}{
|
|
|
|
+ "userid": userId,
|
|
|
|
+ "type": types,
|
|
|
|
+ "ovipjy": o_entniche,
|
|
|
|
+ "o_member_jy": o_entniche,
|
|
|
|
+ "createtime": time.Now().Unix(),
|
|
|
|
+ "from": "distribute", //用于区分是分发设置的
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|