42 lines
736 B
Go
42 lines
736 B
Go
package ping
|
|
|
|
import (
|
|
"backend/pkg/notification/domain/usecase"
|
|
"context"
|
|
"fmt"
|
|
|
|
"backend/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type PingLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
// 系統健康檢查
|
|
func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
|
|
return &PingLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *PingLogic) Ping() error {
|
|
|
|
err := l.svcCtx.DeliveryUC.SendEmail(l.ctx, usecase.MailReq{
|
|
To: []string{"igs170911@gmail.com"},
|
|
From: l.svcCtx.Config.SMTPConfig.Sender,
|
|
SenderName: "t",
|
|
Subject: "test",
|
|
Body: "good",
|
|
})
|
|
|
|
fmt.Println(err)
|
|
|
|
return nil
|
|
}
|