用户API

数据结构

用户基本信息

字段名称 类型 描述
id integer 主键ID
usin string 用户学号或者工号(必填), 也是用户登录的凭证
name string 用户名(必填)
gender enum 性别,m => 男 f => 女 or u => 未知
avatar_url string 头像地址
role integer 角色,1 => 学生 2 => 老师 8 => 家长帐号
email string 邮箱
phone string 手机号
password string 用户密码,该字段可修改不可读
graduates_in integer 用户的届别,既毕业的那一年,如 2016,学生必填
outer_id string 对接方的user唯一ID,用于唯一标识一行记录,一般为数据库的主键
duration integer 学制,比如3表示3年
entered_at string 入学时间,比如 2009-09-01
idcard string 身份证
status integer 用户状态,1 => 正常 2 => 归档 4 => 禁用
student_id integer 关联学生ID,家长帐号使用该字段
guardian_role integer 家长角色,1 => 父亲 2 => 母亲 0 => 其他
... string 其他扩展字段

示例:

{
  id: 1,
  name: '张三',
  gender: 'm',
  avatar_url: '',
  usin: 1780987,
  role: 1
  email: 'zs@example.com'
  phone: ''
  graduates_in: 2018,
  outer_id: 1,
  duration: 3
  entered_at: '2016-08-19'
  idcard: '',
  class_name: "一般", // 扩展字段
  class_name2: "一般2", // 扩展字段2
  ...
}

用户自定义扩展字段

字段名称 类型 描述
name string 字段名称,必须是字母加数字的组合
label string 人类可读的一个名称
role integer 角色,1 => 学生 2 => 老师
type integer 1 => 文本 2 => 单选列表
options string[] type == 2 时可用,列表的可选值

示例:

{
  name: "Height",
  label: "身高",
  role: 1,
  type: 1
}

用户 API

1、创建用户

POST https://open.seiue.com/api/v1/reflections

Request (application/json)

参见上文数据结构「用户基本信息」部分

Reponse 201

新创建的用户数据

2、搜索用户

GET https://open.seiue.com/api/v1/reflections?role=1&$per-page=10&$page=1

Parameters

Name Type Description
role integer 用户角色, 默认全部,但不包括家长, 可选值见上文
usin string 用户学号或工号
status integer 用户状态, 默认全部, 可选值见上文

Response 200

满足条件的用户列表

3、修改用户

PATCH https://open.seiue.com/api/v1/reflections/:id

Parameters

Name Type Description
id integer 待修改用户ID

Request (application/json)

参见上文数据结构「用户基本信息」部分

Response 200

修改后的用户数据

4、删除用户

DELETE https://open.seiue.com/api/v1/reflections/:id

Parameters

Name Type Description
id integer 待删除用户ID

Response (204)

无返回内容

5、创建自定义字段

POST https://open.seiue.com/api/v1/reflection-fields

6、更新自定义字段

PATCH https://open.seiue.com/api/v1/reflection-fields/:fieldName

7、查询自定义字段

GET https://open.seiue.com/api/v1/reflection-fields

8、删除自定义字段

DELETE https://open.seiue.com/api/v1/reflection-fields/:fieldName

results matching ""

    No results matching ""