# 获取用户信息
- 注:
- 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": "该电话号码已经被注册"
}
~~~