发送请求 wx.request,接口调用问题
发布于 6 年前 作者 esu 8555 次浏览 来自 问答

微信小程序发送请求 wx.request,在安卓机器上可以调通接口,在苹果手机上调用不了接口,这是什么原因??请求方法见下:

//对称解密数据

                        wx.request({

                            url: ‘https://zhaoxiangshi.happy791.com/wxSPro/wechatDecryptData’,

                            data: {

                                encryptedData: encryptedData,

                                iv: iv,

                                code: code,

                                apiauthtoken: App.globalData.apiauthtoken

                            },

                            method: ‘POST’, // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT

                            header: { ‘content-type’: ‘application/x-www-form-urlencoded’ }, // 设置请求的 header

                            success: function (res) {

                                // success

                                //同一用户,对同一个微信开放平台下的不同应用,unionid是相同的

                                console.log(“wechatDecryptData”)

                                const openId = res.data.openId;

                                wx.setStorageSync(‘openId’, openId);

                                const unionId = res.data.unionId;

                            },

                            fail: function () {

                                // fail

                                console.log(“对称解密数据wechatDecryptData:fail”)

                                wx.showToast({

                                    title: ‘对称解密微信数据:fail’

                                })

                            }

                        })

回到顶部