浏览代码

Merge branch 'dev_v4.9.69_wh1' of qmx/jy into feature/v4.9.69

王浩 8 月之前
父节点
当前提交
5dc0971496

+ 32 - 8
src/jfw/modules/publicapply/src/subscribe/entity/entity.go

@@ -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
 	}
 
 }

+ 1 - 2
src/jfw/modules/publicapply/src/subscribe/service/service.go

@@ -30,13 +30,12 @@ func (this *ServiceStruct) IsSub() {
 			return Result{Data: nil, Error_msg: Error_msg_1005}
 		}
 		newFN := entity.NewParamInfo(userId, this.Session())
-		isSubscribe, productType, area, district := newFN.IsSub()
+		isSubscribe, productType, area := newFN.IsSub()
 		returnData := map[string]interface{}{
 			"frequentContinuous": config.Config.FrequentContinuous,
 			"screenNumb":         config.Config.ScreenNumb,
 			"isSubscribe":        isSubscribe,
 			"area":               area,
-			"district":           district,
 			"positionType":       gconv.Int64(this.GetSession("positionType")),
 			"productType":        productType,
 			"stayTime":           config.Config.StayTime,