From decff6f2e63b7cc4646aab301c6b89681fd1050e Mon Sep 17 00:00:00 2001 From: "huangsimin@fusen.cn" Date: Fri, 15 Dec 2023 18:34:20 +0800 Subject: [PATCH] update --- goutils/tools.go | 12 ++++++------ service/notify.proto | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/goutils/tools.go b/goutils/tools.go index 0044412..a9857d7 100644 --- a/goutils/tools.go +++ b/goutils/tools.go @@ -9,9 +9,9 @@ package goutils // google.golang.org/protobuf/cmd/protoc-gen-go \ // google.golang.org/grpc/cmd/protoc-gen-go-grpc -import ( - _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" - _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" - _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" - _ "google.golang.org/protobuf/cmd/protoc-gen-go" -) +// import ( +// _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" +// _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" +// _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" +// _ "google.golang.org/protobuf/cmd/protoc-gen-go" +// ) diff --git a/service/notify.proto b/service/notify.proto index d5c6f2f..5784c38 100644 --- a/service/notify.proto +++ b/service/notify.proto @@ -9,18 +9,54 @@ import "service/basic.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/any.proto"; import "google/api/httpbody.proto"; +import "google/protobuf/timestamp.proto"; //定义服务 service notify { // 邮件注册确认 - rpc EmailSend(basic.Request) returns (EmailSendRes) {} + rpc EmailSend(EmailSendReq) returns (EmailSendRes) {} // 邮件注册确认 rpc EmailRegisterConfirm(stream EmailStreamReq) returns (stream EmailStreamResp) {} } + + +message Operator { + + // 操作类型 + enum Type { + IMMEDIATE_RESEND = 0; // 马上重发 + NORMAL_SEND = 1; // 普通发送 + SCHEDULED_SEND = 2; // 计划发送 + CANCEL_SEND = 3; // 取消发送 + } + + message Retry { + int64 retry_count = 1; // 允许重发次数 + google.protobuf.Timestamp interval_time = 2; // 执行的时间间隔 + } + + Type type = 1; // 操作类型 + optional Retry retry = 2; //重试 + optional google.protobuf.Timestamp start_time = 3; // 在这个时间开始执行 + } + +// 默认是 type email message EmailSendReq { - string name = 1; + + string notify_id = 1; // 用于处理唯一的任务,重发都会被利用到 256字节 + string sender = 2; // 发送者 + string title = 3; // 邮件标题 + string content = 4; // 邮件内容 + string target_email = 5; // 发送的目标email + Operator operator = 6; // 操作类型 + + + // string company_name = 5; // fs公司名 + // string confirmation_link = 6; // fs确认连接 + // string sender_name = 7; // 发送人 + optional google.protobuf.Struct metadata = 7; // 扩展参数 } message EmailStreamReq {