Ethan 4 месяцев назад
Родитель
Сommit
143526f800

+ 1 - 0
app/controller/task_controller.go

@@ -69,6 +69,7 @@ func (t TaskController) CreateProduct(c *gin.Context) {
 
 // 关联商品-完成关联创建带货任务
 func (t TaskController) CreateSelection(c *gin.Context) {
+	//data := &vo.SelectionInfoCreateParam{}
 	data := &vo.SelectionInfoCreateParam{}
 	err := c.BindJSON(data)
 	if err != nil {

+ 131 - 49
app/service/local_life_service.go

@@ -17,11 +17,11 @@ import (
 type LocalLifeService struct{}
 
 // 创建本地生活任务
-func (s LocalLifeService) CreateLocalLife(param *vo.LocalCreateParam) (*string, error) {
+func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam) (*string, error) {
 	// a) 生成本地生活项目id
 	localId := string(util.GenerateUUID(10))
 	// b) 查找关联门店信息
-	product, err := dao.StoreDao{}.GetStoreByID(param.StoreId)
+	product, err := dao.StoreDao{}.GetStoreByID(localCreateParam.StoreId)
 	if err != nil {
 		return nil, err
 	}
@@ -30,43 +30,126 @@ func (s LocalLifeService) CreateLocalLife(param *vo.LocalCreateParam) (*string,
 	}
 	// c)创建种草任务
 	var operatorType int64
-	if param.SubAccountId == 0 {
+	if localCreateParam.SubAccountId == 0 {
 		operatorType = 1
 	} else {
 		operatorType = 2
 	}
+	// d) 任务截止时间
+	recruitDdl := time.Time{} //赋零值
+	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", localCreateParam.RecruitDdl, time.Local)
 	// 获取定时任务配置id
 	infoAutoTask := entity.InfoAutoTask{}
-	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(localCreateParam.EnterpriseId)
 	infoAutoDefault := entity.InfoAutoDefault{}
-	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
+	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(localCreateParam.EnterpriseId)
 	t := time.Now()
 	newLocalLife := entity.LocalLifeInfo{
-		EnterpriseID:        param.EnterpriseId,
-		SubAccountID:        param.SubAccountId,
+		EnterpriseID:        localCreateParam.EnterpriseId,
+		SubAccountID:        localCreateParam.SubAccountId,
 		OperatorType:        operatorType,
 		TaskStatus:          1,
 		LocalID:             localId,
-		LocalType:           param.LocalType,
-		LocalPlatform:       param.Platform,
-		StoreID:             param.StoreId,
+		LocalType:           localCreateParam.LocalType,
+		LocalPlatform:       localCreateParam.Platform,
+		StoreID:             localCreateParam.StoreId,
 		StoreRelatedAt:      time.Now(),
-		PromoteBody:         param.PromoteBody,
-		Donate:              param.Donate,
-		TeamBuyingId:        param.TeamBuyingId,
+		PromoteBody:         localCreateParam.PromoteBody,
+		Donate:              localCreateParam.Donate,
+		TeamBuyingId:        localCreateParam.TeamBuyingId,
 		TeamBuyingRelatedAt: time.Now(),
 		CreatedAt:           t,
 		AutoTaskID:          infoAutoTask.AutoTaskID,
 		AutoDefaultID:       infoAutoDefault.AutoDefaultID,
+		LocalName:           localCreateParam.LocalName,
+		TalentType:          localCreateParam.TalentType,
+		RecruitDdl:          recruitDdl,
+		TaskForm:            localCreateParam.TaskForm,
+		ContentType:         localCreateParam.ContentType,
+		TaskDetail:          localCreateParam.TaskDetail,
 	}
-	if param.LocalType == 1 {
-		newLocalLife.ServiceChargeRate = param.ServiceChargeRate
+	if localCreateParam.LocalType == 1 {
+		newLocalLife.ServiceChargeRate = localCreateParam.ServiceChargeRate
 	}
 	err = dao.LocalLifeDao{}.CreateLocalLife(newLocalLife)
 	if err != nil {
 		return nil, err
 	}
 
+	// 4. 更新选品brief和示例(本地生活任务补充信息)
+	if localCreateParam.LocalBrief != nil {
+		// 插入新的brief
+		for _, v := range localCreateParam.LocalBrief {
+			brief := entity.LocalLifeBrief{
+				LocalID:   localId,
+				FileUid:   v.FileUid,
+				FileName:  v.Name,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.LocalLifeBriefDao{}.CreateLocalBrief(brief)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	if localCreateParam.LocalMaterial != nil {
+		// 删除已有示例
+		err = dao.LocalLifeMaterialDao{}.DeleteLocalMaterialByLocalId(localId)
+		if err != nil {
+			return nil, err
+		}
+		// 插入新的示例
+		for _, v := range localCreateParam.LocalMaterial {
+			material := entity.LocalLifeMaterial{
+				LocalID:   localId,
+				FileUid:   v.FileUid,
+				FileName:  v.Name,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.LocalLifeMaterialDao{}.CreateLocalMaterial(material)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
+	// 更新公开种草任务的招募策略
+	var totalRecruitNum int64
+	if localCreateParam.RecruitStrategys != nil {
+		// 2. 接收并创建新的招募策略
+		if len(localCreateParam.RecruitStrategys) != 0 {
+			var recruits []entity.RecruitStrategy
+			for _, strategy := range localCreateParam.RecruitStrategys {
+				recruitStrategy := entity.RecruitStrategy{
+					FeeForm:       strategy.FeeForm,
+					StrategyID:    strategy.StrategyID,
+					FollowersLow:  strategy.FollowersLow,
+					FollowersUp:   strategy.FollowersUp,
+					RecruitNumber: strategy.RecruitNumber,
+					ProjectID:     localId,
+					StrategyType:  1,
+					ServiceRate:   localCreateParam.ServiceChargeRate,
+				}
+				totalRecruitNum += strategy.RecruitNumber
+				if strategy.FeeForm == 2 {
+					recruitStrategy.Offer = strategy.Offer
+					recruitStrategy.ServiceCharge = strategy.Offer * localCreateParam.ServiceChargeRate
+					recruitStrategy.TOffer = strategy.Offer * (1 - localCreateParam.ServiceChargeRate)
+				}
+				recruits = append(recruits, recruitStrategy)
+			}
+			err = dao.RecruitStrategyDao{}.CreateRecruitStrategy(recruits)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
 	return &localId, nil
 }
 
@@ -81,7 +164,6 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 	if localLife == nil {
 		return nil, errors.New("本地生活项目不存在")
 	}
-	println("更新公开本地生活任务的招募策略")
 	// 更新公开种草任务的招募策略
 	var totalRecruitNum int64
 	if localUpdateParam.RecruitStrategys != nil {
@@ -130,10 +212,10 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 	// d) 任务截止时间
 	recruitDdl := time.Time{} //赋零值
 	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", localUpdateParam.RecruitDdl, time.Local)
-	// f) 更新选品状态
-	if localUpdateParam.LocalStatus != 2 && localUpdateParam.LocalStatus != 8 {
-		localUpdateParam.LocalStatus = 1
-	}
+	//// f) 更新选品状态
+	//if localUpdateParam.LocalStatus != 2 && localUpdateParam.LocalStatus != 8 {
+	//	localUpdateParam.LocalStatus = 1
+	//}
 	t := time.Now()
 	updateLocalLife := entity.LocalLifeInfo{
 		StoreID:           localUpdateParam.StoreId,
@@ -141,18 +223,18 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
 		ServiceChargeRate: localUpdateParam.ServiceChargeRate,
 		PromoteBody:       localUpdateParam.PromoteBody,
 		Donate:            localUpdateParam.Donate,
-		TaskStatus:        localUpdateParam.LocalStatus,
-		LocalName:         localUpdateParam.LocalName,
-		TalentType:        localUpdateParam.TalentType,
-		RecruitDdl:        recruitDdl,
-		TaskForm:          localUpdateParam.TaskForm,
-		ContentType:       localUpdateParam.ContentType,
-		TaskDetail:        localUpdateParam.TaskDetail,
-		UpdatedAt:         t,
-	}
-	if localUpdateParam.LocalStatus == 2 {
-		updateLocalLife.SubmitAt = t
-	}
+		//TaskStatus:        localUpdateParam.LocalStatus,
+		LocalName:   localUpdateParam.LocalName,
+		TalentType:  localUpdateParam.TalentType,
+		RecruitDdl:  recruitDdl,
+		TaskForm:    localUpdateParam.TaskForm,
+		ContentType: localUpdateParam.ContentType,
+		TaskDetail:  localUpdateParam.TaskDetail,
+		UpdatedAt:   t,
+	}
+	//if localUpdateParam.LocalStatus == 2 {
+	//	updateLocalLife.SubmitAt = t
+	//}
 	// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
 	result := util.MergeStructValue(&updateLocalLife, localLife)
 	// 利用反射机制将interface类型转换为结构体类型
@@ -283,10 +365,10 @@ func (s LocalLifeService) UpdateLocalTarget(localUpdateParam *vo.LocalUpdatePara
 	// d) 任务截止时间
 	recruitDdl := time.Time{} //赋零值
 	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", localUpdateParam.RecruitDdl, time.Local)
-	// f) 更新选品状态
-	if localUpdateParam.LocalStatus != 2 && localUpdateParam.LocalStatus != 8 {
-		localUpdateParam.LocalStatus = 1
-	}
+	//// f) 更新选品状态
+	//if localUpdateParam.LocalStatus != 2 && localUpdateParam.LocalStatus != 8 {
+	//	localUpdateParam.LocalStatus = 1
+	//}
 	t := time.Now()
 	updateLocalLife := entity.LocalLifeInfo{
 		StoreID:           localUpdateParam.StoreId,
@@ -294,19 +376,19 @@ func (s LocalLifeService) UpdateLocalTarget(localUpdateParam *vo.LocalUpdatePara
 		ServiceChargeRate: localUpdateParam.ServiceChargeRate,
 		PromoteBody:       localUpdateParam.PromoteBody,
 		Donate:            localUpdateParam.Donate,
-		TaskStatus:        localUpdateParam.LocalStatus,
-		LocalName:         localUpdateParam.LocalName,
-		TalentType:        localUpdateParam.TalentType,
-		RecruitDdl:        recruitDdl,
-		TaskForm:          localUpdateParam.TaskForm,
-		ContentType:       localUpdateParam.ContentType,
-		TaskDetail:        localUpdateParam.TaskDetail,
-		UpdatedAt:         t,
-		Tools:             localUpdateParam.Tools,
-	}
-	if localUpdateParam.LocalStatus == 2 {
-		updateLocalLife.SubmitAt = t
-	}
+		//TaskStatus:        localUpdateParam.LocalStatus,
+		LocalName:   localUpdateParam.LocalName,
+		TalentType:  localUpdateParam.TalentType,
+		RecruitDdl:  recruitDdl,
+		TaskForm:    localUpdateParam.TaskForm,
+		ContentType: localUpdateParam.ContentType,
+		TaskDetail:  localUpdateParam.TaskDetail,
+		UpdatedAt:   t,
+		Tools:       localUpdateParam.Tools,
+	}
+	//if localUpdateParam.LocalStatus == 2 {
+	//	updateLocalLife.SubmitAt = t
+	//}
 	// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
 	result := util.MergeStructValue(&updateLocalLife, localLife)
 	// 利用反射机制将interface类型转换为结构体类型

+ 117 - 41
app/service/project_service.go

@@ -17,58 +17,135 @@ import (
 type ProjectService struct{}
 
 // 创建种草任务
-func (s ProjectService) CreateProject(param *vo.ProjectCreateParam) (*string, error) {
+func (s ProjectService) CreateProject(projectCreateParam *vo.ProjectCreateParam) (*string, error) {
 	// a) 生成种草项目id
-	projectId := util.GetProjectID()
+	projectId := string(util.GenerateUUID(10))
 	// b) 查找关联商品信息
-	product, err := dao.ProductDAO{}.GetProductByID(param.ProductId)
+	product, err := dao.ProductDAO{}.GetProductByID(projectCreateParam.ProductId)
 	if err != nil {
 		return nil, err
 	}
 	if product == nil {
 		return nil, errors.New("未找到关联商品")
 	}
-	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(param.ProductId)
+	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(projectCreateParam.ProductId)
 	productInfoToJson, _ := json.Marshal(product)
 	productPhotosToJson, _ := json.Marshal(productPhotos)
+	// d) 任务截止时间
+	recruitDdl := time.Time{} //赋零值
+	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectCreateParam.RecruitDdl, time.Local)
 	// d)创建种草任务
 	var operatorType int64
-	if param.SubAccountId == 0 {
+	if projectCreateParam.SubAccountId == 0 {
 		operatorType = 1
 	} else {
 		operatorType = 2
 	}
+
 	// 获取定时任务配置id
 	infoAutoTask := entity.InfoAutoTask{}
-	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(projectCreateParam.EnterpriseId)
 	infoAutoDefault := entity.InfoAutoDefault{}
-	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
+	infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(projectCreateParam.EnterpriseId)
 	t := time.Now()
 	newProject := entity.Project{
-		ProjectStatus:     1,
-		ProjectType:       param.ProjectType,
-		ProjectId:         projectId,
-		ProductID:         param.ProductId,
-		ProductCategory:   product.ProductCategory,
-		EnterpriseID:      param.EnterpriseId,
-		SubAccountId:      param.SubAccountId,
-		ProjectPlatform:   param.Platform,
-		OperatorType:      operatorType,
-		ProductSnap:       string(productInfoToJson),
-		ProductPhotoSnap:  string(productPhotosToJson),
-		CreatedAt:         t,
-		AutoTaskID:        infoAutoTask.AutoTaskID,
-		AutoDefaultID:     infoAutoDefault.AutoDefaultID,
-		ServiceChargeRate: param.ServiceChargeRate,
+		ProjectStatus:    1,
+		ProjectType:      projectCreateParam.ProjectType,
+		ProjectId:        projectId,
+		ProductID:        projectCreateParam.ProductId,
+		ProductCategory:  product.ProductCategory,
+		EnterpriseID:     projectCreateParam.EnterpriseId,
+		SubAccountId:     projectCreateParam.SubAccountId,
+		ProjectPlatform:  projectCreateParam.Platform,
+		OperatorType:     operatorType,
+		ProductSnap:      string(productInfoToJson),
+		ProductPhotoSnap: string(productPhotosToJson),
+		CreatedAt:        t,
+		AutoTaskID:       infoAutoTask.AutoTaskID,
+		AutoDefaultID:    infoAutoDefault.AutoDefaultID,
+		ProjectName:      projectCreateParam.ProjectName,
+		TalentType:       projectCreateParam.TalentType,
+		RecruitDdl:       recruitDdl,
+		ProjectForm:      projectCreateParam.ProjectForm,
+		ContentType:      projectCreateParam.ContentType,
+		ProjectDetail:    projectCreateParam.ProjectDetail,
+		Tools:            projectCreateParam.Tools,
 	}
-	if param.ProjectType == 1 {
-		newProject.ServiceChargeRate = param.ServiceChargeRate
+	if projectCreateParam.ProjectType == 1 {
+		newProject.ServiceChargeRate = projectCreateParam.ServiceChargeRate
 	}
 	err = dao.ProjectDAO{}.CreateProject(newProject)
 	if err != nil {
 		return nil, err
 	}
 
+	// 4. 更新选品brief和示例(种草任务补充信息)
+	if projectCreateParam.ProjectBrief != nil {
+		// 插入新的brief
+		for _, v := range projectCreateParam.ProjectBrief {
+			brief := entity.ProjectBrief{
+				ProjectID: projectId,
+				FileUid:   v.FileUid,
+				FileName:  v.Name,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.ProjectBriefDao{}.CreateProjectBrief(brief)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	if projectCreateParam.ProjectMaterial != nil {
+		// 插入新的示例
+		for _, v := range projectCreateParam.ProjectMaterial {
+			projectMaterial := entity.ProjectMaterial{
+				ProjectID: projectId,
+				FileUid:   v.FileUid,
+				FileName:  v.Name,
+				FileUrl:   v.FileUrl,
+				CreatedAt: time.Now(),
+				Type:      v.Type,
+			}
+			err = dao.ProjectMaterialDao{}.CreateProjectMaterial(projectMaterial)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	// 更新公开种草任务的招募策略
+	var totalRecruitNum int64
+	if projectCreateParam.RecruitStrategys != nil {
+		// 2. 接收并创建新的招募策略
+		if len(projectCreateParam.RecruitStrategys) != 0 {
+			var recruits []entity.RecruitStrategy
+			for _, strategy := range projectCreateParam.RecruitStrategys {
+				recruitStrategy := entity.RecruitStrategy{
+					FeeForm:       strategy.FeeForm,
+					StrategyID:    strategy.StrategyID,
+					FollowersLow:  strategy.FollowersLow,
+					FollowersUp:   strategy.FollowersUp,
+					RecruitNumber: strategy.RecruitNumber,
+					ProjectID:     projectId,
+					StrategyType:  1,
+					ServiceRate:   projectCreateParam.ServiceChargeRate,
+				}
+				totalRecruitNum += strategy.RecruitNumber
+				if strategy.FeeForm == 2 {
+					recruitStrategy.Offer = strategy.Offer
+					recruitStrategy.ServiceCharge = strategy.Offer * projectCreateParam.ServiceChargeRate
+					recruitStrategy.TOffer = strategy.Offer * (1 - projectCreateParam.ServiceChargeRate)
+				}
+				recruits = append(recruits, recruitStrategy)
+			}
+			err = dao.RecruitStrategyDao{}.CreateRecruitStrategy(recruits)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
 	return &projectId, nil
 }
 
@@ -83,7 +160,6 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 	if project == nil {
 		return nil, errors.New("种草项目不存在")
 	}
-	println("更新公开种草任务的招募策略")
 	// 更新公开种草任务的招募策略
 	var totalRecruitNum int64
 	if projectUpdateParam.RecruitStrategys != nil {
@@ -132,13 +208,13 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 	// d) 任务截止时间
 	recruitDdl := time.Time{} //赋零值
 	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectUpdateParam.RecruitDdl, time.Local)
-	// f) 更新选品状态
-	if projectUpdateParam.ProjectStatus != 2 && projectUpdateParam.ProjectStatus != 8 {
-		projectUpdateParam.ProjectStatus = 1
-	}
+	//// f) 更新选品状态
+	//if projectUpdateParam.ProjectStatus != 2 && projectUpdateParam.ProjectStatus != 8 {
+	//	projectUpdateParam.ProjectStatus = 1
+	//}
 	t := time.Now()
 	updateProject := entity.Project{
-		ProjectStatus:     projectUpdateParam.ProjectStatus,
+		//ProjectStatus:     projectUpdateParam.ProjectStatus,
 		ServiceChargeRate: projectUpdateParam.ServiceChargeRate,
 		ProjectName:       projectUpdateParam.ProjectName,
 		ProductID:         projectUpdateParam.ProductId,
@@ -151,9 +227,9 @@ func (s ProjectService) UpdateProject(projectUpdateParam *vo.ProjectUpdateParam)
 		ContentType:       projectUpdateParam.ContentType,
 		ProjectDetail:     projectUpdateParam.ProjectDetail,
 	}
-	if projectUpdateParam.ProjectStatus == 2 {
-		updateProject.SubmitAt = t
-	}
+	//if projectUpdateParam.ProjectStatus == 2 {
+	//	updateProject.SubmitAt = t
+	//}
 	// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
 	result := util.MergeStructValue(&updateProject, project)
 	// 利用反射机制将interface类型转换为结构体类型
@@ -284,13 +360,13 @@ func (s ProjectService) UpdateProjectTarget(projectUpdateParam *vo.ProjectUpdate
 	// d) 任务截止时间
 	recruitDdl := time.Time{} //赋零值
 	recruitDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", projectUpdateParam.RecruitDdl, time.Local)
-	// f) 更新选品状态
-	if projectUpdateParam.ProjectStatus != 2 && projectUpdateParam.ProjectStatus != 8 {
-		projectUpdateParam.ProjectStatus = 1
-	}
+	//// f) 更新选品状态
+	//if projectUpdateParam.ProjectStatus != 2 && projectUpdateParam.ProjectStatus != 8 {
+	//	projectUpdateParam.ProjectStatus = 1
+	//}
 	t := time.Now()
 	updateProject := entity.Project{
-		ProjectStatus:    projectUpdateParam.ProjectStatus,
+		//ProjectStatus:    projectUpdateParam.ProjectStatus,
 		ProjectName:      projectUpdateParam.ProjectName,
 		ProductID:        projectUpdateParam.ProductId,
 		TalentType:       projectUpdateParam.TalentType,
@@ -304,9 +380,9 @@ func (s ProjectService) UpdateProjectTarget(projectUpdateParam *vo.ProjectUpdate
 		ProjectDetail:    projectUpdateParam.ProjectDetail,
 		Tools:            projectUpdateParam.Tools,
 	}
-	if projectUpdateParam.ProjectStatus == 2 {
-		updateProject.SubmitAt = t
-	}
+	//if projectUpdateParam.ProjectStatus == 2 {
+	//	updateProject.SubmitAt = t
+	//}
 	// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
 	result := util.MergeStructValue(&updateProject, project)
 	// 利用反射机制将interface类型转换为结构体类型

+ 146 - 44
app/service/selection_info_service.go

@@ -53,39 +53,58 @@ type SelectionInfoService struct{}
 //}
 
 // 创建带货任务
-func (s SelectionInfoService) CreateSelectionInfo(param *vo.SelectionInfoCreateParam) (*string, error) {
-	// a) 生成选品id
-	selectionId := util.GetSelectionID()
-	// b) 查找关联商品信息
-	product, err := dao.ProductDAO{}.GetProductByID(param.ProductId)
+func (s SelectionInfoService) CreateSelectionInfo(selectionCreateParam *vo.SelectionInfoCreateParam) (*string, error) {
+	// 1. 生成选品id
+	selectionId := string(util.GenerateUUID(10))
+	// 2. 数据准备
+	// 查找关联商品信息
+	product, err := dao.ProductDAO{}.GetProductByID(selectionCreateParam.ProductId)
 	if err != nil {
 		return nil, err
 	}
 	if product == nil {
 		return nil, errors.New("未找到关联商品")
 	}
-	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(param.ProductId)
+	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(selectionCreateParam.ProductId)
 	productInfoToJson, _ := json.Marshal(product)
 	productPhotosToJson, _ := json.Marshal(productPhotos)
-	// c) 选品名称
-	//selectionName := product.ProductName
-	// d)创建选品
+	// 任务截止时间
+	taskDdl := time.Time{} //赋零值
+	taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", selectionCreateParam.TaskDdl, time.Local)
+
+	// 创建选品
 	// 获取定时任务配置
 	infoAutoTask := entity.InfoAutoTask{}
-	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
+	infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(selectionCreateParam.EnterpriseId)
 	t := time.Now()
+	var sampleMode, taskMode int64
+	if len(selectionCreateParam.FreeStrategys) > 0 {
+		sampleMode = 1
+	} else {
+		sampleMode = 3
+	}
+	if len(selectionCreateParam.RewardStrategys) > 0 {
+		taskMode = 1
+	} else {
+		taskMode = 2
+	}
+
 	newSelection := entity.SelectionInfo{
 		SelectionStatus:  1,
 		SelectionID:      selectionId,
-		ProductID:        param.ProductId,
+		ProductID:        selectionCreateParam.ProductId,
 		ProductCategory:  product.ProductCategory,
-		EnterpriseID:     param.EnterpriseId,
-		SubAccountId:     param.SubAccountId,
-		Platform:         param.Platform,
+		EnterpriseID:     selectionCreateParam.EnterpriseId,
+		SubAccountId:     selectionCreateParam.SubAccountId,
+		Platform:         selectionCreateParam.Platform,
 		ProductSnap:      string(productInfoToJson),
 		ProductPhotoSnap: string(productPhotosToJson),
+		SelectionName:    selectionCreateParam.SelectionName,
+		TaskDdl:          taskDdl,
+		SampleNum:        selectionCreateParam.SampleNum,
+		SampleMode:       sampleMode,
+		TaskMode:         taskMode,
 		CreatedAt:        t,
-		UpdatedAt:        t,
 		AutoTaskID:       infoAutoTask.AutoTaskID,
 	}
 	err = dao.SelectionInfoDAO{}.CreateSelectionInfo(newSelection)
@@ -93,6 +112,86 @@ func (s SelectionInfoService) CreateSelectionInfo(param *vo.SelectionInfoCreateP
 		return nil, err
 	}
 
+	// 4. 更新选品brief和示例(带货任务补充信息)
+	if selectionCreateParam.SecBrief != nil {
+		// 插入新的brief
+		for _, v := range selectionCreateParam.SecBrief {
+			brief := entity.SecBrief{
+				SelectionID: selectionId,
+				FileUid:     v.FileUid,
+				FileName:    v.Name,
+				FileUrl:     v.FileUrl,
+				CreatedAt:   time.Now(),
+				Type:        v.Type,
+			}
+			err = dao.SecBriefDao{}.CreateSecBrief(brief)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	if selectionCreateParam.SecMaterial != nil {
+		// 插入新的示例
+		for _, v := range selectionCreateParam.SecMaterial {
+			secMaterial := entity.SecMaterial{
+				SelectionID: selectionId,
+				FileUid:     v.FileUid,
+				FileName:    v.Name,
+				FileUrl:     v.FileUrl,
+				CreatedAt:   time.Now(),
+				Type:        v.Type,
+			}
+			err = dao.SecMaterialDao{}.CreateSecMaterial(secMaterial)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	// 更新带货任务的免费领样策略
+	if selectionCreateParam.FreeStrategys != nil {
+		// 2. 接收并创建新的免费领样策略
+		if sampleMode == 1 {
+			var frees []entity.FreeStrategy
+			for _, v := range selectionCreateParam.FreeStrategys {
+				free := entity.FreeStrategy{
+					SelectionId:    selectionId,
+					StrategyId:     v.StrategyId,
+					FollowersLow:   v.FollowersLow,
+					FollowersUp:    v.FollowersUp,
+					SaleNum:        v.SaleNum,
+					StrategyStatus: 1,
+					EnrollNum:      0,
+					ChooseNum:      0,
+				}
+				frees = append(frees, free)
+			}
+			err = dao.FreeStrategyDao{}.CreateFreeStrategy(frees)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+	// 更新带货任务的悬赏策略
+	if selectionCreateParam.RewardStrategys != nil {
+		if taskMode == 1 {
+			var rewards []entity.RewardStrategy
+			for _, v := range selectionCreateParam.RewardStrategys {
+				reward := entity.RewardStrategy{
+					SelectionId:    selectionId,
+					Reward:         v.Reward,
+					SaleActual:     v.SaleActual,
+					PerReward:      v.PerReward,
+					StrategyStatus: 1,
+				}
+				rewards = append(rewards, reward)
+			}
+			err = dao.RewardStrategyDao{}.CreateRewardStrategy(rewards)
+			if err != nil {
+				return nil, err
+			}
+		}
+	}
+
 	return &selectionId, nil
 }
 
@@ -113,16 +212,19 @@ func (s SelectionInfoService) UpdateSelectionInfo(selectionUpdateParam *vo.Selec
 	if err != nil {
 		return nil, err
 	}
+	if product == nil {
+		return nil, errors.New("未找到关联商品")
+	}
 	productPhotos, err := dao.ProductPhotoDAO{}.GetProductPhotoByProductID(selectionInfo.ProductID)
 	productInfoToJson, _ := json.Marshal(product)
 	productPhotosToJson, _ := json.Marshal(productPhotos)
 	// d) 任务截止时间
 	taskDdl := time.Time{} //赋零值
 	taskDdl, _ = time.ParseInLocation("2006-01-02 15:04:05", selectionUpdateParam.TaskDdl, time.Local)
-	// f) 更新选品状态
-	if selectionUpdateParam.SelectionStatus != 2 && selectionUpdateParam.SelectionStatus != 7 {
-		selectionUpdateParam.SelectionStatus = 1
-	}
+	//// f) 更新选品状态
+	//if selectionUpdateParam.SelectionStatus != 2 && selectionUpdateParam.SelectionStatus != 7 {
+	//	selectionUpdateParam.SelectionStatus = 1
+	//}
 	t := time.Now()
 	var sampleMode, taskMode int64
 	if len(selectionUpdateParam.FreeStrategys) > 0 {
@@ -136,36 +238,36 @@ func (s SelectionInfoService) UpdateSelectionInfo(selectionUpdateParam *vo.Selec
 		taskMode = 2
 	}
 	updateSelection := entity.SelectionInfo{
-		SelectionID:      selectionUpdateParam.SelectionID,
-		SelectionStatus:  selectionUpdateParam.SelectionStatus,
-		SelectionName:    selectionUpdateParam.SelectionName,
-		EnterpriseID:     selectionUpdateParam.EnterpriseId,
-		SubAccountId:     selectionUpdateParam.SubAccountId,
-		ProductID:        selectionUpdateParam.ProductId,
-		ProductUrl:       selectionUpdateParam.ProductUrl,
-		TaskMode:         taskMode,
-		SampleMode:       sampleMode,
-		SampleNum:        selectionUpdateParam.SampleNum,
-		RemainNum:        selectionUpdateParam.SampleNum,
-		CommissionRate:   selectionUpdateParam.CommissionRate,
-		TaskReward:       selectionUpdateParam.TaskReward,
-		SettlementAmount: selectionUpdateParam.SettlementAmount,
-		EstimatedCost:    selectionInfo.EstimatedCost,
-		SampleCondition:  selectionUpdateParam.SampleCondition,
-		RewardCondition:  selectionUpdateParam.RewardCondition,
-		TaskDdl:          taskDdl,
-		Detail:           selectionUpdateParam.Detail,
+		SelectionID: selectionUpdateParam.SelectionID,
+		//SelectionStatus:  selectionUpdateParam.SelectionStatus,
+		SelectionName: selectionUpdateParam.SelectionName,
+		EnterpriseID:  selectionUpdateParam.EnterpriseId,
+		SubAccountId:  selectionUpdateParam.SubAccountId,
+		ProductID:     selectionUpdateParam.ProductId,
+		//ProductUrl:       selectionUpdateParam.ProductUrl,
+		TaskMode:   taskMode,
+		SampleMode: sampleMode,
+		SampleNum:  selectionUpdateParam.SampleNum,
+		RemainNum:  selectionUpdateParam.SampleNum,
+		//CommissionRate:   selectionUpdateParam.CommissionRate,
+		//TaskReward:       selectionUpdateParam.TaskReward,
+		//SettlementAmount: selectionUpdateParam.SettlementAmount,
+		EstimatedCost: selectionInfo.EstimatedCost,
+		//SampleCondition:  selectionUpdateParam.SampleCondition,
+		//RewardCondition:  selectionUpdateParam.RewardCondition,
+		TaskDdl: taskDdl,
+		//Detail:           selectionUpdateParam.Detail,
 		ProductSnap:      string(productInfoToJson),
 		ProductPhotoSnap: string(productPhotosToJson),
 		CreatedAt:        selectionInfo.CreatedAt,
 		UpdatedAt:        t,
 	}
-	if selectionUpdateParam.SelectionStatus == 2 {
-		updateSelection.SubmitAt = t
-	}
-	if selectionUpdateParam.Status == 1 {
-		updateSelection.Status = 1
-	}
+	//if selectionUpdateParam.SelectionStatus == 2 {
+	//	updateSelection.SubmitAt = t
+	//}
+	//if selectionUpdateParam.Status == 1 {
+	//	updateSelection.Status = 1
+	//}
 	// 合并传入参数和数据表中原记录,若传入参数字段值为空,则将字段赋值为原记录中值
 	result := util.MergeStructValue(&updateSelection, selectionInfo)
 	// 利用反射机制将interface类型转换为结构体类型

+ 37 - 0
app/vo/local_create_param.go

@@ -10,4 +10,41 @@ type LocalCreateParam struct {
 	PromoteBody       int64   `json:"promote_body"`   // 推广主体(1门店 2团购)
 	Donate            int64   `json:"donate"`         // 赠送达人套餐(1有赠送 2无赠送)
 	TeamBuyingId      int64   `json:"team_buying_id"` // 团购id
+
+	LocalName        string                       `json:"local_name"`        // 项目名称(任务标题)
+	TalentType       string                       `json:"talent_type"`       // 达人类型(,分隔)
+	RecruitDdl       string                       `json:"recruit_ddl"`       // 招募截止时间
+	RecruitStrategys []CreateLocalRecruitStrategy `json:"recruit_strategys"` // 招募策略
+
+	TaskForm      int64                `json:"task_form"`    // 项目形式,1-2分别代表线下探店,素材分发
+	ContentType   int64                `json:"content_type"` // 内容形式,1代表图文,2代表视频
+	TaskDetail    string               `json:"task_detail"`  // 项目详情
+	Tools         string               `json:"tools"`        // 工具选择 1邀约招募 2结算账单 3样品物流 4审稿工具 5作品审查 6数据巡检(,分隔)
+	LocalBrief    []*LocalBriefInfo    `json:"local_brief"`
+	LocalMaterial []*LocalMaterialInfo `json:"local_material"`
+}
+
+type LocalBriefInfo struct {
+	FileUrl string `json:"file_url"`
+	FileUid string `json:"file_uid"`
+	Name    string `json:"name"`
+	Type    int64  `json:"type"` // 手卡类型(1图片 2文档)
+}
+
+type LocalMaterialInfo struct {
+	FileUrl string `json:"file_url"`
+	FileUid string `json:"file_uid"`
+	Name    string `json:"name"`
+	Type    int64  `json:"type"` // 素材类型(1图片 2视频)
+}
+
+// 招募策略
+type CreateLocalRecruitStrategy struct {
+	StrategyID    int64   `json:"strategy_id"`    // 策略id
+	FeeForm       int64   `json:"fee_form"`       // 稿费形式,1-3分别代表无费置换、一口价、自报价
+	FollowersLow  int64   `json:"followers_low"`  // 达人粉丝数下限
+	FollowersUp   int64   `json:"followers_up"`   // 达人粉丝数上限
+	RecruitNumber int64   `json:"recruit_number"` // 招募数量
+	Offer         float64 `json:"offer"`          // 报价
+	ServiceCharge float64 `json:"service_charge"` // 服务费
 }

+ 2 - 27
app/vo/local_update_param.go

@@ -9,8 +9,8 @@ type LocalUpdateParam struct {
 	ServiceChargeRate float64 `json:"service_charge_rate"`
 	PromoteBody       int64   `json:"promote_body"` // 推广主体(1门店 2团购)
 	//LocalType         int64                        `json:"local_type"`        // 项目类型,1代表全流程项目,2代表专项项目
-	Donate           int64                        `json:"donate"`            // 赠送达人套餐(1有赠送 2无赠送)
-	LocalStatus      int64                        `json:"local_status"`      // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	Donate int64 `json:"donate"` // 赠送达人套餐(1有赠送 2无赠送)
+	//LocalStatus      int64                        `json:"local_status"`      // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
 	LocalName        string                       `json:"local_name"`        // 项目名称(任务标题)
 	TalentType       string                       `json:"talent_type"`       // 达人类型(,分隔)
 	RecruitDdl       string                       `json:"recruit_ddl"`       // 招募截止时间
@@ -23,28 +23,3 @@ type LocalUpdateParam struct {
 	LocalBrief    []*LocalBriefInfo    `json:"local_brief"`
 	LocalMaterial []*LocalMaterialInfo `json:"local_material"`
 }
-
-type LocalBriefInfo struct {
-	FileUrl string `json:"file_url"`
-	FileUid string `json:"file_uid"`
-	Name    string `json:"name"`
-	Type    int64  `json:"type"` // 手卡类型(1图片 2文档)
-}
-
-type LocalMaterialInfo struct {
-	FileUrl string `json:"file_url"`
-	FileUid string `json:"file_uid"`
-	Name    string `json:"name"`
-	Type    int64  `json:"type"` // 素材类型(1图片 2视频)
-}
-
-// 招募策略
-type CreateLocalRecruitStrategy struct {
-	StrategyID    int64   `json:"strategy_id"`    // 策略id
-	FeeForm       int64   `json:"fee_form"`       // 稿费形式,1-3分别代表无费置换、一口价、自报价
-	FollowersLow  int64   `json:"followers_low"`  // 达人粉丝数下限
-	FollowersUp   int64   `json:"followers_up"`   // 达人粉丝数上限
-	RecruitNumber int64   `json:"recruit_number"` // 招募数量
-	Offer         float64 `json:"offer"`          // 报价
-	ServiceCharge float64 `json:"service_charge"` // 服务费
-}

+ 43 - 6
app/vo/project_create_param.go

@@ -1,10 +1,47 @@
 package vo
 
 type ProjectCreateParam struct {
-	EnterpriseId      string  `json:"enterprise_id"`
-	SubAccountId      int64   `json:"sub_account_id"`
-	Platform          int64   `json:"platform"`
-	ProductId         int64   `json:"product_id"`
-	ServiceChargeRate float64 `json:"service_charge_rate"`
-	ProjectType       int64   `json:"project_type"` // 项目类型,1代表全流程项目,2代表专项项目
+	EnterpriseId      string                  `json:"enterprise_id"`
+	SubAccountId      int64                   `json:"sub_account_id"`
+	Platform          int64                   `json:"platform"`
+	ProductId         int64                   `json:"product_id"`
+	ServiceChargeRate float64                 `json:"service_charge_rate"`
+	ProjectType       int64                   `json:"project_type"`      // 项目类型,1代表全流程项目,2代表专项项目
+	ProjectStatus     int64                   `json:"project_status"`    // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	ProjectName       string                  `json:"task_name"`         // 项目名称(任务标题)
+	TalentType        string                  `json:"talent_type"`       // 达人类型
+	RecruitDdl        string                  `json:"recruit_ddl"`       // 招募截止时间
+	RecruitStrategys  []CreateRecruitStrategy `json:"recruit_strategys"` // 招募策略
+
+	ProjectForm     int64                  `json:"project_form"`   // 项目形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评
+	ContentType     int64                  `json:"content_type"`   // 内容形式,1代表图文,2代表视频
+	ProjectDetail   string                 `json:"project_detail"` // 项目详情
+	Tools           string                 `json:"tools"`          // 工具选择 1邀约招募 2结算账单 3样品物流 4审稿工具 5作品审查 6数据巡检(,分隔)
+	ProjectBrief    []*ProjectBriefInfo    `json:"project_brief"`
+	ProjectMaterial []*ProjectMaterialInfo `json:"project_material"`
+}
+
+type ProjectBriefInfo struct {
+	FileUrl string `json:"file_url"`
+	FileUid string `json:"file_uid"`
+	Name    string `json:"name"`
+	Type    int64  `json:"type"` // 手卡类型(1图片 2文档)
+}
+
+type ProjectMaterialInfo struct {
+	FileUrl string `json:"file_url"`
+	FileUid string `json:"file_uid"`
+	Name    string `json:"name"`
+	Type    int64  `json:"type"` // 素材类型(1图片 2视频)
+}
+
+// 招募策略
+type CreateRecruitStrategy struct {
+	StrategyID    int64   `json:"strategy_id"`    // 策略id
+	FeeForm       int64   `json:"fee_form"`       // 稿费形式,1-3分别代表无费置换、一口价、自报价
+	FollowersLow  int64   `json:"followers_low"`  // 达人粉丝数下限
+	FollowersUp   int64   `json:"followers_up"`   // 达人粉丝数上限
+	RecruitNumber int64   `json:"recruit_number"` // 招募数量
+	Offer         float64 `json:"offer"`          // 报价
+	ServiceCharge float64 `json:"service_charge"` // 服务费
 }

+ 11 - 36
app/vo/project_update_param.go

@@ -1,17 +1,17 @@
 package vo
 
 type ProjectUpdateParam struct {
-	EnterpriseId      string                  `json:"enterprise_id"`
-	SubAccountId      int64                   `json:"sub_account_id"`
-	ProjectID         string                  `json:"project_id"`
-	ProductId         int64                   `json:"product_id"`
-	ServiceChargeRate float64                 `json:"service_charge_rate"`
-	ProjectType       int64                   `json:"project_type"`      // 项目类型,1代表全流程项目,2代表专项项目
-	ProjectStatus     int64                   `json:"project_status"`    // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
-	ProjectName       string                  `json:"task_name"`         // 项目名称(任务标题)
-	TalentType        string                  `json:"talent_type"`       // 达人类型
-	RecruitDdl        string                  `json:"recruit_ddl"`       // 招募截止时间
-	RecruitStrategys  []CreateRecruitStrategy `json:"recruit_strategys"` // 招募策略
+	EnterpriseId      string  `json:"enterprise_id"`
+	SubAccountId      int64   `json:"sub_account_id"`
+	ProjectID         string  `json:"project_id"`
+	ProductId         int64   `json:"product_id"`
+	ServiceChargeRate float64 `json:"service_charge_rate"`
+	ProjectType       int64   `json:"project_type"` // 项目类型,1代表全流程项目,2代表专项项目
+	//ProjectStatus     int64                   `json:"project_status"`    // 项目状态,1-10分别代表创建中、待审核、审核通过、招募中、招募完毕、待支付、已支付、失效、执行中、已结案
+	ProjectName      string                  `json:"task_name"`         // 项目名称(任务标题)
+	TalentType       string                  `json:"talent_type"`       // 达人类型
+	RecruitDdl       string                  `json:"recruit_ddl"`       // 招募截止时间
+	RecruitStrategys []CreateRecruitStrategy `json:"recruit_strategys"` // 招募策略
 
 	ProjectForm     int64                  `json:"project_form"`   // 项目形式,1-3分别代表商品寄拍、素材分发、虚拟产品测评
 	ContentType     int64                  `json:"content_type"`   // 内容形式,1代表图文,2代表视频
@@ -20,28 +20,3 @@ type ProjectUpdateParam struct {
 	ProjectBrief    []*ProjectBriefInfo    `json:"project_brief"`
 	ProjectMaterial []*ProjectMaterialInfo `json:"project_material"`
 }
-
-type ProjectBriefInfo struct {
-	FileUrl string `json:"file_url"`
-	FileUid string `json:"file_uid"`
-	Name    string `json:"name"`
-	Type    int64  `json:"type"` // 手卡类型(1图片 2文档)
-}
-
-type ProjectMaterialInfo struct {
-	FileUrl string `json:"file_url"`
-	FileUid string `json:"file_uid"`
-	Name    string `json:"name"`
-	Type    int64  `json:"type"` // 素材类型(1图片 2视频)
-}
-
-// 招募策略
-type CreateRecruitStrategy struct {
-	StrategyID    int64   `json:"strategy_id"`    // 策略id
-	FeeForm       int64   `json:"fee_form"`       // 稿费形式,1-3分别代表无费置换、一口价、自报价
-	FollowersLow  int64   `json:"followers_low"`  // 达人粉丝数下限
-	FollowersUp   int64   `json:"followers_up"`   // 达人粉丝数上限
-	RecruitNumber int64   `json:"recruit_number"` // 招募数量
-	Offer         float64 `json:"offer"`          // 报价
-	ServiceCharge float64 `json:"service_charge"` // 服务费
-}

+ 49 - 0
app/vo/selection_info_create_param.go

@@ -5,4 +5,53 @@ type SelectionInfoCreateParam struct {
 	SubAccountId int64  `json:"sub_account_id"`
 	Platform     int64  `json:"platform"`
 	ProductId    int64  `json:"product_id"`
+	//SelectionStatus int64                   `json:"selection_status"` // 选品项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案
+	SelectionName   string                  `json:"task_name"`        // 任务名称
+	TaskDdl         string                  `json:"task_ddl"`         // 招募截止时间
+	FreeStrategys   []UpdateFreeStrategys   `json:"free_strategys"`   // 领样策略
+	RewardStrategys []UpdateRewardStrategys `json:"reward_strategys"` // 悬赏策略
+	SampleNum       int64                   `json:"sample_num"`       // 样品数量
+	SecBrief        []*SecBriefInfo         `json:"sec_brief"`
+	SecMaterial     []*SecMaterialInfo      `json:"sec_material"`
+
+	//ProductUrl       string  `json:"product_url"`       // 带货链接
+	//RemainNum        int64   `json:"remain_num"`        // 剩余数量
+	//CommissionRate   float64 `json:"commission_rate"`   // 佣金比例
+	//TaskReward       float64 `json:"task_reward"`       // 任务悬赏
+	//SampleCondition  string  `json:"sample_condition"`  // 领样条件
+	//RewardCondition  string  `json:"reward_condition"`  // 返现悬赏条件
+	//SettlementAmount float64 `json:"settlement_amount"` // 已结算金额
+	//Detail           string  `json:"detail"`            // 卖点总结
+	//Status           int64   `json:"status"`            // 是否删除
+}
+
+type SecBriefInfo struct {
+	FileUrl string `json:"file_url"`
+	FileUid string `json:"file_uid"`
+	Name    string `json:"name"`
+	Type    int64  `json:"type"` // 手卡类型(1图片 2文档)
+}
+
+type SecMaterialInfo struct {
+	FileUrl string `json:"file_url"`
+	FileUid string `json:"file_uid"`
+	Name    string `json:"name"`
+	Type    int64  `json:"type"` // 素材类型(1图片 2视频)
+}
+
+// 领样策略
+type UpdateFreeStrategys struct {
+	StrategyId   int64 `json:"strategy_id"`   // 策略编号
+	FollowersLow int64 `json:"followers_low"` // 达人粉丝数下限
+	FollowersUp  int64 `json:"followers_up"`  // 达人粉丝数上限
+	SaleNum      int64 `json:"sale_num"`      // 近30天橱窗销量
+	EnrollNum    int64 `json:"enroll_num"`    // 报名人数
+	ChooseNum    int64 `json:"choose_num"`    // 已选人数
+}
+
+// 悬赏策略
+type UpdateRewardStrategys struct {
+	Reward     float64 `json:"reward"`      // 悬赏池总金额
+	SaleActual int64   `json:"sale_actual"` // 实际带货销量
+	PerReward  float64 `json:"per_reward"`  // 每人可获得悬赏金
 }

+ 15 - 45
app/vo/selection_info_update_param.go

@@ -1,11 +1,12 @@
 package vo
 
 type SelectionInfoUpdateParam struct {
-	EnterpriseId    string                  `json:"enterprise_id"`
-	SubAccountId    int64                   `json:"sub_account_id"`
-	SelectionID     string                  `json:"selection_id"` // 选品id
-	ProductId       int64                   `json:"product_id"`
-	SelectionStatus int64                   `json:"selection_status"` // 选品项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案
+	EnterpriseId string `json:"enterprise_id"`
+	SubAccountId int64  `json:"sub_account_id"`
+	SelectionID  string `json:"selection_id"` // 选品id(创建时不需要)
+	Platform     int64  `json:"platform"`
+	ProductId    int64  `json:"product_id"`
+	//SelectionStatus int64                   `json:"selection_status"` // 选品项目状态,1-8分别代表创建中、待审核、审核通过、待支付、已支付、执行中、失效、已结案
 	SelectionName   string                  `json:"task_name"`        // 任务名称
 	TaskDdl         string                  `json:"task_ddl"`         // 招募截止时间
 	FreeStrategys   []UpdateFreeStrategys   `json:"free_strategys"`   // 免费领样策略
@@ -14,44 +15,13 @@ type SelectionInfoUpdateParam struct {
 	SecBrief        []*SecBriefInfo         `json:"sec_brief"`
 	SecMaterial     []*SecMaterialInfo      `json:"sec_material"`
 
-	ProductUrl       string  `json:"product_url"`       // 带货链接
-	RemainNum        int64   `json:"remain_num"`        // 剩余数量
-	CommissionRate   float64 `json:"commission_rate"`   // 佣金比例
-	TaskReward       float64 `json:"task_reward"`       // 任务悬赏
-	SampleCondition  string  `json:"sample_condition"`  // 领样条件
-	RewardCondition  string  `json:"reward_condition"`  // 返现悬赏条件
-	SettlementAmount float64 `json:"settlement_amount"` // 已结算金额
-	Detail           string  `json:"detail"`            // 卖点总结
-	Status           int64   `json:"status"`            // 是否删除
-}
-
-type SecBriefInfo struct {
-	FileUrl string `json:"file_url"`
-	FileUid string `json:"file_uid"`
-	Name    string `json:"name"`
-	Type    int64  `json:"type"` // 手卡类型(1图片 2文档)
-}
-
-type SecMaterialInfo struct {
-	FileUrl string `json:"file_url"`
-	FileUid string `json:"file_uid"`
-	Name    string `json:"name"`
-	Type    int64  `json:"type"` // 素材类型(1图片 2视频)
-}
-
-// 领样策略
-type UpdateFreeStrategys struct {
-	StrategyId   int64 `json:"strategy_id"`   // 策略编号
-	FollowersLow int64 `json:"followers_low"` // 达人粉丝数下限
-	FollowersUp  int64 `json:"followers_up"`  // 达人粉丝数上限
-	SaleNum      int64 `json:"sale_num"`      // 近30天橱窗销量
-	EnrollNum    int64 `json:"enroll_num"`    // 报名人数
-	ChooseNum    int64 `json:"choose_num"`    // 已选人数
-}
-
-// 悬赏策略
-type UpdateRewardStrategys struct {
-	Reward     float64 `json:"reward"`      // 悬赏池总金额
-	SaleActual int64   `json:"sale_actual"` // 实际带货销量
-	PerReward  float64 `json:"per_reward"`  // 每人可获得悬赏金
+	//ProductUrl       string  `json:"product_url"`       // 带货链接
+	//RemainNum        int64   `json:"remain_num"`        // 剩余数量
+	//CommissionRate   float64 `json:"commission_rate"`   // 佣金比例
+	//TaskReward       float64 `json:"task_reward"`       // 任务悬赏
+	//SampleCondition  string  `json:"sample_condition"`  // 领样条件
+	//RewardCondition  string  `json:"reward_condition"`  // 返现悬赏条件
+	//SettlementAmount float64 `json:"settlement_amount"` // 已结算金额
+	//Detail           string  `json:"detail"`            // 卖点总结
+	//Status           int64   `json:"status"`            // 是否删除
 }