You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

wechat.go 973 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package mail
  5. import (
  6. "code.gitea.io/gitea/models"
  7. "code.gitea.io/gitea/modules/auth/wechat"
  8. "code.gitea.io/gitea/modules/notification/base"
  9. "time"
  10. )
  11. type wechatNotifier struct {
  12. base.NullNotifier
  13. }
  14. var (
  15. _ base.Notifier = &wechatNotifier{}
  16. )
  17. // NewNotifier create a new wechatNotifier notifier
  18. func NewNotifier() base.Notifier {
  19. return &wechatNotifier{}
  20. }
  21. func (*wechatNotifier) NotifyChangeCloudbrainStatus(cloudbrain *models.Cloudbrain, oldStatus string) {
  22. operateType := wechat.GetJobOperateTypeFromCloudbrainStatus(cloudbrain)
  23. if operateType == "" {
  24. return
  25. }
  26. switch operateType {
  27. case wechat.JobOperateTypeStart:
  28. if cloudbrain.JobType == string(models.JobTypeDebug) {
  29. go wechat.SendCloudbrainStartedMsg(operateType, *cloudbrain, time.Unix(int64(cloudbrain.StartTime), 0))
  30. }
  31. }
  32. }