Browse Source

专项产业调研在我的日程数量中展示

xingzai 2 years ago
parent
commit
4cb416a5e5
2 changed files with 28 additions and 0 deletions
  1. 14 0
      controllers/user.go
  2. 14 0
      services/activity_special.go

+ 14 - 0
controllers/user.go

@@ -227,6 +227,11 @@ func (this *UserController) Detail() {
 			br.ErrMsg = "获取信息失败,Err:" + err.Error()
 			return
 		}
+		if detail == nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:用户不存在"
+			return
+		}
 
 		userRecord, _ := models.GetUserRecordByUserId(uid, utils.WxPlatform)
 		if userRecord != nil {
@@ -280,6 +285,15 @@ func (this *UserController) Detail() {
 				//}
 				detail.SellerName = companyItem.SellerName
 				detail.SellerMobile = companyItem.Mobile
+
+				tatolSpecil, err := services.GetSpecialTripUserSchedule(user.UserId)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+					return
+				}
+				detail.ScheduleNum += tatolSpecil
+
 			} else {
 				hasPermission = 1
 			}

+ 14 - 0
services/activity_special.go

@@ -359,6 +359,20 @@ func GetSpecialTripUserMap(activityIds []int, userId int) (mapUserId map[int]int
 	return
 }
 
+//获取用户已经报名的活动数量
+func GetSpecialTripUserSchedule(userId int) (total int, err error) {
+	var condition string
+	var pars []interface{}
+
+	condition += ` AND t.user_id = ? AND t.is_cancel = 0 `
+	pars = append(pars, userId)
+	condition += ` AND a.activity_time_end >= ? `
+	pars = append(pars, time.Now())
+	condition += ` AND is_valid = 1 `
+	total, err = models.GetActivitySpecialTripCountByActivitySpecial(condition, pars)
+	return
+}
+
 //GetActivitySpecialList 获取专项调研列表
 func GetActivitySpecialList(user *models.WxUserItem, currentIndex, pageSize int, keywords string) (list []*models.CygxActivitySpecialDetail, total int, err error) {
 	listConfirm, totalConfirm, e := GetActivityLabelSpecialConfirmList(user, (currentIndex-1)*pageSize, pageSize, 4, keywords)