Browse Source

✨ feat: 适配uniapp

Pchen. 6 months ago
parent
commit
8b82d47f75
2 changed files with 11 additions and 3 deletions
  1. 8 1
      apis/Order/CreateOrder.js
  2. 3 2
      config.json

+ 8 - 1
apis/Order/CreateOrder.js

@@ -88,12 +88,19 @@ class CreateOrder extends API {
                     })
                     })
                 }
                 }
 
 
+                const deviceType = req.headers['device-type'] ?? '浏览器'
+                let return_url
+                if(deviceType === 'RunForge Uniapp Client') 
+                    return_url = paymentConfig.uni_return_url + orderId
+                else
+                    return_url = paymentConfig.return_url + orderId
+
                 const payParams = {
                 const payParams = {
                     pid: paymentConfig.pid,
                     pid: paymentConfig.pid,
                     type: pay_type,
                     type: pay_type,
                     out_trade_no: orderId,
                     out_trade_no: orderId,
                     notify_url: `${config.url}/Order/CallBack`,
                     notify_url: `${config.url}/Order/CallBack`,
-                    return_url: paymentConfig.return_url + orderId,
+                    return_url,
                     name: goods.name,
                     name: goods.name,
                     money: goods.price
                     money: goods.price
                 }
                 }

+ 3 - 2
config.json

@@ -47,14 +47,15 @@
         "url": "https://pay.gggua.com",
         "url": "https://pay.gggua.com",
         "pid": 1296,
         "pid": 1296,
         "key": "MW222B33ytTv23tf2Z2tFV2k23iHVQ3q",
         "key": "MW222B33ytTv23tf2Z2tFV2k23iHVQ3q",
-        "return_url": "https://xxoo365.top/#/store/orderDetail/"
+        "return_url": "https://xxoo365.top/#/store/orderDetail/",
+        "uni_return_url": "https://m.xxoo365.top/#/pages/order/order-detail?id="
     },
     },
     "unilogin": {
     "unilogin": {
         "url": "https://open.losfer.cn",
         "url": "https://open.losfer.cn",
         "appid": "1274",
         "appid": "1274",
         "appkey": "e9dd049e0d991b997901957200036b30",
         "appkey": "e9dd049e0d991b997901957200036b30",
         "return_url": "https://xxoo365.top/uniLogin/loginSuccess",
         "return_url": "https://xxoo365.top/uniLogin/loginSuccess",
-        "uni_return_url": "https://xxoo365.top/#/pages/login/login"
+        "uni_return_url": "https://m.xxoo365.top/#/pages/login/login"
     },
     },
     "server": "CTBU_CLUB 重庆1号服务器"
     "server": "CTBU_CLUB 重庆1号服务器"
 }
 }