Browse Source

no message

zhangchuanxing 2 weeks ago
parent
commit
7ff1e665c9
3 changed files with 40 additions and 2 deletions
  1. 7 2
      controllers/report_selection.go
  2. 32 0
      services/user.go
  3. 1 0
      utils/constants.go

+ 7 - 2
controllers/report_selection.go

@@ -81,7 +81,7 @@ func (this *ReportSelectionController) Detail() {
 
 
 	resp := new(models.ReportSelectionLetailResp)
 	resp := new(models.ReportSelectionLetailResp)
 	//判断用户权限
 	//判断用户权限
-	hasPermission, err := services.GetUserhasPermission(user)
+	hasPermission, err := services.GetUserhasPermissionReportSelection(user)
 	if err != nil {
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
 		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
@@ -315,7 +315,12 @@ func (this *ReportSelectionController) AddStopTime() {
 	} else if source == 3 {
 	} else if source == 3 {
 		reportType = "szjyhz"
 		reportType = "szjyhz"
 	}
 	}
-	hasPermission, err := services.GetUserhasPermission(user)
+	var hasPermission int
+	if source == 1 {
+		hasPermission, err = services.GetUserhasPermissionReportSelection(user)
+	} else {
+		hasPermission, err = services.GetUserhasPermission(user)
+	}
 	if err != nil {
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
 		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()

+ 32 - 0
services/user.go

@@ -812,6 +812,38 @@ func GetUserhasPermission(user *models.WxUserItem) (hasPermission int, err error
 	return
 	return
 }
 }
 
 
+// 获取用户权限(推荐列表权限校验)
+func GetUserhasPermissionReportSelection(user *models.WxUserItem) (hasPermission int, err error) {
+	//判断是否已经申请过
+	applyCount, err := models.GetApplyRecordCount(user.UserId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	if applyCount > 0 {
+		hasPermission = 3
+	} else {
+		hasPermission = 5
+	}
+	//HasPermission int  `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	if user.CompanyId > 1 {
+		companyPermission, errPer := models.GetCompanyPermission(user.CompanyId)
+		if errPer != nil {
+			err = errPer
+			return
+		}
+		if strings.Contains(companyPermission, utils.TUI_JIAN_LIE_BIAO) {
+			hasPermission = 1
+		} else {
+			if applyCount > 0 {
+				hasPermission = 3
+			} else {
+				hasPermission = 4
+			}
+		}
+	}
+	return
+}
+
 // 获取用户有没有开通任意一个行业权限
 // 获取用户有没有开通任意一个行业权限
 func GetUserhasPermissionOne(user *models.WxUserItem) (hasPermission int, err error) {
 func GetUserhasPermissionOne(user *models.WxUserItem) (hasPermission int, err error) {
 	//判断是否已经申请过
 	//判断是否已经申请过

+ 1 - 0
utils/constants.go

@@ -120,6 +120,7 @@ const (
 	ZHUAN_JIA_NAME                   string = "专家"
 	ZHUAN_JIA_NAME                   string = "专家"
 	ZHUAN_JIA_ID                     int    = 29
 	ZHUAN_JIA_ID                     int    = 29
 	REOURCE_YX                       string = "Yx"
 	REOURCE_YX                       string = "Yx"
+	TUI_JIAN_LIE_BIAO                string = "推荐列表" // 推荐列表行业权限名称
 )
 )
 
 
 const (
 const (