|
|
@@ -493,17 +493,36 @@ type AdData struct {
|
|
|
}
|
|
|
|
|
|
type UserBehavior struct {
|
|
|
- Id string `bson:"_id,omitempty"`
|
|
|
- Gid string `bson:"gid"`
|
|
|
- Pf string `bson:"pf"`
|
|
|
- OpenId string `bson:"openId"`
|
|
|
- AdData interface{} `bson:"adData"`
|
|
|
- AdFromCount int `bson:"adFromCount"`
|
|
|
- TotalDuration int `bson:"totalDuration"`
|
|
|
- TotalAdReqCount int `bson:"totalAdReqCount"`
|
|
|
- TotalAdEposedCount int `bson:"totalAdEposedCount"`
|
|
|
+ Id string `bson:"_id,omitempty"`
|
|
|
+ Gid string `bson:"gid" json:"gid"`
|
|
|
+ Pf string `bson:"pf" json:"pf"`
|
|
|
+ OpenId string `bson:"openId" json:"openId"`
|
|
|
+ RelatedAid int64 `bson:"relatedAid" json:"relatedAid"` //目前关联的aid
|
|
|
+ TotalDuration int `bson:"totalDuration" json:"totalDuration"`
|
|
|
+ TotalAdReqCount int `bson:"totalAdReqCount" json:"totalAdReqCount"`
|
|
|
+ TotalAdEposedCount int `bson:"totalAdEposedCount" json:"totalAdEposedCount"`
|
|
|
+ CreateDate string `bson:"createDate" json:"createDate"`
|
|
|
+ CreateTime int `json:"createTime" bson:"createTime"`
|
|
|
+ StartNum int `bson:"startNum" json:"startNum"`
|
|
|
+
|
|
|
+ ActiveStatus bool `bson:"activeStatus" json:"activeStatus"` //激活状态
|
|
|
+ ConversionStatus bool `bson:"conversionStatus" json:"conversionStatus"` //转化状态
|
|
|
+ RemainData map[string]string `json:"remainData" bson:"remainData"` //留存数据
|
|
|
+}
|
|
|
+type AdRelated struct {
|
|
|
+ Id string `bson:"_id" json:"_id"`
|
|
|
+ UserId string `bson:"userId" json:"userId"`
|
|
|
+ Aid int64 `json:"aid" bson:"aid"` //广告的推广计划id,即广告ID,广告平台配置落地页参数
|
|
|
+ Cid string `json:"cid" bson:"cid"` //openid的用户点击aid广告进入游戏时的唯一标识,广告平台提供
|
|
|
+ Pid int64 `json:"pid" bson:"pid"` //广告的项目id(仅巨量引擎存在,腾讯广告时不存在该值),广告平台配置落地页参数
|
|
|
+ CreateTime int64 `bson:"create_time" json:"createTime"` //当前计划的创建时间
|
|
|
+
|
|
|
+ StartNum int `bson:"startNum" json:"startNum"` //启动次数
|
|
|
+ Revenue float32 `bson:"revenue" json:"revenue"` //当日预估收益
|
|
|
+ Duration int64 `bson:"duration" json:"duration"` //当日在线时长
|
|
|
+ ReqCount int `bson:"req_count" json:"req_count"` //当日的激励视频广告请求次数
|
|
|
+ ExpCount int `bson:"exp_count" json:"exp_count"` //当日的激励视频广告曝光次数
|
|
|
}
|
|
|
-
|
|
|
type BehaviorFilter struct {
|
|
|
Gt int `json:"gt"`
|
|
|
Gte int `json:"gte"`
|
|
|
@@ -521,41 +540,43 @@ func BehaviorList(c *gin.Context) {
|
|
|
form := request.Check(c, &struct {
|
|
|
Gid string `form:"gid" json:"gid" binding:"required"`
|
|
|
Pf string `form:"pf" json:"pf" binding:"required"`
|
|
|
- OpenId string `form:"search" json:"search" binding:""`
|
|
|
+ OpenId string `form:"openId" json:"openId" binding:""`
|
|
|
Offset int `form:"offset" json:"offset" binding:""`
|
|
|
Limit int `form:"limit" json:"limit" binding:""`
|
|
|
|
|
|
- Reported string `form:"reported" json:"reported" binding:""` //all true false
|
|
|
- Pid string `form:"pid" json:"pid" binding:""`
|
|
|
- Aid string `form:"aid" json:"aid" binding:""`
|
|
|
- Cid string `form:"cid" json:"cid" binding:""`
|
|
|
-
|
|
|
- Duration interface{} `form:"duration" json:"duration" binding:""`
|
|
|
- AdReqCount interface{} `form:"adReqCount" json:"adReqCount" binding:""`
|
|
|
- AdEposedcount interface{} `form:"adEposedcount" json:"adEposedcount" binding:""`
|
|
|
-
|
|
|
+ ActiveStatus string `form:"activeStatus" json:"activeStatus" binding:""` //all true false
|
|
|
+ ConversionStatus string `form:"conversionStatus" json:"conversionStatus" binding:""` //all true false
|
|
|
AdFromCount interface{} `form:"adFromCount" json:"adFromCount" binding:""`
|
|
|
TotalDuration interface{} `form:"totalDuration" json:"totalDuration" binding:""`
|
|
|
TotalAdReqCount interface{} `form:"totalAdReqCount" json:"totalAdReqCount" binding:""`
|
|
|
TotalAdEposedCount interface{} `form:"totalAdEposedCount" json:"totalAdEposedCount" binding:""`
|
|
|
+ CreateTime interface{} `form:"createTime" json:"createTime" binding:""`
|
|
|
+ StartNum interface{} `form:"startNum" json:"startNum" binding:""`
|
|
|
}{})
|
|
|
|
|
|
collection := global.App.MongoDB.Database("chunhao").Collection("userBehavior")
|
|
|
|
|
|
ctx := context.Background()
|
|
|
- filter := bson.M{"gid": form.Gid, "pf": form.Pf}
|
|
|
+ filter := bson.M{"gid": form.Gid}
|
|
|
+
|
|
|
+ if form.Pf != "" {
|
|
|
+ filter["pf"] = form.Pf
|
|
|
+ }
|
|
|
|
|
|
if form.OpenId != "" {
|
|
|
filter["openId"] = bson.M{"$regex": form.OpenId}
|
|
|
}
|
|
|
- if form.Pid != "" {
|
|
|
- filter["adData.pid"] = form.Pid
|
|
|
- }
|
|
|
- if form.Aid != "" {
|
|
|
- filter["adData.aid"] = form.Aid
|
|
|
+
|
|
|
+ if form.ActiveStatus == "true" {
|
|
|
+ filter["activeStatus"] = true
|
|
|
+ } else if form.ActiveStatus == "false" {
|
|
|
+ filter["activeStatus"] = false
|
|
|
}
|
|
|
- if form.Cid != "" {
|
|
|
- filter["adData.cid"] = form.Cid
|
|
|
+
|
|
|
+ if form.ActiveStatus == "true" {
|
|
|
+ filter["activeStatus"] = true
|
|
|
+ } else if form.ActiveStatus == "false" {
|
|
|
+ filter["activeStatus"] = false
|
|
|
}
|
|
|
|
|
|
if form.AdFromCount != nil {
|
|
|
@@ -577,7 +598,7 @@ func BehaviorList(c *gin.Context) {
|
|
|
if adFromCount.Lt != 0 {
|
|
|
filters["$lt"] = adFromCount.Lt
|
|
|
}
|
|
|
- if adFromCount.Lt != 0 {
|
|
|
+ if adFromCount.Ne != 0 {
|
|
|
filters["$ne"] = adFromCount.Ne
|
|
|
}
|
|
|
|
|
|
@@ -586,33 +607,6 @@ func BehaviorList(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if form.TotalDuration != nil {
|
|
|
- marsh, _ := json.Marshal(form.TotalDuration)
|
|
|
- var totalDuration BehaviorFilter
|
|
|
- json.Unmarshal(marsh, &totalDuration)
|
|
|
-
|
|
|
- filters := bson.M{}
|
|
|
- if totalDuration.Gt != 0 {
|
|
|
- filters["$gt"] = totalDuration.Gt
|
|
|
- }
|
|
|
- if totalDuration.Gte != 0 {
|
|
|
- filters["$gte"] = totalDuration.Gte
|
|
|
- }
|
|
|
- if totalDuration.Lte != 0 {
|
|
|
- filters["$lte"] = totalDuration.Lte
|
|
|
- }
|
|
|
- if totalDuration.Lt != 0 {
|
|
|
- filters["$lt"] = totalDuration.Lt
|
|
|
- }
|
|
|
- if totalDuration.Lt != 0 {
|
|
|
- filters["$ne"] = totalDuration.Ne
|
|
|
- }
|
|
|
-
|
|
|
- if len(filters) > 0 {
|
|
|
- filter["TotalDuration"] = filters
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if form.TotalAdReqCount != nil {
|
|
|
marsh, _ := json.Marshal(form.TotalAdReqCount)
|
|
|
var totalAdReqCount BehaviorFilter
|
|
|
@@ -631,7 +625,7 @@ func BehaviorList(c *gin.Context) {
|
|
|
if totalAdReqCount.Lt != 0 {
|
|
|
filters["$lt"] = totalAdReqCount.Lt
|
|
|
}
|
|
|
- if totalAdReqCount.Lt != 0 {
|
|
|
+ if totalAdReqCount.Ne != 0 {
|
|
|
filters["$ne"] = totalAdReqCount.Ne
|
|
|
}
|
|
|
|
|
|
@@ -658,7 +652,7 @@ func BehaviorList(c *gin.Context) {
|
|
|
if totalAdEposedCount.Lt != 0 {
|
|
|
filters["$lt"] = totalAdEposedCount.Lt
|
|
|
}
|
|
|
- if totalAdEposedCount.Lt != 0 {
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
filters["$ne"] = totalAdEposedCount.Ne
|
|
|
}
|
|
|
|
|
|
@@ -667,84 +661,309 @@ func BehaviorList(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if form.CreateTime != nil {
|
|
|
+ marsh, _ := json.Marshal(form.CreateTime)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
+
|
|
|
+ filters := bson.M{}
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(filters) > 0 {
|
|
|
+ filter["createTime"] = filters
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if form.StartNum != nil {
|
|
|
+ marsh, _ := json.Marshal(form.StartNum)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
+
|
|
|
+ filters := bson.M{}
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(filters) > 0 {
|
|
|
+ filter["startNum"] = filters
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if form.TotalDuration != nil {
|
|
|
+ marsh, _ := json.Marshal(form.TotalDuration)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
+
|
|
|
+ filters := bson.M{}
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(filters) > 0 {
|
|
|
+ filter["totalDuration"] = filters
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ option := options.Find()
|
|
|
+ option.SetLimit(int64(form.Limit))
|
|
|
+ option.SetSkip(int64(form.Offset))
|
|
|
+
|
|
|
+ cur, err := collection.Find(ctx, filter, option)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail(c, 1001, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ count, err := collection.CountDocuments(ctx, filter)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail(c, 1001, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var data []UserBehavior
|
|
|
+ err = cur.All(ctx, &data)
|
|
|
+ if err != nil {
|
|
|
+ response.Fail(c, 1001, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ response.Success(c, gin.H{
|
|
|
+ "data": data,
|
|
|
+ "count": count,
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func AdRelatedList(c *gin.Context) {
|
|
|
+ form := request.Check(c, &struct {
|
|
|
+ //Gid string `form:"gid" json:"gid" binding:"required"`
|
|
|
+ //Pf string `form:"pf" json:"pf" binding:"required"`
|
|
|
+ //OpenId string `form:"search" json:"search" binding:""`
|
|
|
+ Offset int `form:"offset" json:"offset" binding:""`
|
|
|
+ Limit int `form:"limit" json:"limit" binding:""`
|
|
|
+
|
|
|
+ Pid string `form:"pid" json:"pid" binding:""`
|
|
|
+ Aid string `form:"aid" json:"aid" binding:""`
|
|
|
+ Cid string `form:"cid" json:"cid" binding:""`
|
|
|
+
|
|
|
+ CreateTime interface{} `form:"createTime" json:"createTime" binding:""`
|
|
|
+ StartNum interface{} `form:"startNum" json:"startNum" binding:""`
|
|
|
+ Revenue interface{} `form:"revenue" json:"revenue" binding:""`
|
|
|
+ Duration interface{} `form:"duration" json:"duration" binding:""`
|
|
|
+ ReqCount interface{} `form:"reqCount" json:"reqCount" binding:""`
|
|
|
+ ExpCount interface{} `form:"expCount" json:"expCount" binding:""`
|
|
|
+ }{})
|
|
|
+
|
|
|
+ collection := global.App.MongoDB.Database("chunhao").Collection("adRelated")
|
|
|
+
|
|
|
+ ctx := context.Background()
|
|
|
+ filter := bson.M{}
|
|
|
+ if form.Pid != "" {
|
|
|
+ filter["pid"] = bson.M{"$regex": form.Pid}
|
|
|
+ }
|
|
|
+ if form.Aid != "" {
|
|
|
+ filter["adData.aid"] = form.Aid
|
|
|
+ }
|
|
|
+ if form.Cid != "" {
|
|
|
+ filter["adData.cid"] = form.Cid
|
|
|
+ }
|
|
|
+
|
|
|
+ if form.CreateTime != nil {
|
|
|
+ marsh, _ := json.Marshal(form.CreateTime)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
+
|
|
|
+ filters := bson.M{}
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(filters) > 0 {
|
|
|
+ filter["createTime"] = filters
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if form.StartNum != nil {
|
|
|
+ marsh, _ := json.Marshal(form.StartNum)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
+
|
|
|
+ filters := bson.M{}
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(filters) > 0 {
|
|
|
+ filter["startNum"] = filters
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if form.Revenue != nil {
|
|
|
+ marsh, _ := json.Marshal(form.Revenue)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
+
|
|
|
+ filters := bson.M{}
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
+ }
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(filters) > 0 {
|
|
|
+ filter["revenue"] = filters
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if form.Duration != nil {
|
|
|
marsh, _ := json.Marshal(form.Duration)
|
|
|
- var duration BehaviorFilter
|
|
|
- json.Unmarshal(marsh, &duration)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
|
|
|
filters := bson.M{}
|
|
|
- if duration.Gt != 0 {
|
|
|
- filters["$gt"] = duration.Gt
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
}
|
|
|
- if duration.Gte != 0 {
|
|
|
- filters["$gte"] = duration.Gte
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
}
|
|
|
- if duration.Lte != 0 {
|
|
|
- filters["$lte"] = duration.Lte
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
}
|
|
|
- if duration.Lt != 0 {
|
|
|
- filters["$lt"] = duration.Lt
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
}
|
|
|
- if duration.Lt != 0 {
|
|
|
- filters["$ne"] = duration.Ne
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
}
|
|
|
|
|
|
if len(filters) > 0 {
|
|
|
- filter["adData.duration"] = filters
|
|
|
+ filter["duration"] = filters
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if form.AdReqCount != nil {
|
|
|
- marsh, _ := json.Marshal(form.AdReqCount)
|
|
|
- var adReqCount BehaviorFilter
|
|
|
- json.Unmarshal(marsh, &adReqCount)
|
|
|
+ if form.ReqCount != nil {
|
|
|
+ marsh, _ := json.Marshal(form.ReqCount)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
|
|
|
filters := bson.M{}
|
|
|
- if adReqCount.Gt != 0 {
|
|
|
- filters["$gt"] = adReqCount.Gt
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
}
|
|
|
- if adReqCount.Gte != 0 {
|
|
|
- filters["$gte"] = adReqCount.Gte
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
}
|
|
|
- if adReqCount.Lte != 0 {
|
|
|
- filters["$lte"] = adReqCount.Lte
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
}
|
|
|
- if adReqCount.Lt != 0 {
|
|
|
- filters["$lt"] = adReqCount.Lt
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
}
|
|
|
- if adReqCount.Lt != 0 {
|
|
|
- filters["$ne"] = adReqCount.Ne
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
}
|
|
|
|
|
|
if len(filters) > 0 {
|
|
|
- filter["adData.adReqCount"] = filters
|
|
|
+ filter["reqCount"] = filters
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if form.AdEposedcount != nil {
|
|
|
- marsh, _ := json.Marshal(form.AdEposedcount)
|
|
|
- var adEposedcount BehaviorFilter
|
|
|
- json.Unmarshal(marsh, &adEposedcount)
|
|
|
+ if form.ExpCount != nil {
|
|
|
+ marsh, _ := json.Marshal(form.ExpCount)
|
|
|
+ var totalAdEposedCount BehaviorFilter
|
|
|
+ json.Unmarshal(marsh, &totalAdEposedCount)
|
|
|
|
|
|
filters := bson.M{}
|
|
|
- if adEposedcount.Gt != 0 {
|
|
|
- filters["$gt"] = adEposedcount.Gt
|
|
|
+ if totalAdEposedCount.Gt != 0 {
|
|
|
+ filters["$gt"] = totalAdEposedCount.Gt
|
|
|
}
|
|
|
- if adEposedcount.Gte != 0 {
|
|
|
- filters["$gte"] = adEposedcount.Gte
|
|
|
+ if totalAdEposedCount.Gte != 0 {
|
|
|
+ filters["$gte"] = totalAdEposedCount.Gte
|
|
|
}
|
|
|
- if adEposedcount.Lte != 0 {
|
|
|
- filters["$lte"] = adEposedcount.Lte
|
|
|
+ if totalAdEposedCount.Lte != 0 {
|
|
|
+ filters["$lte"] = totalAdEposedCount.Lte
|
|
|
}
|
|
|
- if adEposedcount.Lt != 0 {
|
|
|
- filters["$lt"] = adEposedcount.Lt
|
|
|
+ if totalAdEposedCount.Lt != 0 {
|
|
|
+ filters["$lt"] = totalAdEposedCount.Lt
|
|
|
}
|
|
|
- if adEposedcount.Lt != 0 {
|
|
|
- filters["$ne"] = adEposedcount.Ne
|
|
|
+ if totalAdEposedCount.Ne != 0 {
|
|
|
+ filters["$ne"] = totalAdEposedCount.Ne
|
|
|
}
|
|
|
|
|
|
if len(filters) > 0 {
|
|
|
- filter["adData.adEposedcount"] = filters
|
|
|
+ filter["expCount"] = filters
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -764,7 +983,7 @@ func BehaviorList(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- var data []UserBehavior
|
|
|
+ var data []AdRelated
|
|
|
err = cur.All(ctx, &data)
|
|
|
if err != nil {
|
|
|
response.Fail(c, 1001, err.Error())
|