Browse Source

修复支付回调接口失效的问题

Pchen. 11 months ago
parent
commit
0c1048542f
1 changed files with 13 additions and 1 deletions
  1. 13 1
      apis/Order/CallBack.js

+ 13 - 1
apis/Order/CallBack.js

@@ -9,11 +9,23 @@ const PAYMENT_KEY = config.pay.key
 class CallBack extends API {
     constructor() {
         super()
-        this.setPath('/Order/Callback')
+        this.setPath('/Order/CallBack')
         this.setMethod('GET')
     }
 
     async onRequest(req, res) {
+        const {
+            pid, trade_no, out_trade_no, type, name, money,
+            trade_status, sign, sign_type
+        } = req.query
+
+        // 参数校验
+        if ([pid, trade_no, out_trade_no, type, name, money, trade_status, sign, sign_type].some(v => v === undefined)) {
+            return res.json({
+                ...BaseStdResponse.MISSING_PARAMETER
+            })
+        }
+
         // 签名校验
         const rawParams = {
             money, name, out_trade_no, pid, trade_no, trade_status, type