修复运行边界条件问题
This commit is contained in:
@@ -147,7 +147,7 @@ type ResourceView struct {
|
||||
}
|
||||
|
||||
// 检查用户是否可提取
|
||||
func ensure(now time.Time, source netip.Addr, resourceId int32, count int) (*ResourceView, []string, error) {
|
||||
func ensure(now time.Time, source netip.Addr, resourceId int32, authWhitelist bool, count int) (*ResourceView, []string, error) {
|
||||
if count > 400 {
|
||||
return nil, nil, core.NewBizErr("单次最多提取 400 个")
|
||||
}
|
||||
@@ -172,6 +172,10 @@ func ensure(now time.Time, source netip.Addr, resourceId int32, count int) (*Res
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if authWhitelist && len(whitelists) == 0 {
|
||||
return nil, nil, core.NewBizErr("当前白名单为空,请先添加白名单")
|
||||
}
|
||||
|
||||
ips := make([]string, len(whitelists))
|
||||
pass := false
|
||||
for i, item := range whitelists {
|
||||
|
||||
Reference in New Issue
Block a user