syntax = "proto3"; option go_package = "./user"; //-------------------------global message ----------------------- message EmptyResponse {} //------------------------ enterprise ------------------------ // 请求获取待审核企业列表 message GetPendingEnterpriseReq { int64 page = 1; int64 page_size = 2; } message EnterpriseItem { int64 id = 1; string enterprise_name = 2; string credit_code = 3; string legal_person = 4; string enterprise_contact = 5; string auth_status = 6; string business_license = 7; string created_at = 8; string updated_at = 9; } message GetPendingEnterpriseResp { int64 total = 1; repeated EnterpriseItem list = 2; } // 审核企业请求 message ReviewEnterpriseReq { int64 enterprise_id = 1; string status = 2; string remarks = 3; } message EnterpriseAuthReq { int64 userId = 1; string enterprise_name = 2; // 企业名称 string credit_code = 3; // 信用代码 string legal_person = 4; // 法人 string business_license = 5; // 营业执照 string enterprise_contact = 6; // 联系人 } // 定义服务 service Enterprise { // 获取待审核企业列表 rpc GetPendingEnterprise(GetPendingEnterpriseReq) returns (GetPendingEnterpriseResp); // 审核企业 rpc ReviewEnterprise(ReviewEnterpriseReq) returns (EmptyResponse); // 提交审核 rpc CreateEnterpriseAuth(EnterpriseAuthReq) returns (EmptyResponse); } //------------------------ User Auth ------------------------ // 定义注册请求 message RegisterReq { string username = 1; string password = 2; string confirmPassword = 3; string phone = 4; string code = 5; } // 定义登录请求 message LoginReq { string username = 1; string password = 2; } // 定义手机登录请求 message PhoneLoginReq { string phone = 1; string code = 2; } message LoginResp{ string token = 1; } // 定义认证服务 service Auth { // 注册接口 rpc RegisterUser(RegisterReq) returns (EmptyResponse); // 登录接口 rpc LoginUser(LoginReq) returns (LoginResp); // 手机登录接口 rpc PhoneLoginUser(PhoneLoginReq) returns (LoginResp); } // 定义手机登录请求 message UserInfoReq { int64 userId = 1; } message UserInfoResp{ string username = 1; string phone = 2; string enterpriseAuthStatus = 3; string enterpriseName = 4; string creditCode = 5; string legalPerson = 6; } message GetEnterpriseAuthStatusReq { int64 userId = 1; } message GetEnterpriseAuthStatusResp { bool isAuth = 1; } service User { // 获取用户信息 rpc UserInfo(UserInfoReq) returns (UserInfoResp); rpc GetEnterpriseAuthStatus(GetEnterpriseAuthStatusReq) returns (GetEnterpriseAuthStatusResp); }