From 9a8f3d050c896fd606800cc623ce3996b2598ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Mon, 24 Apr 2023 22:34:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95=E5=B9=B6?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E5=8A=9F=E8=83=BD=EF=BC=9B=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=8F=91=E8=B4=A7=E3=80=81=E5=8F=96=E6=B6=88=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=8C=E6=AC=A1=E7=A1=AE=E8=AE=A4=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 +++++++ .../src/main/resources/application.yml | 2 +- .../epp/shop/controller/OrderController.java | 5 +-- frontend/src/api/shop-order.js | 2 +- frontend/src/views/shop-order-setting.vue | 42 +++++++++++++++---- 5 files changed, 54 insertions(+), 13 deletions(-) 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 @@