# 獲取用戶信息
- 注:
- 1.username為用戶真實姓名;
- 2.sex為性別,數值對應如下:
```json
{'保密':0,'男':1,'女':2}
```
- 3.headimg的baseUrl為:
``` php
$headBaseUrl = 'https://icu.wangxuefeng.com.cn/static/assets'
```
- 4.subjecttype為文理類別,取值如下:
```json
['文','理']
```
- 5.utype用戶類型,數值對應如下:
```json
{'普通用戶':0,'管理員':1}
```
- 6.tagid為用戶標簽集合,格式如下:
```json
["001", "002", "003","004",...]
```
- 7.registrationid推送設備唯一標識ID,用于消息推送
- 1.通過uid獲取
~~~[api]
get:/users/get/uid
*int:uid=20180001#用戶id
<<<
success
{
"status": true,
"resdata": {
"uid": 20180000,
"username": "王雪峰",
"sex": "男",
"headimg": "/users/up/20180000/_20180000_head__20171225092608_288.png",
"registerdate": "2018-02-19 12:28:04",
"subjecttype": "理",
"grade": 457,
"email": "xuefeng@kcalb.wang",
"phone": "18322442162",
"ip": "61.135.255.86",
"utype": 1,
"collection": "[1, 2, 3, 4]",
"tagid": "[\"001\", \"002\"]",
"registrationid": "18071adc0308aa85504",
"tags": [
{
"tagid": "001",
"tagname": "計算機科學與技術"
},
{
"tagid": "002",
"tagname": "軟件工程"
}
]
}
}
<<<
error
{
"status": false,
"title": "用戶不存在",
"message": "請輸入正確的用戶名重試"
}
~~~
- 2.通過電話號碼```phone```獲取
~~~[api]
get:/users/get/phone
*string:phone=18322442162#用戶電話號碼
<<<
success
{
"status": true,
"resdata": {
"uid": 20180000,
"username": "王雪峰",
"sex": "男",
"headimg": "/users/up/20180000/_20180000_head__20171225092608_288.png",
"registerdate": "2018-02-19 12:28:04",
"subjecttype": "理",
"grade": 457,
"email": "xuefeng@kcalb.wang",
"phone": "18322442162",
"ip": "61.135.255.86",
"utype": 1,
"collection": "[1, 2, 3, 4]",
"tagid": "[\"001\", \"002\"]",
"registrationid": "18071adc0308aa85504",
"tags": [
{
"tagid": "001",
"tagname": "計算機科學與技術"
},
{
"tagid": "002",
"tagname": "軟件工程"
}
]
}
}
<<<
error
{
"status": false,
"title": "用戶不存在",
"message": "請輸入正確的用戶名重試"
}
~~~
- 3.通過郵箱```email```獲取
~~~[api]
get:/users/get/email
*string:email=xuefeng@kcalb.wang#用戶郵箱
<<<
success
{
"status": true,
"resdata": {
"uid": 20180000,
"username": "王雪峰",
"sex": "男",
"headimg": "/users/up/20180000/_20180000_head__20171225092608_288.png",
"registerdate": "2018-02-19 12:28:04",
"subjecttype": "理",
"grade": 457,
"email": "xuefeng@kcalb.wang",
"phone": "18322442162",
"ip": "61.135.255.86",
"utype": 1,
"collection": "[1, 2, 3, 4]",
"tagid": "[\"001\", \"002\"]",
"registrationid": "18071adc0308aa85504",
"tags": [
{
"tagid": "001",
"tagname": "計算機科學與技術"
},
{
"tagid": "002",
"tagname": "軟件工程"
}
]
}
}
<<<
error
{
"status": false,
"title": "用戶不存在",
"message": "請輸入正確的用戶名重試"
}
~~~
- 4.獲取所有用戶信息【僅管理員有權限】
~~~[api]
get:/users/get/all
*int:page=1#當前頁碼
*int:count=2#數量
<<<
success
{
"status": true,
"resdata": [
{
用戶1
},{
用戶2
},
...
],
"total": 2
}
<<<
無用戶
{
"status": false,
"resdata": null
}
<<<
無權限
{
"status": false,
"code": 401,
"title": "沒有權限"
}
~~~
- 5 判斷該手機號碼是否是已注冊用戶
~~~[api]
post:/users/post/isUserByPhone
*string:phone=13919418545#手機號碼
<<<
succes
{
"status": true,
"resdata": {
"uid": 2018123456
}
}
<<<
erro
{
"status": false,
"title": "用戶不存在"
}
~~~
- 6 判斷該手機號碼是否被注冊
~~~[api]
post:/users/post/isNotUserByPhone
*string:phone=13919418545#手機號碼
<<<
succes
{
"status": true
}
<<<
erro
{
"status": false,
"title": "該電話號碼已經被注冊"
}
~~~