syntax = "proto3"; package pb; option go_package = "./pb"; // model message User { int64 id = 1; string username = 2; string phoneNumber = 3; string email = 4; string password = 5; // profile string name = 6; string nickname = 7; int64 gender = 8; string birthdate = 9; string address = 10; int32 age = 11; string country = 12; string picture = 13; } message UserLoginRecord { int64 userId = 1; string lastLoginAt = 2; string lastLoginIp = 3; string lastLoginDevice = 4; string lastLoginUA = 5; string count = 6; } message Role { int64 id = 1; string code = 2; string name = 3; string desc = 4; } message EmptyMessage { } message SimpleMessage { string msg = 1; } /////////////////////////////// user /////////////////////////////////// message CreateUserReq { optional int64 id = 1; optional string username = 2; optional string phoneNumber = 3; optional string email = 4; optional string password = 5; // profile optional string name = 6; optional string nickname = 7; optional int64 gender = 8; optional string birthdate = 9; optional string address = 10; optional int64 age = 11; optional string country = 12; optional string picture = 13; } message CreateUserResp { User user = 1; } message UpdateUserReq { int64 id = 1; // profile optional string name = 2; optional string nickname = 3; optional int64 gender = 4; optional string birthdate = 5; optional string address = 6; optional int64 age = 7; optional string country = 8; optional string picture = 9; } message UpdateUserResp { User user = 1; } message DeleteUserReq { repeated int64 ids = 1; } message DeleteUserResp { repeated int64 ids = 1; } message GetUserReq { optional int64 id = 1; optional string username = 2; optional string phoneNumber = 3; optional string email = 4; } message GetUserBySocialReq { string platform = 1; // 平台类型 string uuid = 2; // platform: openid | unionid } message GetUserResp { User user = 1; } /////////////////////////////// user login record /////////////////////////////////// message UserLoginRecordReq { int64 userId = 1; string lastLoginIp = 2; string lastLoginDevice = 3; string lastLoginUA = 4; } /////////////////////////////// phone | email | ?username? /////////////////////////////////// // ModifyAccountReq 修改账户 message ModifyAccountReq { int64 id = 1; optional string phoneNumber = 2; optional string email = 3; optional string username = 4; } /////////////////////////////// social_profile /////////////////////////////////// message BindSocialReq { int64 id = 1; string platform = 2; string profile = 3; } message BindSocialResp { int64 id = 1; string socialProfile = 2; } /////////////////////////////// role /////////////////////////////////// message CreateRoleReq { string code = 1; string name = 2; string desc = 3; } message CreateRoleResp { Role role = 1; } message UpdateRoleReq { int64 id = 1; // optional string name = 2; optional string desc = 3; } message UpdateRoleResp { Role role = 1; } message DeleteRoleReq { repeated int64 ids = 1; } message DeleteRoleResp { repeated int64 ids = 1; } message GetRoleReq { optional int64 id = 1; optional string code = 2; } message GetRoleResp { Role role = 1; } /////////////////////////////// user-relationship /////////////////////////////////// message BindUserReq { int64 roleId = 1; repeated int64 userIds = 2; } message BindUserResp { int64 roleId = 1; repeated int64 userId = 2; } message BindRoleReq { int64 userId = 1; repeated int64 roleIds = 2; } message BindRoleResp { int64 userId = 1; repeated int64 roleIds = 2; } service userCenter { // user rpc createUser(CreateUserReq) returns (CreateUserResp); rpc updateUser(UpdateUserReq) returns (UpdateUserResp); rpc deleteUser(DeleteUserReq) returns (DeleteUserResp); rpc getUser(GetUserReq) returns (GetUserResp); rpc getUserBySocial(GetUserBySocialReq) returns (GetUserResp); // user-biz rpc modifyAccount(ModifyAccountReq) returns (UpdateUserResp); rpc bindSocial(BindSocialReq) returns (BindSocialResp); // user login record rpc userLoginRecord(UserLoginRecordReq) returns (SimpleMessage); // role rpc createRole(CreateRoleReq) returns (CreateRoleResp); rpc updateRole(UpdateRoleReq) returns (UpdateRoleResp); rpc deleteRole(DeleteRoleReq) returns (DeleteRoleResp); rpc getRole(GetRoleReq) returns (GetRoleResp); // relationship rpc bindRole(BindRoleReq) returns (BindRoleResp); rpc bindUser(BindUserReq) returns (BindUserResp); }