|
@@ -30,7 +30,7 @@ func GetSecTaskById(ctx context.Context, secTaskId string) (*gorm_model.Younggee
|
|
|
return &secTaskInfo, nil
|
|
|
}
|
|
|
|
|
|
-func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, searchValue string, pageSize, pageNum int64) ([]*http_model.SecTaskInfo, int64, error) {
|
|
|
+func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, searchValue string, saleNumMin int, saleNumMax int, pageSize, pageNum int64) ([]*http_model.SecTaskInfo, int64, error) {
|
|
|
db := GetReadDB(ctx)
|
|
|
// var taskStages []int
|
|
|
var freeStages []int
|
|
@@ -44,6 +44,10 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
|
|
|
// 申请成功
|
|
|
freeStages = []int{3, 4, 5}
|
|
|
break
|
|
|
+ case 5:
|
|
|
+ // 申请失败
|
|
|
+ freeStages = []int{2}
|
|
|
+ break
|
|
|
case 6:
|
|
|
// 待发货
|
|
|
freeStages = []int{3}
|
|
@@ -68,7 +72,7 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
|
|
|
freeStages = []int{0, 1, 2, 3, 4, 5}
|
|
|
rewardStages = []int{0, 1}
|
|
|
}
|
|
|
- fmt.Println("task_stages: ", freeStages, rewardStages)
|
|
|
+ // fmt.Println("task_stages: ", freeStages, rewardStages)
|
|
|
if len(freeStages) == 0 {
|
|
|
// 根据悬赏阶段筛选
|
|
|
db = db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("selection_id = ? and reward_stage in ?", selectionId, rewardStages)
|
|
@@ -76,6 +80,7 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
|
|
|
// 根据免费领样阶段筛选
|
|
|
db = db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("selection_id = ? and free_stage in ?", selectionId, freeStages)
|
|
|
}
|
|
|
+
|
|
|
// 查询总数
|
|
|
var total int64
|
|
|
var secTaskInfoList []*gorm_model.YounggeeSecTaskInfo
|
|
@@ -112,11 +117,27 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
|
|
|
v.PlatformNickname = kuaishouUserInfo.NickName
|
|
|
v.KuaiShouUserGender = kuaishouUserInfo.Gender
|
|
|
v.KuaiShouUserLocation = kuaishouUserInfo.City
|
|
|
+ v.FansCount = kuaishouUserInfo.Fan
|
|
|
+ }
|
|
|
+
|
|
|
+ // 按照saleMin和saleMax区间过滤
|
|
|
+ var saleCondition []*http_model.SecTaskInfo
|
|
|
+ if saleNumMin != 0 && saleNumMax != 0 {
|
|
|
+ for _, v := range newSecTaskInfoList {
|
|
|
+ if v.SaleNum <= saleNumMax && v.SaleNum > saleNumMin {
|
|
|
+ saleCondition = append(saleCondition, v)
|
|
|
+ } else {
|
|
|
+ total--
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ saleCondition = newSecTaskInfoList
|
|
|
}
|
|
|
|
|
|
+ // 按照SearchValue过滤
|
|
|
var resSecTaskInfoList []*http_model.SecTaskInfo
|
|
|
if searchValue != "" {
|
|
|
- for _, v := range newSecTaskInfoList {
|
|
|
+ for _, v := range saleCondition {
|
|
|
if strings.Contains(v.SecTaskId, searchValue) {
|
|
|
resSecTaskInfoList = append(resSecTaskInfoList, v)
|
|
|
} else if strings.Contains(v.PlatformNickname, searchValue) {
|
|
@@ -126,9 +147,9 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- resSecTaskInfoList = newSecTaskInfoList
|
|
|
+ resSecTaskInfoList = saleCondition
|
|
|
}
|
|
|
- fmt.Println("resSecTaskInfoList: ", &resSecTaskInfoList)
|
|
|
+
|
|
|
return resSecTaskInfoList, total, nil
|
|
|
}
|
|
|
|