登录注册与用户信息
跟斌叔学编程
登录
Method and Url Structure
| Method |
Resource URL |
| POST |
/server/userinfo/login_wx/ |
Request and Parameters
| Name |
Description |
Required |
Default |
| code |
微信参数 |
YES |
|
Request
{ "code": "011Lcgsa1UB1IQ1Bztta1Gr8sa1Lcgsq"}
cURL Example
curl -X POST -d data{...}http://127.0.0.1:8000/server/userinfo/login_wx/
JSON Response
{ "session": 136888582236}// 注册后回登录会返回 token 信息{ "token": "cd98581962af9e28074677886ceb5d5d503ee389", "session": 658363108573}
注册
Method and Url Structure
| Method |
Resource URL |
| POST |
/server/userinfo/signup_wx/ |
Request and Parameters
| Name |
Description |
Required |
Default |
| session |
登录返回信息 |
YES |
|
| nickname |
昵称 |
YES |
|
| avatar_url |
头像 |
YES |
|
| country |
国籍 |
YES |
|
| province |
省 |
YES |
|
| city |
市 |
YES |
|
| sex |
性别 |
NO |
|
Request
{ "session": "136888582236", "nickname": "尼古拉斯·刘能", "avatar_url": "https://static1.bcjiaoyu.com/head7@3x.png", "country": "呵呵国", "province": "哈哈省", "city": "嘿嘿市"}
cURL Example
curl -X POST -d data{...}http://127.0.0.1:8000/server/userinfo/signup_wx/
JSON Response
{ "token": "03d69f50b774f4fcf7139919d051965aea5a7d7b"}
查看个人信息
Method and Url Structure
| Method |
Resource URL |
| GET |
/server/userinfo/whoami_wx |
cURL Example
curl -X GET -H 'Authorization: Token 68b76feaa3ec4f9da1ed7cfa6cd97f3d53ecf732'http://127.0.0.1:8000/server/userinfo/whoami_wx/
JSON Response
{ "pk": 1, "owner": "or6Un41fqh04N6ZU6qbgWbC2M8Eo", "is_pay": false, "nickname": "尼古拉斯·刘能", "avatar_url": "https://static1.bcjiaoyu.com/head7@3x.png", "group_info": { "status": 0, "status_display": "未组队未买课" }, "sex": "N", "sex_display": "未知", "country": "呵呵国", "province": "哈哈省", "city": "嘿嘿市"}/* group_info = {"status": 0, "status_display": "未组队未买课"} group_info = {"status": 1, "status_display": "组队队员未满"} group_info = {"status": 2, "status_display": "组队已有资格"} group_info = {"status": 3, "status_display": "有钱任性买课"} */
绑定微信请求验证码
Method and Url Structure
| Method |
Resource URL |
| GET |
/server/userinfo/bind_wx_request/ |
Request and Parameters
| Name |
Description |
Required |
Default |
| username |
手机号码 |
YES |
|
Request
{ "username":"123456"}
cURL Example
curl -X POST -d data{...}http://127.0.0.1:8000/server/userinfo/bind_wx_request/?username=123456
JSON Response
{ "message": "", "status": 0}
绑定微信(即注册到用户)
Method and Url Structure
| Method |
Resource URL |
| POST |
/server/userinfo/bind_wx/ |
Request and Parameters
| Name |
Description |
Required |
Default |
| username |
电话号码 |
YES |
|
| password |
密码 |
YES |
|
| verification_code |
验证码 |
YES |
|
| userinfo |
用户信息 |
YES |
|
Request
{ "username":"18519791946", "password":"123456789", "verification_code":"916766", "userinfo":{ "name":"Leon", "avatar":"https://static1.bcjiaoyu.com/head1@3x.png" }}
cURL Example
// 这个注册需要微信中的 tokencurl -X POST -H 'Authorization: Token 68b76feaa3ec4f9da1ed7cfa6cd97f3d53ecf732' -d data{...}http://127.0.0.1:8000/server/userinfo/bind_wx/
JSON Response
// 新用户{ "message": "绑定注册成功"}// 网站注册过的用户{ "message": "绑定成功"}