refactor: 消息模块重构,infra包路径简写等

This commit is contained in:
meilin.huang
2025-07-27 21:02:48 +08:00
parent e96379b6c0
commit 6ad6c69660
149 changed files with 969 additions and 1098 deletions

View File

@@ -1,6 +1,7 @@
package sender
import (
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
@@ -40,7 +41,7 @@ type dingBotMsgResp struct {
// DingBotSender 钉钉机器人消息发送
type DingBotSender struct{}
func (d DingBotSender) Send(channel *msgx.Channel, msg *msgx.Msg) error {
func (d DingBotSender) Send(ctx context.Context, channel *msgx.Channel, msg *msgx.Msg) error {
// https://open.dingtalk.com/document/robots/custom-robot-access#title-72m-8ag-pqw
msgReq := dingBotMsgReq{}
@@ -73,7 +74,7 @@ func (d DingBotSender) Send(channel *msgx.Channel, msg *msgx.Msg) error {
}
timestamp := time.Now().UnixMilli()
sign, err := d.sign(channel.GetExtraString("secret"), timestamp)
sign, err := d.sign(channel.Extra.GetStr("secret"), timestamp)
if err != nil {
return err
}