可以设置用户每天执行缓存任务的额度

This commit is contained in:
刘祥超
2022-06-05 21:15:28 +08:00
parent 71677a8638
commit a2f98d2f25
5 changed files with 84 additions and 15 deletions

View File

@@ -6,11 +6,9 @@ import (
"context"
"encoding/json"
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
"github.com/TeaOSLab/EdgeAPI/internal/errors"
"github.com/TeaOSLab/EdgeAPI/internal/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/dbs"
"github.com/iwind/TeaGo/types"
)
// HTTPCacheTaskKeyService 缓存任务Key管理
@@ -30,11 +28,6 @@ func (this *HTTPCacheTaskKeyService) ValidateHTTPCacheTaskKeys(ctx context.Conte
// 检查Key数量
var clusterId int64
if userId > 0 {
// TODO 限制当日刷新总条数(配额)
if len(req.Keys) > models.MaxKeysPerTask {
return nil, errors.New("too many keys (current:" + types.String(len(req.Keys)) + ", max:" + types.String(models.MaxKeysPerTask) + ")")
}
clusterId, err = models.SharedUserDAO.FindUserClusterId(tx, userId)
if err != nil {
return nil, err