|
@@ -86,7 +86,8 @@ func (this *ParamInfo) SetAreaByOneProvince() (b bool) {
|
|
|
}
|
|
|
return b
|
|
|
}
|
|
|
-func (this *ParamInfo) IsSub() (bool, string, map[string][]interface{}, map[string][]interface{}) {
|
|
|
+func (this *ParamInfo) IsSub() (bool, string, map[string]map[string][]string) {
|
|
|
+ regionMap := map[string]map[string][]string{}
|
|
|
areaMap := make(map[string][]interface{})
|
|
|
districtMap := make(map[string][]interface{})
|
|
|
mData := config.Compatible.Select(this.UserId, `{"o_jy":1,"o_member_jy":1,"o_vipjy":1,"i_vip_status":1,"i_member_status":1,"last_trigger_time":1}`)
|
|
@@ -103,16 +104,16 @@ func (this *ParamInfo) IsSub() (bool, string, map[string][]interface{}, map[stri
|
|
|
positionType := gconv.Int64(this.Session.Get("positionType"))
|
|
|
if positionType == 1 {
|
|
|
//企业身份
|
|
|
- return false, productType, areaMap, districtMap
|
|
|
+ return false, productType, regionMap
|
|
|
}
|
|
|
lastTriggerTime := gconv.Int64((*mData)["last_trigger_time"])
|
|
|
if time.Now().Unix()-lastTriggerTime < config.Config.FrequentContinuous*24*60*60 {
|
|
|
- return false, productType, areaMap, districtMap
|
|
|
+ return false, productType, regionMap
|
|
|
}
|
|
|
o_jy, _ := (*mData)["o_jy"].(map[string]interface{})
|
|
|
a_key, _ := o_jy["a_key"].([]interface{})
|
|
|
if len(a_key) > 0 {
|
|
|
- return false, productType, areaMap, districtMap
|
|
|
+ return false, productType, regionMap
|
|
|
}
|
|
|
if o_jy["o_area"] != nil {
|
|
|
oarea, _ := o_jy["o_area"].(map[string]interface{})
|
|
@@ -137,7 +138,7 @@ func (this *ParamInfo) IsSub() (bool, string, map[string][]interface{}, map[stri
|
|
|
o_vipjy, _ := (*mData)["o_vipjy"].(map[string]interface{})
|
|
|
a_key, _ = o_vipjy["a_key"].([]interface{})
|
|
|
if len(a_key) > 0 {
|
|
|
- return false, productType, areaMap, districtMap
|
|
|
+ return false, productType, regionMap
|
|
|
}
|
|
|
if o_vipjy["o_area"] != nil {
|
|
|
oarea, _ := o_vipjy["o_area"].(map[string]interface{})
|
|
@@ -168,7 +169,7 @@ func (this *ParamInfo) IsSub() (bool, string, map[string][]interface{}, map[stri
|
|
|
o_member_jy, _ := (*mData)["o_member_jy"].(map[string]interface{})
|
|
|
a_key, _ = o_member_jy["a_key"].([]interface{})
|
|
|
if len(a_key) > 0 {
|
|
|
- return false, productType, areaMap, districtMap
|
|
|
+ return false, productType, regionMap
|
|
|
}
|
|
|
if o_member_jy["o_area"] != nil {
|
|
|
oarea, _ := o_member_jy["o_area"].(map[string]interface{})
|
|
@@ -220,9 +221,32 @@ func (this *ParamInfo) IsSub() (bool, string, map[string][]interface{}, map[stri
|
|
|
"$set": map[string]interface{}{"last_trigger_time": time.Now().Unix()},
|
|
|
})
|
|
|
if len(areaMap) == 0 && areaMap != nil && len(districtMap) == 0 && districtMap != nil {
|
|
|
- return true, productType, nil, nil
|
|
|
+ return true, productType, regionMap
|
|
|
} else {
|
|
|
- return true, productType, areaMap, districtMap
|
|
|
+ if areaMap != nil {
|
|
|
+ for k, v := range areaMap {
|
|
|
+ areaMap := map[string][]string{}
|
|
|
+ if k == "北京" || k == "天津" || k == "上海" || k == "重庆" {
|
|
|
+ city := fmt.Sprintf("%s市", k)
|
|
|
+ if districtMap[city] != nil {
|
|
|
+ v = []interface{}{city}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, city := range v {
|
|
|
+ if city == "" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ cityStr := gconv.String(city)
|
|
|
+ if districtMap[cityStr] != nil {
|
|
|
+ areaMap[cityStr] = gconv.Strings(districtMap[cityStr])
|
|
|
+ } else {
|
|
|
+ areaMap[cityStr] = []string{}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ regionMap[k] = areaMap
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true, productType, regionMap
|
|
|
}
|
|
|
|
|
|
}
|