xiongzhu 4 năm trước cách đây
mục cha
commit
2c3c49e0c5

+ 33 - 0
src/main/bench/index.js

@@ -0,0 +1,33 @@
+const axios = require("axios");
+const qs = require("qs");
+setInterval(() => {}, 1 << 30);
+
+axios.defaults.baseURL = "http://localhost:8080";
+axios
+    .post(
+        "/auth/phonePwdLogin",
+        qs.stringify({ phone: "15077886171", password: "123456" })
+    )
+    .then((res) => {
+        console.log(res.data);
+        axios.defaults.headers["Authorization"] = "Bearer " + res.data;
+        axios.get("/user/my").then((res) => {
+            console.log(res.data);
+        });
+        for (let i = 0; i < 10000; i++) {
+            axios
+                .post(
+                    "/order/create",
+                    qs.stringify({ collectionId: 7669, qty: 1 })
+                )
+                .then((res) => {
+                    console.log(res.data);
+                    setTimeout(() => {
+                        axios.post(
+                            "/order/testNotify",
+                            qs.stringify({ id: res.data.id })
+                        );
+                    }, Math.random() * 1000 + 100);
+                });
+        }
+    });

+ 6 - 0
src/main/bench/package.json

@@ -0,0 +1,6 @@
+{
+  "dependencies": {
+    "axios": "^0.24.0",
+    "qs": "^6.10.2"
+  }
+}

+ 70 - 0
src/main/bench/yarn.lock

@@ -0,0 +1,70 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+axios@^0.24.0:
+  version "0.24.0"
+  resolved "https://registry.npmmirror.com/axios/download/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6"
+  integrity sha1-gE5voeS5xSiFAd2d/1anoJQNINY=
+  dependencies:
+    follow-redirects "^1.14.4"
+
+call-bind@^1.0.0:
+  version "1.0.2"
+  resolved "https://registry.nlark.com/call-bind/download/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
+  integrity sha1-sdTonmiBGcPJqQOtMKuy9qkZvjw=
+  dependencies:
+    function-bind "^1.1.1"
+    get-intrinsic "^1.0.2"
+
+follow-redirects@^1.14.4:
+  version "1.14.6"
+  resolved "https://registry.npmmirror.com/follow-redirects/download/follow-redirects-1.14.6.tgz#8cfb281bbc035b3c067d6cd975b0f6ade6e855cd"
+  integrity sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==
+
+function-bind@^1.1.1:
+  version "1.1.1"
+  resolved "https://registry.npm.taobao.org/function-bind/download/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
+  integrity sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=
+
+get-intrinsic@^1.0.2:
+  version "1.1.1"
+  resolved "https://registry.nlark.com/get-intrinsic/download/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6"
+  integrity sha1-FfWfN2+FXERpY5SPDSTNNje0q8Y=
+  dependencies:
+    function-bind "^1.1.1"
+    has "^1.0.3"
+    has-symbols "^1.0.1"
+
+has-symbols@^1.0.1:
+  version "1.0.2"
+  resolved "https://registry.nlark.com/has-symbols/download/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423"
+  integrity sha1-Fl0wcMADCXUqEjakeTMeOsVvFCM=
+
+has@^1.0.3:
+  version "1.0.3"
+  resolved "https://registry.nlark.com/has/download/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
+  integrity sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=
+  dependencies:
+    function-bind "^1.1.1"
+
+object-inspect@^1.9.0:
+  version "1.11.1"
+  resolved "https://registry.npmmirror.com/object-inspect/download/object-inspect-1.11.1.tgz#d4bd7d7de54b9a75599f59a00bd698c1f1c6549b"
+  integrity sha512-If7BjFlpkzzBeV1cqgT3OSWT3azyoxDGajR+iGnFBfVV2EWyDyWaZZW2ERDjUaY2QM8i5jI3Sj7mhsM4DDAqWA==
+
+qs@^6.10.2:
+  version "6.10.2"
+  resolved "https://registry.npmmirror.com/qs/download/qs-6.10.2.tgz#c1431bea37fc5b24c5bdbafa20f16bdf2a4b9ffe"
+  integrity sha512-mSIdjzqznWgfd4pMii7sHtaYF8rx8861hBO80SraY5GT0XQibWZWJSid0avzHGkDIZLImux2S5mXO0Hfct2QCw==
+  dependencies:
+    side-channel "^1.0.4"
+
+side-channel@^1.0.4:
+  version "1.0.4"
+  resolved "https://registry.nlark.com/side-channel/download/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
+  integrity sha1-785cj9wQTudRslxY1CkAEfpeos8=
+  dependencies:
+    call-bind "^1.0.0"
+    get-intrinsic "^1.0.2"
+    object-inspect "^1.9.0"

+ 1 - 0
src/main/java/com/izouma/nineth/domain/Order.java

@@ -185,4 +185,5 @@ public class Order {
 
     private Long invitor;
 
+    private boolean opened;
 }

+ 6 - 0
src/main/java/com/izouma/nineth/web/OrderController.java

@@ -12,6 +12,7 @@ import com.izouma.nineth.repo.OrderRepo;
 import com.izouma.nineth.service.OrderService;
 import com.izouma.nineth.utils.ObjUtils;
 import com.izouma.nineth.utils.SecurityUtils;
+import com.izouma.nineth.utils.SnowflakeIdWorker;
 import com.izouma.nineth.utils.excel.ExcelUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.BeanUtils;
@@ -110,5 +111,10 @@ public class OrderController extends BaseController {
         orderService.setSales();
         return "OK";
     }
+
+    @PostMapping("/testNotify")
+    public void testNotify(@RequestParam Long id) {
+        orderService.notifyOrder(id, PayMethod.ALIPAY, new SnowflakeIdWorker(0, 0).nextId() + "");
+    }
 }