浏览代码

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

lin-jim-leon 2 周之前
父节点
当前提交
f6661ea29b

+ 18 - 15
app/controller/task_controller.go

@@ -216,14 +216,15 @@ func (t TaskController) SelectionClose(c *gin.Context) {
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
-	selectionId, err := service.SelectionInfoService{}.CloseSelection(param.SelectionId)
-	if err != nil {
-		logrus.Errorf("[CloseSelection] call CloseSelection err:%+v\n", err)
-		returnError(c, 40000, err.Error())
+	todo, err1 := service.SelectionInfoService{}.CloseSelection(param.SelectionId)
+	if err1 != nil {
+		logrus.Errorf("[CloseSelection] call CloseSelection err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
 		return
 	}
 	resultMap := make(map[string]string)
-	resultMap["selectionId"] = *selectionId
+	resultMap["selectionId"] = param.SelectionId
+	resultMap["todo"] = todo
 	returnSuccess(c, 20000, resultMap)
 }
 
@@ -412,14 +413,15 @@ func (t TaskController) ProjectClose(c *gin.Context) {
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
-	projectId, err := service.ProjectService{}.CloseProject(param.ProjectId)
-	if err != nil {
-		logrus.Errorf("[CloseProject] call CloseProject err:%+v\n", err)
-		returnError(c, 40000, err.Error())
+	todo, err1 := service.ProjectService{}.CloseProject(param.ProjectId)
+	if err1 != nil {
+		logrus.Errorf("[CloseProject] call CloseProject err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
 		return
 	}
 	resultMap := make(map[string]string)
-	resultMap["projectId"] = *projectId
+	resultMap["projectId"] = param.ProjectId
+	resultMap["todo"] = todo
 	returnSuccess(c, 20000, resultMap)
 }
 
@@ -978,14 +980,15 @@ func (t TaskController) LocalLifeClose(c *gin.Context) {
 		returnError(c, 40000, "Parameter Error: "+err.Error())
 		return
 	}
-	localId, err := service.LocalLifeService{}.CloseLocalLife(param.LocalId)
-	if err != nil {
-		logrus.Errorf("[CloseLocalLife] call CloseLocalLife err:%+v\n", err)
-		returnError(c, 40000, err.Error())
+	todo, err1 := service.LocalLifeService{}.CloseLocalLife(param.LocalId)
+	if err1 != nil {
+		logrus.Errorf("[CloseLocalLife] call CloseLocalLife err:%+v\n", err1)
+		returnError(c, 40000, err1.Error())
 		return
 	}
 	resultMap := make(map[string]string)
-	resultMap["localId"] = *localId
+	resultMap["localId"] = param.LocalId
+	resultMap["todo"] = todo
 	returnSuccess(c, 20000, resultMap)
 }
 

+ 12 - 4
app/dao/local_life_dao.go

@@ -112,7 +112,7 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, task_form, content_type, need_review, need_quality, need_calculate, store_id, team_buying_id, tools")
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, need_pay, task_form, content_type, need_review, need_quality, need_calculate, store_id, team_buying_id, tools")
 	offset := (param.Page - 1) * param.PageSize
 	if param.Order == 1 {
 		if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifes).Error; err != nil {
@@ -130,7 +130,6 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 			LocalId:       localLife.LocalID,
 			LocalPlatform: localLife.LocalPlatform,
 			LocalStatus:   localLife.TaskStatus,
-			EstimatedCost: localLife.EstimatedCost,
 			LocalForm:     localLife.TaskForm,
 			ContentType:   localLife.ContentType,
 			NeedReview:    localLife.NeedReview,
@@ -140,6 +139,11 @@ func (d LocalLifeDao) GetLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReLocal
 			TeamBuyingId:  localLife.TeamBuyingId,
 			Tools:         localLife.Tools,
 		}
+		if localLife.TaskStatus < 6 {
+			reLocalTaskPreview.EstimatedCost = localLife.EstimatedCost
+		} else {
+			reLocalTaskPreview.EstimatedCost = localLife.NeedPay
+		}
 		reLocalTaskPreviews = append(reLocalTaskPreviews, reLocalTaskPreview)
 	}
 
@@ -337,7 +341,7 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
 		query = query.Where("enterprise_id = ? or local_id = ? or local_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, task_form, content_type, store_id, team_buying_id, settlement_amount")
+	query = query.Select("enterprise_id, sub_account_id, local_id, local_platform, task_status, estimated_cost, need_pay, task_form, content_type, store_id, team_buying_id, settlement_amount")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&localLifes).Error; err != nil {
 		return nil, 0, err
@@ -349,13 +353,17 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
 			LocalId:       localLife.LocalID,
 			LocalPlatform: localLife.LocalPlatform,
 			LocalStatus:   localLife.TaskStatus,
-			EstimatedCost: localLife.EstimatedCost,
 			LocalForm:     localLife.TaskForm,
 			ContentType:   localLife.ContentType,
 			StoreId:       localLife.StoreID,
 			TeamBuyingId:  localLife.TeamBuyingId,
 			CashAmount:    localLife.SettlementAmount,
 		}
+		if localLife.TaskStatus < 6 {
+			reBillLocalTaskPreview.EstimatedCost = localLife.EstimatedCost
+		} else {
+			reBillLocalTaskPreview.EstimatedCost = localLife.NeedPay
+		}
 		reBillLocalTaskPreviews = append(reBillLocalTaskPreviews, reBillLocalTaskPreview)
 	}
 

+ 13 - 3
app/dao/project_dao.go

@@ -112,7 +112,7 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 		query = query.Where("enterprise_id = ? or project_id = ? or project_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, need_review, need_quality, need_calculate, before_delivery_num, delivery_num, after_delivery_num, product_id, tools")
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, need_pay, project_form, content_type, need_review, need_quality, need_calculate, before_delivery_num, delivery_num, after_delivery_num, product_id, tools")
 	offset := (param.Page - 1) * param.PageSize
 	if param.Order == 1 {
 		if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
@@ -127,13 +127,13 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 		// 获取种草待筛选达人数
 		projectId := project.ProjectId
 		needFilter := ProjectTaskInfoDao{}.CountByTaskStage(projectId, 1)
+
 		reProjectTaskPreview := vo.ReProjectTaskPreview{
 			EnterpriseId:    project.EnterpriseID,
 			SubAccountId:    project.SubAccountId,
 			ProjectId:       project.ProjectId,
 			ProjectPlatform: project.ProjectPlatform,
 			ProjectStatus:   project.ProjectStatus,
-			EstimatedCost:   project.EstimatedCost,
 			ProjectForm:     project.ProjectForm,
 			ContentType:     project.ContentType,
 			NeedReview:      project.NeedReview,
@@ -146,6 +146,11 @@ func (d ProjectDAO) GetProjectPreviews(param *vo.ProjectSearchParam) ([]vo.RePro
 			Received:        project.AfterDeliveryNum,
 			NeedFilter:      needFilter,
 		}
+		if project.ProjectStatus < 6 {
+			reProjectTaskPreview.EstimatedCost = project.EstimatedCost
+		} else {
+			reProjectTaskPreview.EstimatedCost = project.NeedPay
+		}
 		reProjectTaskPreviews = append(reProjectTaskPreviews, reProjectTaskPreview)
 	}
 
@@ -368,7 +373,7 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 		query = query.Where("enterprise_id = ? or project_id = ? or project_name LIKE ?", param.Others, param.Others, "%"+param.Others+"%")
 	}
 	query.Count(&total)
-	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, project_form, content_type, product_id, settlement_amount")
+	query = query.Select("enterprise_id, sub_account_id, project_id, project_platform, project_status, estimated_cost, need_pay, project_form, content_type, product_id, settlement_amount")
 	offset := (param.Page - 1) * param.PageSize
 	if err := query.Order("created_at asc").Offset(offset).Limit(param.PageSize).Find(&projects).Error; err != nil {
 		return nil, 0, err
@@ -386,6 +391,11 @@ func (d ProjectDAO) GetBillProjectPreviews(param *vo.ProjectSearchParam) ([]vo.R
 			EstimatedCost:   project.EstimatedCost,    // 应付金额
 			CashAmount:      project.SettlementAmount, //实际结算金额
 		}
+		if project.ProjectStatus < 6 {
+			reBillProjectTaskPreview.EstimatedCost = project.EstimatedCost
+		} else {
+			reBillProjectTaskPreview.EstimatedCost = project.NeedPay
+		}
 		reBillProjectTaskPreviews = append(reBillProjectTaskPreviews, reBillProjectTaskPreview)
 	}
 

+ 1 - 0
app/entity/local_life_info.go

@@ -52,6 +52,7 @@ type LocalLifeInfo struct {
 	NeedExplore         int64     `gorm:"column:need_explore;NOT NULL"`                     // 待探店
 	ExploredNum         int64     `gorm:"column:explored_num;default:0;NOT NULL"`           // 已探店
 	InvoiceStatus       int64     `gorm:"column:invoice_status;default:0;NOT NULL"`         // 开票状态(1开票中 2已开票)
+	NeedPay             float64   `gorm:"column:need_pay"`                                  // 待支付金额
 }
 
 func (m *LocalLifeInfo) TableName() string {

+ 1 - 0
app/entity/project.go

@@ -53,6 +53,7 @@ type Project struct {
 	BeforeDeliveryNum int64     `gorm:"column:before_delivery_num"`
 	DeliveryNum       int64     `gorm:"column:delivery_num"`
 	AfterDeliveryNum  int64     `gorm:"column:after_delivery_num"`
+	NeedPay           float64   `gorm:"column:need_pay"` // 待支付金额
 }
 
 func (m *Project) TableName() string {

+ 2 - 2
app/service/bill_service.go

@@ -44,7 +44,7 @@ func (s BillService) PayProject(param *vo.PayParam) error {
 	if projectStatus != 6 {
 		return errors.New("状态异常")
 	}
-	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(projectInfo.EnterpriseID, projectInfo.PaymentAmount)
+	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(projectInfo.EnterpriseID, projectInfo.NeedPay)
 	if err2 != nil {
 		return err2
 	}
@@ -67,7 +67,7 @@ func (s BillService) PayLocalLife(param *vo.PayParam) error {
 	if localStatus != 6 {
 		return errors.New("状态异常")
 	}
-	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(localInfo.EnterpriseID, localInfo.PaymentAmount)
+	_, err2 := dao.EnterpriseDao{}.UpdateEnterpriseBalanceAndFrozen(localInfo.EnterpriseID, localInfo.NeedPay)
 	if err2 != nil {
 		return err2
 	}

+ 34 - 11
app/service/local_life_service.go

@@ -493,7 +493,11 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 	reLocalDetail.LocalStatus = localLife.TaskStatus
 	reLocalDetail.LocalPlatform = localLife.LocalPlatform
 	reLocalDetail.CreatedAt = localLife.CreatedAt.Format("2006-01-02 15:04:05")
-	reLocalDetail.EstimatedCost = localLife.EstimatedCost // 预估成本
+	if localLife.TaskStatus < 6 {
+		reLocalDetail.EstimatedCost = localLife.EstimatedCost
+	} else {
+		reLocalDetail.EstimatedCost = localLife.NeedPay
+	}
 	reLocalDetail.ServiceChargeRate = localLife.ServiceChargeRate
 	var creatorName, phone string
 	if localLife.OperatorType == 1 && localLife.SubAccountID == 0 {
@@ -581,12 +585,12 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
 	reLocalDetail.TaskForm = localLife.TaskForm
 	reLocalDetail.ContentType = localLife.ContentType
 	reLocalDetail.TaskDetail = localLife.TaskDetail
-	taskBriefInfos, err := dao.ProjectBriefDao{}.GetProjectBriefInfo(localId)
+	taskBriefInfos, err := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localId)
 	if err != nil {
 		logrus.Errorf("[localLifeDB service] call GetProjectBriefInfo error,err:%+v", err)
 		return nil, err
 	}
-	taskMaterials, err := dao.ProjectMaterialDao{}.GetProjectMaterialInfo(localId)
+	taskMaterials, err := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localId)
 	if err != nil {
 		logrus.Errorf("[localLifeDB service] call GetprojectMaterialInfo error,err:%+v", err)
 		return nil, err
@@ -622,7 +626,7 @@ func (s LocalLifeService) CopyLocalLife(param *vo.LocalSearchParam) (*string, er
 		EnterpriseID:        param.EnterpriseId,
 		SubAccountID:        param.SubAccountId,
 		OperatorType:        localLifeOrigin.OperatorType,
-		TaskStatus:          localLifeOrigin.TaskStatus,
+		TaskStatus:          1,
 		LocalID:             localIdNew,
 		LocalType:           localLifeOrigin.LocalType,
 		LocalPlatform:       localLifeOrigin.LocalPlatform,
@@ -973,13 +977,32 @@ func (s LocalLifeService) DeleteLocalLife(localId string) (*string, error) {
 }
 
 // 结束本地生活任务
-func (s LocalLifeService) CloseLocalLife(localId string) (*string, error) {
-	err := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
-		LocalID:    localId,
-		TaskStatus: 10,
-		UpdatedAt:  time.Now(),
-	})
-	return &localId, err
+func (s LocalLifeService) CloseLocalLife(localId string) (string, error) {
+	// 任务待办:待审核、待支付、达人未处理、初稿待审、链接待审、待结算  (待发货、待签收)  达人待预约探店时间、探店时间待确认、达人待探店  未传初稿、未发作品、未传数据
+	// 合作待办:可邀约、邀约中、合作中
+	localLife, err := dao.LocalLifeDao{}.GetLocalById(localId)
+	if err != nil {
+		return "0", err
+	}
+	if localLife == nil {
+		return "0", errors.New("任务不存在")
+	}
+	var needProcess int64
+	if localLife.TaskStatus == 4 || localLife.TaskStatus == 8 {
+		// 达人未处理 or 物流待办 or 初稿待审、链接待审、待结算
+		_ = dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? and (task_status = ? or task_stage < ?)", localId, 1, 15).Count(&needProcess).Error // task_status=1待选
+	}
+	if localLife.TaskStatus == 2 || localLife.TaskStatus == 4 || needProcess > 0 {
+		// 存在待办不可结束
+		return "1", nil
+	} else {
+		err := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
+			LocalID:    localId,
+			TaskStatus: 10,
+			UpdatedAt:  time.Now(),
+		})
+		return "0", err
+	}
 }
 
 // 草稿箱——本地生活

+ 33 - 9
app/service/project_service.go

@@ -424,6 +424,7 @@ func (s ProjectService) UpdateProjectTarget(projectUpdateParam *vo.ProjectUpdate
 		ContentType:      projectUpdateParam.ContentType,
 		ProjectDetail:    projectUpdateParam.ProjectDetail,
 		Tools:            projectUpdateParam.Tools,
+		EstimatedCost:    estimatedCost,
 	}
 	//if projectUpdateParam.ProjectStatus == 2 {
 	//	updateProject.SubmitAt = t
@@ -513,7 +514,11 @@ func (s ProjectService) GetProjectDetail(projectId string) (*vo.ReProjectDetail,
 	reProjectDetail.ProjectStatus = project.ProjectStatus
 	reProjectDetail.ProjectPlatform = project.ProjectPlatform
 	reProjectDetail.CreatedAt = project.CreatedAt.Format("2006-01-02 15:04:05")
-	reProjectDetail.EstimatedCost = project.EstimatedCost
+	if project.ProjectStatus < 6 {
+		reProjectDetail.EstimatedCost = project.EstimatedCost
+	} else {
+		reProjectDetail.EstimatedCost = project.NeedPay
+	}
 	reProjectDetail.ServiceChargeRate = project.ServiceChargeRate
 	var creatorName, phone string
 	if project.SubAccountId == 0 {
@@ -617,7 +622,7 @@ func (s ProjectService) CopyProject(param *vo.ProjectSearchParam) (*string, erro
 
 	// 复制任务
 	projectNew := entity.Project{
-		ProjectStatus:     projectOrigin.ProjectStatus,
+		ProjectStatus:     1,
 		ProjectType:       projectOrigin.ProjectType,
 		ProjectId:         projectIdNew,
 		ProductID:         projectOrigin.ProductID,
@@ -936,13 +941,32 @@ func (s ProjectService) DeleteProject(projectId string) (*string, error) {
 }
 
 // 结束种草任务
-func (s ProjectService) CloseProject(projectId string) (*string, error) {
-	err := dao.ProjectDAO{}.UpdateProject(entity.Project{
-		ProjectId:     projectId,
-		ProjectStatus: 10,
-		UpdatedAt:     time.Now(),
-	})
-	return &projectId, err
+func (s ProjectService) CloseProject(projectId string) (string, error) {
+	// 任务待办:待审核、待支付、达人未处理、初稿待审、链接待审、待结算  待发货、待签收  未传初稿、未发作品、未传数据
+	// 合作待办:可邀约、邀约中、合作中
+	project, err := dao.ProjectDAO{}.GetProjectById(projectId)
+	if err != nil {
+		return "0", err
+	}
+	if project == nil {
+		return "0", errors.New("任务不存在")
+	}
+	var needProcess int64
+	if project.ProjectStatus == 4 || project.ProjectStatus == 8 {
+		// 达人未处理 or 物流待办 or 初稿待审、链接待审、待结算
+		_ = dao.Db.Model(&entity.ProjectTaskInfo{}).Where("project_id = ? and (task_status = ? or task_stage < ?)", projectId, 1, 15).Count(&needProcess).Error // task_status=1待选
+	}
+	if project.ProjectStatus == 2 || project.ProjectStatus == 4 || needProcess > 0 {
+		// 存在待办不可结束
+		return "1", nil
+	} else {
+		err := dao.ProjectDAO{}.UpdateProject(entity.Project{
+			ProjectId:     projectId,
+			ProjectStatus: 10,
+			UpdatedAt:     time.Now(),
+		})
+		return "0", err
+	}
 }
 
 // 草稿箱——品牌种草

+ 1 - 1
app/service/recharge_service.go

@@ -302,7 +302,7 @@ func (s RechargeService) FrozenInfoList(param *vo.BalanceParam) (vo.ResultVO, er
 			Platform:      project.ProjectPlatform,
 			CreatorName:   creatorName,
 			TaskType:      "品牌种草",
-			FrozenBalance: project.PaymentAmount,
+			FrozenBalance: project.NeedPay,
 			FrozenTime:    project.PayAt.Format("2006-01-02 15:04:05"),
 			EnterpriseId:  project.EnterpriseID,
 			SubAccountId:  project.SubAccountId,

+ 26 - 8
app/service/selection_info_service.go

@@ -553,7 +553,7 @@ func (s SelectionInfoService) CopySelection(param *vo.SelectionSearchParam) (*st
 
 	// 复制选品
 	selectionNew := entity.SelectionInfo{
-		SelectionStatus:  selectionOrigin.SelectionStatus,
+		SelectionStatus:  1,
 		SelectionID:      selectionIdNew,
 		ProductID:        selectionOrigin.ProductID,
 		ProductCategory:  selectionOrigin.ProductCategory,
@@ -888,13 +888,31 @@ func (s SelectionInfoService) DeleteSelection(selectionId string) (*string, erro
 }
 
 // 结束带货任务
-func (s SelectionInfoService) CloseSelection(selectionId string) (*string, error) {
-	err := dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{
-		SelectionID:     selectionId,
-		SelectionStatus: 8,
-		UpdatedAt:       time.Now(),
-	})
-	return &selectionId, err
+func (s SelectionInfoService) CloseSelection(selectionId string) (string, error) {
+	// 任务待办:待审核、待支付、达人未处理  待发货、待签收  未传初稿、未发作品、未传数据
+	selectionInfo, err := dao.SelectionInfoDAO{}.GetSelectionInfoById(selectionId)
+	if err != nil {
+		return "0", err
+	}
+	if selectionInfo == nil {
+		return "0", errors.New("任务不存在")
+	}
+	var needProcess int64
+	if selectionInfo.SelectionStatus == 6 {
+		// 达人未处理 or 物流待办
+		_ = dao.Db.Model(&entity.SecTaskInfo{}).Where("selection_id = ? and (task_status = ? or logistics_status != ?)", selectionId, 1, 3).Count(&needProcess).Error // task_status=1待选
+	}
+	if selectionInfo.SelectionStatus == 2 || selectionInfo.SelectionStatus == 4 || needProcess > 0 {
+		// 存在待办不可结束
+		return "1", nil
+	} else {
+		err = dao.SelectionInfoDAO{}.UpdateSelectionInfo(entity.SelectionInfo{
+			SelectionID:     selectionId,
+			SelectionStatus: 8,
+			UpdatedAt:       time.Now(),
+		})
+		return "0", err
+	}
 }
 
 // 电商带货选达人角标 未处理、同意合作、拒绝合作

+ 7 - 7
app/vo/re_local_detail.go

@@ -14,7 +14,7 @@ type ReLocalDetail struct {
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
 	WX                string  `json:"wx"`                // 微信
-	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估
+	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估  2025.04.03:支付前是预估一口价+"自报价"字符串  支付后是同意的达人的一口价和自报价即need_pay字段
 	ServiceChargeRate float64 `json:"serviceChargeRate"` // 公开服务费率
 	// 支付方式参数待定
 	// 关联主体
@@ -27,12 +27,12 @@ type ReLocalDetail struct {
 	RecruitDdl       string                  `json:"recruitDdl"`
 	RecruitStrategys []*LocalRecruitStrategy `json:"recruitStrategys"` // 招募策略
 	// 执行要求
-	TaskForm      int64                     `json:"taskForm"`
-	ContentType   int64                     `json:"contentType"`
-	TaskDetail    string                    `json:"taskDetail"`
-	TaskBriefs    []*entity.ProjectBrief    `json:"taskBriefs"`    // 选品brief列表
-	TaskMaterials []*entity.ProjectMaterial `json:"taskMaterials"` // 选品示例列表
-	Tools         string                    `json:"tools"`         // 工具选择
+	TaskForm      int64                       `json:"taskForm"`
+	ContentType   int64                       `json:"contentType"`
+	TaskDetail    string                      `json:"taskDetail"`
+	TaskBriefs    []*entity.LocalLifeBrief    `json:"taskBriefs"`    // 选品brief列表
+	TaskMaterials []*entity.LocalLifeMaterial `json:"taskMaterials"` // 选品示例列表
+	Tools         string                      `json:"tools"`         // 工具选择
 }
 
 type LocalRecruitStrategy struct {

+ 1 - 1
app/vo/re_project_detail.go

@@ -14,7 +14,7 @@ type ReProjectDetail struct {
 	CreatorName       string  `json:"creatorName"`       // 创建者
 	Phone             string  `json:"phone"`             // 联系方式
 	WX                string  `json:"wx"`                // 微信
-	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估
+	EstimatedCost     float64 `json:"estimatedCost"`     // 成本预估  2025.04.03:支付前是预估一口价+"自报价"字符串  支付后是同意的达人的一口价和自报价即need_pay字段
 	ServiceChargeRate float64 `json:"serviceChargeRate"` // 公开服务费率
 	// 支付方式参数待定
 	// 关联商品

+ 5 - 7
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, orderBy []string, orderDesc []int) ([]*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 []string) ([]*http_model.SecTaskInfo, int64, error) {
 	db := GetReadDB(ctx)
 	// var taskStages []int
 	var freeStages []int
@@ -85,7 +85,7 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 	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=降序,其他值=升序
+			isDesc := orderDesc[i] == "desc" // 1=降序,其他值=升序
 
 			switch orderField {
 			case "sale_num":
@@ -124,9 +124,9 @@ func GetSecTaskList(ctx context.Context, selectionId string, taskStatus int, sea
 		return nil, 0, err
 	}
 
-	fmt.Printf("secTaskInfoList:%+v", secTaskInfoList)
+	// fmt.Printf("secTaskInfoList:%+v", secTaskInfoList)
 	newSecTaskInfoList := pack.GormSecTaskListToHttpSecTaskList(secTaskInfoList)
-	fmt.Printf("newSecTaskInfoList:%+v", newSecTaskInfoList)
+	// fmt.Printf("newSecTaskInfoList:%+v", newSecTaskInfoList)
 
 	//for i, secTask := range newSecTaskInfoList {
 	//	if secTask.RegionCode != 0 {
@@ -227,9 +227,7 @@ func PassSecTaskCoop(ctx context.Context, selectionId string, taskIds []string,
 		return false, err
 	}
 	if int64(selection.RemainNum) < count {
-		if int64(len(taskIds)) == 0 || count != int64(len(taskIds)) {
-			return true, errors.New("剩余选品数量不足")
-		}
+		return true, errors.New("剩余样品数量不足")
 	}
 
 	err = db.Transaction(func(tx *gorm.DB) error {

+ 6 - 1
handler/PassSecTaskCoop.go

@@ -37,11 +37,16 @@ func (c PassSecTaskCoop) run() {
 	data = *c.req
 	//auth := middleware.GetSessionAuth(c.ctx)
 	//enterpriseID := auth.EnterpriseID
-	res, err := sectask_service.SelectionTask.PassCoop(c.ctx, data)
+	res, tag, err := sectask_service.SelectionTask.PassCoop(c.ctx, data)
 	if err != nil {
 		logrus.Errorf("[PassSecTaskCoop] call PassSecTaskCoop err:%+v\n", err)
 		util.HandlerPackErrorResp(c.resp, consts.ErrorInternal, "")
 		logrus.Info("PassSecTaskCoop fail,req:%+v", c.req)
+		if tag == 1 {
+			c.resp.Message = err.Error()
+			c.resp.Status = 33000
+			return
+		}
 		c.resp.Message = err.Error()
 		c.resp.Status = 40000
 		return

+ 5 - 3
model/http_model/GetSecTaskList.go

@@ -4,7 +4,7 @@ import "time"
 
 type GetSecTaskListRequest struct {
 	PageSize      int64    `json:"page_size"`
-	PageNum       int64    `json:"page_num"`
+	PageNum       int64    `json:"page"`
 	SelectionId   string   `json:"selection_id"`
 	SecTaskStatus int      `json:"sec_task_status"`
 	SearchValue   string   `json:"search_value"`
@@ -14,8 +14,8 @@ type GetSecTaskListRequest struct {
 	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"`     // 是否降序
+	OrderBy       []string `json:"sort_field"`     // 排序条件
+	OrderDesc     []string `json:"sort_order"`     // 是否降序
 }
 
 type GetSecTaskListData struct {
@@ -66,6 +66,8 @@ type SecTaskInfo struct {
 	ChooseTalentUserId     string    `json:"choose_talent_user_id"`     // 同意/拒绝达人操作人ID
 	ChooseTalentUserType   int       `json:"choose_talent_user_type"`   // 同意/拒绝达人操作人类型,1商家,2子账号
 	ChooseTalentUserName   string    `json:"choose_talent_user_name"`   // 同意/拒绝达人操作人名称
+	TalentOrigin           string    `json:"talent_origin"`             // 达人来源,"公海"
+	SupplierType           int       `json:"supplier_type"`             // 服务商类型,0达人来自公海,1为个人服务商,2为企业服务商
 }
 
 func NewGetSecTaskListRequest() *GetSecTaskListRequest {

+ 2 - 0
pack/sec_task_list.go

@@ -47,6 +47,8 @@ func GormSecTaskToHttpSecTask(secTask *gorm_model.YounggeeSecTaskInfo) *http_mod
 		ChooseTalentUserId:     secTask.ChooseTalentUserId,
 		ChooseTalentUserType:   secTask.ChooseTalentUserType,
 		ChooseTalentUserName:   secTask.ChooseTalentUserId,
+		SupplierType:           0,
+		TalentOrigin:           "公海",
 	}
 }
 

+ 7 - 4
service/sectask_service/sectask.go

@@ -69,16 +69,19 @@ func (*selectionTask) GetList(ctx context.Context, request http_model.GetSecTask
 	return &selectionListData, nil
 }
 
-func (*selectionTask) PassCoop(ctx context.Context, request http_model.PassSecTaskCoopRequest) (*http_model.PassSecTaskCoopData, error) {
-	_, err := db.PassSecTaskCoop(ctx, request.SelectionId, request.TaskIds, request.EnterpriseId, request.SubAccountId)
+func (*selectionTask) PassCoop(ctx context.Context, request http_model.PassSecTaskCoopRequest) (*http_model.PassSecTaskCoopData, int, error) {
+	tag, 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
+		if tag == true {
+			return nil, 1, err
+		}
+		return nil, 2, err
 	}
 
 	selectionListData := http_model.PassSecTaskCoopData{}
 
-	return &selectionListData, nil
+	return &selectionListData, 0, nil
 }
 
 func (*selectionTask) RefuseCoop(ctx context.Context, request http_model.RefuseSecTaskCoopRequest) (*http_model.RefuseSecTaskCoopData, error) {