|
@@ -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
|
|
|
+}
|