diff --git a/README.md b/README.md index a812447..88a38cf 100644 --- a/README.md +++ b/README.md @@ -362,6 +362,22 @@ const envVersion = "【⚠此处修改为当前小程序环境】" // 正式版 +##### 配置 Gateway 限流策略(可选) + +> 如果你不懂这是在做什么,请直接跳过这一步 + +修改 `backend/microservice-gateway/src/main/resources/application.yml` 文件中 `routes` 中各个微服务的 `filters` 例如: + +```yml + filters: # 路由过滤器,使用自定义的限流过滤器工厂 + - name: RateLimitByIp # 设置每秒允许5个请求,每次请求需要1个令牌 + args: + rate: 5.0 + permits: 1 +``` + + + ##### 打 jar 包 IDEA 中右侧 Maven 双击 Lifestyle 的 package,打包完成后的 jar 包可在以下位置找到 diff --git a/backend/microservice-gateway/src/main/resources/application.yml b/backend/microservice-gateway/src/main/resources/application.yml index a863048..91c43f9 100644 --- a/backend/microservice-gateway/src/main/resources/application.yml +++ b/backend/microservice-gateway/src/main/resources/application.yml @@ -45,7 +45,7 @@ spring: args: rate: 5.0 permits: 1 - + - id: access uri: lb://microservice-provider-access predicates: diff --git a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java index b73b860..d0ead16 100644 --- a/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java +++ b/backend/microservice-provider-shop-8003/src/main/java/com/cxyxiaomo/epp/shop/controller/OrderController.java @@ -295,13 +295,12 @@ public class OrderController { /** * 管理员取消订单 * - * @param params + * @param orderId * @return */ @PostMapping("/manage/cancelOrder") @ResponseBody - public Res cancelOrderByManager(@RequestBody JSONObject params) { - Long orderId = params.getLong("orderId"); + public Res cancelOrderByManager(Long orderId) { if (orderId == null) { return Res.error("参数错误"); } diff --git a/frontend/src/api/shop-order.js b/frontend/src/api/shop-order.js index 975025c..3f4bd7e 100644 --- a/frontend/src/api/shop-order.js +++ b/frontend/src/api/shop-order.js @@ -42,7 +42,7 @@ export function deliverOrder(params) { * 关闭订单 * @returns */ -export function cancelOrder(params) { +export function withdrawOrder(params) { return send_request({ url: '/shop/order/manage/cancelOrder', method: 'POST', diff --git a/frontend/src/views/shop-order-setting.vue b/frontend/src/views/shop-order-setting.vue index e1ebe60..03ad29e 100644 --- a/frontend/src/views/shop-order-setting.vue +++ b/frontend/src/views/shop-order-setting.vue @@ -86,6 +86,8 @@