xingzai 10 miesięcy temu
rodzic
commit
88cde77957
3 zmienionych plików z 29 dodań i 1 usunięć
  1. 9 1
      controllers/activity.go
  2. 1 0
      models/activity.go
  3. 19 0
      services/activity_signup.go

+ 9 - 1
controllers/activity.go

@@ -1909,6 +1909,7 @@ func (this *ActivityCoAntroller) Check() {
 		resp.HasPermission = hasPermission
 		resp.SellerName = sellerName
 		resp.SellerMobile = sellerMobile
+		resp.IsShowWxPay = utils.IS_SHOW_WX_PAY //是否展示微信支付按钮
 	}
 	if resp.CheckPermission {
 		//如果权限通过了校验,那么就来校验时间
@@ -1931,10 +1932,17 @@ func (this *ActivityCoAntroller) Check() {
 		for _, v := range resp.GoodsList {
 			resp.PopupPriceMsg += v.PopupPriceMsg //价格弹窗信息
 		}
-		resp.IsShowWxPay = utils.IS_SHOW_WX_PAY                                                      //是否展示微信支付按钮
 		resp.IsCompanyApply = services.GetUserApplyRecordCountByCompanyIdPay(user.CompanyId)         //获取客户是否有过历史申请记录
 		resp.IsNeedBusinessCard = services.GetCygxUserBusinessCardCount(user.UserId, user.CompanyId) //是否需要上传名片
 	}
+
+	resp.CheckSiginUpNum, resp.PopupMsg, err = services.CheckActivityUserSiginUpNum(activityInfo) // 校验人数是否已满
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "CheckActivityUserSiginUp,Err:" + err.Error()
+		return
+	}
+
 	// 判断是否属于研选类型的活动
 	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 		resp.IsResearch = true

+ 1 - 0
models/activity.go

@@ -85,6 +85,7 @@ type ActivityCheck struct {
 	CheckTime          bool                   `description:"时间是否通过校验"`
 	CheckEmail         bool                   `description:"邮箱是否通过校验"`
 	CheckPoints        bool                   `description:"扣点是否通过校验"`
+	CheckSiginUpNum    bool                   `description:"报名人数是否通过校验"`
 	CompanyPoints      string                 `description:"公司剩余点数"`
 	ActivityPoints     string                 `description:"本场活动要扣除的点数"`
 	PopupPriceMsg      string                 `description:"价格弹窗信息"`

+ 19 - 0
services/activity_signup.go

@@ -199,3 +199,22 @@ func CheckActivityUserAll(activityInfo *models.ActivityDetail, wxUser *models.Wx
 	}
 	return
 }
+
+// 校验是否人员已满
+func CheckActivityUserSiginUpNum(activityInfo *models.ActivityDetail) (checkSiginUpNum bool, popupMsg string, err error) {
+	checkSiginUpNum = true
+	if activityInfo.IsLimitPeople == 0 {
+		return
+	}
+	signupCount, e := models.GetActivitySignupSuccessByUserCountNoHz(activityInfo.ActivityId)
+	if e != nil {
+		err = errors.New("GetCygxActivityPointsSetDetail" + e.Error())
+		return
+	}
+	if signupCount >= activityInfo.LimitPeopleNum {
+		checkSiginUpNum = false
+		popupMsg = "此活动报名人数已满,请留意下期活动"
+		return
+	}
+	return
+}