MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / GetVCode

Method GetVCode

internal/repository/cache/sms.go:50–60  ·  view source on GitHub ↗

GetVCode 获取短信验证码

(ctx context.Context, smsID, number string)

Source from the content-addressed store, hash-verified

48
49// GetVCode 获取短信验证码
50func (s *smsCache) GetVCode(ctx context.Context, smsID, number string) (string, error) {
51 key := getVCodeKey(smsID, number)
52 vCode, err := s.client.Get(ctx, key).Result()
53 if err != nil {
54 if errors.Is(err, redis.Nil) {
55 return "", nil //键不存在或者过期了
56 }
57 return "", err
58 }
59 return vCode, nil
60}
61
62// StoreVCode 存储短信验证码
63func (s *smsCache) StoreVCode(ctx context.Context, smsID string, number string, vCode string) error {

Callers

nothing calls this directly

Calls 2

getVCodeKeyFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected