【新增】资源管理模块

This commit is contained in:
PandaGoAdmin
2022-01-14 17:37:01 +08:00
parent 9094780f40
commit 6b060d54aa
22 changed files with 619 additions and 36 deletions

View File

@@ -5,21 +5,6 @@ import (
"github.com/pkg/errors"
)
type AliYun struct {
}
func NewAliYun() *AliYun {
return &AliYun{}
}
func (a *AliYun) GetBusiness(key string) Sms {
return a
}
func (a *AliYun) Send(phone []string, templateParam interface{}) error {
panic("implement me")
}
type AliConfig struct {
accessKeyId string
accessSecret string
@@ -36,7 +21,7 @@ func NewAliSms(AliConfig AliConfig) *AliSms {
}
}
func (a *AliSms) send(PhoneNumbers, SignName, TemplateCode, TemplateParam string) error {
func (a *AliSms) Send(PhoneNumbers, SignName, TemplateCode, TemplateParam string) error {
//客户端
client, err := dysmsapi.NewClientWithAccessKey(a.config.RegionId, a.config.accessKeyId, a.config.accessSecret)
if err != nil {

View File

@@ -1,14 +1,13 @@
package sms
type Sms interface {
GetBusiness(key string) Sms
Send(phone []string, templateParam interface{}) error
Send(PhoneNumbers, SignName, TemplateCode, TemplateParam string) error
}
func NewDefaultSms(use string) Sms {
switch use {
case "AliYun":
return NewAliYun()
return NewAliSms(AliConfig{})
default:
panic("sms driver err")
}