|
@@ -315,7 +315,7 @@ func (d LocalLifeDao) GetBillLocalPreviews(param *vo.LocalSearchParam) ([]vo.ReB
|
|
|
return reBillLocalTaskPreviews, total, nil
|
|
|
}
|
|
|
|
|
|
-// 待办
|
|
|
+// 本地生活任务待办
|
|
|
func (d LocalLifeDao) GetLocalLifeToDo(enterpriseId string, subAccountId int64, platform int64, taskType int64) (map[string]int64, error) {
|
|
|
resultMap := make(map[string]int64)
|
|
|
var needReview int64 // 待审核
|
|
@@ -409,3 +409,83 @@ func (d LocalLifeDao) GetLocalLifeToDo(enterpriseId string, subAccountId int64,
|
|
|
resultMap["needCalculate"] = needCalculate
|
|
|
return resultMap, nil
|
|
|
}
|
|
|
+
|
|
|
+// 探店邀约任务待办
|
|
|
+func (d LocalLifeDao) GetExploreToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
|
|
|
+ resultMap := make(map[string]int64)
|
|
|
+ var needBook int64 // 待预约探店时间
|
|
|
+ var needConfirm int64 // 探店时间待确认
|
|
|
+ var needExplore int64 // 达人待探店
|
|
|
+ var localInfos []entity.LocalLifeInfo
|
|
|
+ //query := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and local_type = ?", enterpriseId, platform, taskType)
|
|
|
+ if subAccountId == 0 {
|
|
|
+ // 待预约探店时间、探店时间待确认、达人待探店
|
|
|
+ query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and task_form = ?", enterpriseId, platform, 1)
|
|
|
+ err := query1.Where("task_status = ?", 8).Select("local_id").Find(&localInfos).Error
|
|
|
+ if err != nil {
|
|
|
+ if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
+ needBook = 0
|
|
|
+ needConfirm = 0
|
|
|
+ needExplore = 0
|
|
|
+ } else {
|
|
|
+ return resultMap, err
|
|
|
+ }
|
|
|
+ } else if len(localInfos) > 0 {
|
|
|
+ var localIDs []string
|
|
|
+ for _, info := range localInfos {
|
|
|
+ localIDs = append(localIDs, info.LocalID)
|
|
|
+ }
|
|
|
+ if len(localIDs) > 0 {
|
|
|
+ err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 4).Count(&needBook).Error // task_stage=4待预约探店
|
|
|
+ if err1 != nil {
|
|
|
+ needBook = 0
|
|
|
+ }
|
|
|
+ err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 5).Count(&needConfirm).Error // task_stage=4预约确认中
|
|
|
+ if err2 != nil {
|
|
|
+ needConfirm = 0
|
|
|
+ }
|
|
|
+ err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and book_status = ?", localIDs, 5).Count(&needExplore).Error // book_status=5达人待探店
|
|
|
+ if err3 != nil {
|
|
|
+ needExplore = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 待预约探店时间、探店时间待确认、达人待探店
|
|
|
+ query1 := Db.Model(&entity.LocalLifeInfo{}).Where("enterprise_id = ? and local_platform = ? and task_form = ?", enterpriseId, platform, 1)
|
|
|
+ err := query1.Where("sub_account_id = ? and task_status = ?", subAccountId, 8).Select("local_id").Find(&localInfos).Error
|
|
|
+ if err != nil {
|
|
|
+ if errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
+ needBook = 0
|
|
|
+ needConfirm = 0
|
|
|
+ needExplore = 0
|
|
|
+ } else {
|
|
|
+ return resultMap, err
|
|
|
+ }
|
|
|
+ } else if len(localInfos) > 0 {
|
|
|
+ var localIDs []string
|
|
|
+ for _, info := range localInfos {
|
|
|
+ localIDs = append(localIDs, info.LocalID)
|
|
|
+ }
|
|
|
+ if len(localIDs) > 0 {
|
|
|
+ err1 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 4).Count(&needBook).Error // task_stage=4待预约探店
|
|
|
+ if err1 != nil {
|
|
|
+ needBook = 0
|
|
|
+ }
|
|
|
+ err2 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and task_stage = ?", localIDs, 5).Count(&needConfirm).Error // task_stage=4预约确认中
|
|
|
+ if err2 != nil {
|
|
|
+ needConfirm = 0
|
|
|
+ }
|
|
|
+ err3 := Db.Model(&entity.LocalLifeTaskInfo{}).Where("local_id in ? and book_status = ?", localIDs, 5).Count(&needExplore).Error // book_status=5达人待探店
|
|
|
+ if err3 != nil {
|
|
|
+ needExplore = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resultMap["needBook"] = needBook
|
|
|
+ resultMap["needConfirm"] = needConfirm
|
|
|
+ resultMap["needExplore"] = needExplore
|
|
|
+
|
|
|
+ return resultMap, nil
|
|
|
+}
|