|
@@ -146,6 +146,54 @@ func GetUserApplyRecordCountByCompanyIdPay(companyIdPay int) (isCompanyApply boo
|
|
return
|
|
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
|
|
|
|
+}
|
|
|
|
+
|
|
// 用户详情页获取用户权限状态 https://hzstatic.hzinsights.com/static/images/202402/20240205/LpE6dspJCLzfQoCoE8SFMDiLuxXk.png(状态码说明)
|
|
// 用户详情页获取用户权限状态 https://hzstatic.hzinsights.com/static/images/202402/20240205/LpE6dspJCLzfQoCoE8SFMDiLuxXk.png(状态码说明)
|
|
func GetUserDetailPermissionCode(userId, companyId int) (permission int, err error) {
|
|
func GetUserDetailPermissionCode(userId, companyId int) (permission int, err error) {
|
|
// 用户申请记录
|
|
// 用户申请记录
|