新增用户服务连接
This commit is contained in:
56
proto/user.proto
Normal file
56
proto/user.proto
Normal file
@@ -0,0 +1,56 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package user;
|
||||
option go_package = "./proto/gen;userpb";
|
||||
|
||||
// 登录请求
|
||||
message LoginRequest {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
// 登录响应
|
||||
message LoginResponse {
|
||||
int64 user_id = 1;
|
||||
string username = 2;
|
||||
string email = 3;
|
||||
string access_token = 4;
|
||||
int32 expires_in = 5; // token过期时间(秒)
|
||||
}
|
||||
|
||||
// 用户注册请求
|
||||
message RegisterRequest {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
string email = 3;
|
||||
string nickname = 4;
|
||||
string phone = 5;
|
||||
}
|
||||
|
||||
// 用户注册响应
|
||||
message RegisterResponse {
|
||||
int64 user_id = 1;
|
||||
string username = 2;
|
||||
string email = 3;
|
||||
}
|
||||
|
||||
// 令牌验证请求
|
||||
message ValidateTokenRequest {
|
||||
string access_token = 1;
|
||||
}
|
||||
|
||||
// 令牌验证响应
|
||||
message ValidateTokenResponse {
|
||||
int64 user_id = 1;
|
||||
bool is_valid = 2;
|
||||
}
|
||||
|
||||
// 用户服务定义
|
||||
service UserService {
|
||||
// 用户登录
|
||||
rpc Login(LoginRequest) returns (LoginResponse);
|
||||
// 用户注册
|
||||
rpc Register(RegisterRequest) returns (RegisterResponse);
|
||||
// 验证访问令牌
|
||||
rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
|
||||
}
|
||||
Reference in New Issue
Block a user