Commit 0a8ddd5a66cd8ebcb5f45e1a9933eddd604be8b2

Authored by yvan.ni
1 parent 89982d83

pay文件的优化

Showing 1 changed file with 64 additions and 1 deletions
utils/pay.js
... ... @@ -49,7 +49,6 @@ module.exports = {
49 49 wx.hideLoading();
50 50 if(t.data.code==0){
51 51  
52   -
53 52 var is_pos_pay=t.data.data.is_pos_pay;
54 53 //-- 富有的插件支付 --
55 54 if(t.data.data.is_fuioupay){
... ... @@ -93,6 +92,70 @@ module.exports = {
93 92  
94 93 var p_data=t.data.data;
95 94 delete p_data.is_pos_pay; //清理掉,不然签名不通过
  95 +
  96 + var err_txt="";
  97 +
  98 + if(!p_data.acct && !err_txt){
  99 + err_txt="未找到acct";
  100 + }
  101 + if(!p_data.appid && !err_txt){
  102 + err_txt="未找到appid";
  103 + }
  104 + if(!p_data.cusid && !err_txt){
  105 + err_txt="未找到cusid";
  106 + }
  107 + if(!p_data.limit_pay && !err_txt){
  108 + err_txt="未找到limit_pay";
  109 + }
  110 + if(!p_data.notify_url && !err_txt){
  111 + err_txt="未找到notify_url";
  112 + }
  113 + if(!p_data.orgid && !err_txt){
  114 + err_txt="未找到orgid";
  115 + }
  116 + if(!p_data.paytype && !err_txt){
  117 + err_txt="未找到paytype";
  118 + }
  119 + if(!p_data.randomstr && !err_txt){
  120 + err_txt="未找到randomstr";
  121 + }
  122 + if(!p_data.remark && !err_txt){
  123 + err_txt="未找到remark";
  124 + }
  125 + if(!p_data.reqsn && !err_txt){
  126 + err_txt="未找到reqsn";
  127 + }
  128 + if(!p_data.sign && !err_txt){
  129 + err_txt="未找到sign";
  130 + }
  131 + if(!p_data.signtype && !err_txt){
  132 + err_txt="未找到signtype";
  133 + }
  134 + if(!p_data.trxamt && !err_txt){
  135 + err_txt="未找到trxamt";
  136 + }
  137 + if(!p_data.validtime && !err_txt){
  138 + err_txt="未找到validtime";
  139 + }
  140 + if(!p_data.version && !err_txt){
  141 + err_txt="未找到version";
  142 + }
  143 +
  144 + if(err_txt){
  145 + i.wx_paying=0;
  146 + getApp().confirmBox(err_txt);
  147 + setTimeout(function(){
  148 + wx.redirectTo({
  149 + url: "/pages/user/order_list/order_list",
  150 + });
  151 + },1000)
  152 + return false;
  153 + }
  154 +
  155 +
  156 +
  157 +
  158 +
96 159 wx.openEmbeddedMiniProgram({
97 160 appId: 'wxef277996acc166c3',
98 161 extraData: p_data,
... ...