user.api
5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
syntax = "v1"
info(
title: "素-企业平台.系统后台服务"
desc: "系统后台管理服务"
author: "ttt"
email: "tiptok02@163.com"
version: "v1"
)
// 后台接口-无验证
@server(
prefix: v1
group: auth
middleware: LogRequest
)
service Core {
@doc "公司注册"
@handler systemAuthRegister
post /auth/company_sign_up(CompanyRegisterRequest) returns (CompanyRegisterResponse)
@doc "系统用户登录"
@handler systemAuthLogin
post /auth/login(AuthLoginRequest) returns (AuthLoginResponse)
}
// 后台接口-验证
@server(
prefix: v1
group: auth
middleware: LogRequest,LoginStatusCheck
jwt: SystemAuth
)
service Core {
@doc "系统用户信息"
@handler systemAuthUserInfo
post /auth/user_info(UserInfoRequest) returns (UserInfoResponse)
@doc "修改用户信息"
@handler systemAuthEditUserInfo
post /auth/edit_user_info(EditUserInfoRequest) returns (UserInfoResponse)
@doc "修改密码"
@handler systemAuthChangePassword
post /auth/change_password(ChangePasswordRequest) returns (ChangePasswordResponse)
@doc "重置密码"
@handler systemAuthResetPassword
post /auth/reset_password(ResetPasswordRequest) returns (ResetPasswordResponse)
@doc "系统用户信息"
@handler systemAuthSwitchCompany
post /auth/switch_company(SwitchCompanyRequest) returns (AuthLoginResponse)
}
@server(
prefix: v1
group: user
middleware: LogRequest
jwt: SystemAuth
)
service Core {
@doc "公司用户列表"
@handler userCompanyUsers
post /user/company_users(CompanyUsersRequest) returns (CompanyUsersResponse)
}
type(
User{
Id int64 `json:"id,optional"` // 用户ID
Name string `json:"name,optional"` // 用户名称
Phone string `json:"phone,optional,omitempty"` // 用户手机号
Avatar string `json:"avatar,optional,omitempty"` // 头像
Departments []Department `json:"departments,optional,omitempty"` // 部门列表
}
)
// 系统公司注册
type(
CompanyRegisterRequest{
Name string `json:"name"` // 公司名称
Logo string `json:"logo"` // 公司LOGO
Phone string `json:"phone"`// 注册人手机号
Code string `json:"code"` // 短信验证码
}
CompanyRegisterResponse{
Token string `json:"token"`
}
)
// 系统用户登录
type(
AuthLoginRequest{
Phone string `json:"phone,optionale"` // 手机
Password string `json:"password,optional"` // 密码
Code string `json:"code,optional"` // 验证码
LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
}
AuthLoginResponse{
Token string `json:"token"`
}
)
// 系统用户信息
type(
UserInfoRequest{
UserId int64 `json:"userId,optional"`
CompanyId int64 `json:"companyId,optional"`
EmployeeId int64 `json:"employeeId,optional"`
}
UserInfoResponse{
Id int64 `json:"id"` // 用户ID
Avatar string `json:"avatar"` // 头像
Name string `json:"name"` // 用户名称
Phone string `json:"phone"` // 用户手机号
Accounts []AccountInfo `json:"accounts"` // 账号列表
Apps []SystemAppItem `json:"apps"` // 应用列表
Menus []Menu `json:"menus"` // 有权限的菜单
}
AccountInfo{
//EmployeeId int64 `json:"employeeId"` // 职员ID
Company Company `json:"company"` // 公司
Selected bool `json:"selected"` // 当前选择的账号
}
)
// 修改用户信息
type(
EditUserInfoRequest{
Avatar *string `json:"avatar,optional"` // 头像
Name *string `json:"name,optional"` // 用户名称
Phone *string `json:"phone,optional"` // 用户手机号
//Password *string `json:"password,optional"` // 密码base64((MD5))
}
// UserInfoResponse{
//
// }
)
// 修改密码
type(
ChangePasswordRequest{
OldPassword string `json:"oldPassword,optional"` // 旧密码
NewPassword string `json:"newPassword"` // 新密码
ConfirmPassword string `json:"confirmPassword"` // 确认密码
}
ChangePasswordResponse{
}
)
// 重置密码
type(
ResetPasswordRequest{
Code string `json:"code"` // 验证码
NewPassword string `json:"newPassword"` // 新密码
ConfirmPassword string `json:"confirmPassword"` // 确认密码
}
ResetPasswordResponse{
}
)
// 切换公司请求
type(
SwitchCompanyRequest{
CompanyId int64 `json:"companyId,string"` // 公司ID
}
)
// 公司用户搜索
type(
CompanyUsersRequest{
}
CompanyUsersResponse{
List []User `json:"list"` // 用户列表
}
)