重构代码结构与认证体系,集成异步任务消费者
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package globals
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"platform/pkg/env"
|
||||
"platform/pkg/u"
|
||||
|
||||
@@ -14,17 +15,18 @@ type aliyunClient struct {
|
||||
Sms *sms.Client
|
||||
}
|
||||
|
||||
func initAliyun() {
|
||||
func initAliyun() error {
|
||||
client, err := sms.NewClient(&openapi.Config{
|
||||
AccessKeyId: &env.AliyunAccessKey,
|
||||
AccessKeySecret: &env.AliyunAccessKeySecret,
|
||||
Endpoint: u.P("dysmsapi.aliyuncs.com"),
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return fmt.Errorf("初始化阿里云客户端失败: %w", err)
|
||||
}
|
||||
|
||||
Aliyun = &aliyunClient{
|
||||
Sms: client,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user