sms_tool
This commit is contained in:
parent
82caad9679
commit
695dcf3c49
@ -137,7 +137,30 @@ func TestSmsClient_SaveCode(t *testing.T) {
|
||||
goRedis := NewRedisCacheAdapter(addr, redisPassword, db)
|
||||
smsClient.Cache = goRedis
|
||||
|
||||
err = smsClient.SaveCode(context.Background(), codeKey, "123456", time.Minute*5, time.Minute)
|
||||
err = smsClient.SaveCode(context.Background(), codeKey, "123456", time.Minute*5)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
fmt.Println("保存成功")
|
||||
}
|
||||
|
||||
func TestSmsClient_SaveCodeWithFrequency(t *testing.T) {
|
||||
config := &SmsConfig{
|
||||
AccessKeyId: accessKeyId,
|
||||
AccessKeySecret: accessKeySecret,
|
||||
}
|
||||
smsClient, err := NewSmsClient(config)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
addr := fmt.Sprintf("%s:%s", redisHost, redisPort)
|
||||
db, _ := strconv.Atoi(redisDb)
|
||||
goRedis := NewRedisCacheAdapter(addr, redisPassword, db)
|
||||
smsClient.Cache = goRedis
|
||||
|
||||
err = smsClient.SaveCodeWithFrequency(context.Background(), codeKey, "123456", time.Minute*5, time.Minute)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user