人人商城H5打包app,吊起微信支付的问题

人人商城H5打包app,吊起微信支付的问题,第1张

需要加入的文件

加入到目录php\addons\ewei_shopv2\payment\h5pay,这个需要新建

文件我会另外上传

下载地址(16条消息) 人人商城H5打包app需要的文件-PHP文档类资源-CSDN文库

需要修改的文件

php\addons\ewei_shopv2\static\js\dist\Ydb\YdbOnline.js

下面主要修改的是YDBOBJ.prototype.SetWxpayInfo方法,里面调用的pluses.payment

至于微信支付的显示,后台配置好就行

function YDBOBJ() {
    this.YundabaoUA = navigator.userAgent.toLowerCase();
    this.isIos = this.YundabaoUA.match(/(iphone|ipod|ipad);?/i);
    this.isAndroid = this.YundabaoUA.match(/android/i);
    this.isWindows = this.YundabaoUA.match(/windows/i);
    this.siteUrl = core.options.siteUrl;

};
YDBOBJ.prototype.ExitApp = function () {

    var Share = 'ExitApp()';
    api.execScript({
        script: Share
    });

    /*api.closeWidget({
         silent : true
        });*/
};

YDBOBJ.prototype.isWXAppInstalled = function (installstate) {
};
YDBOBJ.prototype.SetStatusBarStyle = function (colorvalue) {
};
YDBOBJ.prototype.Share = function (title, content, img, linkUrl) {
    var config = {'apiKey': '', 'apiSecret': ''};

    var shaer_confing = {
        rect: {
            h: 180
        },
        texts: {
            cancel: '取消'
        },
        items: [{
            text: '微信好友',
            icon: 'widget://image/weifriend.png'
        }, {
            text: '微信朋友圈 ',
            icon: 'widget://image/share_to_icon_wxq.png'
        }
        ],
        styles: {
            bg: '#FFF',
            column: 4,
            itemText: {
                color: '#000',
                size: 15,
                marginT: 4
            },
            itemIcon: {
                size: 54
            },
            cancel: {
                bg: 'fs://icon.png',
                color: '#000',
                h: 68,
                size: 21
            }
        },
        tapClose: true
    };


    var Share = 'Share(\'' + title + '\',\'' + content + '\',\'' + img + '\',\'' + linkUrl + '\',' + JSON.stringify(config) + ' ,' + JSON.stringify(shaer_confing) + ')';
    api.execScript({
        script: Share
    });

};


YDBOBJ.prototype.ClearCache = function () {

    var Share = 'ClearCache()';
    api.execScript({
        script: Share
    });

};

YDBOBJ.prototype.SetWxpayInfo = function (ProductName, Desicript, Price, OuttradeNo, attach, OrderId) {

    var config = { 'apiKey': 'wxfa41453b84c89ac5', 'mchId': '1617492720', 'partnerKey': 'cde47ef73a184838340aafce4b402c97', 'notifyUrl': this.siteUrl + 'addons/ewei_shopv2/payment/wechat/notify.php' };

    // var Share = 'SetWxpayInfo(\'' + ProductName + '\',\'' + Desicript + '\',\'' + Price + '\',\'' + OuttradeNo + '\',\'' + attach + '\',' + JSON.stringify(config) + ')';
    // api.execScript({
    //     script: Share
    // });
    var orderInfo = '';
    var pluses = plus;
    // console.log('所有参数',ProductName, Desicript, Price, OuttradeNo, attach, OrderId)
    $.ajax({
        'type': 'POST',
        'url': '/addons/ewei_shopv2/payment/h5pay/index.php',
        'data': {
            total: Price,
            subject: Desicript,
            OuttradeNo:OuttradeNo
        },
        'dataType': 'json',
        success: function (res) {
            console.log('ajax success', JSON.stringify(res));
            orderInfo = res;
            var channels = 0;

            //获取支付渠道
            var wxpaySev = null;
            pluses.payment.getChannels(function (channels) {
                for (var i in channels) {
                    var channel = channels[i];
                    if (channel.id === 'wxpay') {
                        wxpaySev = channel;
                    }
                }
                //发起支付
                pluses.payment.request(wxpaySev, orderInfo, function (res) {
                    // var rawdata = JSON.parse(res);
                    console.log("支付成功", OrderId);
                    $.ajax({
                        url: 'https://****/app/index.php?i=1&c=entry&m=ewei_shopv2&do=mobile&r=order.pay.complete&id='+OrderId+'&uniacid=1&type=wechat&ordersn='+OuttradeNo,
                        data: '',
                        success: function (e) {
                            window.location.href = 'https://****/app/index.php?i=1&c=entry&m=ewei_shopv2&do=mobile&r=order.pay.success&id='+OrderId+'&result=true&uniacid=1&type=wechat'
                        }
                    });
                }, function (e) {
                    console.log("支付失败:" + JSON.stringify(e));
                });
            }, function (e) {
                console.log("获取支付渠道失败:" + JSON.stringify(e));
            });
        }
    });
};

YDBOBJ.prototype.SetRSA2AlipayInfo = function () {
};
//YDBOBJ.prototype.SetAlipayInfo = function(ProductName, Desicript, Price, OuttradeNo) {
//	
//
//	
// core.json('appaccount/alipay', {ProductName:ProductName,Desicript:Desicript,OuttradeNo:OuttradeNo,Price:Price}, function(ret) {
//var Share='payOrder('+JSON.stringify(ret)+')';
// api.execScript({
//					script:Share
//				});
//	
// 
//
//	 }, true);
//};

YDBOBJ.prototype.SetAlipayInfo = function (ProductName, Desicript, Price, OuttradeNo) {
    var config = {
        'partner': '2088002048040679',
        'seller': '1805278****',
        'rsaPriKey': 'MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCTeV2jZxJZY+2uQIleNW7RZCXkFGYcKE6ihdwrfs38SXS9VmbUfoREKQm7PQQjeP8U4sRDiZAeUuEJcfr5c50Mb19IwAnIphuTKz3IGebAcCbJjA6+TgOpTIMDYfW3nlrNOaI2Bk1ZYilJM6XQCtor1IgQucL7LdUl5/jnw2srehEW8pBy5n17WKbA83yxLaGmLaifwtUD/vhwS7vF1NUswzYB+a9TSehQrf319H07V6xnS4AWpDUVVjHo/jH0WYdYpBYDq9XD2pUhCzM1evcA+4EJsuKz2eBbxoRKj+zS6pIXg3gu0ynRkOoxr3flPAJaeAMDQZWPfdPXYHSnXDSZAgMBAAECggEATA5Qi4ARx4YwwyhHcA2wjE7Q99LJYoYrH8hXZxsrkowzp54SxE5HWnurqCPsqXqyWwwkWgxtBiaKJnvhCptkiFA73OIlaZS5LeokH7mz9tUgO9t+kwja/IoYGzt/JOaHP8YUcTZI1+s3DaiUQDoIkIg4cB/NfgsCHV2IUcbH05B+/IR5lwYRNClzBivkChFGrLlef8obLbV6h7hg+oRedHiYT+S99N5x4XJLCHLZQWXYQWrXSJYSbB8YB5ZxsxjR3J7vIC9IGV6gPTJWPqE6kt7aXkbNMgXa+sCefeb9tgyoyFiMzYD+gpIh+20I4Z66PpBOH8x96wAePwG688jbcQKBgQD47qK2cBviYRJH6IAOfGKzyT91eP/R5RRyeppjz4QFaREtHN6YA3Mf5+nxYFa095Y2tePYX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dTVLMM2AfmvU0noUK399fR9O1esZ0uAFqQ1FVYx6P4x9FmHWKQWA6vVw9qVIQszNXr3APuBCbLis9ngW8aESo/s0uqSF4N4LtMp0ZDqMa935TwCWngDA0GVj33T12B0p1w0mQIDAQAB',
        'notifyURL': this.siteUrl + 'addons/ewei_shopv2/payment/alipay/notify.php'
    };
    var Share = 'SetAlipayInfo(\'' + ProductName + '\',\'' + Desicript + '\',\'' + Price + '\',\'' + OuttradeNo + '\',' + JSON.stringify(config) + ')';
    api.execScript({
        script: Share
    });

};


YDBOBJ.prototype.QQLogin = function (accessUrl) {

    var config = {};
    var Share = 'QQLogin(\'' + accessUrl + '\',' + JSON.stringify(config) + ')';
    api.execScript({
        script: Share
    });

};


YDBOBJ.prototype.WXLogin = function (returnDataType, accessUrl) {

    FoxUI.toast.show("正在呼起微信客户端");

    var config = {'apiKey': 'wxa2e1d545cb2aca53', 'apiSecret': '1e51ce9f50fe50168707aeb6ed325ce5'};


    var Share = 'WXLogin(\'' + returnDataType + '\',\'' + accessUrl + '\',' + JSON.stringify(config) + ')';
    api.execScript({
        script: Share
    });

};

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/940470.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-17
下一篇 2022-05-17

发表评论

登录后才能评论

评论列表(0条)

保存