浏览代码

gip : 启动

wangshan 5 月之前
父节点
当前提交
2964244a80
共有 1 个文件被更改,包括 7 次插入8 次删除
  1. 7 8
      captcha/captcha.go

+ 7 - 8
captcha/captcha.go

@@ -46,9 +46,8 @@ var (
 	SendCodeTtl          = 20 * 60
 )
 
-func InitCaptcha() {
-	for i := range [1]int{} {
-		i++
+func InitCaptcha(n int) {
+	for i := 1; i <= n; i++ {
 		if captcha := slideCaptcha(i); captcha != nil {
 			captFuncS = append(captFuncS, captcha)
 		}
@@ -63,14 +62,14 @@ func InitCaptcha() {
 func slideCaptcha(n int) slide.Captcha {
 	var builder slide.Builder
 	switch n {
-	case 1:
+	case 2:
 		builder = slide.NewBuilder(
 			slide.WithGenGraphNumber(2),
+			slide.WithEnableGraphVerticalRandom(true),
 		)
 	default:
 		builder = slide.NewBuilder(
 			slide.WithGenGraphNumber(2),
-			slide.WithEnableGraphVerticalRandom(true),
 		)
 	}
 	// background images
@@ -104,10 +103,10 @@ func slideCaptcha(n int) slide.Captcha {
 		slide.WithBackgrounds(imgS),
 	)
 	switch n {
-	case 1:
-		return builder.Make()
-	default:
+	case 2:
 		return builder.MakeWithRegion()
+	default:
+		return builder.Make()
 	}
 }