Parcourir la source

Merge remote-tracking branch 'origin/develop' into develop

lin-jim-leon il y a 2 semaines
Parent
commit
7532a921bc

+ 7 - 1
app/schedule/auto_task_review.go

@@ -416,7 +416,13 @@ func AutoSelectionReviewTask() {
 		// 审核通过
 		t := time.Now()
 		_ = dao.SelectionReviewDao{}.UpdateSelectionReview(&entity.ReviewSelection{ID: reviewSelection.ID, Status: 2})
-		_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: reviewSelection.SelectionID, SelectionStatus: 4, PassAt: t})
+		// 非悬赏任务审核通过直接变为执行中
+		selection, _ := dao.SelectionInfoDAO{}.GetSelectionInfoById(reviewSelection.SelectionID)
+		if selection != nil && selection.TaskMode == 2 {
+			_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: reviewSelection.SelectionID, SelectionStatus: 6, PassAt: t})
+		} else {
+			_ = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{SelectionID: reviewSelection.SelectionID, SelectionStatus: 4, PassAt: t})
+		}
 	}
 
 	log.Println("AutoSelectionInvalidTask running End, Time :", time.Now())

+ 3 - 1
app/service/local_life_service.go

@@ -488,6 +488,7 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 		return nil, err
 	}
 	// 系统信息
+	reLocalDetail.LocalName = localLife.LocalName
 	reLocalDetail.LocalId = localId
 	reLocalDetail.LocalStatus = localLife.TaskStatus
 	reLocalDetail.LocalPlatform = localLife.LocalPlatform
@@ -1243,7 +1244,8 @@ func (s LocalLifeService) StoreExploreOperate(param *vo.LocalTalentOperateParam)
 	}
 	if param.Status == 1 {
 		err2 := dao.LocalLifeTaskInfoDao{}.UpdateLocalStatus(taskIds, entity.LocalLifeTaskInfo{
-			TaskStage: 7,
+			TaskStage:  7,
+			BookStatus: 5,
 		})
 		if err2 != nil {
 			return err2

+ 1 - 0
app/vo/re_local_detail.go

@@ -5,6 +5,7 @@ import (
 )
 
 type ReLocalDetail struct {
+	LocalName string `json:"localName"` // 任务标题
 	// 系统信息
 	LocalId           string  `json:"localId"`           // 项目id
 	LocalStatus       int64   `json:"localStatus"`       // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、执行中、失效、已结案

+ 73 - 22
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, saleNumMin int, saleNumMax int, 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, orderBy []string, orderDesc []int) ([]*http_model.SecTaskInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// var taskStages []int
 	var freeStages []int
@@ -81,6 +81,32 @@ 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)
 	}
 
+	// 动态排序逻辑
+	if len(orderBy) > 0 && len(orderDesc) > 0 && len(orderBy) == len(orderDesc) {
+		for i := 0; i < len(orderBy); i++ {
+			orderField := orderBy[i]
+			isDesc := orderDesc[i] == 1 // 1=降序,其他值=升序
+
+			switch orderField {
+			case "sale_num":
+				if isDesc {
+					db = db.Order("sale_num desc")
+				} else {
+					db = db.Order("sale_num asc")
+				}
+			case "fans_count":
+				if isDesc {
+					db = db.Order("fans_num desc")
+				} else {
+					db = db.Order("fans_num asc")
+				}
+			}
+		}
+	} else {
+		// 默认排序
+		db = db.Order("sec_task_id desc")
+	}
+
 	// 查询总数
 	var total int64
 	var secTaskInfoList []*gorm_model.YounggeeSecTaskInfo
@@ -88,10 +114,11 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		logrus.WithContext(ctx).Errorf("[GetSelectionList] error query mysql total, err:%+v", err)
 		return nil, 0, err
 	}
+
 	// 查询该页数据
 	limit := pageSize
 	offset := pageSize * (pageNum - 1) // assert pageNum start with 0
-	err := db.Order("create_date desc").Limit(int(limit)).Offset(int(offset)).Find(&secTaskInfoList).Error
+	err := db.Limit(int(limit)).Offset(int(offset)).Find(&secTaskInfoList).Error
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[GetSelectionList] error query mysql total, err:%+v", err)
 		return nil, 0, err
@@ -127,7 +154,7 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 			return nil, 0, selectionInfoErr
 		}
 		v.EnterpriseId = selectionInfo.EnterpriseID
-		v.SubAccountId = 0
+		v.SubAccountId = selectionInfo.SubAccountId
 	}
 
 	// 按照saleMin和saleMax区间过滤
@@ -163,14 +190,23 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 	return resSecTaskInfoList, total, nil
 }
 
-func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string) (bool, error) {
+func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string, enterpriseId string, subAccountId int) (bool, error) {
 	db := GetWriteDB(ctx)
 	// 1. 校验
 	var count int64
-	fmt.Println("task_ids: ", taskIds)
+	//fmt.Println("task_ids: ", taskIds)
 	err := db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Count(&count).Error
 
-	fmt.Println("count: ", count)
+	var chooseTalentUserId string
+	var chooseTalentUserType int
+	if subAccountId == 0 {
+		chooseTalentUserType = 1
+		chooseTalentUserId = enterpriseId
+	} else {
+		chooseTalentUserType = 2
+		chooseTalentUserId = conv.MustString(subAccountId)
+	}
+	//fmt.Println("count: ", count)
 	if err != nil {
 		return false, err
 	}
@@ -201,11 +237,13 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
 		// 若选品不提供样品,则直接跳转执行阶段,否则进入发货阶段
 		if selection.SampleMode == 3 {
 			updateData := gorm_model.YounggeeSecTaskInfo{
-				TaskStatus:       2,
-				TaskStage:        8,
-				SelectDate:       time.Now(),
-				LogisticsStatus:  3,
-				AssignmentStatus: 1,
+				ChooseTalentUserId:   chooseTalentUserId,
+				ChooseTalentUserType: chooseTalentUserType,
+				TaskStatus:           2,
+				TaskStage:            8,
+				SelectDate:           time.Now(),
+				LogisticsStatus:      3,
+				AssignmentStatus:     1,
 			}
 			err = tx.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND task_stage = 3", taskIds).Updates(updateData).Error
 			if err != nil {
@@ -215,11 +253,13 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
 		} else {
 			// 免费领样
 			updateData := gorm_model.YounggeeSecTaskInfo{
-				TaskStatus:      2,
-				TaskStage:       6,
-				SelectDate:      time.Now(),
-				LogisticsStatus: 1,
-				FreeStage:       3,
+				ChooseTalentUserId:   chooseTalentUserId,
+				ChooseTalentUserType: chooseTalentUserType,
+				TaskStatus:           2,
+				TaskStage:            6,
+				SelectDate:           time.Now(),
+				LogisticsStatus:      1,
+				FreeStage:            3,
 			}
 			err = tx.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Updates(updateData).Error
 			if err != nil {
@@ -263,8 +303,17 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string)
 	return true, nil
 }
 
-func RefuseSecTaskCoop(ctx context.Context, taskIds []string) (bool, error) {
+func RefuseSecTaskCoop(ctx context.Context, taskIds []string, enterpriseId string, subAccountId int) (bool, error) {
 	db := GetWriteDB(ctx)
+	var chooseTalentUserId string
+	var chooseTalentUserType int
+	if subAccountId == 0 {
+		chooseTalentUserType = 1
+		chooseTalentUserId = enterpriseId
+	} else {
+		chooseTalentUserType = 2
+		chooseTalentUserId = conv.MustString(subAccountId)
+	}
 	// 1. 校验
 	var count int64
 	err := db.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Count(&count).Error
@@ -285,11 +334,13 @@ func RefuseSecTaskCoop(ctx context.Context, taskIds []string) (bool, error) {
 	err = db.Transaction(func(tx *gorm.DB) error {
 		// 2. 修改任务状态和任务阶段
 		updateData := gorm_model.YounggeeSecTaskInfo{
-			TaskStatus:     3,
-			TaskStage:      5,
-			CompleteDate:   time.Now(),
-			CompleteStatus: 3,
-			FreeStage:      2,
+			ChooseTalentUserId:   chooseTalentUserId,
+			ChooseTalentUserType: chooseTalentUserType,
+			TaskStatus:           3,
+			TaskStage:            5,
+			CompleteDate:         time.Now(),
+			CompleteStatus:       3,
+			FreeStage:            2,
 		}
 		err = tx.Model(gorm_model.YounggeeSecTaskInfo{}).Where("task_id IN ? AND free_stage = 1", taskIds).Updates(updateData).Error
 		if err != nil {

+ 2 - 0
handler/logistics_create.go

@@ -55,6 +55,7 @@ func (h *CreateLogisticsHandler) run() {
 		}
 		h.resp.Message = "成功添加物流信息"
 		h.resp.Data = res
+		h.resp.Status = 20000
 	} else {
 		res, err := service.Logistics.Update(h.ctx, data)
 		if err != nil {
@@ -65,6 +66,7 @@ func (h *CreateLogisticsHandler) run() {
 		}
 		h.resp.Message = "成功修改物流信息"
 		h.resp.Data = res
+		h.resp.Status = 20000
 	}
 
 }

+ 2 - 0
model/gorm_model/project_task.go

@@ -74,6 +74,8 @@ type YoungeeTaskInfo struct {
 	City                   string    `gorm:"column:city"`                                                                     //报名达人的所在城市
 	SOperatename           string    `gorm:"column:s_operate_name;type:varchar(255);comment:提报达人服务商名称" json:"s_operate_name"` //提报达人服务商名称
 	TalentName             string    `gorm:"column:talent_name"`                                                              //达人昵称
+	CreateLogisticUserId   string    `gorm:"column:create_logistic_user_id"`                                                  //创建快递单ID
+	CreateLogisticUserType int       `gorm:"column:create_logistic_user_type"`                                                //创建快递单用户类型,1商家,2子账号,3管理后台
 }
 
 func (m *YoungeeTaskInfo) TableName() string {

+ 4 - 0
model/gorm_model/selection_task_info.go

@@ -49,6 +49,10 @@ type YounggeeSecTaskInfo struct {
 	OpenID                 string     `gorm:"column:open_id;size:255" json:"open_id" comment:"账号唯一标识"`
 	WxNum                  string     `gorm:"column:wx_num;size:255" json:"wx_num" comment:"微信号"`
 	BOperator              string     `gorm:"column:b_operator;size:255" json:"b_operator" comment:"ID"`
+	CreateLogisticUserType int        `gorm:"column:create_logistic_user_type"` // 创建快递单类型
+	CreateLogisticUserId   string     `gorm:"column:create_logistic_user_id"`   // 创建快递单ID
+	ChooseTalentUserId     string     `gorm:"column:choose_talent_user_id"`     // 同意/拒绝达人操作人ID
+	ChooseTalentUserType   int        `gorm:"column:choose_talent_user_type"`   // 同意/拒绝达人操作人类型,1商家,2子账号,3管理后台
 }
 
 func (m *YounggeeSecTaskInfo) TableName() string {

+ 2 - 0
model/http_model/CreateSecTaskLogistics.go

@@ -8,6 +8,8 @@ type CreateSecTaskLogisticsRequest struct {
 	ExplorestoreEndtime   string `json:"explorestore_endtime"`   // 线下探店-探店结束时间
 	ExplorestorePeriod    string `json:"explorestore_period"`    // 线下探店-探店持续时间
 	ThingsType            int    `json:"things_type"`            // 产品类型 1:实物, 3:线下探店
+	EnterpriseId          string `json:"enterprise_id"`          // 商家ID
+	SubAccountId          int    `json:"sub_account_id"`         // 子账号ID
 }
 
 type CreateSecTaskLogisticsData struct {

+ 55 - 49
model/http_model/GetSecTaskList.go

@@ -3,19 +3,19 @@ package http_model
 import "time"
 
 type GetSecTaskListRequest struct {
-	PageSize      int64  `json:"page_size"`
-	PageNum       int64  `json:"page_num"`
-	SelectionId   string `json:"selection_id"`
-	SecTaskStatus int    `json:"sec_task_status"`
-	SearchValue   string `json:"search_value"`
-	Type          int    `json:"type"`           // 查询类型,1、2、3分别表示确定达人查询、发货管理查询、结算管理查询
-	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天橱窗销量区间最大值
-	OrderBy       string `json:"order_by"`       // 排序条件
-	OrderDesc     int    `json:"order_desc"`     // 是否降序
+	PageSize      int64    `json:"page_size"`
+	PageNum       int64    `json:"page_num"`
+	SelectionId   string   `json:"selection_id"`
+	SecTaskStatus int      `json:"sec_task_status"`
+	SearchValue   string   `json:"search_value"`
+	Type          int      `json:"type"`           // 查询类型,1、2、3分别表示确定达人查询、发货管理查询、结算管理查询
+	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天橱窗销量区间最大值
+	OrderBy       []string `json:"order_by"`       // 排序条件
+	OrderDesc     []int    `json:"order_desc"`     // 是否降序
 }
 
 type GetSecTaskListData struct {
@@ -24,42 +24,48 @@ type GetSecTaskListData struct {
 }
 
 type SecTaskInfo struct {
-	SelectionId           string    `json:"selection_id"`            // 带货任务ID
-	SecTaskId             string    `json:"sec_task_id"`             // 带货任务ID
-	PlatformNickname      string    `json:"platform_nickname"`       // 帐号昵称
-	TalentId              string    `json:"talent_id"`               // 达人ID
-	TalentAvatar          string    `json:"talent_avatar"`           // 达人头像
-	KuaiShouUserId        string    `json:"kuai_shou_user_id"`       // 快手账号
-	KuaiShouUserGender    string    `json:"kuai_shou_user_gender"`   // 快手用户性别
-	KuaiShouUserLocation  string    `json:"kuai_shou_user_location"` // 快手用户ip属地
-	FansCount             string    `json:"fans_count"`              // 粉丝数
-	EnterpriseId          string    `json:"enterprise_id"`           // 商家ID
-	SubAccountId          int       `json:"sub_account_id"`          // 商家子账号ID
-	HomePageCaptureUrl    string    `json:"home_page_capture_url"`   // 主页截图链接
-	HomePageUrl           string    `json:"home_page_url"`           // 主页链接
-	RegionCode            int       `json:"region_code"`             // 区域编码
-	DetailAddr            string    `json:"detail_addr"`             // 物流信息
-	CompanyName           string    `json:"company_name"`            // 物流公司
-	LogisticsNumber       string    `json:"logistics_number"`        // 物流单号
-	ExplorestoreStarttime time.Time `json:"explorestore_starttime"`  // 线下探店-探店开始时间
-	ExplorestoreEndtime   time.Time `json:"explorestore_endtime"`    // 线下探店-探店结束时间
-	ExplorestorePeriod    string    `json:"explorestore_period"`     // 线下探店-探店持续时间
-	DataScreenshot        string    `json:"data_screenshot"`         // 数据截图
-	AssignmentLink        string    `json:"assignment_link"`         // 作业链接
-	ReturnMoney           string    `json:"return_money"`            // 返现
-	TaskReward            string    `json:"task_reward"`             // 悬赏金
-	IsPayReward           int       `json:"is_pay_reward"`           // 是否给悬赏金
-	IsPayPayment          int       `json:"is_pay_payment"`          // 是否返现
-	CreateDate            string    `json:"create_date"`             // 创建时间
-	SelectDate            string    `json:"select_date"`             // 反选时间
-	DeliveryDate          string    `json:"delivery_date"`           // 发货时间
-	CompleteDate          string    `json:"complete_date"`           // 结算时间
-	SignedTime            string    `json:"signed_time"`             // 快递签收时间
-	SaleNum               int       `json:"sale_num"`                // 30天橱窗销量
-	FreeStrategyId        int       `json:"free_strategy_id"`        // 免费领样策略id
-	ProductId             int       `json:"product_id"`              // 商品ID
-	FreeStage             int       `json:"free_stage"`              // 免费领样阶段,1-5分别代表已申请、已拒绝、待发货、已发货、已收货
-	RewardStage           int       `json:"reward_stage"`            // 悬赏阶段,1-2分别代表待结算(管理后台设置)、已结算(小程序端设置)
+	SelectionId            string    `json:"selection_id"`              // 带货任务ID
+	SecTaskId              string    `json:"sec_task_id"`               // 带货任务ID
+	PlatformNickname       string    `json:"platform_nickname"`         // 帐号昵称
+	TalentId               string    `json:"talent_id"`                 // 达人ID
+	TalentAvatar           string    `json:"talent_avatar"`             // 达人头像
+	KuaiShouUserId         string    `json:"kuai_shou_user_id"`         // 快手账号
+	KuaiShouUserGender     string    `json:"kuai_shou_user_gender"`     // 快手用户性别
+	KuaiShouUserLocation   string    `json:"kuai_shou_user_location"`   // 快手用户ip属地
+	FansCount              string    `json:"fans_count"`                // 粉丝数
+	EnterpriseId           string    `json:"enterprise_id"`             // 商家ID
+	SubAccountId           int       `json:"sub_account_id"`            // 商家子账号ID
+	HomePageCaptureUrl     string    `json:"home_page_capture_url"`     // 主页截图链接
+	HomePageUrl            string    `json:"home_page_url"`             // 主页链接
+	RegionCode             int       `json:"region_code"`               // 区域编码
+	DetailAddr             string    `json:"detail_addr"`               // 物流信息
+	CompanyName            string    `json:"company_name"`              // 物流公司
+	LogisticsNumber        string    `json:"logistics_number"`          // 物流单号
+	ExplorestoreStarttime  time.Time `json:"explorestore_starttime"`    // 线下探店-探店开始时间
+	ExplorestoreEndtime    time.Time `json:"explorestore_endtime"`      // 线下探店-探店结束时间
+	ExplorestorePeriod     string    `json:"explorestore_period"`       // 线下探店-探店持续时间
+	DataScreenshot         string    `json:"data_screenshot"`           // 数据截图
+	AssignmentLink         string    `json:"assignment_link"`           // 作业链接
+	ReturnMoney            string    `json:"return_money"`              // 返现
+	TaskReward             string    `json:"task_reward"`               // 悬赏金
+	IsPayReward            int       `json:"is_pay_reward"`             // 是否给悬赏金
+	IsPayPayment           int       `json:"is_pay_payment"`            // 是否返现
+	CreateDate             string    `json:"create_date"`               // 创建时间
+	SelectDate             string    `json:"select_date"`               // 反选时间
+	DeliveryDate           string    `json:"delivery_date"`             // 发货时间
+	CompleteDate           string    `json:"complete_date"`             // 结算时间
+	SignedTime             string    `json:"signed_time"`               // 快递签收时间
+	SaleNum                int       `json:"sale_num"`                  // 30天橱窗销量
+	FreeStrategyId         int       `json:"free_strategy_id"`          // 免费领样策略id
+	ProductId              int       `json:"product_id"`                // 商品ID
+	FreeStage              int       `json:"free_stage"`                // 免费领样阶段,1-5分别代表已申请、已拒绝、待发货、已发货、已收货
+	RewardStage            int       `json:"reward_stage"`              // 悬赏阶段,1-2分别代表待结算(管理后台设置)、已结算(小程序端设置)
+	CreateLogisticUserId   string    `json:"create_logistic_user_id"`   // 创建快递单用户ID
+	CreateLogisticUserType int       `json:"create_logistic_user_type"` // 创建快递单类型
+	CreateLogisticUserName string    `json:"create_logistic_user_name"` // 创建快递单用户名称
+	ChooseTalentUserId     string    `json:"choose_talent_user_id"`     // 同意/拒绝达人操作人ID
+	ChooseTalentUserType   int       `json:"choose_talent_user_type"`   // 同意/拒绝达人操作人类型,1商家,2子账号
+	ChooseTalentUserName   string    `json:"choose_talent_user_name"`   // 同意/拒绝达人操作人名称
 }
 
 func NewGetSecTaskListRequest() *GetSecTaskListRequest {

+ 4 - 2
model/http_model/PassSecTaskCoop.go

@@ -1,8 +1,10 @@
 package http_model
 
 type PassSecTaskCoopRequest struct {
-	SelectionId string   `json:"selection_id"`
-	TaskIds     []string `json:"task_ids"`
+	SelectionId  string   `json:"selection_id"`
+	TaskIds      []string `json:"task_ids"`
+	EnterpriseId string   `json:"enterprise_id"`
+	SubAccountId int      `json:"sub_account_id"`
 }
 
 type PassSecTaskCoopData struct {

+ 3 - 1
model/http_model/RefuseSecTaskCoop.go

@@ -1,7 +1,9 @@
 package http_model
 
 type RefuseSecTaskCoopRequest struct {
-	TaskIds []string `json:"task_ids"`
+	TaskIds      []string `json:"task_ids"`
+	EnterpriseId string   `json:"enterprise_id"`  // 商家ID
+	SubAccountId int      `json:"sub_account_id"` // 子账号ID
 }
 
 type RefuseSecTaskCoopData struct {

+ 9 - 6
model/http_model/logistics_create.go

@@ -1,18 +1,21 @@
 package http_model
 
 type CreateLogisticsRequest struct {
+	EnterpriseId    string `json:"enterprise_id"`
+	SubAccountId    int64  `json:"sub_account_id"`
+	TaskID          string `json:"task_id"`          // 任务id
+	CompanyName     string `json:"company_name"`     // 实物商品-物流公司名称
+	LogisticsNumber string `json:"logistics_number"` // 实物商品-物流单号
+	ThingsType      int    `json:"things_type"`      // 产品类型 1:实物, 2:线下探店 3:虚拟产品
+	IsUpdate        int    `json:"is_update"`        //更新标志位 0:不更新 1:更新
+	LogisticsID     int64  `json:"logistics_id"`     // 货物-id
+
 	StrategyID            int64  `json:"strategy_id"`             //招募策略id
-	LogisticsID           int64  `json:"logistics_id"`            // 货物-id
-	CompanyName           string `json:"company_name"`            // 实物商品-物流公司名称
-	LogisticsNumber       string `json:"logistics_number"`        // 实物商品-物流单号
 	ExplorestoreStarttime string `json:"explorestore_starttime"`  // 线下探店-探店开始时间
 	ExplorestoreEndtime   string `json:"explorestore_endtime"`    // 线下探店-探店结束时间
 	ExplorestorePeriod    string `json:"explorestore_period"`     // 线下探店-探店持续时间
 	CouponCodeInformation string `json:"coupon_code_information"` // 虚拟产品-券码信息
-	TaskID                string `json:"task_id"`                 // 任务id
 	DeliveryTime          string `json:"delivery_time"`           // 发货时间
-	ThingsType            int    `json:"things_type"`             //产品类型 1:实物, 2:虚拟产品,3:线下探店
-	IsUpdate              int    `json:"is_update"`               //更新标志位 0:不更新 1:更新
 }
 
 type CreateLogisticsData struct {

+ 25 - 19
pack/sec_task_list.go

@@ -22,25 +22,31 @@ func GormSecTaskToHttpSecTask(secTask *gorm_model.YounggeeSecTaskInfo) *http_mod
 	TalentPlatformInfoSnap := secTask.TalentPlatformInfoSnap
 	regionCode, _ := strconv.Atoi(conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "region_code"), ""))
 	return &http_model.SecTaskInfo{
-		SelectionId:        secTask.SelectionID,
-		SecTaskId:          secTask.TaskID,
-		PlatformNickname:   conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname"), ""),
-		FansCount:          conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count"), ""),
-		HomePageCaptureUrl: conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_capture_url"), ""),
-		HomePageUrl:        conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_url"), ""),
-		RegionCode:         regionCode,
-		DetailAddr:         conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "detail_addr"), "") + " " + conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "receiver_name"), "") + " " + conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "phone_number"), ""),
-		CreateDate:         conv.MustString(secTask.CreateDate, "")[:19],
-		SelectDate:         conv.MustString(secTask.SelectDate, "")[:19],
-		DeliveryDate:       conv.MustString(secTask.DeliveryDate, "")[:19],
-		CompleteDate:       conv.MustString(secTask.CompleteDate, "")[:19],
-		IsPayReward:        secTask.IsPayReward,
-		IsPayPayment:       secTask.IsPayPayment,
-		SignedTime:         conv.MustString(secTask.SignedTime, "0000"),
-		SaleNum:            secTask.SaleNum,
-		FreeStrategyId:     secTask.FreeStrategyId,
-		TalentId:           secTask.TalentID,
-		ProductId:          secTask.ProductId,
+		SelectionId:            secTask.SelectionID,
+		SecTaskId:              secTask.TaskID,
+		PlatformNickname:       conv.MustString(gjson.Get(TalentPlatformInfoSnap, "platform_nickname"), ""),
+		FansCount:              conv.MustString(gjson.Get(TalentPlatformInfoSnap, "fans_count"), ""),
+		HomePageCaptureUrl:     conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_capture_url"), ""),
+		HomePageUrl:            conv.MustString(gjson.Get(TalentPlatformInfoSnap, "home_page_url"), ""),
+		RegionCode:             regionCode,
+		DetailAddr:             conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "detail_addr"), "") + " " + conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "receiver_name"), "") + " " + conv.MustString(gjson.Get(secTask.TalentPostAddrSnap, "phone_number"), ""),
+		CreateDate:             conv.MustString(secTask.CreateDate, "")[:19],
+		SelectDate:             conv.MustString(secTask.SelectDate, "")[:19],
+		DeliveryDate:           conv.MustString(secTask.DeliveryDate, "")[:19],
+		CompleteDate:           conv.MustString(secTask.CompleteDate, "")[:19],
+		IsPayReward:            secTask.IsPayReward,
+		IsPayPayment:           secTask.IsPayPayment,
+		SignedTime:             conv.MustString(secTask.SignedTime, "0000"),
+		SaleNum:                secTask.SaleNum,
+		FreeStrategyId:         secTask.FreeStrategyId,
+		TalentId:               secTask.TalentID,
+		ProductId:              secTask.ProductId,
+		CreateLogisticUserId:   secTask.CreateLogisticUserId,
+		CreateLogisticUserType: secTask.CreateLogisticUserType,
+		CreateLogisticUserName: secTask.CreateLogisticUserId,
+		ChooseTalentUserId:     secTask.ChooseTalentUserId,
+		ChooseTalentUserType:   secTask.ChooseTalentUserType,
+		ChooseTalentUserName:   secTask.ChooseTalentUserId,
 	}
 }
 

+ 1 - 0
route/init.go

@@ -310,6 +310,7 @@ func InitRoute(r *gin.Engine) {
 		task.POST("/logistics/selection/talent/count", controller.TaskController{}.LogisticsSelectionTalentCount) // 带货待发货、待签收、已签收角标
 		task.POST("/logistics/talent/list", controller.TaskController{}.LogisticsTalentList)                      // 种草达人物流列表
 		task.POST("/logistics/talent/count", controller.TaskController{}.LogisticsTalentCount)                    // 种草待发货、待签收、已签收角标
+		task.POST("/logistics/createLogistics", handler.WrapCreateLogisticsHandler)                               // 创建物流信息
 
 		// 探店管理
 		task.POST("/store/explore/list", controller.TaskController{}.StoreExploreList)            // 探店本地生活列表

+ 40 - 8
service/logistics.go

@@ -23,7 +23,6 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 	ThingsType := newLogistics.ThingsType
 	StrategyID := newLogistics.StrategyID
 	Logistics := gorm_model.YoungeeTaskLogistics{
-		LogisticsID:           newLogistics.LogisticsID,
 		TaskID:                newLogistics.TaskID,
 		ThingsType:            int64(ThingsType),
 		ExplorestoreStarttime: time.Now(),
@@ -35,7 +34,6 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 	if ThingsType == 1 {
 		Logistics.CompanyName = newLogistics.CompanyName
 		Logistics.LogisticsNumber = newLogistics.LogisticsNumber
-		Logistics.DeliveryTime = time.Now()
 	} else if ThingsType == 3 {
 		fmt.Println("开始时间:", newLogistics.ExplorestoreStarttime)
 		fmt.Println("结束时间:", newLogistics.ExplorestoreEndtime)
@@ -53,6 +51,29 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 		return nil, err
 	}
 
+	// 修改task_info中发货状态
+	err = db.UpdateLogisticsStatus(ctx, Logistics.TaskID, 2)
+	if err != nil {
+		logrus.WithContext(ctx).Errorf("[logistics service] call UpdateLogisticsStatus error,err:%+v", err)
+		return nil, err
+	}
+
+	updateTaskData := gorm_model.YoungeeTaskInfo{
+		TaskID: newLogistics.TaskID,
+	}
+	if newLogistics.SubAccountId == 0 {
+		updateTaskData.CreateLogisticUserId = newLogistics.EnterpriseId
+		updateTaskData.CreateLogisticUserType = 1
+	} else {
+		updateTaskData.CreateLogisticUserId = conv.MustString(newLogistics.SubAccountId)
+		updateTaskData.CreateLogisticUserType = 2
+	}
+	_, err5 := db.UpdateTask(ctx, updateTaskData, nil)
+	if err5 != nil {
+		logrus.WithContext(ctx).Errorf("[projectPay service] call SpecialSettlePay error,err:%+v", err5)
+		return nil, err5
+	}
+
 	projectId, err1 := db.GetProjectIdByTaskId(ctx, newLogistics.TaskID)
 	if err1 != nil {
 		logrus.WithContext(ctx).Errorf("[project service] call GetProjectIdByTaskId error,err:%+v", err1)
@@ -73,12 +94,6 @@ func (*logistics) Create(ctx context.Context, newLogistics http_model.CreateLogi
 		logrus.WithContext(ctx).Errorf("[project service] call UpdateLogisticsNumber error,err:%+v", err)
 		return nil, err
 	}
-	// 修改task_info中发货状态
-	err = db.UpdateLogisticsStatus(ctx, Logistics.TaskID, 2)
-	if err != nil {
-		logrus.WithContext(ctx).Errorf("[logistics service] call UpdateLogisticsStatus error,err:%+v", err)
-		return nil, err
-	}
 
 	// 修改task_info中发货时间
 	err = db.UpdateLogisticsDate(ctx, Logistics.TaskID)
@@ -146,6 +161,23 @@ func (*logistics) Update(ctx context.Context, newLogistics http_model.CreateLogi
 	res := &http_model.CreateLogisticsData{
 		LogisticsID: *logisticsID,
 	}
+
+	updateTaskData := gorm_model.YoungeeTaskInfo{
+		TaskID: newLogistics.TaskID,
+	}
+	if newLogistics.SubAccountId == 0 {
+		updateTaskData.CreateLogisticUserId = newLogistics.EnterpriseId
+		updateTaskData.CreateLogisticUserType = 1
+	} else {
+		updateTaskData.CreateLogisticUserId = conv.MustString(newLogistics.SubAccountId)
+		updateTaskData.CreateLogisticUserType = 2
+	}
+	_, err5 := db.UpdateTask(ctx, updateTaskData, nil)
+	if err5 != nil {
+		logrus.WithContext(ctx).Errorf("[projectPay service] call SpecialSettlePay error,err:%+v", err5)
+		return nil, err5
+	}
+
 	return res, nil
 }
 

+ 18 - 5
service/sectask_service/logistics.go

@@ -2,6 +2,7 @@ package sectask_service
 
 import (
 	"context"
+	"github.com/issue9/conv"
 	"github.com/sirupsen/logrus"
 	"time"
 	"youngee_b_api/db"
@@ -41,13 +42,25 @@ func (*logistics) Create(ctx context.Context, request http_model.CreateSecTaskLo
 		return nil, err
 	}
 
+	var createLogisticUserType int
+	var createLogisticUserId string
+	if request.SubAccountId == 0 {
+		createLogisticUserType = 1
+		createLogisticUserId = request.EnterpriseId
+	} else if request.SubAccountId != 0 {
+		createLogisticUserType = 2
+		createLogisticUserId = conv.MustString(request.SubAccountId)
+	}
+
 	// 修改task_info中发货时间、任务阶段
 	updatdSecTask := gorm_model.YounggeeSecTaskInfo{
-		TaskID:          request.TaskID,
-		LogisticsStatus: 2,
-		TaskStage:       8,
-		DeliveryDate:    time.Now(),
-		FreeStage:       4,
+		TaskID:                 request.TaskID,
+		LogisticsStatus:        2,
+		TaskStage:              8,
+		DeliveryDate:           time.Now(),
+		FreeStage:              4,
+		CreateLogisticUserId:   createLogisticUserId,
+		CreateLogisticUserType: createLogisticUserType,
 	}
 
 	_, err = db.UpdateSecTask(ctx, updatdSecTask)

+ 3 - 3
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.SaleNumMin, request.SaleNumMax, request.PageSize, request.PageNum)
+	secTaskList, total, err := db.GetSecTaskList(ctx, request.SelectionId, request.SecTaskStatus, request.SearchValue, request.SaleNumMin, request.SaleNumMax, request.PageSize, request.PageNum, request.OrderBy, request.OrderDesc)
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[sectask_service service] call GetSecTaskList error,err:%+v", err)
 		return nil, err
@@ -70,7 +70,7 @@ func (*selectionTask) GetList(ctx context.Context, request http_model.GetSecTask
 }
 
 func (*selectionTask) PassCoop(ctx context.Context, request http_model.PassSecTaskCoopRequest) (*http_model.PassSecTaskCoopData, error) {
-	_, err := db.PassSecTaskCoop(ctx, request.SelectionId, request.TaskIds)
+	_, err := db.PassSecTaskCoop(ctx, request.SelectionId, request.TaskIds, request.EnterpriseId, request.SubAccountId)
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[sectask_service service] call PassCoop error,err:%+v", err)
 		return nil, err
@@ -83,7 +83,7 @@ func (*selectionTask) PassCoop(ctx context.Context, request http_model.PassSecTa
 
 func (*selectionTask) RefuseCoop(ctx context.Context, request http_model.RefuseSecTaskCoopRequest) (*http_model.RefuseSecTaskCoopData, error) {
 
-	_, err := db.RefuseSecTaskCoop(ctx, request.TaskIds)
+	_, err := db.RefuseSecTaskCoop(ctx, request.TaskIds, request.EnterpriseId, request.SubAccountId)
 	if err != nil {
 		logrus.WithContext(ctx).Errorf("[sectask_service service] call RefuseCoop error,err:%+v", err)
 		return nil, err