mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 23:20:26 +08:00
实现路径规则各项数据修改
This commit is contained in:
@@ -118,6 +118,7 @@ func (this *HTTPLocationDAO) ComposeLocationConfig(locationId int64) (*servercon
|
||||
config.Name = location.Name
|
||||
config.Pattern = location.Pattern
|
||||
config.URLPrefix = location.UrlPrefix
|
||||
config.IsBreak = location.IsBreak == 1
|
||||
|
||||
// web
|
||||
if location.WebId > 0 {
|
||||
|
||||
@@ -99,6 +99,14 @@ func (this *HTTPLocationService) FindAndInitHTTPLocationReverseProxyConfig(ctx c
|
||||
IsOn: false,
|
||||
ReverseProxyId: reverseProxyId,
|
||||
}
|
||||
reverseProxyJSON, err := json.Marshal(reverseProxyRef)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = models.SharedHTTPLocationDAO.UpdateLocationReverseProxy(req.LocationId, reverseProxyJSON)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
reverseProxyConfig, err := models.SharedReverseProxyDAO.ComposeReverseProxyConfig(reverseProxyRef.ReverseProxyId)
|
||||
@@ -139,6 +147,10 @@ func (this *HTTPLocationService) FindAndInitHTTPLocationWebConfig(ctx context.Co
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = models.SharedHTTPLocationDAO.UpdateLocationWeb(req.LocationId, webId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
config, err := models.SharedHTTPWebDAO.ComposeWebConfig(webId)
|
||||
@@ -153,3 +165,18 @@ func (this *HTTPLocationService) FindAndInitHTTPLocationWebConfig(ctx context.Co
|
||||
WebJSON: configJSON,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 修改反向代理设置
|
||||
func (this *HTTPLocationService) UpdateHTTPLocationReverseProxy(ctx context.Context, req *pb.UpdateHTTPLocationReverseProxyRequest) (*pb.RPCUpdateSuccess, error) {
|
||||
// 校验请求
|
||||
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = models.SharedHTTPLocationDAO.UpdateLocationReverseProxy(req.LocationId, req.ReverseProxyJSON)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rpcutils.RPCUpdateSuccess()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user