优化小程序部分

This commit is contained in:
hero920103 committed 2026-10-31 19:17:37 +08:00
1 parent 727319a6eb
commit d4e89788c5
46 files changed
+4906 -63

No files matched your search

+15
View File
@@ -13,6 +13,9 @@ import (
"time"
"server/models"
"server/services/wechatmini"
"github.com/beego/beego/v2/core/logs"
)
type ReminderData struct {
@@ -294,6 +297,18 @@ func (s *SiteMsgSender) Send(ctx context.Context, reminder ReminderData, title,
if err != nil {
return false, err
}
// 同时推送到小程序订阅消息(用户授权过才有一次发送机会,失败不影响站内信)
receiverID := reminder.ReceiverUserID
go func(uid uint64, t, c string) {
res := wechatmini.PushTenantNotice(uid, t, c)
if res.Sent > 0 {
logs.Info("[wechat-mini] 日程提醒已推送订阅消息: user=%d sent=%d", uid, res.Sent)
}
for _, e := range res.Errors {
logs.Info("[wechat-mini] 订阅消息推送失败: user=%d err=%v", uid, e)
}
}(receiverID, title, content)
return true, nil
}