cmdszh
cmdszh
  • 发布:2022-05-12 13:10
  • 更新:2022-05-12 15:34
  • 阅读:973

【报Bug】app 部分手机无法调起微信支付

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 3.4.7

HBuilderX类型: 正式

HBuilderX版本号: 3.4.7

手机系统: Android

手机系统版本号: Android 11

手机厂商: 华为

手机机型: 荣耀 X20 SE

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

App下载地址或H5⽹址: https://7463-tcb-kjg1wz7iyqr1jv837c0e5-d34743-1309641310.tcb.qcloud.la/__UNI__134AAF7_0512124245.apk

示例代码:

uni.showLoading({
title: '请求数据中',
mask: false
});
var url = '';
var data;
var type;

            if (this.Index == 1) {  
                data = {  
                    body:this.accountId+'',  
                    subject: "账户充值",  
                    totalAmount: this.money,  
                    passbackParams: "000000000",  
                    productCode: "000000001"  
                }  
                url = '/alipay/appPay';  
                type = "alipay"  
            }  
            if (this.Index == 2) {  
                url = "/wxpay/webPay"  
                data = {  
                    total_fee: this.money,  
                    body: "账户充值",  
                    attach: this.accountId+''  
                }  
                type = "wxpay"  
            }  
            uni.request({  
                url: helper.server_url + url,  
                method: 'POST',  
                data: data,  
                header: {  
                    'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息  
                    'token': this.$token.token.valuetoken  
                },  
                success: res => {  
                    if (res.data.code == 0) {  
                        console.log("type:"+type);  
                        uni.requestPayment({  
                            provider: type,  
                            orderInfo:res.data.data, //微信、支付宝订单数据  
                            success: function(res) {  
                                uni.showToast({  
                                    title: '支付成功',  
                                    icon: "none"  
                                });  
                                console.log('success:' + JSON.stringify(res));  
                            },  

                            fail: function(err) {  
                                console.log('fail:' + JSON.stringify(err));  
                                uni.showToast({  
                                    title: '支付失败,如有问题请及时联系管理员',  
                                    icon:"none"  
                                });  
                            }  
                        });  
                    } else {  
                        uni.showToast({  
                            title: '发起支付失败,'+res.data.message,  
                            icon: "none"  
                        });  
                    }  

                },  
                fail: () => {  
                    uni.showToast({  
                        title: '获取支付数据失败',  
                        icon: "none"  
                    });  
                },  
                complete: () => {  
                    uni.hideLoading()  
                }  
            });

操作步骤:

app 调用微信充值

预期结果:

所有类型的手机都可以调起微信支付

实际结果:

部分手机无法调起微信支付,部分手机可以

bug描述:

微信支付服务调出支付界面,Logcat 报错如下

2022-05-12 12:49:02.841 977-977/? I/AGPService: aps-info: visible pkgName 0 - uni.UNI134AAF7  
2022-05-12 12:49:03.440 982-1718/? D/dubaid: [CpuAppStats.cpp] FindUidEntry# Uid(10032) has not package, maybe it's already uninstalled  
2022-05-12 12:49:04.193 3930-11756/? W/HONOR_AWARENESS_AppLifeFence:  key : cd00f570-c759-4731-bc33-cf45c9262c2b,not contained in white list : [com.tencent.mm/com.tencent.mm.plugin.remittance.ui.RemittanceBusiResultUI, com.tencent.mm/com.tencent.mm.framework.app.UIPageFragmentActivity, com.tencent.mm/com.tencent.mm.plugin.wallet_core.ui.WalletOrderInfoNewUI, com.eg.android.AlipayGphone/com.alipay.android.msp.ui.views.MspContainerActivity, com.eg.android.AlipayGphone/com.alipay.android.msp.ui.views.MspUniRenderActivity]  
2022-05-12 12:49:04.193 1541-1575/? I/StatusBarDisable: setFlags what=0 which=1 pkg=Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity}  
2022-05-12 12:49:04.199 2144-2765/? D/ScenarioService: new above launcher front pkgs: [com.android.packageinstaller, uni.UNI134AAF7, com.huawei.android.internal.app, com.tencent.mm, uni.UNI134AAF7, com.huawei.android.internal.app, com.tencent.mm]  
2022-05-12 12:49:04.224 9768-9768/? E/Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory  
    java.lang.Throwable  
        at android.app.Instrumentation.getFactory(Instrumentation.java:1276)  
        at android.app.Instrumentation.newActivity(Instrumentation.java:1267)  
        at com.tencent.mm.splash.l.newActivity(SourceFile:64)  
        at com.tencent.mm.pluginguard.ActivityHookInstrumentation.newActivity(SourceFile:149)  
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3982)  
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4295)  
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:93)  
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)  
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)  
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2532)  
        at android.os.Handler.dispatchMessage(Handler.java:109)  
        at android.os.Looper.loop(Looper.java:228)  
        at android.app.ActivityThread.main(ActivityThread.java:8731)  
        at java.lang.reflect.Method.invoke(Native Method)  
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:613)  
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1085)  
2022-05-12 12:49:04.280 1541-2233/? I/WindowManager: Changing focus from null to Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity}mode 3 displayId=0  
2022-05-12 12:49:04.281 1541-2233/? V/HwPhoneWindowManager: updateSystemUiColorLw window=Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity},EmuiStyle=0,StatusBarColor=0x0,NavigationBarColor=0xfffcfcfc, mForceNotchStatusBar=false  
2022-05-12 12:49:04.284 1541-1575/? I/StatusBarDisable: setFlags what=0 which=1 pkg=Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity}  
2022-05-12 12:49:04.304 1541-2233/? I/InputDispatcher: Focus entered window: Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity} in display 0  
2022-05-12 12:49:04.311 1541-2233/? I/WindowManager: Changing focus from Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity} to nullmode 0 displayId=0  
2022-05-12 12:49:04.316 2144-2765/? I/ScenarioService: refresh visibleApp:[com.tencent.mm, uni.UNI134AAF7]  
2022-05-12 12:49:04.317 2144-2765/? I/PGServer: report state:14 event type:1 pid:-1 uid:-1 pkg:com.tencent.mm#uni.UNI134AAF7 to pid: 2144  
2022-05-12 12:49:04.317 9768-9768/? E/Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory  
    java.lang.Throwable  
        at android.app.Instrumentation.getFactory(Instrumentation.java:1276)  
        at android.app.Instrumentation.newActivity(Instrumentation.java:1267)  
        at com.tencent.mm.splash.l.newActivity(SourceFile:64)  
        at com.tencent.mm.pluginguard.ActivityHookInstrumentation.newActivity(SourceFile:149)  
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3982)  
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4295)  
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:93)  
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)  
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)  
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2532)  
        at android.os.Handler.dispatchMessage(Handler.java:109)  
        at android.os.Looper.loop(Looper.java:228)  
        at android.app.ActivityThread.main(ActivityThread.java:8731)  
        at java.lang.reflect.Method.invoke(Native Method)  
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:613)  
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1085)  
2022-05-12 12:49:04.317 977-977/? I/AGPService: aps-info: visible pkgName 0 - uni.UNI134AAF7  
2022-05-12 12:49:04.337 1541-5048/? I/InputDispatcher: Focus left window: Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity} in display 0  
2022-05-12 12:49:04.359 1541-1671/? I/SWAP_SCENE: Entering notifySceneData notifySceneData. EventType:SWITCH_TO_FOREGROUND para:uni.UNI134AAF7  
2022-05-12 12:49:04.359 1541-1671/? I/ActivityTaskManager: START u0 {flg=0x10000000 hwFlg=0x110 cmp=uni.UNI134AAF7/.wxapi.WXPayEntryActivity (has extras)} from uid 10188  
2022-05-12 12:49:04.360 1541-1671/? I/ActivityTaskManager: ActivityRecord info: ActivityInfo{d46596d uni.UNI134AAF7.wxapi.WXPayEntryActivity}  
2022-05-12 12:49:04.360 1541-1671/? D/ActivityTaskManager: TaskLaunchParamsModifier:task=null activity=ActivityRecord{87c5633 u0 uni.UNI134AAF7/.wxapi.WXPayEntryActivity display-from-caller=0 task-display-area=DefaultTaskDisplayArea@108011477 display-area-windowing-mode=1  
2022-05-12 12:49:04.360 1541-1671/? D/ActivityTaskManager: TaskLaunchParamsModifier:task=Task{6eeb463 #1426 visible=false type=standard mode=fullscreen translucent=true A=10193:uni.UNI134AAF7 U=0 StackId=1426 sz=1} activity=ActivityRecord{87c5633 u0 uni.UNI134AAF7/.wxapi.WXPayEntryActivity t-1} display-from-task=0 task-display-area=DefaultTaskDisplayArea@108011477 display-area-windowing-mode=1 non-freeform-display  
2022-05-12 12:49:04.361 1541-1671/? I/WindowManager: Changing focus from null to Window{86155d u0 uni.UNI134AAF7/io.dcloud.PandoraEntryActivity}mode 3 displayId=0  
2022-05-12 12:49:04.362 1541-1671/? W/HwActivityTaskManagerServiceEx: appSwitch from: com.tencent.mm to: uni.UNI134AAF7  
2022-05-12 12:49:04.363 1541-1671/? I/WindowManager: addWindowToken: displayid:0 binder:Token{d8179a2 ActivityRecord{87c5633 u0 uni.UNI134AAF7/.wxapi.WXPayEntryActivity t-1}} token:ActivityRecord{87c5633 u0 uni.UNI134AAF7/.wxapi.WXPayEntryActivity t-1}  
2022-05-12 12:49:04.364 1541-1586/? D/HwGameAssistantController: UPDATE: mCurFgPkg=uni.UNI134AAF7, mCurFgPid=10631, mIsCurGame=false  
2022-05-12 12:49:04.364 3930-4033/? I/HONOR_AWARENESS_AmsRegister: app switch from : com.tencent.mm to uni.UNI134AAF7 as ComponentInfo{uni.UNI134AAF7/io.dcloud.PandoraEntryActivity}  label:  
2022-05-12 12:49:04.364 3930-4033/? I/HONOR_AWARENESS_AppLifeCycleAbility: app exit : com.tencent.mm act : ComponentInfo{uni.UNI134AAF7/io.dcloud.PandoraEntryActivity} label :   
2022-05-12 12:49:04.364 1541-1585/? I/SWAP_SCENE: Entering notifySceneData notifySceneData. EventType:APP_SWITCH_TO para:uni.UNI134AAF7
2022-05-12 13:10 负责人:DCloud_Android_THB 分享
已邀请:
DCloud_Android_THB

DCloud_Android_THB

你好,我这边在小米10s miui13安装你的apk ,选择充值是可以拉起微信支付的,能否确保您不同手机的微信版本是一致的?

  • cmdszh (作者)

    微信版本都是8.0.22, 同样的环境,换了个能充值的手机,自定义基座调试,一开始充值成功。多冲几次又报上面相同的错误,我们这个应用已经上线两年了,最近几个月客户抱怨部分手机微信充值调不起来。是不是新版本的微信兼容性问题呢?另外,苹果用户一直没这个问题。

    2022-05-12 18:17

  • DCloud_Android_THB

    回复 cmdszh: 你看一下fail的时候error中的code是不是 -1 可能的原因:签名错误、未注册APPID、项目设置APPID不正确、注册的APPID与设置的不匹配、其他异常原因等

    2022-05-12 22:59

  • cmdszh (作者)

    回复 DCloud_Android_THB: fail:{"errMsg":"requestPayment:fail [payment微信:-1]General errors","errCode":-100,"code":-100}

    2022-05-12 23:01

  • DCloud_Android_THB

    回复 cmdszh: 我怀疑后台返回的数据有点问题,我这边用你的app继第一次支付成功后,后面几次尝试都是失败,方便校验一下orderInfo的数据正确性吗?

    2022-05-12 23:08

  • cmdszh (作者)

    回复 DCloud_Android_THB: 用双开的微信,第二个微信号支付,每次都成功。IOS 也都是每次成功。所以 orderInfo没有问题。

    2022-05-12 23:20

  • cmdszh (作者)

    回复 DCloud_Android_THB: orderInfo用“微信支付接口签名校验工具”校验证过了,没有问题。

    2022-05-13 00:05

  • DCloud_Android_THB

    回复 cmdszh: 嗯。。。。 这样你能出个能复现的demo,我这边跑一下。

    2022-05-13 01:01

该问题目前已经被锁定, 无法添加新回复