|
@@ -375,12 +375,82 @@ func (*sProject) GetSpecialProjectList(ctx context.Context, supplierId int, page
|
|
|
}
|
|
|
|
|
|
// GetSpecialSProjectList 查找服务商加入商单后的定向种草任务列表
|
|
|
-func (*sProject) GetSpecialSProjectList(ctx context.Context, supplierId int, pageSize, pageNum int32, condition *common_model.SSpecialProjectCondition) ([]*gorm_model.SProjectInfo, int64, error) {
|
|
|
- sProjects, total, err := db.GetSpecialProjectList(ctx, supplierId, pageSize, pageNum, condition)
|
|
|
+func (*sProject) GetSpecialSProjectList(ctx context.Context, supplierId int, pageSize, pageNum int32, condition *common_model.SSpecialProjectCondition) (*http_model.SpecialSProjectListData, error) {
|
|
|
+ var specialProjectListData *http_model.SpecialSProjectListData
|
|
|
+ specialProjectListData = &http_model.SpecialSProjectListData{}
|
|
|
+ specialProjects, total, err := db.GetSpecialProjectList(ctx, supplierId, pageSize, pageNum, condition)
|
|
|
if err != nil {
|
|
|
- return nil, 0, err
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ if specialProjects != nil {
|
|
|
+ specialProjectListData.Total = total
|
|
|
+ // 1. 定向种草任务基本信息填入
|
|
|
+ for _, specialProject := range specialProjects {
|
|
|
+ var currSpecialProject *http_model.SpecialProjectResponse
|
|
|
+ currSpecialProject = &http_model.SpecialProjectResponse{}
|
|
|
+ currSpecialProject.SProjectId = specialProject.SProjectId
|
|
|
+ currSpecialProject.ProjectPlatform = specialProject.ProjectPlatform
|
|
|
+ currSpecialProject.ProjectForm = specialProject.ProjectForm
|
|
|
+ currSpecialProject.ContentType = specialProject.ContentType
|
|
|
+ currSpecialProject.SProjectStatus = specialProject.SProjectStatus
|
|
|
+
|
|
|
+ // 2. 定向种草任务商品信息填入
|
|
|
+ // 2.1. 商品信息
|
|
|
+ productInfo, productErr := db.GetProductByID(ctx, specialProject.ProductId)
|
|
|
+ if productErr != nil {
|
|
|
+ return nil, productErr
|
|
|
+ }
|
|
|
+ if productInfo != nil {
|
|
|
+ currSpecialProject.ProductId = productInfo.ProductID
|
|
|
+ currSpecialProject.ProductName = productInfo.ProductName
|
|
|
+ currSpecialProject.ProductPrice = productInfo.ProductPrice
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.2. 商品图片信息
|
|
|
+ productPhotoInfo, productPhotoErr := db.GetProductPhotoByProductID(ctx, specialProject.ProductId)
|
|
|
+ if productPhotoErr != nil {
|
|
|
+ return nil, productPhotoErr
|
|
|
+ }
|
|
|
+ if productPhotoInfo != nil {
|
|
|
+ for _, p := range productPhotoInfo {
|
|
|
+ if p.Symbol == 1 {
|
|
|
+ currSpecialProject.ProductPhotoUrl = p.PhotoUrl
|
|
|
+ currSpecialProject.ProductPhotoUid = p.PhotoUid
|
|
|
+ currSpecialProject.ProductPhotoSymbol = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3. 招募策略信息
|
|
|
+ recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, specialProject.ProjectId)
|
|
|
+ if recruitErr != nil {
|
|
|
+ return nil, recruitErr
|
|
|
+ }
|
|
|
+ if recruitStrategy != nil {
|
|
|
+ for _, strategy := range recruitStrategy {
|
|
|
+ showStrategy := http_model.EasyRecruitStrategy{
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
+ RecruitNumber: strategy.RecruitNumber,
|
|
|
+ StrategyId: strategy.StrategyID,
|
|
|
+ }
|
|
|
+ currSpecialProject.RecruitStrategy = append(currSpecialProject.RecruitStrategy, showStrategy)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 4. 原种草任务信息
|
|
|
+ projectInfo, projectErr := db.GetProjectDetail(ctx, specialProject.ProjectId)
|
|
|
+ if projectErr != nil {
|
|
|
+ return nil, projectErr
|
|
|
+ }
|
|
|
+ if projectInfo != nil {
|
|
|
+ currSpecialProject.Tools = projectInfo.Tools
|
|
|
+ }
|
|
|
+ specialProjectListData.SpecialProjectInfo = append(specialProjectListData.SpecialProjectInfo, currSpecialProject)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ specialProjectListData.Total = 0
|
|
|
}
|
|
|
- return sProjects, total, nil
|
|
|
+ return specialProjectListData, nil
|
|
|
}
|
|
|
|
|
|
// UpdateSProject 更新SProject信息
|