Skip to content

Commit

Permalink
脱离Email alert
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyiming748 committed Feb 12, 2024
1 parent 7b8a704 commit e870ae8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 227 deletions.
16 changes: 0 additions & 16 deletions alert/README.md

This file was deleted.

55 changes: 0 additions & 55 deletions alert/constant.go

This file was deleted.

84 changes: 0 additions & 84 deletions alert/email.go

This file was deleted.

67 changes: 0 additions & 67 deletions alert/voice.go

This file was deleted.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/zhangyiming748/AVmerger v0.0.37
github.com/zhangyiming748/filetype v0.0.1
github.com/zhangyiming748/mahonia v0.0.1
github.com/zhangyiming748/sendEmailAlert v0.0.16
golang.org/x/net v0.21.0
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gorm.io/driver/sqlite v1.5.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ github.com/zhangyiming748/filetype v0.0.1 h1:C7a49LHKzqiYAiw/u2lTmPU6gP6Nwb6/sSD
github.com/zhangyiming748/filetype v0.0.1/go.mod h1:DFFw06VgsQVSriUKe95IC+HKaY4u6hCCbXJE1L1HNUk=
github.com/zhangyiming748/mahonia v0.0.1 h1:zsk33+dSWU5D6qNpxN23gyEjIFe8x7r5IbzP2ggAKuI=
github.com/zhangyiming748/mahonia v0.0.1/go.mod h1:GlWmGjv246VJ+x2Q4t+1tkrss7WEjJcFzqKfWrkk6j4=
github.com/zhangyiming748/sendEmailAlert v0.0.16 h1:vmqvwVDMJFTvbObtpD85NBkEfZ5wh2i2v7crUZYhlac=
github.com/zhangyiming748/sendEmailAlert v0.0.16/go.mod h1:h2eP0g8maG0MbG7WnT+gD6zexjj3Y6DkfobD3Z3IOdA=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/klauspost/cpuid/v2"
"github.com/zhangyiming748/AVmerger/merge"
"github.com/zhangyiming748/sendEmailAlert"
"io"
"log/slog"
"os"
Expand All @@ -12,7 +13,6 @@ import (
"processAll/GBK2UTF8"
"processAll/GetAllFolder"
"processAll/GetFileInfo"
"processAll/alert"
"processAll/count"
"processAll/processAudio"
"processAll/processImage"
Expand Down Expand Up @@ -244,13 +244,13 @@ func main() {
程序结束后发送电子邮件通知,可选追加内容
*/
func sendEmail(start, end time.Time, ss ...string) {
i := new(alert.Info)
i := new(sendEmailAlert.Info)
i.SetUsername(util.GetVal("email", "username"))
i.SetPassword(util.GetVal("email", "password"))
i.SetTo(strings.Split(util.GetVal("email", "tos"), ";"))
i.SetFrom(util.GetVal("email", "from"))
i.SetHost(alert.NetEase.SMTP)
i.SetPort(alert.NetEase.SMTPProt)
i.SetHost(sendEmailAlert.NetEase.SMTP)
i.SetPort(sendEmailAlert.NetEase.SMTPProt)
i.SetSubject(strings.Join([]string{"AllInOne", util.GetVal("main", "mission"), "任务完成"}, ":"))
text := strings.Join([]string{start.Format("任务开始时间 2006年01月02日 15:04:05"), end.Format("任务结束时间 2006年01月02日 15:04:05"), fmt.Sprintf("任务用时%.3f分", end.Sub(start).Minutes())}, "<br>")
i.SetText(text)
Expand All @@ -259,7 +259,7 @@ func sendEmail(start, end time.Time, ss ...string) {
for _, s := range ss {
i.AppendText(s)
}
alert.Send(i)
sendEmailAlert.Send(i)
}

/*
Expand Down

0 comments on commit e870ae8

Please sign in to comment.