fix: some api bug

This commit is contained in:
wwweww
2026-03-31 22:12:06 +08:00
parent c5ff4f0216
commit e7970ac25f
219 changed files with 16195 additions and 2126 deletions
+13 -13
View File
@@ -112,7 +112,7 @@ message Players {
repeated int64 games = 9; //games
int64 createdAt = 10; //createdAt
int64 updatedAt = 11; //updatedAt
int64 gender = 12; //gender
bool gender = 12; //gender
}
message AddPlayersReq {
@@ -166,20 +166,20 @@ message GetPlayersByIdResp {
}
message SearchPlayersReq {
int64 page = 1; //page
int64 limit = 2; //limit
int64 id = 3; //id
int64 userId = 4; //userId
string status = 5; //status
double rating = 6; //rating
int64 totalOrders = 7; //totalOrders
int64 completedOrders = 8; //completedOrders
int64 shopId = 9; //shopId
optional int64 page = 1; //page
optional int64 limit = 2; //limit
optional int64 id = 3; //id
optional int64 userId = 4; //userId
optional string status = 5; //status
optional double rating = 6; //rating
optional int64 totalOrders = 7; //totalOrders
optional int64 completedOrders = 8; //completedOrders
optional int64 shopId = 9; //shopId
repeated string tags = 10; //tags
repeated int64 games = 11; //games
int64 createdAt = 12; //createdAt
int64 updatedAt = 13; //updatedAt
int64 gender = 14; //gender
optional int64 createdAt = 12; //createdAt
optional int64 updatedAt = 13; //updatedAt
optional int64 gender = 14; //gender
}
message SearchPlayersResp {
+20 -1
View File
@@ -87,6 +87,23 @@ message SearchUserVerificationsResp {
repeated UserVerifications userVerifications = 1; //userVerifications
}
message AddOrUpdateUserVerificationsReq {
int64 userId = 1; // userId
string role = 2;
string material = 3; // material
}
message AddOrUpdateUserVerificationsResp {
bool success = 1; // success
}
message ListUserVerificationsByUserIdReq {
int64 userId = 1; // userId
}
message ListUserVerificationsByUserIdResp {
repeated UserVerifications userVerifications = 1; // userVerifications
}
// ------------------------------------
@@ -100,6 +117,8 @@ service user_verifications{
rpc UpdateUserVerifications(UpdateUserVerificationsReq) returns (UpdateUserVerificationsResp);
rpc DelUserVerifications(DelUserVerificationsReq) returns (DelUserVerificationsResp);
rpc GetUserVerificationsById(GetUserVerificationsByIdReq) returns (GetUserVerificationsByIdResp);
rpc SearchUserVerifications(SearchUserVerificationsReq) returns (SearchUserVerificationsResp);
rpc SearchUserVerifications(SearchUserVerificationsReq) returns (SearchUserVerificationsResp);
rpc AddOrUpdateUserVerifications(AddOrUpdateUserVerificationsReq) returns (AddOrUpdateUserVerificationsResp);
rpc ListUserVerificationsByUserId(ListUserVerificationsByUserIdReq) returns (ListUserVerificationsByUserIdResp);
}
+166 -16
View File
@@ -4,9 +4,9 @@ option go_package = "./pb";
package pb;
// ------------------------------------
// ------------------------------------
// Messages
// ------------------------------------
// ------------------------------------
//--------------------------------users--------------------------------
//--------------------------------users--------------------------------
@@ -125,30 +125,30 @@ message LoginResp {
string token = 1;
string username = 2;
string email = 3;
int64 id = 4;
int64 id = 4;
}
message ValidateTokenReq {
string token = 1; // JWT token
int64 userId = 2; // 用户ID
string token = 1; // JWT token
int64 userId = 2; // 用户ID
}
message ValidateTokenResp {
bool valid = 1; // token 是否有效(不在黑名单中)
string message = 2; // 验证失败原因
int64 userId = 3; // 用户ID
string roleType = 4; // 用户角色
bool valid = 1; // token 是否有效(不在黑名单中)
string message = 2; // 验证失败原因
int64 userId = 3; // 用户ID
string roleType = 4; // 用户角色
}
message CheckPermissionReq {
int64 userId = 1; // 用户ID
string resource = 2; // 资源 ID
string action = 3; // 操作类型: read/write/delete
int64 userId = 1; // 用户ID
string resource = 2; // 资源 ID
string action = 3; // 操作类型: read/write/delete
}
message CheckPermissionResp {
bool allowed = 1; // 是否有权限
string message = 2; // 拒绝原因
bool allowed = 1; // 是否有权限
string message = 2; // 拒绝原因
}
message RegisterReq {
@@ -182,9 +182,143 @@ message ResetPasswordReq {
message ResetPasswordResp {
}
message SwitchRoleReq {
int64 userId = 1;
string newRole = 2;
}
message SwitchRoleResp {
bool success = 1;
}
//--------------------------------userFollows--------------------------------
message UserFollows {
int64 id = 1; //id
int64 followerId = 2; //followerId
int64 followeeId = 3; //followeeId
int64 createdAt = 4; //createdAt
}
message AddUserFollowsReq {
int64 followerId = 1; //followerId
int64 followeeId = 2; //followeeId
int64 createdAt = 3; //createdAt
}
message AddUserFollowsResp {
}
message UpdateUserFollowsReq {
int64 id = 1; //id
int64 followerId = 2; //followerId
int64 followeeId = 3; //followeeId
int64 createdAt = 4; //createdAt
}
message UpdateUserFollowsResp {
}
message DelUserFollowsReq {
int64 id = 1; //id
int64 userId = 2; // userId
}
message DelUserFollowsResp {
}
message GetUserFollowsByIdReq {
int64 id = 1; //id
}
message GetUserFollowsByIdResp {
UserFollows userFollows = 1; //userFollows
}
message SearchUserFollowsReq {
int64 page = 1; //page
int64 limit = 2; //limit
int64 id = 3; //id
int64 followerId = 4; //followerId
int64 followeeId = 5; //followeeId
int64 createdAt = 6; //createdAt
}
message SearchUserFollowsResp {
repeated UserFollows userFollows = 1; //userFollows
}
//--------------------------------userPreferences--------------------------------
message UserPreferences {
int64 userId = 1; //userId
bool notificationOrder = 2; //notificationOrder
bool notificationCommunity = 3; //notificationCommunity
bool notificationSystem = 4; //notificationSystem
string theme = 5; //theme
string language = 6; //language
int64 updatedAt = 7; //updatedAt
}
message AddUserPreferencesReq {
int64 userId = 1; //userId
bool notificationOrder = 2; //notificationOrder
bool notificationCommunity = 3; //notificationCommunity
bool notificationSystem = 4; //notificationSystem
string theme = 5; //theme
string language = 6; //language
int64 updatedAt = 7; //updatedAt
}
message AddUserPreferencesResp {
}
message UpdateUserPreferencesReq {
int64 userId = 1; //userId
bool notificationOrder = 2; //notificationOrder
bool notificationCommunity = 3; //notificationCommunity
bool notificationSystem = 4; //notificationSystem
string theme = 5; //theme
string language = 6; //language
int64 updatedAt = 7; //updatedAt
}
message UpdateUserPreferencesResp {
}
message DelUserPreferencesReq {
int64 id = 1; //id
}
message DelUserPreferencesResp {
}
message GetUserPreferencesByIdReq {
int64 id = 1; //id
}
message GetUserPreferencesByIdResp {
UserPreferences userPreferences = 1; //userPreferences
}
message SearchUserPreferencesReq {
int64 page = 1; //page
int64 limit = 2; //limit
int64 userId = 3; //userId
bool notificationOrder = 4; //notificationOrder
bool notificationCommunity = 5; //notificationCommunity
bool notificationSystem = 6; //notificationSystem
string theme = 7; //theme
string language = 8; //language
int64 updatedAt = 9; //updatedAt
}
message SearchUserPreferencesResp {
repeated UserPreferences userPreferences = 1; //userPreferences
}
// ------------------------------------
// Rpc Func
// ------------------------------------
// ------------------------------------
service usercenter {
@@ -193,12 +327,28 @@ service usercenter {
rpc UpdateUsers(UpdateUsersReq) returns (UpdateUsersResp);
rpc DelUsers(DelUsersReq) returns (DelUsersResp);
rpc GetUsersById(GetUsersByIdReq) returns (GetUsersByIdResp);
rpc GetUserByUsername(GetUserByUsernameReq) returns (GetUserByUsernameResp);
rpc SearchUsers(SearchUsersReq) returns (SearchUsersResp);
rpc GetUserByUsername(GetUserByUsernameReq) returns (GetUserByUsernameResp);
rpc Login(LoginReq) returns (LoginResp);
rpc Register(RegisterReq) returns (RegisterResp);
rpc ValidateToken(ValidateTokenReq) returns (ValidateTokenResp);
rpc CheckPermission(CheckPermissionReq) returns (CheckPermissionResp);
rpc Logout(LogoutReq) returns (LogoutResp);
rpc ResetPassword(ResetPasswordReq) returns (ResetPasswordResp);
rpc SwitchRole(SwitchRoleReq) returns (SwitchRoleResp);
//-----------------------userFollows-----------------------
rpc AddUserFollows(AddUserFollowsReq) returns (AddUserFollowsResp);
rpc UpdateUserFollows(UpdateUserFollowsReq) returns (UpdateUserFollowsResp);
rpc DelUserFollows(DelUserFollowsReq) returns (DelUserFollowsResp);
rpc GetUserFollowsById(GetUserFollowsByIdReq) returns (GetUserFollowsByIdResp);
rpc SearchUserFollows(SearchUserFollowsReq) returns (SearchUserFollowsResp);
//-----------------------userPreferences-----------------------
rpc AddUserPreferences(AddUserPreferencesReq) returns (AddUserPreferencesResp);
rpc UpdateUserPreferences(UpdateUserPreferencesReq) returns (UpdateUserPreferencesResp);
rpc DelUserPreferences(DelUserPreferencesReq) returns (DelUserPreferencesResp);
rpc GetUserPreferencesById(GetUserPreferencesByIdReq) returns (GetUserPreferencesByIdResp);
rpc SearchUserPreferences(SearchUserPreferencesReq) returns (SearchUserPreferencesResp);
}