|
@@ -222,3 +222,32 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func GetUserHasPermissionSimple(user *models.WxUserItem) (hasPermission int, err error) {
|
|
|
+
|
|
|
+ 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
|
|
|
+}
|