账号绑定API
PC端跳转API
路径
URL: | {buyer-domain}/account-binder/pc/{type} |
---|---|
METHOD | GET |
参数
参数 | 类型 | 说明 |
---|---|---|
type | String | 方式,可选有:QQ、WECHAT、WEIBO、ALIPAY |
处理逻辑
拼接参数
redirect至第三方平台
WAP跳转API
路径
URL: | {buyer-domain}/account-binder/wap/{type} |
---|---|
METHOD | GET |
参数
参数 | 类型 | 说明 |
---|---|---|
type | String | 方式,可选有:QQ、WECHAT、WEIBO、ALIPAY |
处理逻辑
拼接参数
redirect至第三方平台
callback API
路径(注意此处用passport的域名,此处的api应在passport中)
URL: | {passport-domain}/account-binder/{port}/{type}/callback |
---|---|
METHOD | GET |
参数
参数 | 类型 | 说明 |
---|---|---|
code | String | 第三平台返回的code |
type | String | 登录方式,可选有:QQ、WECHAT、WEIBO、ALIPAY |
port | String | 登录端,可选有:PC,WAP |
逻辑处理
和第三方平台交互获取openid 将uuid和openid、access_token、type参数进行绑定:
向redis以 OPENID_{UUID}的key 写Auth2Token对象:
有效期为5分钟
写入成功后,跳转至 /account-binder,并将uuid写入cookie:
名称为uuid,path为主域名,有效期为5分钟
绑定openidAPI
路径
URL: | {buyer-domain}/account-binder/pc/{uuid} |
---|---|
METHOD | POST |
参数
参数 | 类型 | 说明 |
---|---|---|
uuid | String | 对照过openid的uuid |
处理逻辑
由redis中取出对应的type和openid
由usercontext中拿到buyer
将两者在数据库中建立关联
取消绑定API
路径
URL: | {buyer-domain}/account-binder/pc/{type} |
---|---|
METHOD | DELETE |
参数
参数 | 类型 | 说明 |
---|---|---|
type | String | 方式,可选有:QQ、WECHAT、WEIBO、ALIPAY |
处理逻辑
由usercontext中拿到buyer
删除type类型的openid
一个月内只,同一个openid允许解绑一次
获取绑定列表API
路径
URL: | {buyer-domain}/account-binder |
---|---|
METHOD | get |
参数
无
处理逻辑
读取出此用户各个平台的绑定情况列表,要含有类型、是否已经绑定字段,不用分页