feat: aliyun sms
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"lone-services/pkg/sms"
|
||||
"lone-services/pkg/utils"
|
||||
"lone-services/services/user/internal/config"
|
||||
|
||||
@@ -14,6 +15,7 @@ type ServiceContext struct {
|
||||
Prefix string
|
||||
JWT *config.JWTAuth
|
||||
SaleSvcName string
|
||||
SMS sms.SMS
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config, db *gorm.DB, jwtAuth *config.JWTAuth) *ServiceContext {
|
||||
@@ -21,11 +23,18 @@ func NewServiceContext(c config.Config, db *gorm.DB, jwtAuth *config.JWTAuth) *S
|
||||
if saleSvc == utils.StringEmpty {
|
||||
logx.Error("config services.sale empty")
|
||||
}
|
||||
|
||||
smsClient, err := config.NewSMS()
|
||||
if err != nil {
|
||||
logx.Errorf("sms init: %v", err)
|
||||
}
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
DB: db,
|
||||
Prefix: utils.GetConfigString("mysql.prefix"),
|
||||
JWT: jwtAuth,
|
||||
SaleSvcName: saleSvc,
|
||||
SMS: smsClient,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user