|
@@ -28,7 +28,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
if product == nil {
|
|
if product == nil {
|
|
return nil, errors.New("未找到关联门店")
|
|
return nil, errors.New("未找到关联门店")
|
|
}
|
|
}
|
|
- // c)创建种草任务
|
|
|
|
|
|
+ // c)创建本地生活任务
|
|
var operatorType int64
|
|
var operatorType int64
|
|
if localCreateParam.SubAccountId == 0 {
|
|
if localCreateParam.SubAccountId == 0 {
|
|
operatorType = 1
|
|
operatorType = 1
|
|
@@ -101,11 +101,6 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
}
|
|
}
|
|
|
|
|
|
if localCreateParam.LocalMaterial != nil {
|
|
if localCreateParam.LocalMaterial != nil {
|
|
- // 删除已有示例
|
|
|
|
- err = dao.LocalLifeMaterialDao{}.DeleteLocalMaterialByLocalId(localId)
|
|
|
|
- if err != nil {
|
|
|
|
- return nil, err
|
|
|
|
- }
|
|
|
|
// 插入新的示例
|
|
// 插入新的示例
|
|
for _, v := range localCreateParam.LocalMaterial {
|
|
for _, v := range localCreateParam.LocalMaterial {
|
|
material := entity.LocalLifeMaterial{
|
|
material := entity.LocalLifeMaterial{
|
|
@@ -602,6 +597,139 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
|
|
return &reLocalDetail, nil
|
|
return &reLocalDetail, nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 复制本地生活任务
|
|
|
|
+func (s LocalLifeService) CopyLocalLife(param *vo.LocalSearchParam) (*string, error) {
|
|
|
|
+ localLifeOrigin, err := dao.LocalLifeDao{}.GetLocalById(param.LocalId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.Errorf("[localLifeDB service] call GetLocalById error,err:%+v", err)
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ if localLifeOrigin == nil {
|
|
|
|
+ return nil, errors.New("任务不存在")
|
|
|
|
+ }
|
|
|
|
+ localIdOrigin := localLifeOrigin.LocalID
|
|
|
|
+ localIdNew := strings.ReplaceAll(util.GenerateUUID(11), "-", "")
|
|
|
|
+ t := time.Now()
|
|
|
|
+ // 获取定时任务配置id
|
|
|
|
+ infoAutoTask := entity.InfoAutoTask{}
|
|
|
|
+ infoAutoTask = dao.InfoAutoTaskDao{}.GetAutoTaskLast(param.EnterpriseId)
|
|
|
|
+ infoAutoDefault := entity.InfoAutoDefault{}
|
|
|
|
+ infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(param.EnterpriseId)
|
|
|
|
+
|
|
|
|
+ // 复制任务
|
|
|
|
+ localLifeNew := entity.LocalLifeInfo{
|
|
|
|
+ EnterpriseID: param.EnterpriseId,
|
|
|
|
+ SubAccountID: param.SubAccountId,
|
|
|
|
+ OperatorType: localLifeOrigin.OperatorType,
|
|
|
|
+ TaskStatus: localLifeOrigin.TaskStatus,
|
|
|
|
+ LocalID: localIdNew,
|
|
|
|
+ LocalType: localLifeOrigin.LocalType,
|
|
|
|
+ LocalPlatform: localLifeOrigin.LocalPlatform,
|
|
|
|
+ StoreID: localLifeOrigin.StoreID,
|
|
|
|
+ StoreRelatedAt: t,
|
|
|
|
+ PromoteBody: localLifeOrigin.PromoteBody,
|
|
|
|
+ Donate: localLifeOrigin.Donate,
|
|
|
|
+ TeamBuyingId: localLifeOrigin.TeamBuyingId,
|
|
|
|
+ TeamBuyingRelatedAt: t,
|
|
|
|
+ CreatedAt: t,
|
|
|
|
+ AutoTaskID: infoAutoTask.AutoTaskID,
|
|
|
|
+ AutoDefaultID: infoAutoDefault.AutoDefaultID,
|
|
|
|
+ LocalName: localLifeOrigin.LocalName,
|
|
|
|
+ TalentType: localLifeOrigin.TalentType,
|
|
|
|
+ RecruitDdl: localLifeOrigin.RecruitDdl,
|
|
|
|
+ TaskForm: localLifeOrigin.TaskForm,
|
|
|
|
+ ContentType: localLifeOrigin.ContentType,
|
|
|
|
+ TaskDetail: localLifeOrigin.TaskDetail,
|
|
|
|
+ ServiceChargeRate: localLifeOrigin.ServiceChargeRate,
|
|
|
|
+ EstimatedCost: localLifeOrigin.EstimatedCost,
|
|
|
|
+ }
|
|
|
|
+ err = dao.LocalLifeDao{}.CreateLocalLife(localLifeNew)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更新选品brief和示例(本地生活任务补充信息)
|
|
|
|
+ localBriefInfos, err := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localIdOrigin)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.Errorf("[projectDB service] call GetLocalBriefInfo error,err:%+v", err)
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ if localBriefInfos != nil {
|
|
|
|
+ for _, v := range localBriefInfos {
|
|
|
|
+ brief := entity.LocalLifeBrief{
|
|
|
|
+ LocalID: localIdNew,
|
|
|
|
+ FileUid: v.FileUid,
|
|
|
|
+ FileName: v.FileName,
|
|
|
|
+ FileUrl: v.FileUrl,
|
|
|
|
+ CreatedAt: time.Now(),
|
|
|
|
+ Type: v.Type,
|
|
|
|
+ }
|
|
|
|
+ err = dao.LocalLifeBriefDao{}.CreateLocalBrief(brief)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ localMaterials, err := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localIdOrigin)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.Errorf("[projectDB service] call GetLocalMaterialInfo error,err:%+v", err)
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ if localMaterials != nil {
|
|
|
|
+ for _, v := range localMaterials {
|
|
|
|
+ material := entity.LocalLifeMaterial{
|
|
|
|
+ LocalID: localIdNew,
|
|
|
|
+ FileUid: v.FileUid,
|
|
|
|
+ FileName: v.FileName,
|
|
|
|
+ FileUrl: v.FileUrl,
|
|
|
|
+ CreatedAt: time.Now(),
|
|
|
|
+ Type: v.Type,
|
|
|
|
+ }
|
|
|
|
+ err = dao.LocalLifeMaterialDao{}.CreateLocalMaterial(material)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更新本地生活任务的招募策略
|
|
|
|
+ recruitStrategys, err := dao.RecruitStrategyDao{}.GetRecruitStrategyByProjectId(localIdOrigin)
|
|
|
|
+ if err != nil {
|
|
|
|
+ logrus.Errorf("[localLifeDB service] call GetRecruitStrategy error,err:%+v", err)
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ var totalRecruitNum int64
|
|
|
|
+ if recruitStrategys != nil {
|
|
|
|
+ // 2. 接收并创建新的招募策略
|
|
|
|
+ if len(recruitStrategys) != 0 {
|
|
|
|
+ var recruits []entity.RecruitStrategy
|
|
|
|
+ for _, strategy := range recruitStrategys {
|
|
|
|
+ recruitStrategy := entity.RecruitStrategy{
|
|
|
|
+ FeeForm: strategy.FeeForm,
|
|
|
|
+ StrategyID: strategy.StrategyID,
|
|
|
|
+ FollowersLow: strategy.FollowersLow,
|
|
|
|
+ FollowersUp: strategy.FollowersUp,
|
|
|
|
+ RecruitNumber: strategy.RecruitNumber,
|
|
|
|
+ ProjectID: localIdNew,
|
|
|
|
+ StrategyType: strategy.StrategyType,
|
|
|
|
+ ServiceRate: strategy.ServiceRate,
|
|
|
|
+ Offer: strategy.Offer,
|
|
|
|
+ ServiceCharge: strategy.ServiceCharge,
|
|
|
|
+ TOffer: strategy.TOffer,
|
|
|
|
+ }
|
|
|
|
+ totalRecruitNum += strategy.RecruitNumber
|
|
|
|
+ recruits = append(recruits, recruitStrategy)
|
|
|
|
+ }
|
|
|
|
+ err = dao.RecruitStrategyDao{}.CreateRecruitStrategy(recruits)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return &localIdNew, nil
|
|
|
|
+}
|
|
|
|
+
|
|
// 本地生活提交审核
|
|
// 本地生活提交审核
|
|
func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdateParam) (*string, error) {
|
|
func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdateParam) (*string, error) {
|
|
localId := localUpdateParam.LocalID
|
|
localId := localUpdateParam.LocalID
|
|
@@ -774,6 +902,7 @@ func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdatePara
|
|
updateLocal := entity.LocalLifeInfo{
|
|
updateLocal := entity.LocalLifeInfo{
|
|
LocalID: localId,
|
|
LocalID: localId,
|
|
TaskStatus: 2,
|
|
TaskStatus: 2,
|
|
|
|
+ SubmitAt: t,
|
|
UpdatedAt: t,
|
|
UpdatedAt: t,
|
|
}
|
|
}
|
|
err9 := dao.LocalLifeDao{}.UpdateLocal(updateLocal)
|
|
err9 := dao.LocalLifeDao{}.UpdateLocal(updateLocal)
|