2023-11-30 03:05:42 +00:00
|
|
|
|
syntax = "proto3"; //版本声明,使用v3版本
|
|
|
|
|
|
|
|
|
|
package notify;
|
|
|
|
|
option go_package = "gitlab.fusenpack.com/backend/notify;service";
|
|
|
|
|
|
|
|
|
|
// 导入google/api/annotations.proto 注释依赖
|
|
|
|
|
import "service/basic.proto";
|
|
|
|
|
import "google/protobuf/struct.proto";
|
2023-12-15 10:34:20 +00:00
|
|
|
|
import "google/protobuf/timestamp.proto";
|
2023-11-30 03:05:42 +00:00
|
|
|
|
|
|
|
|
|
//定义服务
|
|
|
|
|
service notify {
|
2024-01-09 10:26:05 +00:00
|
|
|
|
|
2024-01-17 09:01:09 +00:00
|
|
|
|
// 心跳 必要 用来启动邮件
|
2024-01-09 10:26:05 +00:00
|
|
|
|
rpc Ping(basic.Request) returns (basic.Response) {}
|
|
|
|
|
|
|
|
|
|
// 邮件发送基础版本
|
2023-12-15 10:34:20 +00:00
|
|
|
|
rpc EmailSend(EmailSendReq) returns (EmailSendRes) {}
|
2023-12-01 10:01:03 +00:00
|
|
|
|
|
2024-01-17 09:01:09 +00:00
|
|
|
|
// 通过邮件通知 注册确认
|
2024-01-09 10:26:05 +00:00
|
|
|
|
rpc EmailRegisterConfirm( EmailRegisterReq) returns ( EmailRegisterResp) {}
|
|
|
|
|
|
2024-01-17 09:01:09 +00:00
|
|
|
|
// 通过邮件通知 重置密码的填写页面
|
2024-01-09 10:26:05 +00:00
|
|
|
|
rpc EmailResetPasswordHtml( EmailResetHtmlReq) returns (EmailResetHtmlResp) {}
|
2023-12-06 04:08:20 +00:00
|
|
|
|
|
2024-01-17 09:01:09 +00:00
|
|
|
|
// 通过邮件通知 重置密码的确认
|
2024-01-09 10:26:05 +00:00
|
|
|
|
rpc EmailResetConfirm( EmailResetConfirmReq) returns (EmailResetConfirmResp) {}
|
|
|
|
|
|
2024-01-17 09:01:09 +00:00
|
|
|
|
// 通过邮件通知 订单 支付详情
|
2024-01-09 10:26:05 +00:00
|
|
|
|
rpc OrderPaymentDetails( OrderPaymentDetailsReq) returns (OrderPaymentDetailsResp) {}
|
|
|
|
|
|
|
|
|
|
|
2024-01-17 09:01:09 +00:00
|
|
|
|
// 通过邮件通知 订单 状态流转
|
2024-01-09 10:26:05 +00:00
|
|
|
|
rpc OrderStatusTransition( OrderStatusTransitionReq) returns (OrderStatusTransitionResp) {}
|
2024-01-09 10:39:52 +00:00
|
|
|
|
|
2024-01-17 09:01:09 +00:00
|
|
|
|
// 通过邮件通知 订单 尾部款通知
|
2024-01-09 10:39:52 +00:00
|
|
|
|
rpc OrderPayArrears( OrderPayArrearsReq) returns (OrderPayArrearsResp) {}
|
2024-01-09 10:26:05 +00:00
|
|
|
|
}
|
2023-12-15 10:34:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message Operator {
|
|
|
|
|
|
|
|
|
|
// 操作类型
|
|
|
|
|
enum Type {
|
2024-01-09 10:26:05 +00:00
|
|
|
|
immediate_resend = 0; // 马上重发(覆盖当前的发送任务,等于重置)
|
|
|
|
|
normal_send = 1; // 标准发送(可以设置时间和重发的次数)
|
|
|
|
|
cancel_send = 2; // 取消发送(取消当前的发送)
|
2023-12-15 10:34:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message Retry {
|
|
|
|
|
int64 retry_count = 1; // 允许重发次数
|
2024-01-09 10:26:05 +00:00
|
|
|
|
int64 interval_time = 2; // 执行的时间间隔 sec 用秒为单位
|
|
|
|
|
|
2023-12-15 10:34:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Type type = 1; // 操作类型
|
|
|
|
|
optional Retry retry = 2; //重试
|
2024-01-09 10:26:05 +00:00
|
|
|
|
|
2023-12-15 10:34:20 +00:00
|
|
|
|
optional google.protobuf.Timestamp start_time = 3; // 在这个时间开始执行
|
2024-01-09 10:26:05 +00:00
|
|
|
|
optional google.protobuf.Timestamp last_send_time = 4; // 上次发送的时间
|
2023-12-15 10:34:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-09 10:26:05 +00:00
|
|
|
|
message EmailNotifyBasic {
|
2024-01-17 06:47:43 +00:00
|
|
|
|
optional string notify_id = 1; // 用于处理唯一的任务,重发都会被利用到 256字节, 如果不写自动生成一个uuid
|
2024-01-09 10:26:05 +00:00
|
|
|
|
string sender = 2; // 发送者
|
|
|
|
|
string target_email = 3; // 发送的目标email
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-12-15 10:34:20 +00:00
|
|
|
|
// 默认是 type email
|
2023-12-06 04:08:20 +00:00
|
|
|
|
message EmailSendReq {
|
2024-01-09 10:26:05 +00:00
|
|
|
|
EmailNotifyBasic basic_email = 1;
|
|
|
|
|
string title = 2; // 邮件标题
|
|
|
|
|
string content = 3; // 邮件内容
|
|
|
|
|
Operator operator = 4; // 操作类型
|
|
|
|
|
optional google.protobuf.Struct metadata = 5; // 扩展参数
|
2023-12-06 04:08:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-09 10:26:05 +00:00
|
|
|
|
// 消息类型
|
|
|
|
|
enum NotifyType {
|
|
|
|
|
email = 0; // email
|
|
|
|
|
feishu = 1; // 飞书
|
|
|
|
|
wechat = 2; // 微信
|
2023-12-07 07:34:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-01-09 10:26:05 +00:00
|
|
|
|
|
|
|
|
|
// 操作类型
|
|
|
|
|
enum EmailStatus {
|
|
|
|
|
ok = 0; // 成功
|
|
|
|
|
running = 1; // 进行中
|
|
|
|
|
error = 2; // 处理错误
|
|
|
|
|
cancel = 3; // 已经被取消
|
|
|
|
|
finish = 4; // 结束
|
2023-12-06 04:08:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-06 09:13:51 +00:00
|
|
|
|
|
2024-01-09 10:26:05 +00:00
|
|
|
|
|
2023-12-06 09:13:51 +00:00
|
|
|
|
message EmailSendRes {
|
2024-01-09 10:26:05 +00:00
|
|
|
|
EmailStatus status = 1;
|
|
|
|
|
string msg = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message EmailRegisterReq {
|
|
|
|
|
EmailNotifyBasic basic_email = 1;
|
|
|
|
|
string confirmation_link = 2;
|
2023-12-06 09:13:51 +00:00
|
|
|
|
}
|
2024-01-09 10:26:05 +00:00
|
|
|
|
|
|
|
|
|
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
|
2024-01-09 10:39:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message OrderPayArrearsReq {
|
|
|
|
|
EmailNotifyBasic basic_email = 1;
|
|
|
|
|
string pay_arrears_link = 2; // 检查状态
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
message OrderPayArrearsResp {
|
|
|
|
|
int64 code = 1; // 0成功 其他异常
|
|
|
|
|
string notify_id = 2; // 通知id
|
2024-01-09 10:26:05 +00:00
|
|
|
|
}
|