当前位置:网站首页>Wechat applet obtains mobile number
Wechat applet obtains mobile number
2022-07-27 18:39:00 【mr_ cmx】
First get session_key, I don't know how to get it. I can see My previous blog post
wxml:
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
Get cell phone number
</button>
js:
// Get the user's mobile number
getPhoneNumber (e) {
if(e.detail.errMsg=='getPhoneNumber:ok'){
let self=this;
wx.showLoading({
title: ' Loading ',
mask:true
})
let data={
sessionkey:app.globalData.session_key,// Previously obtained session_key
iv: e.detail.iv,
encryptedData: e.detail.encryptedData// Encrypt data
};
// Here we have got encryptedData Encrypt data , Then send it to the background AES Decrypt
wx.request({
url: app.globalData.requestUrl+'/wx/get_phoneNumber ', // Change to your own url
data,
header: {
"Content-Type": "application/x-www-form-urlencoded"
},
method:'POST',
success (res) {
wx.hideLoading()
console.log(res.data)
// Expected after decryption json structure
/*{ "phoneNumber": Mobile phone number bound by the user ( Foreign mobile phone numbers will have area codes ), "purePhoneNumber": Mobile phone number without area code , "countryCode": Area code , "watermark": { "appid": APPID, "timestamp": TIMESTAMP } }*/
}
})
}
}
Backstage decryption
Wechat official provides a variety of programming language sample code (( Click to download ). The interface name of each language type is consistent . Call method can refer to the example
If you have used the official wechat offer mentioned by wechat payment before wechatpay Development Library , Then use it directly Sensitive information plus / Decrypt The function is simple
If you want to download, you can go before Wechat paid blog Download , It's not listed here
边栏推荐
- 机器学习——SVM训练集只有一类标签数据而引发的错误
- [MIT 6.S081] Lab 4: traps
- Deep learning: Gan optimization method dcgan case
- [MIT 6.S081] Lab 9: file system
- Jrs-303 usage
- @Convert 注解在jpa中进行查询的注意事项
- 常用词词性表
- MySQL code database creation parking management system foreign key
- [MIT 6.S081] Lab 11: networking
- @Considerations for query of convert annotation in JPA
猜你喜欢

解决Jsp级联问题

2021.8.1笔记 DBA

Random talk on GIS data (V) - geographic coordinate system

Deep learning - VIDEO behavior recognition: paper reading - two stream revolutionary networks for action recognition in videos

Log4j 史诗级漏洞,京东这样的大厂都中招了

2021.7.22笔记 约束

Why don't you like it? It's easy to send mail in ci/cd

怎么会不喜欢呢,CI/CD中轻松发送邮件
![[mit 6.s081] LEC 10: multiprocessors and locking notes](/img/62/ca6362830321feaf450865132cdea9.png)
[mit 6.s081] LEC 10: multiprocessors and locking notes

MySQL 主从复制数据不一致,怎么办?
随机推荐
怎么会不喜欢呢,CI/CD中轻松发送邮件
[MIT 6.S081] Lec 1: Introduction and examples 笔记
2021.8.9笔记 request
MySQL learns the relationship between Day2 Sorting Query / aggregation function / grouping query / paging query / constraint / multiple tables
Binary tree concept
[mit 6.s081] LEC 4: page tables notes
MySQL学习 Day3 多表查询 / 事务 / DCL
Knowledge map pyhanlp realizes named body recognition (with named body recognition code)
XML学习 Day1 : xml / Jsoup解析器 / selector选择器 /Xpath选择器
Installation and deployment of zabbix6.0
Preliminary introduction to C miscellaneous lecture linked list
On model training and reasoning of AI deep learning
@Considerations for query of convert annotation in JPA
2021.7.30笔记 索引
"Who is Huawei" documentary film series landing on BBC: exposing a large number of Ren Zhengfei's unknown experience
Deep learning: GCN diagram classification case
[MIT 6.S081] Lab 5: xv6 lazy page allocation
2021.7.19 notes DML
微信小程序微信支付概述
2. Change color space and color detection