当前位置:   article > 正文

苍穹外卖项目学习----跳过使用微信支付

苍穹外卖项目学习----跳过使用微信支付

苍穹外卖项目学习----跳过微信支付

在学习苍穹外卖项目的过程中,遇到了个人开发者无法使用微信支付,导致后续功能无法开发。这里我们可以尝试修改一下微信小程序的源码尝试跳过一下。
如下图为wx小程序官方文档提供的流程。我们可以将步骤9-22全部跳过,直接返回支付成功。
在这里插入图片描述

在这里插入图片描述
打开微信小程序开发工具,如上图找到pages/pay/index.js
在这里插入图片描述
找到第226行 小程序向微信支付后台发起请求的部分,注释掉红框,只保留绿框中的发送成功的代码

 if (res.code === 1) {
            wx.showModal({
              title: '提示',
              content: '支付成功',
              success:function(){
                uni.redirectTo({url: '/pages/success/index?orderId=' + _this.orderId });
              }
            })
            console.log('支付成功!')
            // wx.requestPayment({
            //   nonceStr: res.data.nonceStr,
            //   package: res.data.packageStr,
            //   paySign: res.data.paySign,
            //   timeStamp: res.data.timeStamp,
            //   signType: res.data.signType,
            //   success:function(res){
            //     wx.showModal({
            //       title: '提示',
            //       content: '支付成功',
            //       success:function(){
            //         uni.redirectTo({url: '/pages/success/index?orderId=' + _this.orderId });
            //       }
            //     })
            //     console.log('支付成功!')
            //   }
            // })


            //uni.redirectTo({url: '/pages/success/index?orderId=' + _this.orderId });

          } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

再完善一下步骤8 后端提交给小程序的数据,随便返回一些数据(这里返回为null应该也没事)
在这里插入图片描述
因为我们跳过了支付过程,记得在controller中提交完订单就修改支付状态
在这里插入图片描述

最后实现跳过验证实现伪支付成功!!!!
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/258424
推荐阅读
相关标签
  

闽ICP备14008679号