浏览代码

fix: 权限校验信息

hsun 2 年之前
父节点
当前提交
b7fc01a751
共有 1 个文件被更改,包括 17 次插入4 次删除
  1. 17 4
      services/company/permission.go

+ 17 - 4
services/company/permission.go

@@ -124,16 +124,16 @@ func CheckBaseFiccPermission(companyId int64, userId int) (ok bool, checkInfo re
 		err = errors.New("获取用户FICC权限失败 Err:" + e.Error())
 		return
 	}
-	// 客户状态是否为流失
-	if productInfo.Status == "流失" {
-		checkInfo.Type = CheckTypeApply
+	wxUser, e := wx_user.GetByUserId(userId)
+	if e != nil {
+		err = errors.New("不存在当前用户, Err:" + e.Error())
 		return
 	}
 	// 是否为弘则研究已禁用的联系人
 	if companyId == 16 {
 		userInfo, e := wx_user.GetByUserId(userId)
 		if e != nil {
-			err = errors.New("用户信息异常 Err:" + e.Error())
+			err = errors.New("用户信息异常, Err:" + e.Error())
 			return
 		}
 		if userInfo.Enabled != 1 {
@@ -141,6 +141,19 @@ func CheckBaseFiccPermission(companyId int64, userId int) (ok bool, checkInfo re
 			return
 		}
 	}
+	customerInfo := response.CustomerInfo{
+		CompanyName: productInfo.CompanyName,
+		Status:      productInfo.Status,
+		Name:        wxUser.RealName,
+		IsSuspend:   productInfo.IsSuspend,
+		Mobile:      wxUser.Mobile,
+	}
+	checkInfo.CustomerInfo = customerInfo
+	// 客户状态是否为流失
+	if productInfo.Status == "流失" {
+		checkInfo.Type = CheckTypeApply
+		return
+	}
 	// 客户对应的销售信息
 	sellerInfo, e := admin.GetByAdminId(productInfo.SellerID)
 	if e != nil {