|
@@ -2,6 +2,7 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_clpt/models"
|
|
|
"hongze/hongze_clpt/services"
|
|
@@ -120,6 +121,8 @@ func (this *ActivityController) LabelTypeList() {
|
|
|
// @Param KeyWord query string false "搜索关键词 多个用 , 隔开"
|
|
|
// @Param ActivityId query int false "活动列表传过来的活动ID"
|
|
|
// @Param Filter query int false "筛选条件 0:全部 1:视频 2:音频"
|
|
|
+// @Param IsExternalLabel query int false "是否仅展示外部资源 1:是、0:否 默认0"
|
|
|
+// @Param IsResearchPoints query int false "是否仅展示研选扣点 1:是、0:否 默认0"
|
|
|
// @Success 200 {object} models.GetCygxActivityListRep
|
|
|
// @router /list [get]
|
|
|
func (this *ActivityController) ActivityListNew() {
|
|
@@ -147,7 +150,16 @@ func (this *ActivityController) ActivityListNew() {
|
|
|
keyWord := this.GetString("KeyWord")
|
|
|
playBack, _ := this.GetInt("PlayBack")
|
|
|
filter, _ := this.GetInt("Filter")
|
|
|
- activityId, _ := this.GetInt("ActivityId") // 仅用于判断【新】标签
|
|
|
+ activityId, _ := this.GetInt("ActivityId") // 仅用于判断【新】标签
|
|
|
+ isExternalLabel, _ := this.GetInt("IsExternalLabel") //
|
|
|
+ isResearchPoints, _ := this.GetInt("IsResearchPoints") //
|
|
|
+
|
|
|
+ if isExternalLabel == 1 {
|
|
|
+
|
|
|
+ }
|
|
|
+ if isResearchPoints == 1 {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
var startSize int
|
|
|
if pageSize <= 0 {
|
|
@@ -658,6 +670,22 @@ func (this *ActivityController) SignupAdd() {
|
|
|
}
|
|
|
activityId := req.ActivityId
|
|
|
signupType := req.SignupType
|
|
|
+ email := req.Email
|
|
|
+
|
|
|
+ //如果用户传了邮箱就绑定邮箱
|
|
|
+ if email != "" && user.Email == "" {
|
|
|
+ if !utils.ValidateEmailFormatat(req.Email) {
|
|
|
+ br.Msg = "邮箱格式错误,请重新输入"
|
|
|
+ br.ErrMsg = "邮箱格式错误,请重新输入"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ user.Email = req.Email
|
|
|
+ err = models.UpdateUserEmail(email, uid)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "绑定客户邮箱失败!"
|
|
|
+ }
|
|
|
+ }
|
|
|
hasPermission := 0
|
|
|
if signupType == 1 && user.Mobile == "" && user.OutboundMobile == "" {
|
|
|
resp.GoBindEmail = true
|
|
@@ -711,6 +739,18 @@ func (this *ActivityController) SignupAdd() {
|
|
|
br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ popupMsg, err := services.CheckActivityUserAll(activityInfo, user)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "报名失败!"
|
|
|
+ br.ErrMsg = "CheckActivityUserAll,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if popupMsg != "" {
|
|
|
+ br.Msg = "报名失败!"
|
|
|
+ br.ErrMsg = fmt.Sprint("userId:", uid, "Activity:id", popupMsg)
|
|
|
+ return
|
|
|
+ }
|
|
|
//人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
|
|
|
//如果是下面几种情况则对报名信息做判断限制 (公司调研电话会(限制人数)、公司线下调研、专家/分析师线下沙龙)
|
|
|
//if (activityInfo.ActivityTypeId == 3 && activityInfo.IsLimitPeople == 1) || activityInfo.ActivityTypeId > 3 {
|
|
@@ -2025,3 +2065,93 @@ func (this *ActivityController) ScheduleList() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 活动报名之前的校验(权限、时间、点数、邮箱)
|
|
|
+// @Description 活动报名之前的校验(权限、时间、点数、邮箱)接口
|
|
|
+// @Param request body models.ActivityIdRep true "type json string"
|
|
|
+// @Success Ret=200 {object} models.SignupStatus
|
|
|
+// @router /check [post]
|
|
|
+func (this *ActivityController) Check() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req models.ActivityIdRep
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ activityId := req.ActivityId
|
|
|
+ activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
|
|
|
+ if activityInfo == nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if errInfo != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + errInfo.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //这里的文案顺序提示 权限>时间>研选扣点>邮箱绑定。
|
|
|
+ resp := new(models.ActivityCheck)
|
|
|
+ hasPermission := 0
|
|
|
+ havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.IsResearchSpecial = isResearchSpecial
|
|
|
+ if havePower {
|
|
|
+ hasPermission = 1
|
|
|
+ resp.CheckPermission = true
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
+ } else {
|
|
|
+ hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.PopupMsg = popupMsg
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
+ resp.SellerName = sellerName
|
|
|
+ resp.SellerMobile = sellerMobile
|
|
|
+ }
|
|
|
+ if resp.CheckPermission {
|
|
|
+ //如果权限通过了校验,那么就来校验时间
|
|
|
+ resp.CheckTime, resp.PopupMsg = services.CheckSiginupDeadline(activityInfo)
|
|
|
+ }
|
|
|
+ if resp.CheckTime {
|
|
|
+ // 如果时间通过校验就校验点数
|
|
|
+ resp.CheckPoints, resp.PopupMsg, resp.CompanyPoints, resp.ActivityPoints, err = services.CheckActivityPoints(activityInfo, user)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "CheckActivityPoints,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if resp.CheckPoints {
|
|
|
+ //如果通过点数的校验,就来校验邮箱
|
|
|
+ resp.CheckEmail, resp.PopupMsg = services.CheckActivityUserEmail(activityInfo, user)
|
|
|
+ }
|
|
|
+ // 判断是否属于研选类型的活动
|
|
|
+ if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
|
+ resp.IsResearch = true
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Data = resp
|
|
|
+}
|