add: anowflake email kafka, refa: redis connectg

This commit is contained in:
wwweww
2026-02-25 01:16:13 +08:00
parent fdbcde13b2
commit 300058ad01
67 changed files with 3596 additions and 139 deletions
+34
View File
@@ -0,0 +1,34 @@
syntax = "v1"
info (
author: "Asadz"
date: "2024-06-19"
version: "1.0"
)
type (
SendVerificationCodeReq {
Email string `json:"email" binding:"required,email"`
Scene string `json:"scene" binding:"required,oneof=register login reset_password bind_email"`
}
SendVerificationCodeResp {
RequestId string `json:"requestId"`
ExpireInSec int64 `json:"expireInSec"`
Message string `json:"message"`
}
)
@server (
group: email
prefix: /api/email
middleware: Logger
)
service email-api {
@doc (
summary: "发送邮箱验证码"
description: "向用户邮箱发送验证码,支持注册、登录、重置密码、绑定邮箱等场景"
)
@handler SendVerificationCode
post /verification-code/send (SendVerificationCodeReq) returns (SendVerificationCodeResp)
}
+92
View File
@@ -0,0 +1,92 @@
syntax = "proto3";
package email;
option go_package = "./email";
service EmailService {
// 发送验证码邮件
rpc SendVerificationCode(SendVerificationCodeReq) returns (SendVerificationCodeResp);
// 发送通用邮件
rpc SendEmail(SendEmailReq) returns (SendEmailResp);
// 批量发送邮件
rpc SendBatchEmail(SendBatchEmailReq) returns (SendBatchEmailResp);
// 发送模板邮件
rpc SendTemplateEmail(SendTemplateEmailReq) returns (SendTemplateEmailResp);
}
// 发送验证码请求
message SendVerificationCodeReq {
string to = 1; // 收件人邮箱
string code = 2; // 验证码
string type = 3; // 类型: register, reset, login
string language = 4; // 语言: zh-CN, en-US
int32 expire_minutes = 5; // 过期时间(分钟)
}
// 发送验证码响应
message SendVerificationCodeResp {
int32 code = 1;
string message = 2;
string message_id = 3; // 邮件ID,用于追踪
}
// 发送通用邮件请求
message SendEmailReq {
string to = 1; // 收件人
string subject = 2; // 主题
string body = 3; // 邮件内容(HTML)
string cc = 4; // 抄送
string bcc = 5; // 密送
repeated Attachment attachments = 6; // 附件
EmailPriority priority = 7; // 优先级
}
// 发送通用邮件响应
message SendEmailResp {
int32 code = 1;
string message = 2;
string message_id = 3;
}
// 批量发送邮件请求
message SendBatchEmailReq {
repeated string to_list = 1; // 收件人列表
string subject = 2;
string body = 3;
EmailPriority priority = 4;
}
// 批量发送邮件响应
message SendBatchEmailResp {
int32 code = 1;
string message = 2;
int32 success_count = 3;
int32 failed_count = 4;
repeated FailedEmail failed_list = 5;
}
// 发送模板邮件请求
message SendTemplateEmailReq {
string to = 1;
string template_name = 2; // 模板名称
map<string, string> params = 3; // 模板参数
string language = 4;
}
// 发送模板邮件响应
message SendTemplateEmailResp {
int32 code = 1;
string message = 2;
string message_id = 3;
}
// 附件
message Attachment {
string filename = 1;
bytes content = 2;
string content_type = 3; // MIME类型
}
// 邮件优先级
enum EmailPriority {
NORMAL = 0;
HIGH = 1;
LOW = 2;
}
// 失败的邮件
message FailedEmail {
string email = 1;
string reason = 2;
}
+23
View File
@@ -0,0 +1,23 @@
syntax = "proto3";
package snowflake;
option go_package = "./snowflake";
service SnowflakeService {
rpc NextId(NextIdReq) returns (NextIdResp);
rpc NextIds(NextIdsReq) returns (NextIdsResp);
}
message NextIdReq {}
message NextIdResp {
int64 id = 1;
}
message NextIdsReq {
int32 count = 1;
}
message NextIdsResp {
repeated int64 ids = 1;
}