-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsms.go
46 lines (39 loc) · 1022 Bytes
/
sms.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cmd
import (
"os"
"github.com/kaz-under-the-bridge/mock-alert-notifier/internal/helper"
"github.com/spf13/cobra"
)
var SMSCmd = &cobra.Command{
Use: "sms",
Short: "SMS関連のサブコマンド",
Run: func(cmd *cobra.Command, args []string) {
_ = cmd.Help()
},
}
var SMSSendAll bool
var SMSSendUserByIDs string
var SMSTemplateName string
var SMSSendCmd = &cobra.Command{
Use: "send",
Short: "SMS送信",
Run: func(cmd *cobra.Command, args []string) {
// テンプレートの指定は必須
if SMSTemplateName == "" {
_ = cmd.Help()
os.Exit(1)
}
if SMSSendUserByIDs != "" {
// ID(カンマ区切り)を対象にSMSを送信
// err := usecase.SendSMSTo(SMSTemplateName, SMSSendUserByIDs)
helper.Logger.Info("Send SMS to users by IDs ends successfully")
os.Exit(0)
}
if SMSSendAll {
// 全ユーザにSMSを送信
// err := usecase.SendSMSToAllUsers(SMSTemplateName)
helper.Logger.Info("Send SMS to all users ends successfully")
os.Exit(0)
}
},
}