最近搜索

小程序 request 使用方法

浏览:561
管理员 2020-10-22 14:04


 //向自己发送 订阅消息  订单状态提醒
    request({
      url:  baseURL+'/api/xcx/sendMsg1',
      method: 'post',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: {
        openid: app.globalData.openid
      }
    }).then(res => {
      console.log(res.data)
            //成功代码 {errcode: 0, errmsg: "ok"}   
      //失败代码 {errcode: 43101, errmsg: "user refuse to accept the msg hint: [JIadkAwgE-tRzq7a]"}
      console.log(res.data.msg.errcode)//0是成功
      console.log(res.data.msg.errmsg)//ok是成功
    })




联系站长

站长微信:xiaomao0055

站长QQ:14496453