Răsfoiți Sursa

分享与权限的弹窗样式展示

xingzai 3 ani în urmă
părinte
comite
78590d73a3

+ 0 - 23
controllers/activity.go

@@ -586,13 +586,6 @@ func (this *ActivityCoAntroller) Detail() {
 		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
 		return
 	}
-	detailConfig, err := models.GetConfigByCode("free_trial_card")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
-		return
-	}
-
 	//获取FICC销售信息 如果是FICC的客户类型,则默认他申请过
 	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
 	if err != nil && err.Error() != utils.ErrNoRow() {
@@ -632,12 +625,6 @@ func (this *ActivityCoAntroller) Detail() {
 					}
 				}
 			}
-
-			if detailConfig.ConfigValue == "1" {
-				if hasPermission == 3 {
-					resp.IsShow = true
-				}
-			}
 			resp.HasPermission = hasPermission
 			resp.OperationMode = "Apply"
 			resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
@@ -750,11 +737,6 @@ func (this *ActivityCoAntroller) Detail() {
 						}
 					}
 				}
-				if detailConfig.ConfigValue == "1" {
-					if hasPermission == 3 {
-						resp.IsShow = true
-					}
-				}
 				resp.HasPermission = hasPermission
 				resp.OperationMode = "Apply"
 				resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
@@ -833,11 +815,6 @@ func (this *ActivityCoAntroller) Detail() {
 		resp.Detail = activityInfo
 	}
 	resp.HasPermission = hasPermission
-	if detailConfig.ConfigValue == "1" {
-		if hasPermission == 3 {
-			resp.IsShow = true
-		}
-	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 0 - 11
controllers/article.go

@@ -325,17 +325,6 @@ Loop:
 	}
 
 	resp := new(models.ArticleDetailResp)
-	detailConfig, err := models.GetConfigByCode("free_trial_card")
-	if err != nil {
-		br.Msg = "获取数据失败"
-		br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
-		return
-	}
-	if detailConfig.ConfigValue == "1" {
-		if hasPermission == 2 || hasPermission == 4 || hasPermission == 5 {
-			resp.IsShow = true
-		}
-	}
 	resp.HasPermission = hasPermission
 	resp.HaveResearch = haveResearch
 	resp.HasFree = hasFree

+ 64 - 0
controllers/user.go

@@ -1118,3 +1118,67 @@ func (this *UserController) FreeButtonUpdate() {
 	br.Success = true
 	br.Msg = "操作成功!"
 }
+
+// @Title 权限弹窗是否展示免费月卡
+// @Description 获取权限弹窗是否展示免费月卡接口
+// @Param	request	body models.IsShow true "type json string"
+// @Success 200
+// @router /isShow/alert [get]
+func (this *UserController) AlertIsShow() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	var resp models.IsShow
+	detail, err := models.GetConfigByCode("free_trial_card")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
+		return
+	}
+	if user.CompanyId == 0 && detail.ConfigValue == "1" {
+		resp.IsShow = true
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 分享的时候是否展示免费月卡
+// @Description 获取权限弹窗是否展示免费月卡接口
+// @Param	request	body models.IsShow true "type json string"
+// @Success 200
+// @router /isShow/share [get]
+func (this *UserController) ShareIsShow() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	var resp models.IsShow
+	detail, err := models.GetConfigByCode("free_trial_card")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
+		return
+	}
+	if user.CompanyId != 16 && detail.ConfigValue == "1" {
+		resp.IsShow = true
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}

+ 0 - 1
models/activity.go

@@ -108,7 +108,6 @@ type CygxActivityResp struct {
 	SellerMobile      string `description:"销售电话"`
 	SellerName        string `description:"销售姓名"`
 	Detail            *ActivityDetail
-	IsShow            bool `description:"是否展示"`
 }
 
 //通过纪要ID获取活动详情

+ 0 - 1
models/article.go

@@ -224,7 +224,6 @@ type ArticleDetailResp struct {
 	HasFree       int    `description:"1:已付费(至少包含一个品类的权限),2:未付费(没有任何品类权限)"`
 	HaveResearch  bool   `description:"是否有研选权限"`
 	Mobile        string `description:"用户手机号"`
-	IsShow        bool   `description:"是否展示"`
 }
 
 type ArticleDetailHtgjResp struct {

+ 18 - 0
routers/commentsRouter_controllers.go

@@ -772,6 +772,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "AlertIsShow",
+            Router: "/isShow/alert",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"],
         beego.ControllerComments{
             Method: "IsShow",
@@ -781,6 +790,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "ShareIsShow",
+            Router: "/isShow/share",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"],
         beego.ControllerComments{
             Method: "Login",