|
@@ -4,11 +4,11 @@ import (
|
|
|
"errors"
|
|
|
"github.com/sirupsen/logrus"
|
|
|
"reflect"
|
|
|
- "strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
|
"youngee_m_api/app/dao"
|
|
|
"youngee_m_api/app/entity"
|
|
|
+ "youngee_m_api/app/service/review_service"
|
|
|
"youngee_m_api/app/util"
|
|
|
"youngee_m_api/app/vo"
|
|
|
)
|
|
@@ -27,7 +27,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
|
if product == nil {
|
|
|
return nil, errors.New("未找到关联门店")
|
|
|
}
|
|
|
- // c)创建种草任务
|
|
|
+ // c)创建本地生活任务
|
|
|
var operatorType int64
|
|
|
if localCreateParam.SubAccountId == 0 {
|
|
|
operatorType = 1
|
|
@@ -71,6 +71,7 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
|
TaskForm: localCreateParam.TaskForm,
|
|
|
ContentType: localCreateParam.ContentType,
|
|
|
TaskDetail: localCreateParam.TaskDetail,
|
|
|
+ Tools: localCreateParam.Tools,
|
|
|
}
|
|
|
if localCreateParam.LocalType == 1 {
|
|
|
newLocalLife.ServiceChargeRate = localCreateParam.ServiceChargeRate
|
|
@@ -100,11 +101,6 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
|
}
|
|
|
|
|
|
if localCreateParam.LocalMaterial != nil {
|
|
|
- // 删除已有示例
|
|
|
- err = dao.LocalLifeMaterialDao{}.DeleteLocalMaterialByLocalId(localId)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
// 插入新的示例
|
|
|
for _, v := range localCreateParam.LocalMaterial {
|
|
|
material := entity.LocalLifeMaterial{
|
|
@@ -146,8 +142,8 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
|
totalRecruitNum += strategy.RecruitNumber
|
|
|
if strategy.FeeForm == 2 {
|
|
|
recruitStrategy.Offer = strategy.Offer
|
|
|
- recruitStrategy.ServiceCharge = strategy.Offer * localCreateParam.ServiceChargeRate
|
|
|
- recruitStrategy.TOffer = strategy.Offer * (1 - localCreateParam.ServiceChargeRate)
|
|
|
+ recruitStrategy.ServiceCharge = strategy.Offer * localCreateParam.ServiceChargeRate * 0.01
|
|
|
+ recruitStrategy.TOffer = strategy.Offer * (1 - localCreateParam.ServiceChargeRate*0.01)
|
|
|
}
|
|
|
recruits = append(recruits, recruitStrategy)
|
|
|
}
|
|
@@ -157,7 +153,11 @@ func (s LocalLifeService) CreateLocalLife(localCreateParam *vo.LocalCreateParam)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- _ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{LocalID: localId, EstimatedCost: estimatedCost})
|
|
|
+ _ = dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
|
|
|
+ LocalID: localId,
|
|
|
+ EstimatedCost: estimatedCost,
|
|
|
+ TotalRecruitNum: totalRecruitNum,
|
|
|
+ })
|
|
|
|
|
|
return &localId, nil
|
|
|
}
|
|
@@ -207,8 +207,8 @@ func (s LocalLifeService) UpdateLocal(localUpdateParam *vo.LocalUpdateParam) (*s
|
|
|
totalRecruitNum += strategy.RecruitNumber
|
|
|
if strategy.FeeForm == 2 {
|
|
|
recruitStrategy.Offer = strategy.Offer
|
|
|
- recruitStrategy.ServiceCharge = strategy.Offer * localUpdateParam.ServiceChargeRate
|
|
|
- recruitStrategy.TOffer = strategy.Offer * (1 - localUpdateParam.ServiceChargeRate)
|
|
|
+ recruitStrategy.ServiceCharge = strategy.Offer * localUpdateParam.ServiceChargeRate * 0.01
|
|
|
+ recruitStrategy.TOffer = strategy.Offer * (1 - localUpdateParam.ServiceChargeRate*0.01)
|
|
|
}
|
|
|
recruits = append(recruits, recruitStrategy)
|
|
|
}
|
|
@@ -240,14 +240,15 @@ 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,
|
|
|
- EstimatedCost: estimatedCost,
|
|
|
+ LocalName: localUpdateParam.LocalName,
|
|
|
+ TalentType: localUpdateParam.TalentType,
|
|
|
+ RecruitDdl: recruitDdl,
|
|
|
+ TaskForm: localUpdateParam.TaskForm,
|
|
|
+ ContentType: localUpdateParam.ContentType,
|
|
|
+ TaskDetail: localUpdateParam.TaskDetail,
|
|
|
+ UpdatedAt: t,
|
|
|
+ EstimatedCost: estimatedCost,
|
|
|
+ TotalRecruitNum: totalRecruitNum,
|
|
|
}
|
|
|
//if localUpdateParam.LocalStatus == 2 {
|
|
|
// updateLocalLife.SubmitAt = t
|
|
@@ -398,15 +399,16 @@ 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,
|
|
|
- EstimatedCost: estimatedCost,
|
|
|
+ LocalName: localUpdateParam.LocalName,
|
|
|
+ TalentType: localUpdateParam.TalentType,
|
|
|
+ RecruitDdl: recruitDdl,
|
|
|
+ TaskForm: localUpdateParam.TaskForm,
|
|
|
+ ContentType: localUpdateParam.ContentType,
|
|
|
+ TaskDetail: localUpdateParam.TaskDetail,
|
|
|
+ UpdatedAt: t,
|
|
|
+ Tools: localUpdateParam.Tools,
|
|
|
+ EstimatedCost: estimatedCost,
|
|
|
+ TotalRecruitNum: totalRecruitNum,
|
|
|
}
|
|
|
//if localUpdateParam.LocalStatus == 2 {
|
|
|
// updateLocalLife.SubmitAt = t
|
|
@@ -491,12 +493,26 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
|
|
|
logrus.Errorf("[localLifeDB service] call GetLocalById error,err:%+v", err)
|
|
|
return nil, err
|
|
|
}
|
|
|
+ if localLife == nil {
|
|
|
+ return nil, errors.New("数据不存在")
|
|
|
+ }
|
|
|
// 系统信息
|
|
|
+ reLocalDetail.LocalName = localLife.LocalName
|
|
|
reLocalDetail.LocalId = localId
|
|
|
reLocalDetail.LocalStatus = localLife.TaskStatus
|
|
|
reLocalDetail.LocalPlatform = localLife.LocalPlatform
|
|
|
reLocalDetail.CreatedAt = localLife.CreatedAt.Format("2006-01-02 15:04:05")
|
|
|
- reLocalDetail.EstimatedCost = localLife.EstimatedCost // 预估成本
|
|
|
+ reLocalDetail.SubmitAt = localLife.SubmitAt.Format("2006-01-02 15:04:05")
|
|
|
+ reLocalDetail.PassAt = localLife.AutoFailAt.Format("2006-01-02 15:04:05")
|
|
|
+ reLocalDetail.AutoFailAt = localLife.AutoFailAt.Format("2006-01-02 15:04:05")
|
|
|
+ reLocalDetail.StartAt = localLife.PayAt.Format("2006-01-02 15:04:05")
|
|
|
+ reLocalDetail.FinishAt = localLife.FinishAt.Format("2006-01-02 15:04:05")
|
|
|
+ reLocalDetail.FailAt = localLife.FailAt.Format("2006-01-02 15:04:05")
|
|
|
+ if localLife.TaskStatus < 6 {
|
|
|
+ reLocalDetail.EstimatedCost = localLife.EstimatedCost
|
|
|
+ } else {
|
|
|
+ reLocalDetail.EstimatedCost = localLife.NeedPay
|
|
|
+ }
|
|
|
reLocalDetail.ServiceChargeRate = localLife.ServiceChargeRate
|
|
|
var creatorName, phone string
|
|
|
if localLife.OperatorType == 1 && localLife.SubAccountID == 0 {
|
|
@@ -517,7 +533,7 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
|
|
|
// 关联主体
|
|
|
var reStore vo.ReStorePreview
|
|
|
store, err := dao.StoreDao{}.GetStoreByID(localLife.StoreID)
|
|
|
- if err == nil {
|
|
|
+ if err == nil && store != nil {
|
|
|
photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
|
|
|
if e != nil {
|
|
|
photoUrl = ""
|
|
@@ -536,7 +552,7 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
|
|
|
reLocalDetail.StoreInfo = &reStore
|
|
|
var reTeamBuying vo.ReTeamBuyingPreview
|
|
|
teamBuying, err := dao.TeamBuyingDao{}.GetTeamBuyingByID(localLife.TeamBuyingId)
|
|
|
- if err == nil {
|
|
|
+ if err == nil && teamBuying != nil {
|
|
|
photoUrl, e := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
|
|
|
if e != nil {
|
|
|
photoUrl = ""
|
|
@@ -584,12 +600,12 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
|
|
|
reLocalDetail.TaskForm = localLife.TaskForm
|
|
|
reLocalDetail.ContentType = localLife.ContentType
|
|
|
reLocalDetail.TaskDetail = localLife.TaskDetail
|
|
|
- taskBriefInfos, err := dao.ProjectBriefDao{}.GetProjectBriefInfo(localId)
|
|
|
+ taskBriefInfos, err := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localId)
|
|
|
if err != nil {
|
|
|
logrus.Errorf("[localLifeDB service] call GetProjectBriefInfo error,err:%+v", err)
|
|
|
return nil, err
|
|
|
}
|
|
|
- taskMaterials, err := dao.ProjectMaterialDao{}.GetProjectMaterialInfo(localId)
|
|
|
+ taskMaterials, err := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localId)
|
|
|
if err != nil {
|
|
|
logrus.Errorf("[localLifeDB service] call GetprojectMaterialInfo error,err:%+v", err)
|
|
|
return nil, err
|
|
@@ -601,186 +617,321 @@ func (s LocalLifeService) GetLocalLifeDetail(localId string) (*vo.ReLocalDetail,
|
|
|
return &reLocalDetail, nil
|
|
|
}
|
|
|
|
|
|
-//// 本地生活提交审核
|
|
|
-//func (s LocalLifeService) LocalLifeToReview(localUpdateParam *vo.LocalUpdateParam) (*string, error) {
|
|
|
-// localId := localUpdateParam.LocalID
|
|
|
-//
|
|
|
-// local, err := dao.LocalLifeDao{}.GetLocalById(localId)
|
|
|
-// if err != nil {
|
|
|
-// logrus.Errorf("[projectInfoDB service] call GetProject error,err:%+v", err)
|
|
|
-// return nil, err
|
|
|
-// }
|
|
|
-//
|
|
|
-// localName := local.LocalName // 任务标题
|
|
|
-// localDetail := local.TaskDetail // 任务详情
|
|
|
-// store, err := dao.StoreDao{}.GetStoreByID(local.StoreID)
|
|
|
-// if err != nil {
|
|
|
-// return nil, err
|
|
|
-// }
|
|
|
-// storeName := store.StoreName // 门店名称
|
|
|
-// storeDetail := store.StoreDetail // 门店特点
|
|
|
-// storeMainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
|
|
|
-// if err1 != nil {
|
|
|
-// return nil, err1
|
|
|
-// }
|
|
|
-// teamBuying, err2 := dao.TeamBuyingDao{}.GetTeamBuyingByID(local.TeamBuyingId)
|
|
|
-// if err2 != nil {
|
|
|
-// return nil, err2
|
|
|
-// }
|
|
|
-// teamBuyingName := teamBuying.TeamBuyingName // 团购标题
|
|
|
-// teamBuyingDetail := teamBuying.TeamBuyingDetail // 团购详情
|
|
|
-// teamBuyingMainPhoto, err3 := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
|
|
|
-// if err3 != nil {
|
|
|
-// return nil, err3
|
|
|
-// }
|
|
|
-// var images []string
|
|
|
-// var videos []string
|
|
|
-// var videoJobIds []string
|
|
|
-// var documents []string
|
|
|
-// var documentJobIds []string
|
|
|
-// reviewService := review_service.GetConfig()
|
|
|
-//
|
|
|
-// storePhotos, err4 := dao.ProductPhotoDAO{}.GetProductPhotoByStoreID(local.StoreID)
|
|
|
-// if err4 != nil {
|
|
|
-// return nil, err4
|
|
|
-// }
|
|
|
-// for _, storePhoto := range storePhotos {
|
|
|
-// if storePhoto.Symbol == 2 || storePhoto.Symbol == 4 {
|
|
|
-// images = append(images, storePhoto.PhotoUrl)
|
|
|
-// } else if storePhoto.Symbol == 3 || storePhoto.Symbol == 5 {
|
|
|
-// var videoJobId *string
|
|
|
-// var reviewErr error
|
|
|
-// i := 10
|
|
|
-// for {
|
|
|
-// videoJobId, reviewErr = reviewService.CheckVideo(storePhoto.PhotoUrl)
|
|
|
-// if reviewErr == nil || i == 0 {
|
|
|
-// break
|
|
|
-// }
|
|
|
-// i -= 1
|
|
|
-// }
|
|
|
-// if reviewErr != nil {
|
|
|
-// return nil, reviewErr
|
|
|
-// }
|
|
|
-// videos = append(videos, storePhoto.PhotoUrl)
|
|
|
-// videoJobIds = append(videoJobIds, *videoJobId)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// teamBuyingPhotos, err5 := dao.ProductPhotoDAO{}.GetProductPhotoByTeamBuyingID(local.TeamBuyingId)
|
|
|
-// if err5 != nil {
|
|
|
-// return nil, err5
|
|
|
-// }
|
|
|
-// for _, teamBuyingPhoto := range teamBuyingPhotos {
|
|
|
-// if teamBuyingPhoto.Symbol == 2 || teamBuyingPhoto.Symbol == 4 {
|
|
|
-// images = append(images, teamBuyingPhoto.PhotoUrl)
|
|
|
-// } else if teamBuyingPhoto.Symbol == 3 || teamBuyingPhoto.Symbol == 5 {
|
|
|
-// var videoJobId *string
|
|
|
-// var reviewErr error
|
|
|
-// i := 10
|
|
|
-// for {
|
|
|
-// videoJobId, reviewErr = reviewService.CheckVideo(teamBuyingPhoto.PhotoUrl)
|
|
|
-// if reviewErr == nil || i == 0 {
|
|
|
-// break
|
|
|
-// }
|
|
|
-// i -= 1
|
|
|
-// }
|
|
|
-// if reviewErr != nil {
|
|
|
-// return nil, reviewErr
|
|
|
-// }
|
|
|
-// videos = append(videos, teamBuyingPhoto.PhotoUrl)
|
|
|
-// videoJobIds = append(videoJobIds, *videoJobId)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// localBriefInfos, err6 := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localId)
|
|
|
-// if err6 != nil {
|
|
|
-// return nil, err6
|
|
|
-// }
|
|
|
-// for _, localBriefInfo := range localBriefInfos {
|
|
|
-// if localBriefInfo.Type == 1 {
|
|
|
-// images = append(images, localBriefInfo.FileUrl)
|
|
|
-// } else if localBriefInfo.Type == 2 {
|
|
|
-// var documentJobId *string
|
|
|
-// var reviewErr error
|
|
|
-// i := 10
|
|
|
-// fileType := "pdf"
|
|
|
-// parts := strings.Split(localBriefInfo.FileName, ".")
|
|
|
-// if len(parts) > 1 {
|
|
|
-// fileType = parts[len(parts)-1]
|
|
|
-// }
|
|
|
-// for {
|
|
|
-// documentJobId, reviewErr = reviewService.CheckDocument(localBriefInfo.FileUrl, fileType)
|
|
|
-// if reviewErr == nil || i == 0 {
|
|
|
-// break
|
|
|
-// }
|
|
|
-// i -= 1
|
|
|
-// }
|
|
|
-// if reviewErr != nil {
|
|
|
-// return nil, reviewErr
|
|
|
-// }
|
|
|
-// documents = append(documents, localBriefInfo.FileUrl)
|
|
|
-// documentJobIds = append(documentJobIds, *documentJobId)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// localMaterials, err7 := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localId)
|
|
|
-// if err7 != nil {
|
|
|
-// return nil, err7
|
|
|
-// }
|
|
|
-// for _, localMaterial := range localMaterials {
|
|
|
-// if localMaterial.Type == 1 {
|
|
|
-// images = append(images, localMaterial.FileUrl)
|
|
|
-// } else if localMaterial.Type == 2 {
|
|
|
-// var videoJobId *string
|
|
|
-// var reviewErr error
|
|
|
-// i := 10
|
|
|
-// for {
|
|
|
-// videoJobId, reviewErr = reviewService.CheckVideo(localMaterial.FileUrl)
|
|
|
-// if reviewErr == nil || i == 0 {
|
|
|
-// break
|
|
|
-// }
|
|
|
-// i -= 1
|
|
|
-// }
|
|
|
-// if reviewErr != nil {
|
|
|
-// return nil, reviewErr
|
|
|
-// }
|
|
|
-// videos = append(videos, localMaterial.FileUrl)
|
|
|
-// videoJobIds = append(videoJobIds, *videoJobId)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// newReviewLocal := &entity.ReviewLocalLife{
|
|
|
-// LocalID: localId,
|
|
|
-// TaskName: localName,
|
|
|
-// TaskDetail: localDetail,
|
|
|
-// StoreMainPhoto: storeMainPhoto,
|
|
|
-// StoreName: storeName,
|
|
|
-// StoreDetail: storeDetail,
|
|
|
-// TeamBuyingMainPhoto: teamBuyingMainPhoto,
|
|
|
-// TeamBuyingName: teamBuyingName,
|
|
|
-// TeamBuyingDetail: teamBuyingDetail,
|
|
|
-// Images: strings.Join(images, ","),
|
|
|
-// Videos: strings.Join(videos, ","),
|
|
|
-// Documents: strings.Join(documents, ","),
|
|
|
-// VideoJobIds: strings.Join(videoJobIds, ","),
|
|
|
-// DocumentJobIds: strings.Join(documentJobIds, ","),
|
|
|
-// Status: 1,
|
|
|
-// }
|
|
|
-// err8 := dao.LocalLifeReviewDao{}.Create(newReviewLocal)
|
|
|
-// if err8 != nil {
|
|
|
-// return nil, err8
|
|
|
-// }
|
|
|
-//
|
|
|
-// t := time.Now()
|
|
|
-// updateLocal := entity.LocalLifeInfo{
|
|
|
-// LocalID: localId,
|
|
|
-// TaskStatus: 2,
|
|
|
-// UpdatedAt: t,
|
|
|
-// }
|
|
|
-// err9 := dao.LocalLifeDao{}.UpdateLocal(updateLocal)
|
|
|
-// if err9 != nil {
|
|
|
-// return nil, err9
|
|
|
-// }
|
|
|
-// return &localId, 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(localLifeOrigin.EnterpriseID)
|
|
|
+ infoAutoDefault := entity.InfoAutoDefault{}
|
|
|
+ infoAutoDefault = dao.InfoAutoDefaultDao{}.GetAutoDefaultLast(localLifeOrigin.EnterpriseID)
|
|
|
+
|
|
|
+ // 复制任务
|
|
|
+ localLifeNew := entity.LocalLifeInfo{
|
|
|
+ EnterpriseID: localLifeOrigin.EnterpriseID,
|
|
|
+ SubAccountID: localLifeOrigin.SubAccountID,
|
|
|
+ OperatorType: localLifeOrigin.OperatorType,
|
|
|
+ TaskStatus: 1,
|
|
|
+ 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,
|
|
|
+ Tools: localLifeOrigin.Tools,
|
|
|
+ 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) {
|
|
|
+ localId := localUpdateParam.LocalID
|
|
|
+
|
|
|
+ local, err := dao.LocalLifeDao{}.GetLocalById(localId)
|
|
|
+ if err != nil {
|
|
|
+ logrus.Errorf("[projectInfoDB service] call GetProject error,err:%+v", err)
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ localName := local.LocalName // 任务标题
|
|
|
+ localDetail := local.TaskDetail // 任务详情
|
|
|
+ store, err := dao.StoreDao{}.GetStoreByID(local.StoreID)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ storeName := store.StoreName // 门店名称
|
|
|
+ storeDetail := store.StoreDetail // 门店特点
|
|
|
+ storeMainPhoto, err1 := dao.ProductPhotoDAO{}.GetMainPhotoByStoreID(store.StoreID)
|
|
|
+ if err1 != nil {
|
|
|
+ return nil, err1
|
|
|
+ }
|
|
|
+ teamBuying, err2 := dao.TeamBuyingDao{}.GetTeamBuyingByID(local.TeamBuyingId)
|
|
|
+ if err2 != nil {
|
|
|
+ return nil, err2
|
|
|
+ }
|
|
|
+ teamBuyingName := teamBuying.TeamBuyingName // 团购标题
|
|
|
+ teamBuyingDetail := teamBuying.TeamBuyingDetail // 团购详情
|
|
|
+ teamBuyingMainPhoto, err3 := dao.ProductPhotoDAO{}.GetMainPhotoByTeamBuyingID(teamBuying.TeamBuyingID)
|
|
|
+ if err3 != nil {
|
|
|
+ return nil, err3
|
|
|
+ }
|
|
|
+ var images []string
|
|
|
+ var videos []string
|
|
|
+ var videoJobIds []string
|
|
|
+ var documents []string
|
|
|
+ var documentJobIds []string
|
|
|
+ reviewService := review_service.GetConfig()
|
|
|
+
|
|
|
+ storePhotos, err4 := dao.ProductPhotoDAO{}.GetProductPhotoByStoreID(local.StoreID)
|
|
|
+ if err4 != nil {
|
|
|
+ return nil, err4
|
|
|
+ }
|
|
|
+ for _, storePhoto := range storePhotos {
|
|
|
+ if storePhoto.Symbol == 2 || storePhoto.Symbol == 4 {
|
|
|
+ images = append(images, storePhoto.PhotoUrl)
|
|
|
+ } else if storePhoto.Symbol == 3 || storePhoto.Symbol == 5 {
|
|
|
+ var videoJobId *string
|
|
|
+ var reviewErr error
|
|
|
+ i := 10
|
|
|
+ for {
|
|
|
+ videoJobId, reviewErr = reviewService.CheckVideo(storePhoto.PhotoUrl)
|
|
|
+ if reviewErr == nil || i == 0 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ i -= 1
|
|
|
+ }
|
|
|
+ if reviewErr != nil {
|
|
|
+ return nil, reviewErr
|
|
|
+ }
|
|
|
+ videos = append(videos, storePhoto.PhotoUrl)
|
|
|
+ videoJobIds = append(videoJobIds, *videoJobId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ teamBuyingPhotos, err5 := dao.ProductPhotoDAO{}.GetProductPhotoByTeamBuyingID(local.TeamBuyingId)
|
|
|
+ if err5 != nil {
|
|
|
+ return nil, err5
|
|
|
+ }
|
|
|
+ for _, teamBuyingPhoto := range teamBuyingPhotos {
|
|
|
+ if teamBuyingPhoto.Symbol == 2 || teamBuyingPhoto.Symbol == 4 {
|
|
|
+ images = append(images, teamBuyingPhoto.PhotoUrl)
|
|
|
+ } else if teamBuyingPhoto.Symbol == 3 || teamBuyingPhoto.Symbol == 5 {
|
|
|
+ var videoJobId *string
|
|
|
+ var reviewErr error
|
|
|
+ i := 10
|
|
|
+ for {
|
|
|
+ videoJobId, reviewErr = reviewService.CheckVideo(teamBuyingPhoto.PhotoUrl)
|
|
|
+ if reviewErr == nil || i == 0 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ i -= 1
|
|
|
+ }
|
|
|
+ if reviewErr != nil {
|
|
|
+ return nil, reviewErr
|
|
|
+ }
|
|
|
+ videos = append(videos, teamBuyingPhoto.PhotoUrl)
|
|
|
+ videoJobIds = append(videoJobIds, *videoJobId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ localBriefInfos, err6 := dao.LocalLifeBriefDao{}.GetLocalBriefInfo(localId)
|
|
|
+ if err6 != nil {
|
|
|
+ return nil, err6
|
|
|
+ }
|
|
|
+ for _, localBriefInfo := range localBriefInfos {
|
|
|
+ if localBriefInfo.Type == 1 {
|
|
|
+ images = append(images, localBriefInfo.FileUrl)
|
|
|
+ } else if localBriefInfo.Type == 2 {
|
|
|
+ var documentJobId *string
|
|
|
+ var reviewErr error
|
|
|
+ i := 10
|
|
|
+ fileType := "pdf"
|
|
|
+ parts := strings.Split(localBriefInfo.FileName, ".")
|
|
|
+ if len(parts) > 1 {
|
|
|
+ fileType = parts[len(parts)-1]
|
|
|
+ }
|
|
|
+ for {
|
|
|
+ documentJobId, reviewErr = reviewService.CheckDocument(localBriefInfo.FileUrl, fileType)
|
|
|
+ if reviewErr == nil || i == 0 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ i -= 1
|
|
|
+ }
|
|
|
+ if reviewErr != nil {
|
|
|
+ return nil, reviewErr
|
|
|
+ }
|
|
|
+ documents = append(documents, localBriefInfo.FileUrl)
|
|
|
+ documentJobIds = append(documentJobIds, *documentJobId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ localMaterials, err7 := dao.LocalLifeMaterialDao{}.GetLocalMaterialInfo(localId)
|
|
|
+ if err7 != nil {
|
|
|
+ return nil, err7
|
|
|
+ }
|
|
|
+ for _, localMaterial := range localMaterials {
|
|
|
+ if localMaterial.Type == 1 {
|
|
|
+ images = append(images, localMaterial.FileUrl)
|
|
|
+ } else if localMaterial.Type == 2 {
|
|
|
+ var videoJobId *string
|
|
|
+ var reviewErr error
|
|
|
+ i := 10
|
|
|
+ for {
|
|
|
+ videoJobId, reviewErr = reviewService.CheckVideo(localMaterial.FileUrl)
|
|
|
+ if reviewErr == nil || i == 0 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ i -= 1
|
|
|
+ }
|
|
|
+ if reviewErr != nil {
|
|
|
+ return nil, reviewErr
|
|
|
+ }
|
|
|
+ videos = append(videos, localMaterial.FileUrl)
|
|
|
+ videoJobIds = append(videoJobIds, *videoJobId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ newReviewLocal := &entity.ReviewLocalLife{
|
|
|
+ LocalID: localId,
|
|
|
+ TaskName: localName,
|
|
|
+ TaskDetail: localDetail,
|
|
|
+ StoreMainPhoto: storeMainPhoto,
|
|
|
+ StoreName: storeName,
|
|
|
+ StoreDetail: storeDetail,
|
|
|
+ TeamBuyingMainPhoto: teamBuyingMainPhoto,
|
|
|
+ TeamBuyingName: teamBuyingName,
|
|
|
+ TeamBuyingDetail: teamBuyingDetail,
|
|
|
+ Images: strings.Join(images, ","),
|
|
|
+ Videos: strings.Join(videos, ","),
|
|
|
+ Documents: strings.Join(documents, ","),
|
|
|
+ VideoJobIds: strings.Join(videoJobIds, ","),
|
|
|
+ DocumentJobIds: strings.Join(documentJobIds, ","),
|
|
|
+ Status: 1,
|
|
|
+ }
|
|
|
+ err8 := dao.LocalLifeReviewDao{}.Create(newReviewLocal)
|
|
|
+ if err8 != nil {
|
|
|
+ return nil, err8
|
|
|
+ }
|
|
|
+
|
|
|
+ t := time.Now()
|
|
|
+ updateLocal := entity.LocalLifeInfo{
|
|
|
+ LocalID: localId,
|
|
|
+ TaskStatus: 2,
|
|
|
+ SubmitAt: t,
|
|
|
+ UpdatedAt: t,
|
|
|
+ }
|
|
|
+ err9 := dao.LocalLifeDao{}.UpdateLocal(updateLocal)
|
|
|
+ if err9 != nil {
|
|
|
+ return nil, err9
|
|
|
+ }
|
|
|
+ return &localId, nil
|
|
|
+}
|
|
|
|
|
|
// 本地生活任务列表
|
|
|
func (s LocalLifeService) GetLocalLifeTaskList(param *vo.LocalSearchParam) (vo.ResultVO, error) {
|
|
@@ -841,6 +992,35 @@ func (s LocalLifeService) DeleteLocalLife(localId string) (*string, error) {
|
|
|
return res, nil
|
|
|
}
|
|
|
|
|
|
+// 结束本地生活任务
|
|
|
+func (s LocalLifeService) CloseLocalLife(localId string) (string, error) {
|
|
|
+ // 任务待办:待审核、待支付、达人未处理、初稿待审、链接待审、待结算 (待发货、待签收) 达人待预约探店时间、探店时间待确认、达人待探店 未传初稿、未发作品、未传数据
|
|
|
+ // 合作待办:可邀约、邀约中、合作中
|
|
|
+ localLife, err := dao.LocalLifeDao{}.GetLocalById(localId)
|
|
|
+ if err != nil {
|
|
|
+ return "0", err
|
|
|
+ }
|
|
|
+ if localLife == nil {
|
|
|
+ return "0", errors.New("任务不存在")
|
|
|
+ }
|
|
|
+ var needProcess int64
|
|
|
+ if localLife.TaskStatus == 4 || localLife.TaskStatus == 8 {
|
|
|
+ // 达人未处理 or 物流待办 or 初稿待审、链接待审、待结算
|
|
|
+ _ = dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? and (task_status = ? or task_stage < ?)", localId, 1, 15).Count(&needProcess).Error // task_status=1待选
|
|
|
+ }
|
|
|
+ if localLife.TaskStatus == 2 || localLife.TaskStatus == 4 || needProcess > 0 {
|
|
|
+ // 存在待办不可结束
|
|
|
+ return "1", nil
|
|
|
+ } else {
|
|
|
+ err := dao.LocalLifeDao{}.UpdateLocal(entity.LocalLifeInfo{
|
|
|
+ LocalID: localId,
|
|
|
+ TaskStatus: 10,
|
|
|
+ UpdatedAt: time.Now(),
|
|
|
+ })
|
|
|
+ return "0", err
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 草稿箱——本地生活
|
|
|
func (s LocalLifeService) GetLocalLifeDraftList(param *vo.LocalDraftParam) (vo.ResultVO, error) {
|
|
|
if param.Page == 0 {
|
|
@@ -959,34 +1139,27 @@ func (s LocalLifeService) GetStoreExploreInfo(param *vo.StoreExploreParam) (*vo.
|
|
|
var err error
|
|
|
localLifeId := param.LocalLifeId
|
|
|
if param.Status == 1 { // 待预约
|
|
|
- localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 1, "", param.Page, param.PageSize)
|
|
|
+ localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 4, "", param.Page, param.PageSize)
|
|
|
} else if param.Status == 2 { // 待确认
|
|
|
- localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 2, param.SearchTime, param.Page, param.PageSize)
|
|
|
- } else if param.Status == 3 { // 待探店
|
|
|
localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 5, param.SearchTime, param.Page, param.PageSize)
|
|
|
+ } else if param.Status == 3 { // 待探店
|
|
|
+ localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByBookStatus(localLifeId, 5, param.SearchTime, param.Page, param.PageSize)
|
|
|
} else if param.Status == 4 { // 已探店
|
|
|
- localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByTaskStage(localLifeId, 6, param.SearchTime, param.Page, param.PageSize)
|
|
|
+ localLifeTaskInfos, total, err = dao.LocalLifeTaskInfoDao{}.GetListByBookStatus(localLifeId, 6, param.SearchTime, param.Page, param.PageSize)
|
|
|
}
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
for _, localLifeTaskInfo := range localLifeTaskInfos {
|
|
|
// 获取达人信息
|
|
|
- talentInfo, err := dao.TalentInfoDao{}.SelectTalentInfo(localLifeTaskInfo.TalentID)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
- //regionName, err := dao.RegionInfoDao{}.SelectRegion(talentInfo.VisitStoreRegion)
|
|
|
- //if err != nil {
|
|
|
- // regionName = ""
|
|
|
- //}
|
|
|
- regionName := localLifeTaskInfo.City
|
|
|
+ platformKuaishouUserInfo, _ := dao.PlatformKuaishouUserInfoDao{}.GetUserInfo(localLifeTaskInfo.OpenID)
|
|
|
talentPreview := &vo.TalentPreview{
|
|
|
TalentId: localLifeTaskInfo.TalentID,
|
|
|
- TalentPhoto: talentInfo.Avatar,
|
|
|
- TalentName: talentInfo.TalentWxNickname,
|
|
|
- Account: "",
|
|
|
- Location: regionName,
|
|
|
+ TalentPhoto: platformKuaishouUserInfo.HeadUri,
|
|
|
+ TalentName: platformKuaishouUserInfo.NickName,
|
|
|
+ Account: platformKuaishouUserInfo.OpenID,
|
|
|
+ Location: platformKuaishouUserInfo.City,
|
|
|
+ Gender: platformKuaishouUserInfo.Gender,
|
|
|
}
|
|
|
reStoreExploreTalent := &vo.ReStoreExploreTalent{
|
|
|
ReTalentPreview: talentPreview,
|
|
@@ -1014,6 +1187,25 @@ func (s LocalLifeService) GetStoreExploreInfo(param *vo.StoreExploreParam) (*vo.
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
+// 探店达人列表角标
|
|
|
+func (t LocalLifeService) StoreExploreInfoCount(param *vo.StoreExploreParam) map[string]int64 {
|
|
|
+ res := make(map[string]int64)
|
|
|
+ var needBook int64
|
|
|
+ var needConfirm int64
|
|
|
+ var needExplore int64
|
|
|
+ var explored int64
|
|
|
+ dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", param.LocalLifeId, 4).Count(&needBook)
|
|
|
+ dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND task_stage = ?", param.LocalLifeId, 5).Count(&needConfirm)
|
|
|
+ dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND book_status = ?", param.LocalLifeId, 5).Count(&needExplore)
|
|
|
+ dao.Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id = ? AND book_status = ?", param.LocalLifeId, 6).Count(&explored)
|
|
|
+ res["needBook"] = needBook
|
|
|
+ res["needConfirm"] = needConfirm
|
|
|
+ res["needExplore"] = needExplore
|
|
|
+ res["explored"] = explored
|
|
|
+
|
|
|
+ return res
|
|
|
+}
|
|
|
+
|
|
|
// 终止合作
|
|
|
func (s LocalLifeService) StoreExploreOver(param *vo.LocalTalentOperateParam) (*string, error) {
|
|
|
taskId := param.TaskId
|
|
@@ -1025,13 +1217,8 @@ func (s LocalLifeService) StoreExploreOver(param *vo.LocalTalentOperateParam) (*
|
|
|
"terminate_reason": param.Reason,
|
|
|
"terminate_time": time.Now(),
|
|
|
}
|
|
|
- if param.SubAccountId == 0 {
|
|
|
- updateData["terminate_operator_type"] = 1
|
|
|
- updateData["terminate_operator"] = param.EnterpriseId
|
|
|
- } else {
|
|
|
- updateData["terminate_operator_type"] = 2
|
|
|
- updateData["terminate_operator"] = param.SubAccountId
|
|
|
- }
|
|
|
+ updateData["terminate_operator_type"] = 3
|
|
|
+ updateData["terminate_operator"] = ""
|
|
|
err := dao.LocalLifeTaskInfoDao{}.UpdateField(param.TaskId, updateData)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
@@ -1070,20 +1257,17 @@ func (s LocalLifeService) StoreExploreOperate(param *vo.LocalTalentOperateParam)
|
|
|
} else {
|
|
|
return errors.New("status error")
|
|
|
}
|
|
|
- if param.SubAccountId == 0 {
|
|
|
- bookinfoNew.BOperatorType = 1
|
|
|
- bookinfoNew.BOperator = param.EnterpriseId
|
|
|
- } else {
|
|
|
- bookinfoNew.BOperatorType = 2
|
|
|
- bookinfoNew.BOperator = strconv.FormatInt(param.SubAccountId, 10)
|
|
|
- }
|
|
|
+ bookinfoNew.BOperatorType = 3
|
|
|
+ bookinfoNew.BOperator = ""
|
|
|
err1 := dao.BookInfoDao{}.UpdateBookStatus(bookIds, bookinfoNew)
|
|
|
if err1 != nil {
|
|
|
return err1
|
|
|
}
|
|
|
if param.Status == 1 {
|
|
|
err2 := dao.LocalLifeTaskInfoDao{}.UpdateLocalStatus(taskIds, entity.LocalLifeTaskInfo{
|
|
|
- TaskStage: 7,
|
|
|
+ TaskStage: 7,
|
|
|
+ BookStatus: 5,
|
|
|
+ ExploreTime: time.Now(),
|
|
|
})
|
|
|
if err2 != nil {
|
|
|
return err2
|
|
@@ -1092,3 +1276,175 @@ func (s LocalLifeService) StoreExploreOperate(param *vo.LocalTalentOperateParam)
|
|
|
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+// 本地生活任务待办
|
|
|
+func (p LocalLifeService) GetTaskToDo(enterpriseId string, subAccountId int64, taskType int64) (map[string]map[string]int64, error) {
|
|
|
+ res := make(map[string]map[string]int64)
|
|
|
+ redbook, err1 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 1, taskType)
|
|
|
+ if err1 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err1)
|
|
|
+ return res, err1
|
|
|
+ }
|
|
|
+ douyin, err2 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 2, taskType)
|
|
|
+ if err2 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err2)
|
|
|
+ return res, err2
|
|
|
+ }
|
|
|
+ kuaishou, err3 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 4, taskType)
|
|
|
+ if err3 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err3)
|
|
|
+ return res, err3
|
|
|
+ }
|
|
|
+ weibo, err4 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 3, taskType)
|
|
|
+ if err4 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err4)
|
|
|
+ return res, err4
|
|
|
+ }
|
|
|
+ bilibili, err5 := dao.LocalLifeDao{}.GetLocalLifeToDo(enterpriseId, subAccountId, 5, taskType)
|
|
|
+ if err5 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err5)
|
|
|
+ return res, err5
|
|
|
+ }
|
|
|
+ all := make(map[string]int64)
|
|
|
+ all["needReview"] = redbook["needReview"] + douyin["needReview"] + kuaishou["needReview"] + weibo["needReview"] + bilibili["needReview"]
|
|
|
+ all["needPay"] = redbook["needPay"] + douyin["needPay"] + kuaishou["needPay"] + weibo["needPay"] + bilibili["needPay"]
|
|
|
+ all["needProcess"] = redbook["needProcess"] + douyin["needProcess"] + kuaishou["needProcess"] + weibo["needProcess"] + bilibili["needProcess"]
|
|
|
+ all["needCheck"] = redbook["needCheck"] + douyin["needCheck"] + kuaishou["needCheck"] + weibo["needCheck"] + bilibili["needCheck"]
|
|
|
+ all["needQuality"] = redbook["needQuality"] + douyin["needQuality"] + kuaishou["needQuality"] + weibo["needQuality"] + bilibili["needQuality"]
|
|
|
+ all["needCalculate"] = redbook["needCalculate"] + douyin["needCalculate"] + kuaishou["needCalculate"] + weibo["needCalculate"] + bilibili["needCalculate"]
|
|
|
+ res["redbook"] = redbook
|
|
|
+ res["douyin"] = douyin
|
|
|
+ res["kuaishou"] = kuaishou
|
|
|
+ res["weibo"] = weibo
|
|
|
+ res["bilibili"] = bilibili
|
|
|
+ res["all"] = all
|
|
|
+
|
|
|
+ return res, nil
|
|
|
+}
|
|
|
+
|
|
|
+// 探店邀约任务待办
|
|
|
+func (p LocalLifeService) GetExploreToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
|
|
|
+ res := make(map[string]map[string]int64)
|
|
|
+ redbook, err1 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 1)
|
|
|
+ if err1 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err1)
|
|
|
+ return res, err1
|
|
|
+ }
|
|
|
+ douyin, err2 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 2)
|
|
|
+ if err2 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err2)
|
|
|
+ return res, err2
|
|
|
+ }
|
|
|
+ kuaishou, err3 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 4)
|
|
|
+ if err3 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err3)
|
|
|
+ return res, err3
|
|
|
+ }
|
|
|
+ weibo, err4 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 3)
|
|
|
+ if err4 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err4)
|
|
|
+ return res, err4
|
|
|
+ }
|
|
|
+ bilibili, err5 := dao.LocalLifeDao{}.GetExploreToDo(enterpriseId, subAccountId, 5)
|
|
|
+ if err5 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err5)
|
|
|
+ return res, err5
|
|
|
+ }
|
|
|
+ all := make(map[string]int64)
|
|
|
+ all["needBook"] = redbook["needBook"] + douyin["needBook"] + kuaishou["needBook"] + weibo["needBook"] + bilibili["needBook"]
|
|
|
+ all["needConfirm"] = redbook["needConfirm"] + douyin["needConfirm"] + kuaishou["needConfirm"] + weibo["needConfirm"] + bilibili["needConfirm"]
|
|
|
+ all["needExplore"] = redbook["needExplore"] + douyin["needExplore"] + kuaishou["needExplore"] + weibo["needExplore"] + bilibili["needExplore"]
|
|
|
+ res["redbook"] = redbook
|
|
|
+ res["douyin"] = douyin
|
|
|
+ res["kuaishou"] = kuaishou
|
|
|
+ res["weibo"] = weibo
|
|
|
+ res["bilibili"] = bilibili
|
|
|
+ res["all"] = all
|
|
|
+
|
|
|
+ return res, nil
|
|
|
+}
|
|
|
+
|
|
|
+// 违约管理任务待办
|
|
|
+func (p LocalLifeService) GetDefaultToDo(enterpriseId string, subAccountId int64, taskType int64) (map[string]map[string]int64, error) {
|
|
|
+ res := make(map[string]map[string]int64)
|
|
|
+ redbook, err1 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 1, taskType)
|
|
|
+ if err1 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err1)
|
|
|
+ return res, err1
|
|
|
+ }
|
|
|
+ douyin, err2 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 2, taskType)
|
|
|
+ if err2 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err2)
|
|
|
+ return res, err2
|
|
|
+ }
|
|
|
+ kuaishou, err3 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 4, taskType)
|
|
|
+ if err3 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err3)
|
|
|
+ return res, err3
|
|
|
+ }
|
|
|
+ weibo, err4 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 3, taskType)
|
|
|
+ if err4 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err4)
|
|
|
+ return res, err4
|
|
|
+ }
|
|
|
+ bilibili, err5 := dao.LocalLifeDao{}.GetDefaultToDo(enterpriseId, subAccountId, 5, taskType)
|
|
|
+ if err5 != nil {
|
|
|
+ logrus.Errorf("[GetLocalLifeToDo service] call GetLocalLifeToDo error,err:%+v", err5)
|
|
|
+ return res, err5
|
|
|
+ }
|
|
|
+ all := make(map[string]int64)
|
|
|
+ all["noSketch"] = redbook["noSketch"] + douyin["noSketch"] + kuaishou["noSketch"] + weibo["noSketch"] + bilibili["noSketch"]
|
|
|
+ all["noWork"] = redbook["noWork"] + douyin["noWork"] + kuaishou["noWork"] + weibo["noWork"] + bilibili["noWork"]
|
|
|
+ all["noData"] = redbook["noData"] + douyin["noData"] + kuaishou["noData"] + weibo["noData"] + bilibili["noData"]
|
|
|
+ all["cooperateOver"] = redbook["cooperateOver"] + douyin["cooperateOver"] + kuaishou["cooperateOver"] + weibo["cooperateOver"] + bilibili["cooperateOver"]
|
|
|
+ res["redbook"] = redbook
|
|
|
+ res["douyin"] = douyin
|
|
|
+ res["kuaishou"] = kuaishou
|
|
|
+ res["weibo"] = weibo
|
|
|
+ res["bilibili"] = bilibili
|
|
|
+ res["all"] = all
|
|
|
+
|
|
|
+ return res, nil
|
|
|
+}
|
|
|
+
|
|
|
+// 合作待办-任务邀约
|
|
|
+func (p LocalLifeService) GetTaskInviteToDo(enterpriseId string, subAccountId int64) (map[string]map[string]int64, error) {
|
|
|
+ res := make(map[string]map[string]int64)
|
|
|
+ redbook, err1 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 1)
|
|
|
+ if err1 != nil {
|
|
|
+ logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err1)
|
|
|
+ return res, err1
|
|
|
+ }
|
|
|
+ douyin, err2 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 2)
|
|
|
+ if err2 != nil {
|
|
|
+ logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err2)
|
|
|
+ return res, err2
|
|
|
+ }
|
|
|
+ kuaishou, err3 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 4)
|
|
|
+ if err3 != nil {
|
|
|
+ logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err3)
|
|
|
+ return res, err3
|
|
|
+ }
|
|
|
+ weibo, err4 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 3)
|
|
|
+ if err4 != nil {
|
|
|
+ logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err4)
|
|
|
+ return res, err4
|
|
|
+ }
|
|
|
+ bilibili, err5 := dao.LocalLifeDao{}.GetTaskInviteToDo(enterpriseId, subAccountId, 5)
|
|
|
+ if err5 != nil {
|
|
|
+ logrus.Errorf("[GetTaskInviteToDo service] call GetTaskInviteToDo error,err:%+v", err5)
|
|
|
+ return res, err5
|
|
|
+ }
|
|
|
+ all := make(map[string]int64)
|
|
|
+ all["availInvitationNum"] = redbook["availInvitationNum"] + douyin["availInvitationNum"] + kuaishou["availInvitationNum"] + weibo["availInvitationNum"] + bilibili["availInvitationNum"]
|
|
|
+ all["invitingNum"] = redbook["invitingNum"] + douyin["invitingNum"] + kuaishou["invitingNum"] + weibo["invitingNum"] + bilibili["invitingNum"]
|
|
|
+ all["cooperatingNum"] = redbook["cooperatingNum"] + douyin["cooperatingNum"] + kuaishou["cooperatingNum"] + weibo["cooperatingNum"] + bilibili["cooperatingNum"]
|
|
|
+ res["redbook"] = redbook
|
|
|
+ res["douyin"] = douyin
|
|
|
+ res["kuaishou"] = kuaishou
|
|
|
+ res["weibo"] = weibo
|
|
|
+ res["bilibili"] = bilibili
|
|
|
+ res["all"] = all
|
|
|
+
|
|
|
+ return res, nil
|
|
|
+}
|