api/v1/user.proto

DeleteUserRequest

删除用户

Field Type Label Description
id int64 repeated

Dynamic

用户动态

Field Type Label Description
id int64 动态ID
user_id int64 用户ID
content string 内容
type int32 类型
username string 用户名
created_at google.protobuf.Timestamp 创建时间
updated_at google.protobuf.Timestamp 更新时间

FindPasswordRequest

找回密码

Field Type Label Description
email string 邮箱
token string 签名token
password string 新密码
captcha string 验证码
captcha_id string 验证码ID

GetUserCaptchaReply

验证码响应

Field Type Label Description
enable bool 是否启用验证码
id string 验证码ID
captcha string 验证码
type string 验证码类型

GetUserCaptchaRequest

查询验证码请求

Field Type Label Description
type string 验证码类型:register、login、comment、find_password、upload

GetUserPermissionsReply

用户权限信息查询

Field Type Label Description
permission Permission repeated

GetUserRequest

获取用户信息

Field Type Label Description
id int64

ListUserDynamicReply

用户动态列表响应

Field Type Label Description
total int64 总数
dynamic Dynamic repeated 动态列表

ListUserDynamicRequest

用户动态列表请求

Field Type Label Description
page int64 页码
size int64 每页数量
id int64 用户ID

ListUserReply

用户列表响应

Field Type Label Description
total int64 总数
user User repeated 用户列表

ListUserRequest

用户列表请求

Field Type Label Description
page int64 页码
size int64 每页数量
wd string 搜索关键词
sort string 排序字段
id int64 repeated 用户ID
group_id int64 repeated 用户组ID
status int32 repeated 用户状态
limit int64 请求数量限制,大于0时,page和size无效

LoginReply

用户登录响应

Field Type Label Description
token string
user User

RegisterAndLoginRequest

用户注册登录请求

Field Type Label Description
username string 用户名
password string 密码
captcha string 验证码
captcha_id string 验证码ID
email string 邮箱

SetUserRequest

管理后台设置用户信息

Field Type Label Description
id int64 用户ID
username string 用户名
password string 密码
group_id int64 repeated 用户组ID
email string 邮箱

Sign

用户签到

Field Type Label Description
id int64 签到ID
user_id int64 用户ID
sign_at int32 签到日期
ip string 签到IP
created_at google.protobuf.Timestamp 创建时间
award int32 签到积分奖励

UpdateUserPasswordRequest

修改用户密码

Field Type Label Description
id int64 用户ID
old_password string 旧密码
new_password string 新密码

User

用户信息

Field Type Label Description
login_at google.protobuf.Timestamp 最后登录时间
created_at google.protobuf.Timestamp 注册时间
updated_at google.protobuf.Timestamp 更新时间
id int64 用户ID
username string 用户名
mobile string 手机号
email string 邮箱,唯一
address string 地址
signature string 个性签名
last_login_ip string 最后登录IP
register_ip string 注册IP
doc_count int32 文档数量
follow_count int32 关注数量
fans_count int32 粉丝数量
favorite_count int32 收藏数量
comment_count int32 评论数量
status int32 用户状态,见 web/utils/enum.js,当前没有使用
avatar string 头像
identity string 身份证
realname string 真实姓名
group_id int64 repeated 用户组ID
credit_count int32 积分

UserAPI

Method Name Request Type Response Type Description
Register RegisterAndLoginRequest LoginReply 用户注册
Login RegisterAndLoginRequest LoginReply 用户登录
Logout .google.protobuf.Empty .google.protobuf.Empty 退出登录
GetUser GetUserRequest User 查询用户信息。如果传递了Id参数,则表示查询用户的公开信息,否则查询当前用户的私有信息
UpdateUserPassword UpdateUserPasswordRequest .google.protobuf.Empty 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限
UpdateUserProfile User .google.protobuf.Empty 更新用户密码。如果不传用户ID,则表示更新当前用户的密码; 如果穿了用户ID,则表示更新指定用户的密码,这时需要验证当前用户的权限
DeleteUser DeleteUserRequest .google.protobuf.Empty 删除用户。需要验证用户权限
AddUser SetUserRequest .google.protobuf.Empty 新增用户
SetUser SetUserRequest .google.protobuf.Empty 设置用户
ListUser ListUserRequest ListUserReply 查询用户列表。对于非管理员,返回相应用户的公开信息; 对于管理员,返回相应用户的绝大部分信息
GetUserCaptcha GetUserCaptchaRequest GetUserCaptchaReply GetUserCaptcha 获取用户验证码
GetUserPermissions .google.protobuf.Empty GetUserPermissionsReply GetUserCaptcha 获取用户验证码
CanIUploadDocument .google.protobuf.Empty .google.protobuf.Empty 用户是否可以上传文档
ListUserDynamic ListUserDynamicRequest ListUserDynamicReply 获取用户动态,包括获取关注的用户的动态
SignToday .google.protobuf.Empty Sign 每日签到
GetSignedToday .google.protobuf.Empty Sign 获取今日已签到记录
FindPasswordStepOne FindPasswordRequest .google.protobuf.Empty 找回密码:第一步,发送验证码
FindPasswordStepTwo FindPasswordRequest .google.protobuf.Empty 找回密码:第二步,修改密码

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)