• APIcloud微信支付和支付宝支付(方案2,主要在后台进行)


    支付宝代码

    var aliPay = api.require('aliPay');
    api.ajax({
    url: yuming+'index.php/api/Alipay/getOrder',
    method: 'post',
    data:{values: {
    'user_id':$api.getStorage('id'),'totalfee':totalfee,house_id:$api.getStorage('fid'),user_payment_type:user_payment_type,user_payment_type_id:user_payment_type_id,count:$api.dom('#num').value
    }}
    }, function(rets) {
    // alert(JSON.stringify(rets));
    aliPay.payOrder({
    orderInfo: rets.str
    }, function(ret, err) {
    if(ret.status)
    {
    $api.dom('#chongzhi2').style.display='none';
    //
    $api.setStorage('tiaoshu',0)
    api.alert({
    title: '',
    msg: '支付成功',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    /////////
    api.ajax({
    url: yuming+ 'index.php/api/History/addHistory/',
    method: 'post',
    data:{values: {
    'house_id':$api.getStorage('fid'),'user_id':$api.getStorage('id')
    }}
    }, function(ret) {
    var jsfun = 'shuaxin();';
    api.execScript({
    name: 'root',
    frameName: 'frame3',
    script: jsfun
    });
    })

    }
    else
    {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    jfk=0;
    $api.dom('#qrfk').innerText='确认付款'
    }
    });
    });

    微信支付代码

    var wx = api.require('wx');
    var wxPay = api.require('wxPay');
    wx.auth({
    apiKey: ''
    }, function(ret, err) {
    if (ret.status) {
    var code = ret.code;
    wx.getToken({
    apiKey: '',
    apiSecret: '',
    code: code
    }, function(ret, err) {
    if (ret.status) {
    api.ajax({
    url: yuming+'index.php/api/weixin/getOrder',
    method: 'post',
    data:{values: {
    'openid':ret.openId,'user_id':$api.getStorage('id'),'totalfee':totalfee,house_id:$api.getStorage('fid'),user_payment_type:user_payment_type,user_payment_type_id:user_payment_type_id,count:$api.dom('#num').value
    }}
    }, function(rets) {
    wxPay.payOrder({
    apiKey: rets.return.apiKey,
    orderId: rets.return.orderId,
    mchId: rets.return.mchId,
    nonceStr: rets.return.nonceStr,
    timeStamp: rets.return.timeStamp,
    package: rets.return.package,
    sign: rets.return.sign,
    }, function(ret, err) {
    if (ret.status) {
    $api.dom('#chongzhi2').style.display='none';
    //
    $api.setStorage('tiaoshu',0)
    api.alert({
    title: '',
    msg: '支付成功',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    ///////////
    api.ajax({
    url: yuming+ 'index.php/api/History/addHistory/',
    method: 'post',
    data:{values: {
    'house_id':$api.getStorage('fid'),'user_id':$api.getStorage('id')
    }}
    }, function(ret) {
    var jsfun = 'shuaxin();';
    api.execScript({
    name: 'root',
    frameName: 'frame3',
    script: jsfun
    });
    })

    } else {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });
    jfk=0;
    $api.dom('#qrfk').innerText='确认付款'
    }


    });
    });
    } else {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });

    $api.dom('#qrfk').innerText='确认付款'
    }
    });
    } else {
    api.alert({
    title: '',
    msg: '付款失败',
    buttons:[ '确定']
    },function(ret,err){
    if(ret.buttonIndex == 1){

    return;
    }
    });

    $api.dom('#qrfk').innerText='确认付款'
    }
    });

    }
    }

    }
    }
    })
    })
    }
    })

  • 相关阅读:
    shell脚本while read line的使用
    shell 一次性赋值多个变量
    Docker Volume
    nginx反向代理与负载均衡
    lua中 table.getn(t) 、#t、 table.maxn(t) 这三个什么区别?
    pv绑定pvc
    使用brew services管理服务
    Kubernetes中强制删除Pod、namespace
    shell 中的${},##, %% , :- ,:+, ? 的使用
    petalinux中fsbl源码
  • 原文地址:https://www.cnblogs.com/jyc226/p/8081532.html
Copyright © 2020-2023  润新知