Xingyu Xian před 4 měsíci
rodič
revize
2532a9ae14

+ 26 - 5
db/sectask.go

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

+ 2 - 0
model/http_model/GetSecTaskList.go

@@ -12,6 +12,8 @@ type GetSecTaskListRequest struct {
 	TaskStage     int    `json:"sec_task_stage"`
 	FreeStage     int    `json:"free_stage"`   // 免费领样阶段,1-5分别代表已申请、已拒绝、待发货、已发货、已收货
 	RewardStage   int    `json:"reward_stage"` // 悬赏阶段,1-2分别代表待结算(管理后台设置)、已结算(小程序端设置)
+	SaleNumMin    int    `json:"sale_num_min"` // 30天橱窗销量区间最小值
+	SaleNumMax    int    `json:"sale_num_max"` // 30天橱窗销量区间最大值
 }
 
 type GetSecTaskListData struct {

+ 3 - 0
model/http_model/get_user_info.go

@@ -24,3 +24,6 @@ func NewGetUserInfoResponse() *CommonResponse {
 	resp.Data = new(GetUserInfoData)
 	return resp
 }
+
+// 18710497683.1733835023.c9bf4974ced35cbbb257f18a38086205
+// 15321732876.1734336467.ae902dfe65ad150b69f8a5c041cc4e90

+ 31 - 0
pack/sec_task_list.go

@@ -55,4 +55,35 @@ type T struct {
 	ReceiverName string `json:"receiver_name"`
 }
 
+
+type T struct {
+	Id                string `json:"id"`
+	Point             int    `json:"point"`
+	Avatar            string `json:"avatar"`
+	Income            int    `json:"income"`
+	TaskAll           int    `json:"task_all"`
+	TaskEnd           int    `json:"task_end"`
+	ApplyNum          int    `json:"apply_num"`
+	UserType          int    `json:"user_type"`
+	TaskApply         int    `json:"task_apply"`
+	Withdrawed        int    `json:"withdrawed"`
+	Canwithdraw       int    `json:"canwithdraw"`
+	CreateDate        string `json:"create_date"`
+	Withdrawing       int    `json:"withdrawing"`
+	InBlacklist       int    `json:"in_blacklist"`
+	IsBindBank        int    `json:"is_bind_bank"`
+	IsBindInfo        int    `json:"is_bind_info"`
+	TaskExecute       int    `json:"task_execute"`
+	IsBindAccount     int    `json:"is_bind_account"`
+	LastLoginDate     string `json:"last_login_date"`
+	TalentNickname    string `json:"talent_nickname"`
+	IsBindLocation    int    `json:"is_bind_location"`
+	TalentWxOpenid    string `json:"talent_wx_openid"`
+	TalentAgeBracket  int    `json:"talent_age_bracket"`
+	TalentNationality int    `json:"talent_nationality"`
+	TalentWxNickname  string `json:"talent_wx_nickname"`
+	VisitStoreRegion  int    `json:"visit_store_region"`
+	TalentPhoneNumber string `json:"talent_phone_number"`
+}
+
 */

+ 1 - 1
service/sectask_service/sectask.go

@@ -25,7 +25,7 @@ func (*selectionTask) GetList(ctx context.Context, request http_model.GetSecTask
 	// younggee_assignment_info:数据截图、作业链接
 	// selection_info: 返现金额、悬赏金额
 	// 1. 根据选品任务阶段、账号昵称or任务id查询任务基本信息(包括任务id、账号昵称、粉丝数、主页截图、主页链接、申请时间)
-	secTaskList, total, err := db.GetSecTaskList(ctx, request.SelectionId, request.SecTaskStatus, request.SearchValue, request.PageSize, request.PageNum)
+	secTaskList, total, err := db.GetSecTaskList(ctx, request.SelectionId, request.SecTaskStatus, request.SearchValue, request.SaleNumMin, request.SaleNumMax, request.PageSize, request.PageNum)
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[sectask_service service] call GetSecTaskList error,err:%+v", err)
 		return nil, err