Browse Source

1. 微信支付回调地址 拼接 2. data 不传递给支付回调

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

+ 3 - 1
README.md

@@ -186,4 +186,6 @@ appid
 
 ## 2021.7.28 ------ 给忘川伏魔录单独一个版本的代码 -----
 
--   [ ] 删除 android 相关的代码
+-   [x] 删除 android 相关的代码
+-   [x] 微信支付回调地址 拼接
+-   [x] data 不传递给支付回调

+ 40 - 55
src/App.vue

@@ -141,7 +141,16 @@ export default {
       const allQuery = this.$utils.getAllQueryString();
       // 2. 将需要的参数拼接
       const queryString = this.$utils.queryStringUtil({
-        ...allQuery,
+        amount,
+        appid,
+        cp_order_id,
+        goods_id,
+        goods_name,
+        platform: allQuery.platform,
+        role_name,
+        role_id,
+        server_id,
+        server_name,
         pay_type,
         pay_platform,
         pay: "game",
@@ -175,31 +184,13 @@ export default {
             return;
           }
 
-          const time = new Date().getTime();
-          const orderItem = {
-            order_id: data.order_id,
-            time,
-            server_id,
-            server_name,
-            cp_order_id,
-            app_id: appid,
-            role_name,
-            role_id,
-            goods_id,
-            goods_name,
-            amount,
-            pay_type,
-            uid: this.userInfo.uid,
-          };
-          //   let orderList = JSON.parse(localStorage.getItem("orderList")) || [];
-          let orderList = this.$utils.readStorage("", "orderList");
-          orderList = (orderList && JSON.parse(orderList)) || [];
-          orderList.push(orderItem);
-
-          //   localStorage.setItem("orderList", JSON.stringify(orderList));
-          this.$utils.writeStorage("", "orderList", JSON.stringify(orderList));
-          //   window.location.href = data.url;
-          this.onPayUtil(data.url);
+          let payUrl = data.url;
+          if (pay_platform === "WECHATPAY") {
+            payUrl = `${payUrl}&redirect_url=${encodeURIComponent(
+              returnUrlLeft + queryString
+            )}`;
+          }
+          this.onPayUtil(payUrl);
         });
     },
 
@@ -211,15 +202,26 @@ export default {
       const { appid } = this;
       const returnUrlLeft =
         window.location.origin + window.location.pathname + "#/counter?";
+
       // 1. 拿到所有的当前路由的参数
       const allQuery = this.$utils.getAllQueryString();
       // 2. 将需要的参数拼接
       const queryString = this.$utils.queryStringUtil({
-        ...allQuery,
+        amount,
+        appid,
+        cp_order_id,
+        goods_id,
+        goods_name,
+        platform: allQuery.platform,
+        role_name,
+        role_id,
+        server_id,
+        server_name,
         pay_type,
         pay_platform,
-        pay: "hb",
+        pay: "game",
       });
+
       return this.$api
         .recharge({
           amount,
@@ -238,39 +240,22 @@ export default {
             return res;
           }
 
-          // 成功
-          const time = new Date().getTime();
-          const orderItem = {
-            order_id: data.order_id,
-            time,
-            server_id: "",
-            server_name: "",
-            cp_order_id: "",
-            app_id: appid,
-            role_name: "",
-            role_id: "",
-            goods_id: "",
-            goods_name,
-            amount,
-            pay_type,
-            uid: this.userInfo.uid,
-          };
-          let orderList = this.$utils.readStorage("", "orderList");
-          orderList = (orderList && JSON.parse(orderList)) || [];
-          orderList.push(orderItem);
-
-          this.$utils.writeStorage("", "orderList", JSON.stringify(orderList));
-
-          window.location.href = data.url;
+          let payUrl = data.url;
+          if (pay_platform === "WECHATPAY") {
+            payUrl = `${payUrl}&redirect_url=${encodeURIComponent(
+              returnUrlLeft + queryString
+            )}`;
+          }
+          this.onPayUtil(payUrl);
           return res;
         });
     },
 
     // 支付工具函数
     onPayUtil(payUrl) {
-      window.location.href = `${this.$CONFIG.wcfmlPayUrl}?jump=${encodeURI(
-        encodeURIComponent(payUrl)
-      )}`;
+      window.location.href = `${
+        this.$CONFIG.wcfmlPayUrl
+      }?jump=${encodeURIComponent(payUrl)}`;
     },
 
     // 订单查询

+ 1 - 1
src/components/Menu/MenuPay/MenuHbPay.vue

@@ -115,7 +115,7 @@ export default {
         this.getFinance();
         setTimeout(() => {
           this.back();
-        }, 3000);
+        }, 1500);
       });
     },
   },

+ 3 - 4
src/config.js

@@ -6,10 +6,10 @@ import wechatImgTips from "./assets/image/wxtips.jpg"; // 微信公众号福利
 
 /* 所有配置 */
 const CONFIG = {
-    // 热血之刃
-    name: "热血之刃", // 名字
+    // 忘川伏魔录
+    name: "忘川伏魔录", // 名字
     icon: icon, //   图标
-    appid: 3, // 热血之刃 appid
+    appid: 777, // 忘川伏魔录 appid
     // 公众号信息
     wechatInfo: {
         wechatName: '惊鸿游戏', // 公众号名
@@ -25,7 +25,6 @@ const CONFIG = {
         floatImgRed: "", //   缩略图 左 红点
     },
     isRealName: true, // 实名认证版本
-    loginTitle: "jh", // 快速登录随机账号开头
     visitorPrompt: "温馨提示: 快速登录未绑定手机号无法找回密码, <br /> 请进入游戏后尽快绑定! ", // 快速登录账密截图提示
     kfQQ: 3563681140, // 客服qq
     serviceUrl: "//kf.jhfly.cn/chatIndex?kefu_id=kefu2&refer=", // 惊鸿客服url

+ 3 - 3
src/views/Counter/Counter.vue

@@ -3,7 +3,7 @@
   <div class="counter">
     <!-- 上方支付方式 -->
     <div class="top clear">
-      <i class="iconfont icon-back" @click="back"></i>
+      <i class="iconfont icon-back"></i>
       <div class="title">
         <img
           v-if="query.pay_platform === 'HB'"
@@ -41,13 +41,13 @@
       继续付款
     </div> -->
 
-    <div class="continue" @click="back">返回游戏</div>
+    <div class="continue">支付完成</div>
 
     <!-- 支付遇到问题 -->
     <div class="question" @click="onService">支付遇到问题?联系客服</div>
 
     <!-- 支付完成 -->
-    <div class="finish" @click="back">支付完成, 返回游戏</div>
+    <div class="finish">支付完成</div>
   </div>
 </template>
 

+ 1 - 1
src/views/Login/LoginBox.vue

@@ -114,7 +114,7 @@ export default {
     // wcfml 忘川伏魔录登录工具函数
     wcfmlLogin(data) {
       // 记住密码 todo
-      const savedata = this.$utils.getQueryString("data");
+      const savedata = decodeURIComponent(this.$utils.getQueryString("data"));
 
       // 跳转对应登录链接
       const query = this.$utils.queryStringUtil({