最新版本
This commit is contained in:
228
service/auth.proto
Normal file
228
service/auth.proto
Normal file
@@ -0,0 +1,228 @@
|
||||
syntax = "proto3"; //版本声明,使用v3版本
|
||||
|
||||
package auth;
|
||||
option go_package = "gitee.com/fusenpack/fusen-auth;service";
|
||||
|
||||
// 导入google/api/annotations.proto 注释依赖
|
||||
import "google/api/annotations.proto";
|
||||
import "service/basic.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
|
||||
//定义服务
|
||||
service auth {
|
||||
|
||||
// 登录接口
|
||||
rpc ValidToken(ValidTokenRequest) returns (ValidTokenResponse) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/valid/token"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 登录接口
|
||||
rpc Login(UserLoginRequest) returns (UserLoginResponse) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/login"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 注册接口
|
||||
rpc Register(UserRegisterRequest) returns (basic.Response) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/register"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Cookie 接受接口
|
||||
rpc AcceptCookie(basic.Request) returns (GuestResponse) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/accept-cookie"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 调试令牌创建接口
|
||||
rpc CreateDebugToken(UserDebugRequest) returns (DebugTokenResponse) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/debug/token/create"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Google 登录接口
|
||||
rpc GoogleLogin(GoogleLoginRequest) returns (basic.Response) {
|
||||
// 添加 HTTP GET 网关注解
|
||||
option (google.api.http) = {
|
||||
get: "/api/auth/oauth2/login/google"
|
||||
};
|
||||
}
|
||||
|
||||
// 邮箱确认接口
|
||||
rpc EmailConfirmation(EmailConfirmationRequest) returns (basic.Response) {
|
||||
// 添加 HTTP GET 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/email/confirmation"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 使用邮箱注册接口
|
||||
rpc EmailRegister(EmailRegisterRequest) returns (basic.Response) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/oauth2/register"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 发送重置令牌到邮箱接口
|
||||
rpc ResetToken(UserResetTokenRequest) returns (basic.Response) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/reset/token"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 重置密码接口
|
||||
rpc ResetPassword(UserResetPasswordRequest) returns (basic.Response) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/reset/password"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 获取重定向到 HTML 页面接口
|
||||
rpc ResetPasswordHtml(UserResetHtmlRequest) returns (basic.Response) {
|
||||
// 添加 HTTP GET 网关注解
|
||||
option (google.api.http) = {
|
||||
get: "/api/auth/reset/password/html"
|
||||
};
|
||||
}
|
||||
|
||||
// 调试删除帐号接口
|
||||
rpc DebugDelete(AuthDeleteRequest) returns (basic.Response) {
|
||||
// 添加 HTTP POST 网关注解
|
||||
option (google.api.http) = {
|
||||
post: "/api/auth/debug/delete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 验证token的请求
|
||||
message ValidTokenRequest {
|
||||
optional string user_token = 1;
|
||||
optional string debug_token = 2;
|
||||
}
|
||||
|
||||
|
||||
// 验证token的请求
|
||||
message ValidTokenResponse {
|
||||
google.protobuf.Struct user_info = 1;
|
||||
google.protobuf.Struct debug_info = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 定义调试令牌请求消息
|
||||
message UserDebugRequest {
|
||||
string password = 1; // 密码,内部使用都是明文
|
||||
optional int64 exp = 2; // 过期时间,不发默认一天
|
||||
int64 is_cache = 3 ; // 是否缓存
|
||||
int64 is_all_template_tag = 4; // 是否开启全部模板
|
||||
}
|
||||
|
||||
// 定义调试删除帐号请求消息
|
||||
message AuthDeleteRequest {
|
||||
string email = 1;
|
||||
}
|
||||
|
||||
// 定义用户登录请求消息
|
||||
message UserLoginRequest {
|
||||
string email = 1;
|
||||
string password = 2;
|
||||
}
|
||||
|
||||
// 定义用户登录响应消息
|
||||
message UserLoginResponse
|
||||
{
|
||||
string token = 1; // 登录 JWT Token
|
||||
}
|
||||
|
||||
// 定义用户注册请求消息
|
||||
message UserRegisterRequest {
|
||||
string wid = 1; // WebSocket 的 ID
|
||||
string first_name = 2; // 首名
|
||||
string last_name = 3; // 名
|
||||
string resetaurant = 4; // 餐厅类型
|
||||
string email = 5; // email
|
||||
string password = 6; // 密码
|
||||
}
|
||||
|
||||
// 定义请求重置令牌消息
|
||||
message UserResetTokenRequest {
|
||||
string wid = 1;
|
||||
string email = 2; // email
|
||||
}
|
||||
|
||||
// 定义返回重置令牌消息
|
||||
message ResetTokenResponse
|
||||
{
|
||||
string reset_token = 1; // 获取重置的令牌
|
||||
}
|
||||
|
||||
// 定义请求重置密码 HTML 页面消息
|
||||
message UserResetHtmlRequest {
|
||||
string reset_token = 1;
|
||||
}
|
||||
|
||||
// 定义请求重置密码消息
|
||||
message UserResetPasswordRequest {
|
||||
string reset_token = 1;
|
||||
string new_password = 2;
|
||||
}
|
||||
|
||||
// 定义请求 Google 登录消息
|
||||
message GoogleLoginRequest {
|
||||
string code = 1;
|
||||
string scope = 2;
|
||||
string authuser = 3;
|
||||
string prompt = 4;
|
||||
}
|
||||
|
||||
// 定义请求邮箱确认消息
|
||||
message EmailConfirmationRequest {
|
||||
string token = 1; // 操作 Token
|
||||
string optype = 2; // 操作类型
|
||||
}
|
||||
|
||||
// 定义请求使用邮箱注册消息
|
||||
message EmailRegisterRequest {
|
||||
string wid = 1;
|
||||
string email = 2;
|
||||
string register_token = 3;
|
||||
}
|
||||
|
||||
// 定义游客获取 Token 请求消息
|
||||
message GuestResponse
|
||||
{
|
||||
string token = 1; // 登录 JWT Token
|
||||
}
|
||||
|
||||
// 获取debug token返回值
|
||||
message DebugTokenResponse
|
||||
{
|
||||
string debug_token = 1; // debug token JWT Token
|
||||
}
|
||||
20
service/basic.proto
Normal file
20
service/basic.proto
Normal file
@@ -0,0 +1,20 @@
|
||||
syntax = "proto3"; //版本声明,使用v3版本
|
||||
|
||||
package basic;
|
||||
|
||||
option go_package = ".;service";
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
|
||||
// 定义请求消息类型.
|
||||
message Request {
|
||||
|
||||
}
|
||||
|
||||
// golang使用一个map返回, 使用这个response
|
||||
message Response {
|
||||
google.protobuf.Value data=1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
225
service/fsservice.proto
Normal file
225
service/fsservice.proto
Normal file
@@ -0,0 +1,225 @@
|
||||
syntax = "proto3"; //版本声明,使用v3版本
|
||||
|
||||
package fsservice;
|
||||
option go_package = "gitee.com/fusenpack/fusen-service;service";
|
||||
|
||||
// 导入google/api/annotations.proto 注释依赖
|
||||
import "google/api/annotations.proto";
|
||||
import "service/basic.proto";
|
||||
import "google/protobuf/struct.proto";
|
||||
import "google/protobuf/any.proto";
|
||||
|
||||
//定义服务
|
||||
service notify {
|
||||
rpc Hello(basic.Request) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/notify/hello"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//定义服务
|
||||
service info {
|
||||
// 用户信息
|
||||
rpc UserInfo(UserInfoRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/user"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// 用户个人资料查询
|
||||
rpc UserProfile(QueryProfileRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/user/profile"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 获取默认用户个人资料
|
||||
rpc DefaultUserProfile(DefaultProfileRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/info/user/profile/default/{request}"
|
||||
};
|
||||
}
|
||||
|
||||
// 更新用户个人资料
|
||||
rpc UpdateProfileBase(ProfileRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/user/profile/base/update"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 设置默认地址
|
||||
rpc AddressDefault(AddressDefaultRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/address/default"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 添加地址
|
||||
rpc AddressAdd(AddressRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/address/add"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 更新地址
|
||||
rpc AddressUpdate(AddressRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/address/update"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 更新地址使用状态
|
||||
rpc AddressUsedUpdate(AddressIdRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/address/update/used"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 删除地址
|
||||
rpc AddressDelete(AddressIdRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/address/delete"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 获取地址列表
|
||||
rpc AddressList(basic.Request) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/info/address/list"
|
||||
};
|
||||
}
|
||||
|
||||
// 获取餐厅列表
|
||||
rpc RestaurantList(basic.Request) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
get: "/api/info/restaurant/list"
|
||||
};
|
||||
}
|
||||
|
||||
// 搜索建议
|
||||
rpc PreLogoSearchSuggestions(PreLogoSearchSuggestionsRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/prelogo/search/suggestions"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 搜索
|
||||
rpc PreLogoSearch(PreLogoSearchRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/prelogo/search"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// 联系我们
|
||||
rpc ContactUs(ContactUsRequest) returns (basic.Response) {
|
||||
option (google.api.http) = {
|
||||
post: "/api/info/contact/us"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
message UserInfoRequest {
|
||||
repeated string module = 1; // 模块
|
||||
}
|
||||
|
||||
message QueryProfileRequest {
|
||||
string top_key = 1; // 首键
|
||||
}
|
||||
|
||||
message QueryProfileResponse {
|
||||
google.protobuf.Struct data = 1;
|
||||
}
|
||||
|
||||
message DefaultProfileRequest {
|
||||
string request = 1; // 请求
|
||||
}
|
||||
|
||||
message ProfileRequest {
|
||||
ProfileBase base = 1; // 基础个人资料
|
||||
SubscriptionStatus sub_status = 2; // 订阅状态
|
||||
}
|
||||
|
||||
message ProfileBase {
|
||||
optional string first_name = 1; // 名字
|
||||
optional string last_name = 2; // 姓氏
|
||||
optional string email = 4; // 电子邮件
|
||||
optional string mobile = 5; // 手机号码
|
||||
optional string resetaurant = 6; // 餐厅
|
||||
optional string company = 7; // 公司
|
||||
}
|
||||
|
||||
message SubscriptionStatus {
|
||||
NotificationEmail notification_email = 1; // 邮件通知设置
|
||||
NotificationPhone notification_phone = 2; // 电话通知设置
|
||||
}
|
||||
|
||||
message NotificationEmail {
|
||||
bool order_update = 1; // 订单更新
|
||||
bool newseleter = 2; // 新闻订阅
|
||||
}
|
||||
|
||||
message NotificationPhone {
|
||||
bool order_update = 1; // 订单更新
|
||||
bool newseleter = 2; // 新闻订阅
|
||||
}
|
||||
|
||||
message AddressObjectRequest {
|
||||
int64 address_id = 1; // 地址ID
|
||||
string address_name = 2; // 地址名称
|
||||
}
|
||||
|
||||
message AddressIdRequest {
|
||||
int64 address_id = 1; // 地址ID
|
||||
}
|
||||
|
||||
message AddressDefaultRequest {
|
||||
int64 address_id = 1; // 地址ID
|
||||
int64 is_default = 2; // 是否默认
|
||||
}
|
||||
|
||||
message AddressRequest {
|
||||
int64 address_id = 1; // 地址ID(已弃用)
|
||||
int64 is_default = 2; // 是否默认
|
||||
string first_name = 3; // 名字
|
||||
string last_name = 4; // 姓氏
|
||||
string mobile = 5; // 手机号码
|
||||
string zip_code = 6; // 邮政编码
|
||||
string street = 7; // 街道
|
||||
string suite = 8; // 套房
|
||||
string city = 9; // 城市
|
||||
string state = 10; // 省份
|
||||
}
|
||||
|
||||
message PreLogoSearchSuggestionsRequest {
|
||||
string keywords = 1; // 关键字
|
||||
}
|
||||
|
||||
message PreLogoSearchRequest {
|
||||
string zip_code = 1; // 邮编
|
||||
string keywords = 2; // 关键字
|
||||
}
|
||||
|
||||
message ContactUsRequest {
|
||||
string name = 1; // 姓名
|
||||
string email = 2; // 电子邮件
|
||||
string phone = 3; // 电话号码
|
||||
string message = 4; // 消息内容
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user