Browse Source

查研观向报告权限弹窗

xingzai 2 years ago
parent
commit
cc40411ec0
3 changed files with 37 additions and 3 deletions
  1. 2 2
      controllers/activity.go
  2. 22 1
      controllers/article.go
  3. 13 0
      services/user_permission.go

+ 2 - 2
controllers/activity.go

@@ -2785,7 +2785,7 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 	activityTypeId := this.GetString("ActivityTypeId")
 	keyWord := this.GetString("KeyWord")
 	playBack, _ := this.GetInt("PlayBack")
-	activityId, _ := this.GetInt("ActivityId")	// 仅用于判断【新】标签
+	activityId, _ := this.GetInt("ActivityId") // 仅用于判断【新】标签
 
 	if label == "undefined" {
 		label = ""
@@ -3618,7 +3618,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	}
 
 	//获取对应活动的数量并排序
-	activityIds := make([]int, 0)	// 用于查询活动【新】标签Map
+	activityIds := make([]int, 0) // 用于查询活动【新】标签Map
 	intArr := make([]int, 0)
 	var items []*models.ActivityTypeHome
 	for _, v := range list {

+ 22 - 1
controllers/article.go

@@ -312,6 +312,27 @@ Loop:
 		}
 		haveResearch = true
 	}
+	if hasPermission == 5 {
+		companyPermissionNoStatus, err := models.GetCompanyPermissionByUserNoStatus(user.CompanyId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if companyPermissionNoStatus != "" {
+			sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
+				return
+			}
+			if sellerItemQy != nil {
+				hasPermission = 3
+				detail.SellerMobile = sellerItemQy.Mobile
+				detail.SellerName = sellerItemQy.RealName
+			}
+		}
+	}
 
 	if hasPermission == 2 || hasPermission == 4 {
 		//获取销售手机号
@@ -327,6 +348,7 @@ Loop:
 			detail.SellerName = sellerItemQy.RealName
 		}
 	}
+
 	if detail.ArticleId < utils.SummaryArticleId {
 		if user.Mobile != "" {
 			chartUserTokenByMobile, _ := services.GetUserTokenByMobile(user.Mobile)
@@ -353,7 +375,6 @@ Loop:
 			chartUserTokenByMobile, _ := services.GetUserTokenByMobile(user.Mobile)
 			detail.ReportLink += "?token=" + chartUserTokenByMobile
 		}
-
 	}
 	resp := new(models.ArticleDetailResp)
 	resp.HasPermission = hasPermission

+ 13 - 0
services/user_permission.go

@@ -0,0 +1,13 @@
+package services
+
+import "hongze/hongze_cygx/models"
+
+//通过openid获取用户信息
+func GetCompanyPermissionByUserNoStatus(companyId int) (companyPermissionNoStatus string, err error) {
+	companyPermission, err := models.GetCompanyPermissionByUserNoStatus(companyId)
+	if err != nil {
+		return
+	}
+	companyPermissionNoStatus = companyPermission
+	return
+}