增加租户套餐
This commit is contained in:
@@ -3,6 +3,7 @@ package controllers
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
@@ -186,6 +187,20 @@ func (c *PlatformTenantUserController) CreateTenantUser() {
|
||||
p.Uid = uid
|
||||
}
|
||||
|
||||
// 用户数配额校验:租户用户数达到上限时不允许新增(增购用户数后放开)
|
||||
if check, err := services.CheckTenantUserQuota(p.Tid, p.Uid); err != nil {
|
||||
c.Data["json"] = map[string]interface{}{"code": 500, "msg": "用户数校验失败: " + err.Error()}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
} else if !check.Allowed {
|
||||
c.Data["json"] = map[string]interface{}{
|
||||
"code": 400,
|
||||
"msg": fmt.Sprintf("该租户用户数已达上限(%d/%d),请先为租户增购用户数", check.Used, check.Quota),
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
}
|
||||
|
||||
isDefault := int8(0)
|
||||
status := int8(1)
|
||||
if p.IsDefault != nil {
|
||||
|
||||
Reference in New Issue
Block a user