From 5093ca325cf181b0f533fa5c3a63f931c3246454 Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Tue, 9 Jan 2024 18:26:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84notify?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/basic.proto | 3 +- service/notify.proto | 136 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 112 insertions(+), 27 deletions(-) diff --git a/service/basic.proto b/service/basic.proto index dc94d1e..443e886 100644 --- a/service/basic.proto +++ b/service/basic.proto @@ -36,4 +36,5 @@ message Meta { int64 page_count=2; int64 current_page=3; int64 per_page=4; -} \ No newline at end of file +} + \ No newline at end of file diff --git a/service/notify.proto b/service/notify.proto index 5784c38..044a4f3 100644 --- a/service/notify.proto +++ b/service/notify.proto @@ -8,68 +8,152 @@ 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(stream EmailStreamReq) returns (stream EmailStreamResp) {} -} + // 邮件注册确认 + 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) {} +} message Operator { // 操作类型 enum Type { - IMMEDIATE_RESEND = 0; // 马上重发 - NORMAL_SEND = 1; // 普通发送 - SCHEDULED_SEND = 2; // 计划发送 - CANCEL_SEND = 3; // 取消发送 + immediate_resend = 0; // 马上重发(覆盖当前的发送任务,等于重置) + normal_send = 1; // 标准发送(可以设置时间和重发的次数) + cancel_send = 2; // 取消发送(取消当前的发送) } message Retry { int64 retry_count = 1; // 允许重发次数 - google.protobuf.Timestamp interval_time = 2; // 执行的时间间隔 + 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 { - - string notify_id = 1; // 用于处理唯一的任务,重发都会被利用到 256字节 - string sender = 2; // 发送者 - string title = 3; // 邮件标题 - string content = 4; // 邮件内容 - string target_email = 5; // 发送的目标email - Operator operator = 6; // 操作类型 - - + EmailNotifyBasic basic_email = 1; + string title = 2; // 邮件标题 + string content = 3; // 邮件内容 + Operator operator = 4; // 操作类型 // string company_name = 5; // fs公司名 // string confirmation_link = 6; // fs确认连接 // string sender_name = 7; // 发送人 - optional google.protobuf.Struct metadata = 7; // 扩展参数 + optional google.protobuf.Struct metadata = 5; // 扩展参数 } -message EmailStreamReq { - string file_name = 1; - string file_content = 2; +// 消息类型 +enum NotifyType { + email = 0; // email + feishu = 1; // 飞书 + wechat = 2; // 微信 } -message EmailStreamResp { - string code = 1; - string ok = 2; + +// 操作类型 +enum EmailStatus { + ok = 0; // 成功 + running = 1; // 进行中 + error = 2; // 处理错误 + cancel = 3; // 已经被取消 + finish = 4; // 结束 } + message EmailSendRes { - string file_name = 1; + 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 +} \ No newline at end of file