mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-08 03:00:26 +08:00
请求限制API支持用户调用
This commit is contained in:
@@ -663,13 +663,20 @@ func (this *HTTPWebService) UpdateHTTPWebCommon(ctx context.Context, req *pb.Upd
|
||||
|
||||
// UpdateHTTPWebRequestLimit 修改请求限制
|
||||
func (this *HTTPWebService) UpdateHTTPWebRequestLimit(ctx context.Context, req *pb.UpdateHTTPWebRequestLimitRequest) (*pb.RPCSuccess, error) {
|
||||
_, err := this.ValidateAdmin(ctx)
|
||||
_, userId, err := this.ValidateAdminAndUser(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
|
||||
if userId > 0 {
|
||||
err = models.SharedHTTPWebDAO.CheckUserWeb(tx, userId, req.HttpWebId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
var config = &serverconfigs.HTTPRequestLimitConfig{}
|
||||
err = json.Unmarshal(req.RequestLimitJSON, config)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user