rdluck 4 years ago
parent
commit
e1ab148c35
2 changed files with 12 additions and 2 deletions
  1. 8 0
      controllers/user.go
  2. 4 2
      services/user_permission.go

+ 8 - 0
controllers/user.go

@@ -207,3 +207,11 @@ func (this *UserController) SmallLimit() {
 	br.Success = true
 	br.Data = resp
 }
+
+//func init() {
+//	fmt.Println("start")
+//	userPermission, err := services.CheckUserPermission(11602)
+//	fmt.Println(err)
+//	fmt.Println(userPermission)
+//	fmt.Println("end")
+//}

+ 4 - 2
services/user_permission.go

@@ -2,6 +2,7 @@ package services
 
 import (
 	"errors"
+	"fmt"
 	"hongze/hongze_api/models"
 	"hongze/hongze_api/utils"
 	"strconv"
@@ -14,7 +15,7 @@ func CheckUserPermission(userId int) (status int, err error) {
 			if err.Error() == utils.ErrNoRow() {
 				status = 40001
 				err = errors.New("用户信息不存在:userId:" + strconv.Itoa(userId))
-				return status,err
+				return status, err
 			}
 			status = 40001
 			err = errors.New("获取用户信息失败:userId:" + strconv.Itoa(userId) + ";Err:" + err.Error())
@@ -26,6 +27,7 @@ func CheckUserPermission(userId int) (status int, err error) {
 			return status, err
 		}
 		companyId := wxUser.CompanyId
+		fmt.Println(companyId)
 		company, err := models.GetCompanyById(companyId)
 		if err != nil {
 			status = 40001
@@ -37,7 +39,7 @@ func CheckUserPermission(userId int) (status int, err error) {
 			err = errors.New("客户信息不存在:userId:" + strconv.Itoa(userId))
 			return status, err
 		}
-		if company.IsFeeCustomer == 1 {
+		if company.CompanyType == 1 || company.CompanyType == 2 {
 			status = 0
 		} else {
 			status = 40002