mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-24 14:06:36 +08:00
实现修改缓存配置
This commit is contained in:
@@ -47,7 +47,6 @@ func (this *HTTPWebService) FindEnabledHTTPWeb(ctx context.Context, req *pb.Find
|
||||
result.Id = int64(web.Id)
|
||||
result.IsOn = web.IsOn == 1
|
||||
result.Root = web.Root
|
||||
result.GzipId = int64(web.GzipId)
|
||||
result.Charset = web.Charset
|
||||
result.RequestHeaderPolicyId = int64(web.RequestHeaderPolicyId)
|
||||
result.ResponseHeaderPolicyId = int64(web.ResponseHeaderPolicyId)
|
||||
@@ -78,7 +77,7 @@ func (this *HTTPWebService) UpdateHTTPWebGzip(ctx context.Context, req *pb.Updat
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = models.SharedHTTPWebDAO.UpdateWebGzip(req.WebId, req.GzipId)
|
||||
err = models.SharedHTTPWebDAO.UpdateWebGzip(req.WebId, req.GzipJSON)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -192,3 +191,19 @@ func (this *HTTPWebService) UpdateHTTPStat(ctx context.Context, req *pb.UpdateHT
|
||||
}
|
||||
return rpcutils.RPCUpdateSuccess()
|
||||
}
|
||||
|
||||
// 更改缓存配置
|
||||
func (this *HTTPWebService) UpdateHTTPCache(ctx context.Context, req *pb.UpdateHTTPCacheRequest) (*pb.RPCUpdateSuccess, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = models.SharedHTTPWebDAO.UpdateWebCache(req.WebId, req.CacheJSON)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return rpcutils.RPCUpdateSuccess()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user