|
@@ -120,11 +120,15 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
|
|
|
|
// 更新公开种草任务的招募策略
|
|
|
var totalRecruitNum int64
|
|
|
+ var estimatedCost float64
|
|
|
if localCreateParam.RecruitStrategys != nil {
|
|
|
// 2. 接收并创建新的招募策略
|
|
|
if len(localCreateParam.RecruitStrategys) != 0 {
|
|
|
var recruits []entity.RecruitStrategy
|
|
|
for _, strategy := range localCreateParam.RecruitStrategys {
|
|
|
+ if strategy.FeeForm == 2 {
|
|
|
+ estimatedCost += float64(strategy.RecruitNumber) * strategy.Offer
|
|
|
+ }
|
|
|
recruitStrategy := entity.RecruitStrategy{
|
|
|
FeeForm: strategy.FeeForm,
|
|
|
StrategyID: strategy.StrategyID,
|
|
@@ -149,6 +153,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ _ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: localId, EstimatedCost: estimatedCost})
|
|
|
|
|
|
return &localId, nil
|
|
|
}
|
|
@@ -166,6 +171,7 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
|
|
|
}
|
|
|
// 更新公开种草任务的招募策略
|
|
|
var totalRecruitNum int64
|
|
|
+ var estimatedCost float64
|
|
|
if localUpdateParam.RecruitStrategys != nil {
|
|
|
// 1. 删除已有的招募策略
|
|
|
err = dao.RecruitStrategyDao{}.DeleteRecruitStrategyByProjectID(localUpdateParam.LocalID)
|
|
@@ -176,6 +182,9 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
|
|
|
if len(localUpdateParam.RecruitStrategys) != 0 {
|
|
|
var recruits []entity.RecruitStrategy
|
|
|
for _, strategy := range localUpdateParam.RecruitStrategys {
|
|
|
+ if strategy.FeeForm == 2 {
|
|
|
+ estimatedCost += float64(strategy.RecruitNumber) * strategy.Offer
|
|
|
+ }
|
|
|
recruitStrategy := entity.RecruitStrategy{
|
|
|
FeeForm: strategy.FeeForm,
|
|
|
StrategyID: strategy.StrategyID,
|
|
@@ -224,13 +233,14 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
|
|
|
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,
|
|
|
+ LocalName: localUpdateParam.LocalName,
|
|
|
+ TalentType: localUpdateParam.TalentType,
|
|
|
+ RecruitDdl: recruitDdl,
|
|
|
+ TaskForm: localUpdateParam.TaskForm,
|
|
|
+ ContentType: localUpdateParam.ContentType,
|
|
|
+ TaskDetail: localUpdateParam.TaskDetail,
|
|
|
+ UpdatedAt: t,
|
|
|
+ EstimatedCost: estimatedCost,
|
|
|
}
|
|
|
//if localUpdateParam.LocalStatus == 2 {
|
|
|
// updateLocalLife.SubmitAt = t
|
|
@@ -321,6 +331,7 @@ func (s LocalLifeService) UpdateLocalTarget(localUpdateParam *vo.LocalUpdatePara
|
|
|
println("更新定向本地生活任务的招募策略")
|
|
|
// 更新公开种草任务的招募策略
|
|
|
var totalRecruitNum int64
|
|
|
+ var estimatedCost float64
|
|
|
if localUpdateParam.RecruitStrategys != nil {
|
|
|
// 1. 删除已有的招募策略
|
|
|
err = dao.RecruitStrategyDao{}.DeleteRecruitStrategyByProjectID(localUpdateParam.LocalID)
|
|
@@ -331,6 +342,9 @@ func (s LocalLifeService) UpdateLocalTarget(localUpdateParam *vo.LocalUpdatePara
|
|
|
if len(localUpdateParam.RecruitStrategys) != 0 {
|
|
|
var recruits []entity.RecruitStrategy
|
|
|
for _, strategy := range localUpdateParam.RecruitStrategys {
|
|
|
+ if strategy.FeeForm == 2 {
|
|
|
+ estimatedCost += float64(strategy.RecruitNumber) * strategy.Offer
|
|
|
+ }
|
|
|
recruitStrategy := entity.RecruitStrategy{
|
|
|
FeeForm: strategy.FeeForm,
|
|
|
StrategyID: strategy.StrategyID,
|
|
@@ -377,14 +391,15 @@ func (s LocalLifeService) UpdateLocalTarget(localUpdateParam *vo.LocalUpdatePara
|
|
|
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,
|
|
|
+ LocalName: localUpdateParam.LocalName,
|
|
|
+ TalentType: localUpdateParam.TalentType,
|
|
|
+ RecruitDdl: recruitDdl,
|
|
|
+ TaskForm: localUpdateParam.TaskForm,
|
|
|
+ ContentType: localUpdateParam.ContentType,
|
|
|
+ TaskDetail: localUpdateParam.TaskDetail,
|
|
|
+ UpdatedAt: t,
|
|
|
+ Tools: localUpdateParam.Tools,
|
|
|
+ EstimatedCost: estimatedCost,
|
|
|
}
|
|
|
//if localUpdateParam.LocalStatus == 2 {
|
|
|
// updateLocalLife.SubmitAt = t
|