|
@@ -163,7 +163,6 @@ func (*sProject) GetSPorjectDetail(ctx context.Context, sProjectId int) (*http_m
|
|
|
return nil, err
|
|
|
}
|
|
|
if sProjectInfo != nil {
|
|
|
- fmt.Println(sProjectInfo)
|
|
|
sProjectData.SProjectId = sProjectInfo.SProjectId
|
|
|
sProjectData.ProjectName = sProjectInfo.ProjectName
|
|
|
sProjectData.ProjectID = sProjectInfo.ProjectId
|
|
@@ -171,76 +170,126 @@ func (*sProject) GetSPorjectDetail(ctx context.Context, sProjectId int) (*http_m
|
|
|
sProjectData.ProjectPlatform = sProjectInfo.ProjectPlatform
|
|
|
sProjectData.ProjectForm = sProjectInfo.ProjectForm
|
|
|
sProjectData.ContentType = sProjectInfo.ContentType
|
|
|
- }
|
|
|
+ sProjectData.EnterpriseID = sProjectInfo.EnterpriseId
|
|
|
|
|
|
- // 2. 取出商家发布的种草任务表中的信息
|
|
|
- projectInfo, projectErr := db.GetProjectDetail(ctx, sProjectInfo.ProjectId)
|
|
|
- if projectErr != nil {
|
|
|
- return nil, projectErr
|
|
|
- }
|
|
|
- if projectInfo != nil {
|
|
|
- fmt.Println(projectInfo)
|
|
|
- sProjectData.TalentType = projectInfo.TalentType
|
|
|
- sProjectData.RecruitDdl = *projectInfo.RecruitDdl
|
|
|
- sProjectData.ProjectDetail = projectInfo.ProjectDetail
|
|
|
- sProjectData.PayAt = *projectInfo.PayAt
|
|
|
- }
|
|
|
+ // 2. 取出商家发布的种草任务表中的信息作为补充
|
|
|
+ projectInfo, projectErr := db.GetProjectDetail(ctx, sProjectInfo.ProjectId)
|
|
|
+ if projectErr != nil {
|
|
|
+ return nil, projectErr
|
|
|
+ }
|
|
|
+ if projectInfo != nil {
|
|
|
+ sProjectData.TalentType = projectInfo.TalentType
|
|
|
+ sProjectData.RecruitDdl = conv.MustString(projectInfo.RecruitDdl)[0:19]
|
|
|
+ sProjectData.ProjectDetail = projectInfo.ProjectDetail
|
|
|
+ // sProjectData.PayAt = conv.MustString(projectInfo.PayAt)
|
|
|
+ sProjectData.ProjectDetail = projectInfo.ProjectDetail
|
|
|
+ sProjectData.EstimatedCost = projectInfo.EstimatedCost
|
|
|
+ sProjectData.PassAt = conv.MustString(projectInfo.PassAt)[0:19]
|
|
|
|
|
|
- // 3. 取出招募策略并聚合达人数量信息
|
|
|
- recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, sProjectData.ProjectID)
|
|
|
- if recruitErr != nil {
|
|
|
- return nil, recruitErr
|
|
|
- }
|
|
|
- if recruitStrategy != nil {
|
|
|
- for _, strategy := range recruitStrategy {
|
|
|
- fmt.Println("recruitStrategy: ", strategy)
|
|
|
- selectedNumber, countTaskErr := db.CountTaskNumByStrategyId(ctx, sProjectData.ProjectID, strategy.StrategyID)
|
|
|
- if countTaskErr != nil {
|
|
|
- return nil, countTaskErr
|
|
|
+ // 3. 取出招募策略并聚合达人数量信息
|
|
|
+ recruitStrategy, recruitErr := db.GetRecruitStrategyByProjectId(ctx, sProjectData.ProjectID)
|
|
|
+ if recruitErr != nil {
|
|
|
+ return nil, recruitErr
|
|
|
}
|
|
|
- showStrategy := http_model.ShowSRecruitStrategy{
|
|
|
- StrategyID: strategy.StrategyID,
|
|
|
- FeeForm: strategy.FeeForm,
|
|
|
- FollowersLow: strategy.FollowersLow,
|
|
|
- FollowersUp: strategy.FollowersUp,
|
|
|
- RecruitNumber: strategy.RecruitNumber,
|
|
|
- ServiceCharge: projectInfo.ServiceChargeRate,
|
|
|
- SelectedNumber: selectedNumber,
|
|
|
- Offer: strategy.Offer,
|
|
|
+ if recruitStrategy != nil {
|
|
|
+ for _, strategy := range recruitStrategy {
|
|
|
+ // fmt.Println("recruitStrategy: ", strategy)
|
|
|
+ selectedNumber, countTaskErr := db.CountTaskNumByStrategyId(ctx, sProjectData.ProjectID, strategy.StrategyID)
|
|
|
+ if countTaskErr != nil {
|
|
|
+ return nil, countTaskErr
|
|
|
+ }
|
|
|
+ showStrategy := http_model.ShowSRecruitStrategy{
|
|
|
+ StrategyID: strategy.StrategyID,
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
+ FollowersLow: strategy.FollowersLow,
|
|
|
+ FollowersUp: strategy.FollowersUp,
|
|
|
+ RecruitNumber: strategy.RecruitNumber,
|
|
|
+ ServiceCharge: projectInfo.ServiceChargeRate,
|
|
|
+ SelectedNumber: selectedNumber,
|
|
|
+ Offer: strategy.Offer,
|
|
|
+ }
|
|
|
+ sProjectData.SRecruitStrategys = append(sProjectData.SRecruitStrategys, showStrategy)
|
|
|
+ }
|
|
|
}
|
|
|
- sProjectData.SRecruitStrategys = append(sProjectData.SRecruitStrategys, showStrategy)
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- // 4. 取出种草任务创建者用户信息
|
|
|
- if projectInfo.OperatorType == 1 {
|
|
|
- fmt.Println("商家用户")
|
|
|
- enterpriseInfo, enterpriseErr := db.GetEnterpriseByEnterpriseID(ctx, projectInfo.EnterpriseID)
|
|
|
- if enterpriseErr != nil {
|
|
|
- return nil, enterpriseErr
|
|
|
- }
|
|
|
- sProjectData.CreatorName = enterpriseInfo.BusinessName
|
|
|
- sProjectData.CreatorCompany = enterpriseInfo.BusinessName
|
|
|
- sProjectData.CreatorType = 1
|
|
|
- sProjectData.Phone = enterpriseInfo.Phone
|
|
|
- } else if projectInfo.OperatorType == 2 {
|
|
|
- fmt.Println("商家子账号")
|
|
|
- enterpriseInfo, enterpriseErr := db.GetEnterpriseByEnterpriseID(ctx, projectInfo.EnterpriseID)
|
|
|
- if enterpriseErr != nil {
|
|
|
- return nil, enterpriseErr
|
|
|
- }
|
|
|
- sProjectData.CreatorCompany = enterpriseInfo.BusinessName
|
|
|
- subAccountInfo, SubAccountErr := db.FindSubAccountById(ctx, projectInfo.SubAccountId)
|
|
|
- if SubAccountErr != nil {
|
|
|
- return nil, SubAccountErr
|
|
|
- }
|
|
|
- sProjectData.Phone = subAccountInfo.PhoneNumber
|
|
|
- jobInfo, jobErr := db.FindJobByJobId(ctx, subAccountInfo.JobId)
|
|
|
- if jobErr != nil {
|
|
|
- return nil, jobErr
|
|
|
+ // 4. 取出种草任务创建者用户信息
|
|
|
+ if projectInfo.OperatorType == 1 {
|
|
|
+ // fmt.Println("商家用户")
|
|
|
+ enterpriseInfo, enterpriseErr := db.GetEnterpriseByEnterpriseID(ctx, projectInfo.EnterpriseID)
|
|
|
+ if enterpriseErr != nil {
|
|
|
+ return nil, enterpriseErr
|
|
|
+ }
|
|
|
+ sProjectData.CreatorName = enterpriseInfo.BusinessName
|
|
|
+ sProjectData.CreatorCompany = enterpriseInfo.BusinessName
|
|
|
+ sProjectData.CreatorType = 1
|
|
|
+ sProjectData.Phone = enterpriseInfo.BusinessName
|
|
|
+ } else if projectInfo.OperatorType == 2 {
|
|
|
+ // fmt.Println("商家子账号")
|
|
|
+ enterpriseInfo, enterpriseErr := db.GetEnterpriseByEnterpriseID(ctx, projectInfo.EnterpriseID)
|
|
|
+ if enterpriseErr != nil {
|
|
|
+ return nil, enterpriseErr
|
|
|
+ }
|
|
|
+ sProjectData.CreatorCompany = enterpriseInfo.BusinessName
|
|
|
+ subAccountInfo, SubAccountErr := db.FindSubAccountById(ctx, projectInfo.SubAccountId)
|
|
|
+ if SubAccountErr != nil {
|
|
|
+ return nil, SubAccountErr
|
|
|
+ }
|
|
|
+ sProjectData.Phone = subAccountInfo.PhoneNumber
|
|
|
+ jobInfo, jobErr := db.FindJobByJobId(ctx, subAccountInfo.JobId)
|
|
|
+ if jobErr != nil {
|
|
|
+ return nil, jobErr
|
|
|
+ }
|
|
|
+ sProjectData.CreatorType = 2
|
|
|
+ sProjectData.CreatorName = jobInfo.JobName
|
|
|
+ }
|
|
|
+
|
|
|
+ // 5. 商品信息
|
|
|
+ // 5.1. 取出商品信息并聚合
|
|
|
+ productInfo, productErr := db.GetProductByID(ctx, projectInfo.ProductID)
|
|
|
+ if productErr != nil {
|
|
|
+ return nil, productErr
|
|
|
+ }
|
|
|
+ if productInfo != nil {
|
|
|
+ sProjectData.ProductID = productInfo.ProductID
|
|
|
+ sProjectData.ProductName = productInfo.ProductName
|
|
|
+ sProjectData.ProductType = productInfo.ProductType
|
|
|
+ sProjectData.ProductPrice = productInfo.ProductPrice
|
|
|
+ sProjectData.ProductCategory = productInfo.ProductCategory
|
|
|
+ }
|
|
|
+ // 5.2. 聚合商品图片信息
|
|
|
+ productPhotoInfo, productPhotoErr := db.GetProductPhotoByProductID(ctx, projectInfo.ProductID)
|
|
|
+ if productPhotoErr != nil {
|
|
|
+ return nil, productPhotoErr
|
|
|
+ }
|
|
|
+ if productPhotoInfo != nil {
|
|
|
+ for _, p := range productPhotoInfo {
|
|
|
+ if p.Symbol == 1 {
|
|
|
+ sProjectData.ProductMainPhotoUrl = p.PhotoUrl
|
|
|
+ sProjectData.ProductMainPhotoUid = p.PhotoUid
|
|
|
+ sProjectData.Symbol = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 6. 执行要求Brief和素材
|
|
|
+ // 6.1. Brief
|
|
|
+ projectBrief, briefErr := db.FindProjectBriefByProjectId(ctx, sProjectData.ProjectID)
|
|
|
+ if briefErr != nil {
|
|
|
+ return nil, briefErr
|
|
|
+ }
|
|
|
+ if projectBrief != nil {
|
|
|
+ sProjectData.ProjectBriefInfo = projectBrief
|
|
|
+ }
|
|
|
+
|
|
|
+ // 6.2. 素材
|
|
|
+ projectMaterial, materialErr := db.FindProjectMaterialByProjectId(ctx, sProjectData.ProjectID)
|
|
|
+ if materialErr != nil {
|
|
|
+ return nil, materialErr
|
|
|
+ }
|
|
|
+ if projectMaterial != nil {
|
|
|
+ sProjectData.ProjectMaterial = projectMaterial
|
|
|
+ }
|
|
|
}
|
|
|
- sProjectData.CreatorType = 2
|
|
|
- sProjectData.CreatorName = jobInfo.JobName
|
|
|
}
|
|
|
return sProjectData, nil
|
|
|
}
|