ziwen 1 year ago
parent
commit
fa2fe42993
2 changed files with 30 additions and 1 deletions
  1. 1 1
      controllers/tag.go
  2. 29 0
      services/company_permission.go

+ 1 - 1
controllers/tag.go

@@ -32,7 +32,7 @@ func (this *TagController) TagCustomizeList() {
 
 	var condition string
 
-	hasPermission, _, _, _, err := services.GetUserHasPermission(sysUser)
+	hasPermission, err := services.GetUserHasPermissionSimple(sysUser)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()

+ 29 - 0
services/company_permission.go

@@ -222,3 +222,32 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
 	}
 	return
 }
+
+
+//获取用户对应的权限简单版
+func GetUserHasPermissionSimple(user *models.WxUserItem) (hasPermission int, err error) {
+	//HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	uid := user.UserId
+	applyCount, e := models.GetApplyRecordCount(uid)
+	if e != nil {
+		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
+		return
+	}
+	if user.CompanyId <= 1 {
+		if applyCount == 0 {
+			hasPermission = 5
+		} else {
+			hasPermission = 6
+		}
+	} else {
+		companyPermission, e := models.GetCompanyPermission(user.CompanyId)
+		if e != nil {
+			err = errors.New("GetCompanyPermission, Err: " + e.Error())
+			return
+		}
+		if companyPermission != "" {
+			hasPermission = 1
+		}
+	}
+	return
+}