Jianghan há 1 ano atrás
pai
commit
34d22fe07c
1 ficheiros alterados com 34 adições e 0 exclusões
  1. 34 0
      jyBXSubscribe/rpc/model/push.go

+ 34 - 0
jyBXSubscribe/rpc/model/push.go

@@ -1461,6 +1461,32 @@ func (s *subscribePush) getFreeDatasSQL(bsp *ViewCondition, startTime, endTime i
 		Buyerclass += `]}}`
 		musts = append(musts, Buyerclass)
 	}
+	/**
+	  100-500
+	  100-
+	  -500
+	*/
+	if bsp.Amount != "" {
+		at := strings.Split(bsp.Amount, "-")
+		if len(at) == 2 {
+			Bidamount := `{"range":{"bidamount":{` // "gte": %d, "lte": %d}}}
+			if at[0] != "" {
+				minPrice := common.Int64All(common.Float64All(at[0]) * 10000) //换成元
+				if minPrice >= 0 {
+					Bidamount += fmt.Sprintf("\"gte\": %d", minPrice)
+				}
+			}
+			if at[1] != "" {
+				maxPrice := common.Int64All(common.Float64All(at[1]) * 10000)
+				if maxPrice > 0 {
+					Bidamount += fmt.Sprintf(",\"lte\": %d", maxPrice)
+				}
+			}
+			Bidamount += `}}}`
+			musts = append(musts, Bidamount)
+		}
+
+	}
 	boolsNum := 0 //should
 	if len(bsp.Keyword) > 0 {
 		boolsNum = 1
@@ -1660,6 +1686,7 @@ type ViewCondition struct {
 	SelectType []string      //筛选(正文 or 标题)
 	Subtype    []string      //信息类型
 	Size       int           //数量
+	Amount     string        //金额
 }
 
 // 获取用户信息
@@ -1672,6 +1699,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 		Area       map[string]interface{}
 		District   map[string]interface{}
 		SelectType []string
+		Amount     string
 	}{}
 	switch s.ModuleFlag {
 	case MemberFlag:
@@ -1694,6 +1722,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 			} else {
 				tmpInfo.SelectType = []string{"title"}
 			}
+			tmpInfo.Amount = common.ObjToString(o_member_jy["amount"])
 		}
 	case SubVipFlag:
 		userMap, ok := IC.Mgo.FindById("user", spqp.UserId, `{"o_vipjy":1,"i_vip_status":1,"subpush_inactive":1}`)
@@ -1714,6 +1743,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 			} else {
 				tmpInfo.SelectType = []string{"title"}
 			}
+			tmpInfo.Amount = common.ObjToString(o_vipjy["amount"])
 		}
 	case EntnicheFlag:
 		//商机管理
@@ -1735,6 +1765,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 					} else {
 						tmpInfo.SelectType = []string{"title"}
 					}
+					tmpInfo.Amount = common.ObjToString(entInfo["amount"])
 					if common.IntAllDef(entInfo["i_ppstatus"], 0) == 1 && entInfo["o_area_p"] != nil {
 						tmpInfo.Area, _ = entInfo["o_area_p"].(map[string]interface{})
 					}
@@ -1751,6 +1782,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 				} else {
 					tmpInfo.SelectType = []string{"title"}
 				}
+				tmpInfo.Amount = common.ObjToString(entInfo["amount"])
 			}
 		}
 	default:
@@ -1772,6 +1804,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 			} else {
 				tmpInfo.SelectType = []string{"title"}
 			}
+			tmpInfo.Amount = common.ObjToString(o_jy["amount"])
 			if common.IntAllDef(o_jy["i_ppstatus"], 0) == 1 && o_jy["o_area_p"] != nil {
 				tmpInfo.Area, _ = o_jy["o_area_p"].(map[string]interface{})
 			}
@@ -1784,6 +1817,7 @@ func (s *subscribePush) GetUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 		City:       getStringArrFromDbResult(tmpInfo.Area, 2),
 		District:   districtHandle(tmpInfo.District),
 		SelectType: tmpInfo.SelectType,
+		Amount:     tmpInfo.Amount,
 	}
 	//付费用户
 	if isPayBool {