|
@@ -591,3 +591,83 @@ func (d LocalLifeDao) GetLocalLifeFinished(enterpriseId string, invoiceStatus in
|
|
|
}
|
|
|
return localLifeAmount, err
|
|
|
}
|
|
|
+
|
|
|
+// 合作待办-任务邀约
|
|
|
+func (d LocalLifeDao) GetTaskInviteToDo(enterpriseId string, subAccountId int64, platform int64) (map[string]int64, error) {
|
|
|
+ resultMap := make(map[string]int64)
|
|
|
+ var availInvitationNum int64 //
|
|
|
+ var invitingNum int64 //
|
|
|
+ var cooperatingNum 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["availInvitationNum"] = availInvitationNum
|
|
|
+ resultMap["invitingNum"] = invitingNum
|
|
|
+ resultMap["cooperatingNum"] = cooperatingNum
|
|
|
+
|
|
|
+ return resultMap, nil
|
|
|
+}
|