chore: 并入 iotlcm-admin-svr 历史到 admin-svr/(原提交 49818c6)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package bcache
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/consts"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// 存储mfa验证码 KeyUserMfaCode:{uuid}
|
||||
func SetUserMfaCode(ctx context.Context, uuid string, code string) error {
|
||||
mfaKey := fmt.Sprintf(consts.KeyUserMfaCode, uuid)
|
||||
_, err := g.Redis().Set(ctx, mfaKey, code)
|
||||
return err
|
||||
}
|
||||
|
||||
// 获取mfa验证码 KeyUserMfaCode:{uuid}
|
||||
func GetUserMfaCode(ctx context.Context, uuid string) (string, error) {
|
||||
mfaKey := fmt.Sprintf(consts.KeyUserMfaCode, uuid)
|
||||
code, err := g.Redis().Get(ctx, mfaKey)
|
||||
return code.String(), err
|
||||
}
|
||||
|
||||
// 删除mfa验证码 KeyUserMfaCode:{uuid}
|
||||
func DeleteUserMfaCode(ctx context.Context, uuid string) error {
|
||||
mfaKey := fmt.Sprintf(consts.KeyUserMfaCode, uuid)
|
||||
_, err := g.Redis().Del(ctx, mfaKey)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user