wx.sendPhoneSms(Object object)

接口已废弃,请使用 button 组件指定 open-type 触发接口。

发送短信验证码到指定手机号上,验证码是由 6 位数字组成的字符串,用于手机验证码登录

在调用此接口前,请先进行验证码短信配置open in new window

参数

Object object

属性类型默认值必填说明
phoneNumberstring手机号
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数
completefunction接口调用结束的回调函数

object.fail 回调函数

参数
Object res
属性类型说明
errCodenumber错误码
errMsgstring错误提示

res.errCode

errCode说明
-1system error
10001007多端应用未绑定移动应用
10001017发送短信超过频率限制
-700000前端错误,errMsg 将给出详细提示

示例代码

wx.sendPhoneSms({
  phoneNumber: '13700000000'
})