|
@@ -47,6 +47,11 @@ func ValidCaptcha(phone, cap string) error {
|
47
|
47
|
return capEngine.ValidCaptcha(phone, cap)
|
48
|
48
|
}
|
49
|
49
|
|
|
50
|
+// DestoryCaptcha 清空验证码
|
|
51
|
+func DestoryCaptcha(phone string) {
|
|
52
|
+ capEngine.DestoryCaptcha(phone)
|
|
53
|
+}
|
|
54
|
+
|
50
|
55
|
// Random 获取随机数
|
51
|
56
|
// 连续调用会有随机数不随机问题
|
52
|
57
|
func (c *CaptchaEngine) Random(length int, phone string) string {
|
|
@@ -96,10 +101,12 @@ func (c *CaptchaEngine) ValidCaptcha(phone, cap string) error {
|
96
|
101
|
return errors.New("验证码不正确")
|
97
|
102
|
}
|
98
|
103
|
|
|
104
|
+ return nil
|
|
105
|
+}
|
|
106
|
+
|
|
107
|
+func (c *CaptchaEngine) DestoryCaptcha(phone string) {
|
99
|
108
|
// 如果成功, 则注销
|
100
|
109
|
delete(c.capList, phone)
|
101
|
|
-
|
102
|
|
- return nil
|
103
|
110
|
}
|
104
|
111
|
|
105
|
112
|
func init() {
|