瀏覽代碼

no message

xingzai 1 年之前
父節點
當前提交
f2c0397e6d
共有 2 個文件被更改,包括 14 次插入8 次删除
  1. 9 7
      controllers/user.go
  2. 5 1
      services/user_permission.go

+ 9 - 7
controllers/user.go

@@ -173,7 +173,7 @@ func (this *UserController) Detail() {
 	}
 	resp.OutboundCountryCode = userDetail.OutboundCountryCode
 	resp.OutboundMobile = userDetail.OutboundMobile
-
+	var hasPermission int
 	if user.CompanyId > 1 {
 		companyItem, err := models.GetCompanyDetailById(user.CompanyId)
 		if err != nil && err.Error() != utils.ErrNoRow() {
@@ -232,7 +232,14 @@ func (this *UserController) Detail() {
 				}
 				if companyReportPermissionDetail == nil || companyProduct.IsSuspend == 1 {
 					//hasPermission = 1
+					hasPermission, err = services.GetUserDetailPermissionCode(user.UserId, user.CompanyId)
+					if err != nil && err.Error() != utils.ErrNoRow() {
+						br.Msg = "获取信息失败"
+						br.ErrMsg = "获取信息失败,GetUserDetailPermissionCode Err:" + err.Error()
+						return
+					}
 				} else {
+					hasPermission = 1
 					//有研选订阅或研选扣点包任意一项试用权限,即为试用客户,期限显示两项合并之后的最长时间
 					minDate := time.Now()
 					maxDate := time.Now()
@@ -269,12 +276,7 @@ func (this *UserController) Detail() {
 			resp.PermissionName = append(resp.PermissionName, utils.CHART_PERMISSION_NAME_MF_YANXUAN)
 		}
 	}
-	hasPermission, err := services.GetUserDetailPermissionCode(user.UserId, user.CompanyId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,GetUserDetailPermissionCode Err:" + err.Error()
-		return
-	}
+
 	specialAuthorCheck := services.GetYanxuanSpecialAuthorInfo(user) //用户是否没开通研选专栏以及,专栏信息是否完善
 	resp.IsAuthor = specialAuthorCheck.IsAuthor
 	resp.HasPermission = hasPermission

+ 5 - 1
services/user_permission.go

@@ -261,7 +261,11 @@ func GetUserDetailPermissionCode(userId, companyId int) (permission int, err err
 		return
 	}
 	if raiCount == 1 {
-		permission = 1
+		if applyCount > 0 {
+			permission = 2
+		} else {
+			permission = 3
+		}
 	} else {
 
 		if companyId == 1 {