|
@@ -202,7 +202,7 @@ func GetUserRaiPermissionYanXuanInfo(user *models.WxUserItem) (hasPermission int
|
|
|
}
|
|
|
|
|
|
// 获取权益销售姓名
|
|
|
-func GetSellerName(user *models.WxUserItem) (sellerName string, sellerId int) {
|
|
|
+func GetSellerName(user *models.WxUserItem) (sellerName, mobile string, sellerId int) {
|
|
|
var err error
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
@@ -232,6 +232,7 @@ func GetSellerName(user *models.WxUserItem) (sellerName string, sellerId int) {
|
|
|
}
|
|
|
sellerName = sealldetail.RealName
|
|
|
sellerId = sealldetail.AdminId
|
|
|
+ mobile = sealldetail.Mobile
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -273,3 +274,51 @@ func GetUserDetailPermissionCode(userId, companyId int) (permission int, err err
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 获取用户权限状态 https://hzstatic.hzinsights.com/static/images/202402/20240205/LpE6dspJCLzfQoCoE8SFMDiLuxXk.png(状态码说明)
|
|
|
+func GetUserPermissionCode(userId, companyId int) (permission int, err error) {
|
|
|
+ // 用户申请记录
|
|
|
+ applyCount, e := models.GetApplyRecordCount(userId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("获取用户申请信息失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if companyId == 1 {
|
|
|
+ // 潜在用户
|
|
|
+ if applyCount > 0 {
|
|
|
+ permission = 6
|
|
|
+ } else {
|
|
|
+ permission = 7
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //权益客户
|
|
|
+ raiCount, e := models.GetCompanyProductCount(companyId, utils.COMPANY_PRODUCT_RAI_ID)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("获取用户申请信息失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if raiCount == 1 {
|
|
|
+ if applyCount > 0 {
|
|
|
+ permission = 2
|
|
|
+ } else {
|
|
|
+ permission = 3
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //ficc 客户
|
|
|
+ ficcCount, e := models.GetCompanyProductCount(companyId, utils.COMPANY_PRODUCT_FICC_ID)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("获取用户申请信息失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if ficcCount == 1 {
|
|
|
+ if applyCount > 0 {
|
|
|
+ permission = 4
|
|
|
+ } else {
|
|
|
+ permission = 5
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|