Merge branch 'master' of gitlab.fusenpack.com:backend/proto

This commit is contained in:
laodaming@fusen.cn
2024-01-12 10:29:17 +08:00
24 changed files with 652 additions and 556 deletions

View File

@@ -14,113 +14,29 @@ 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: "*"
};
}
rpc ValidToken(ValidTokenRequest) returns (ValidTokenResponse) {}
// Cookie 接受接口
rpc AcceptCookie(basic.Request) returns (GuestResponse) {
// 添加 HTTP POST 网关注解
option (google.api.http) = {
post: "/api/auth/accept-cookie"
body: "*"
};
}
rpc CreateAcceptCookie(basic.Request) returns (GuestResponse) {}
// 调试令牌创建接口
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: "*"
};
}
rpc CreateDebugToken(UserDebugRequest) returns (DebugTokenResponse) {}
}
message Debug {
int64 exp = 1;
int64 is_cache = 2;
int64 is_all_template_tag = 3;
}
message UserInfo {
int64 user_id = 1;
int64 guest_id = 2;
int64 exp = 3;
Debug debug = 4;
}
// 验证token的请求
message ValidTokenRequest {
optional string user_token = 1;
@@ -130,8 +46,7 @@ message ValidTokenRequest {
// 验证token的请求
message ValidTokenResponse {
google.protobuf.Struct user_info = 1;
google.protobuf.Struct debug_info = 2;
UserInfo user_info = 1;
}

View File

@@ -17,4 +17,24 @@ message Response {
}
message ResourceInfo{
string resource_id = 1;
int64 guest_id =2;
int64 user_id =3;
string resource_type = 4;
string resource_url = 5;
string version = 6;
int64 api_type = 7;
string bucket_name = 8;
string source = 9;
string uploaded_at = 10;
google.protobuf.Struct metadata = 11;
}
message Meta {
int64 total_count =1;
int64 page_count=2;
int64 current_page=3;
int64 per_page=4;
}

View File

@@ -8,15 +8,163 @@ import "google/api/annotations.proto";
import "service/basic.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
import "google/api/httpbody.proto";
import "google/protobuf/timestamp.proto";
//定义服务
service notify {
// 心跳
rpc Ping(basic.Request) returns (basic.Response) {}
// 邮件发送基础版本
rpc EmailSend(EmailSendReq) returns (EmailSendRes) {}
// 邮件注册确认
rpc EmailRegisterConfirm(basic.Request) returns (basic.Response) {
option (google.api.http) = {
post: "/api/notify/email"
body: "*"
};
// 邮件注册确认
rpc EmailRegisterConfirm( EmailRegisterReq) returns ( EmailRegisterResp) {}
// 邮件重置密码的填写页面
rpc EmailResetPasswordHtml( EmailResetHtmlReq) returns (EmailResetHtmlResp) {}
// 邮件重置密码的确认
rpc EmailResetConfirm( EmailResetConfirmReq) returns (EmailResetConfirmResp) {}
// 订单 支付详情
rpc OrderPaymentDetails( OrderPaymentDetailsReq) returns (OrderPaymentDetailsResp) {}
// 订单 状态流转
rpc OrderStatusTransition( OrderStatusTransitionReq) returns (OrderStatusTransitionResp) {}
// 订单 状态流转
rpc OrderPayArrears( OrderPayArrearsReq) returns (OrderPayArrearsResp) {}
}
message Operator {
// 操作类型
enum Type {
immediate_resend = 0; // 马上重发(覆盖当前的发送任务,等于重置)
normal_send = 1; // 标准发送(可以设置时间和重发的次数)
cancel_send = 2; // 取消发送(取消当前的发送)
}
message Retry {
int64 retry_count = 1; // 允许重发次数
int64 interval_time = 2; // 执行的时间间隔 sec 用秒为单位
}
Type type = 1; // 操作类型
optional Retry retry = 2; //重试
optional google.protobuf.Timestamp start_time = 3; // 在这个时间开始执行
optional google.protobuf.Timestamp last_send_time = 4; // 上次发送的时间
}
message EmailNotifyBasic {
optional string notify_id = 1; // 用于处理唯一的任务,重发都会被利用到 256字节
string sender = 2; // 发送者
string target_email = 3; // 发送的目标email
}
// 默认是 type email
message EmailSendReq {
EmailNotifyBasic basic_email = 1;
string title = 2; // 邮件标题
string content = 3; // 邮件内容
Operator operator = 4; // 操作类型
optional google.protobuf.Struct metadata = 5; // 扩展参数
}
// 消息类型
enum NotifyType {
email = 0; // email
feishu = 1; // 飞书
wechat = 2; // 微信
}
// 操作类型
enum EmailStatus {
ok = 0; // 成功
running = 1; // 进行中
error = 2; // 处理错误
cancel = 3; // 已经被取消
finish = 4; // 结束
}
message EmailSendRes {
EmailStatus status = 1;
string msg = 2;
}
message EmailRegisterReq {
EmailNotifyBasic basic_email = 1;
string confirmation_link = 2;
}
message EmailRegisterResp {
int64 code = 1; // 0成功 其他异常
string notify_id = 2; // 通知id
}
message EmailResetHtmlReq {
EmailNotifyBasic basic_email = 1;
string confirmation_link = 4;
}
message EmailResetHtmlResp {
int64 code = 1; // 0成功 其他异常
string notify_id = 2; // 通知id
}
message EmailResetConfirmReq {
string reset_password_link = 1;
string reset_token = 2;
}
message EmailResetConfirmResp {
int64 code = 1; // 0成功 其他异常
bytes content = 2; // 返回页面内容
}
message OrderPaymentDetailsReq {
EmailNotifyBasic basic_email = 1;
string payment_details_link = 2;
}
message OrderPaymentDetailsResp {
int64 code = 1; // 0成功 其他异常
string notify_id = 2; // 通知id
}
message OrderStatusTransitionReq {
EmailNotifyBasic basic_email = 1;
string last_status = 2; // 上个状态
string current_status = 3; // 当前状态
string check_status_link = 4; // 检查状态
}
message OrderStatusTransitionResp {
int64 code = 1; // 0成功 其他异常
string notify_id = 2; // 通知id
}
message OrderPayArrearsReq {
EmailNotifyBasic basic_email = 1;
string pay_arrears_link = 2; // 检查状态
}
message OrderPayArrearsResp {
int64 code = 1; // 0成功 其他异常
string notify_id = 2; // 通知id
}

View File

@@ -11,52 +11,157 @@ import "google/protobuf/any.proto";
//定义服务
service resource {
// 删除资源详情
rpc ResourceDelete(ResourceDeleteReq) returns (ResourceDeleteRes) {}
// 更新资源详情
rpc ResourceSave(ResourceSaveReq) returns (ResourceSaveRes) {}
// 获取资源详情
rpc GetResourceInfo(GetResourceInfoReq) returns (basic.Response) {
option (google.api.http) = {
get: "/api/resource/info"
};
}
rpc ResourceInfo(ResourceInfoReq) returns (ResourceInfoRes) {}
// 获取资源列表
rpc GetResourceList(GetResourceListReq) returns (basic.Response) {
option (google.api.http) = {
get: "/api/resource/list"
};
}
rpc ResourceList(ResourceListReq) returns (ResourceListRes) {}
// 后端上传--单文件
rpc UploadFileBackend(UploadFileBackendReq) returns (UploadFileBackendRes) {
option (google.api.http) = {
post: "/api/resource/upload-file-backend",
body: "*"
};
}
rpc UploadFileBackend(UploadFileBackendReq) returns (UploadFileBackendRes) {}
// 后端上传--分片上传
rpc UploadFileBackendFragment(UploadFileBackendFragmentReq) returns (UploadFileBackendFragmentRes) {
option (google.api.http) = {
post: "/api/resource/upload-file-backend-fragment",
body: "*"
};
}
rpc UploadFileBackendFragment(UploadFileBackendFragmentReq) returns (UploadFileBackendFragmentRes) {}
// logo合图
rpc LogoCombine(LogoCombineReq) returns (LogoCombineRes) {}
// logo基础信息
rpc LogoInfoSet(LogoInfoSetReq) returns (LogoInfoSetRes) {}
// logo裁剪处理
rpc LogoCropping(LogoCroppingReq) returns (LogoCroppingRes) {}
// logo缩略处理
rpc LogoResize(LogoResizeReq) returns (LogoResizeRes) {}
}
/* logo缩略处理 */
message LogoResizeReq{
string resource_id=1;
int64 width=2;
int64 height=3;
int64 handle_type = 100; // 类型1=缓存 2=重新 3=临时
int64 user_id = 101;
int64 guest_id = 102;
}
message LogoResizeRes{
string resource_id=1;
string resource_url=2;
}
/* logo缩略处理 */
/* 更新资源详情 */
message ResourceSaveReq {
optional ResourceFilter filter=1;
optional ResourceFilter save=2;
}
message ResourceSaveRes {}
/* 更新资源详情 */
/* 删除资源详情 */
message ResourceDeleteReq {
optional ResourceFilter filter=1;
int64 delete_type = 12; // 删除类型1=删除数据库 2=删除s3 3=删除数据库+s3
int64 delete_limit = 13; // 删除数量
}
message ResourceDeleteRes {}
/* 删除资源详情 */
/* logo裁剪处理 */
message LogoCroppingReq {
string is_remove_bg=1;
string logo_file=2;
string width=3;
string height=4;
string proportion=5;
int64 handle_type = 100; // 类型1=缓存 2=重新 3=临时
int64 user_id = 101;
int64 guest_id = 102;
}
message LogoCroppingRes {
string resource_id=1;
string resource_url=2;
bool ismax_proportion=3;
repeated string img_color=4;
}
/* logo裁剪处理 */
/* logo基础信息 */
message LogoInfoSetReq {
string logo_url=1;
string version=2;
int64 is_all_template=3;
}
message LogoInfoSetRes {
string info =1;
}
/* logo基础信息 */
/* logo合图 */
message LogoCombineReq {
int64 product_template_v2_info_id =1;
string product_template_v2_info_material_img =2;
string product_template_v2_info_template_info =3;
string template_tag =4;
string website=5;
string slogan=6;
string address=7;
string phone=8;
string qrcode=9;
string logo_url=10;
string resolution=11;
TemplateTagColor template_tag_color=12;
string logo_metadata=13;
repeated TemplateTagGroups template_tag_groups=14;
int64 handle_type = 100; // 类型1=缓存 2=重新 3=临时
int64 user_id = 101;
int64 guest_id = 102;
}
message TemplateTagColor {
repeated Color color =1;
int64 index = 2;
}
message Color {
repeated string names = 1;
}
message TemplateTagGroups {
string tag =1;
string name =2;
string value =3;
int64 fixed =4;
}
message LogoCombineRes {
string resource_id = 4;
string resource_url = 6;
int64 diff_time_logo_combine=15; // 合图算法时间
int64 diff_time_upload_file=16; // 合图上传时间
}
/* logo合图 */
/* 后端上传--分片上传 */
message UploadFileBackendFragmentReq {
string file_name = 1; // 文件名
bytes file_content = 2; // 文件流
bytes file_header = 3; // 文件头
string file_data = 4; // base64
bytes file_content = 3; // 文件流
bytes file_header = 4; // 文件头
string file_data = 5; // base64
int64 chunk_number = 6; // 当前分片号:1、2、3
int64 total_chunks = 7; // 总分片数:3
int64 chunk_number = 5; // 当前分片号:1、2、3
int64 total_chunks = 6; // 总分片数:3
int64 user_id = 7;
int64 guest_id = 8;
int64 api_type = 10; // 请求类型1=对外2=对内'
int64 upload_bucket = 11; // 上传桶类型
int64 api_type = 10; // 请求类型1=对外2=对内
int64 upload_bucket = 11; // 上传桶类型1=持久2=缓存
string file_key = 12; // 哈希
string source = 13;// 来源
string metadata = 14; // json格式
@@ -64,6 +169,10 @@ message UploadFileBackendFragmentReq {
string resource_id = 16; // 资源ID
string backup_type = 17; // 资源备份oss
string upload_type = 18; // 上传方式s3
int64 CacheType = 100; // 缓存类型0=不缓存 1=存储数据库
int64 user_id = 101;
int64 guest_id = 102;
}
message UploadFileBackendFragmentRes {
string resource_type = 5;
@@ -77,12 +186,10 @@ message UploadFileBackendReq {
string file_name = 1; // 文件名
bytes file_content = 2; // 文件流
bytes file_header = 3; // 文件头
int64 user_id = 4;
int64 guest_id = 5;
string file_data = 6; // base64
int64 api_type = 10; // 请求类型1=对外2=对内'
int64 upload_bucket = 11; // 上传桶类型
int64 api_type = 10; // 请求类型1=对外2=对内
int64 upload_bucket = 11; // 上传桶类型1=持久2=缓存
string file_key = 12; // 哈希
string source = 13;// 来源
string metadata = 14; // json格式
@@ -90,6 +197,10 @@ message UploadFileBackendReq {
string resource_id = 16; // 资源ID
string backup_type = 17; // 资源备份oss
string upload_type = 18; // 上传方式s3
int64 CacheType = 100; // 缓存类型0=不缓存 1=存储数据库
int64 user_id = 101;
int64 guest_id = 102;
}
message UploadFileBackendRes{
@@ -100,25 +211,28 @@ message UploadFileBackendRes{
/* 后端上传--文件流--单文件 */
/* 获取资源列表 */
message GetResourceListReq{
optional string resource_id = 1;
optional int64 guest_id =2;
optional int64 user_id =3;
optional string resource_type = 4;
optional string resource_url = 5;
optional string version = 6;
optional int64 api_type = 7;
optional string bucket_name = 8;
optional string source = 9;
message ResourceListReq{
optional ResourceFilter filter=1;
optional int64 current_page =101;
optional int64 per_page =102;
optional string order_by = 103;
}
message ResourceListRes{
repeated basic.ResourceInfo list=1;
basic.Meta meta =2;
}
/* 获取资源列表 */
/* 获取资源详情 */
message GetResourceInfoReq{
message ResourceInfoReq{
optional ResourceFilter filter=1;
}
message ResourceInfoRes{
basic.ResourceInfo info =1;
}
message ResourceFilter {
optional string resource_id = 1;
optional int64 guest_id =2;
optional int64 user_id =3;
@@ -128,5 +242,13 @@ message GetResourceInfoReq{
optional int64 api_type = 7;
optional string bucket_name = 8;
optional string source = 9;
optional google.protobuf.Struct filters= 10; // 其他过滤条件
optional ResourceIds resource_ids =11; // 资源ID列表
optional string metadata = 12;
}
message ResourceIds {
repeated string resource_ids = 1;
}
/* 获取资源详情 */