项目中需要获取微信用户头像及昵称。如果是把昵称和头像url保存到数据库的话,信息会无法及时更新,而且更换头像后原来的url会失效,应该下载头像到本地吗?如果是用其他方式的话又如何,请问哪种方式比较合理。
大家讲道理2017-05-16 13:02:32
Each OpenID used is unique and needs to be stored in the database. The avatar nickname may change and the expiration time of the stored session setting is changed. Personal opinion
过去多啦不再A梦2017-05-16 13:02:32
Be sure to save the database, including openid. If you have high requirements for updating your WeChat username and avatar, make scheduled tasks to update them regularly.
If you only need to update the avatar, access the avatar address regularly. If it does not exist, call the interface to query WeChat user information and update the database.
ringa_lee2017-05-16 13:02:32
I also encountered this problem. When logging in with WeChat, the avatar of the WeChat user is captured, but what should I do if the user changes the avatar?