Browse Source

no message

xingzai 1 year ago
parent
commit
aa96fd8049
4 changed files with 89 additions and 0 deletions
  1. 66 0
      controllers/activity.go
  2. 12 0
      models/activity.go
  3. 9 0
      routers/commentsRouter.go
  4. 2 0
      services/activity.go

+ 66 - 0
controllers/activity.go

@@ -2480,3 +2480,69 @@ func (this *ActivityController) ActivityVoiceHistoryAdd() {
 	br.Msg = "操作成功"
 	return
 }
+
+// @Title  获取易董活动跳转地址详情
+// @Description 获取易董活动跳转地址详情接口
+// @Param   ActivityId   query   int  true       "活动ID"
+// @Success Ret=200 {object} models.CygxActivityResp
+// @router /get_yidong_url [get]
+func (this *ActivityController) GetYidongUrl() {
+	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
+	}
+	uid := user.UserId
+	activityId, _ := this.GetInt("ActivityId")
+	if activityId < 1 {
+		br.Msg = "请输入活动ID"
+		return
+	}
+	resp := new(models.CygxYidongActivityUrlResp)
+	activityInfo, err := models.GetAddActivityInfoByIdShow(uid, activityId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取活动详情信息失败,Err:" + err.Error()
+		return
+	}
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
+		return
+	}
+	resp.IsResearchSpecial = isResearchSpecial
+	if havePower {
+		resp.HasPermission = 1
+		if activityInfo.YidongActivityId != "" {
+			ydTgc, _ := services.GetYiDongCreateUserInfo(user)
+			yidongLongLink, _ := services.GetYiDongOriginalLink(activityInfo)
+			if yidongLongLink != "" {
+				resp.YidongActivityUrl = yidongLongLink + "%26source=11%26fromHz=true%26tgc=" + ydTgc
+			}
+		}
+	} else {
+		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
+			return
+		}
+		popupMsg = "暂无查看权限"
+		resp.PopupMsg = popupMsg
+		resp.HasPermission = hasPermission
+		resp.SellerName = sellerName
+		resp.SellerMobile = sellerMobile
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 12 - 0
models/activity.go

@@ -129,6 +129,7 @@ type ActivityDetail struct {
 	TemporaryLabel            string                     `description:"临时标签"`
 	IsCanAppointmentMinutes   int                        `description:"是否可预约纪要 1是 ,0 否 默认0 "`
 	YidongActivityId          string                     `description:"易董活动ID"`
+	IsYidongActivity          bool                       `description:"是否属于易董同步过来的活动"`
 	YidongActivityUrl         string                     `description:"易董活动跳转地址"`
 	AudioLink                 bool                       `description:"是否展示回放按钮"`
 	VoiceList                 *CygxActivityVoiceReq      `description:"音频数据"`
@@ -230,6 +231,7 @@ type ActivityListResp struct {
 	IsResearchPoints        bool                       `description:"是否为研选扣点"`
 	SiginupDeadline         string                     `description:"报名截止时间"`
 	CancelDeadline          string                     `description:"取消报名截止时间"`
+	IsYidongActivity        bool                       `description:"是否属于易董同步过来的活动"`
 }
 
 type ActivityCheck struct {
@@ -265,6 +267,16 @@ type CygxActivityResp struct {
 	Detail            *ActivityListResp
 }
 
+type CygxYidongActivityUrlResp struct {
+	HasPermission     int    `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	PopupMsg          string `description:"权限弹窗信息"`
+	SellerMobile      string `description:"销售电话"`
+	SellerName        string `description:"销售姓名"`
+	IsResearch        bool   `description:"是否属于研选"`
+	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
+	YidongActivityUrl string `description:"易董活动跳转地址"`
+}
+
 // 列表
 func GetCygxActivityList(condition string, pars []interface{}, sortTime string, startSize, pageSize int) (items []*CygxActivity, err error) {
 	o := orm.NewOrm()

+ 9 - 0
routers/commentsRouter.go

@@ -61,6 +61,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"],
+        beego.ControllerComments{
+            Method: "GetYidongUrl",
+            Router: `/get_yidong_url`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"],
         beego.ControllerComments{
             Method: "ActivityListSearch",

+ 2 - 0
services/activity.go

@@ -916,6 +916,7 @@ func ActivityArrButtonShow(items []*models.ActivityDetail, user *models.WxUserIt
 		if activityDetail.YidongActivityId != "" {
 			activityDetail.IsShowSignup = false
 			activityDetail.IsShowDetails = true
+			activityDetail.IsYidongActivity = true
 
 			if activityDetail.YidongActivityId != "" {
 				ydTgc, _ := GetYiDongCreateUserInfo(user)
@@ -1073,6 +1074,7 @@ func ActivityArrButtonShow(items []*models.ActivityDetail, user *models.WxUserIt
 			IsExternalLabel:         v.IsExternalLabel,
 			SiginupDeadline:         v.SiginupDeadline,
 			CancelDeadline:          v.CancelDeadline,
+			IsYidongActivity:        v.IsYidongActivity,
 		}
 		au := new(models.UserPermissionAuthInfo)
 		au.SellerName = authInfo.SellerName