From 4a23356a5840b624c81dda44b0028ed8fc3656cc Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 13 十月 2023 11:14:25 +0800
Subject: [PATCH] 销售线索简单数据权限

---
 api/v1/captcha.go |  104 +++++++++++++++++++++++-----------------------------
 1 files changed, 46 insertions(+), 58 deletions(-)

diff --git a/api/v1/captcha.go b/api/v1/captcha.go
index 4be71ca..124ed57 100644
--- a/api/v1/captcha.go
+++ b/api/v1/captcha.go
@@ -1,62 +1,50 @@
 package v1
 
-import (
-	"aps_crm/conf"
-	"aps_crm/constvar"
-	"aps_crm/model/response"
-	"aps_crm/pkg/contextx"
-	"aps_crm/pkg/convertx"
-	"aps_crm/pkg/ecode"
-	"aps_crm/pkg/logx"
-	"github.com/gin-gonic/gin"
-	"github.com/mojocn/base64Captcha"
-	"time"
-)
-
 type BaseApi struct{}
 
-// Captcha
-//	@Tags		Base
-//	@Summary	鑾峰彇楠岃瘉鐮�
-//	@Produce	application/json
-//	@Success	200	{object}	contextx.Response{data=response.LoginResponse}	"鎴愬姛"
-//	@Router		/api/base/captcha [post]
-func (slf *BaseApi) Captcha(c *gin.Context) {
-	ctx, ok := contextx.NewContext(c, nil)
-	if !ok {
-		return
-	}
-
-	// 鍒ゆ柇楠岃瘉鐮佹槸鍚﹀紑鍚�
-	openCaptcha := conf.Conf.Captcha.OpenCaptcha               // 鏄惁寮�鍚槻鐖嗘鏁�
-	openCaptchaTimeOut := conf.Conf.Captcha.OpenCaptchaTimeOut // 缂撳瓨瓒呮椂鏃堕棿
-	key := c.ClientIP()
-	v, ok := constvar.BlackCache.Get(key)
-	if !ok {
-		constvar.BlackCache.Set(key, 1, time.Second*time.Duration(openCaptchaTimeOut))
-	}
-
-	var oc bool
-	if openCaptcha == 0 || convertx.InterfaceToInt(v) > openCaptcha { // 0 琛ㄧず姣忔鐧诲綍閮介渶瑕侀獙璇佺爜 鎴栬�呭綋鍓嶆鏁板凡瓒呰繃闃茬垎娆℃暟
-		oc = true
-	}
-	// 瀛楃,鍏紡,楠岃瘉鐮侀厤缃�
-	// 鐢熸垚榛樿鏁板瓧鐨刣river
-	driver := base64Captcha.NewDriverDigit(conf.Conf.Captcha.ImgHeight, conf.Conf.Captcha.ImgWidth, conf.Conf.Captcha.KeyLong, 0.7, 80)
-	cp := base64Captcha.NewCaptcha(driver, store)
-	id, b64s, err := cp.Generate()
-	captcha := store.Get(id, false)
-	logx.Infof("Captcha Generate captchaId:%v captcha:%v", id, captcha)
-	if err != nil {
-		logx.Errorf("Captcha Generate err:%v", err)
-		ctx.Fail(ecode.CaptchaGenerateFailed)
-		return
-	}
-
-	ctx.OkWithDetailed(response.CaptchaResponse{
-		CaptchaId:     id,
-		PicPath:       b64s,
-		CaptchaLength: conf.Conf.Captcha.KeyLong,
-		OpenCaptcha:   oc,
-	})
-}
+//
+//// Captcha
+////	@Tags		Base
+////	@Summary	鑾峰彇楠岃瘉鐮�
+////	@Produce	application/json
+////	@Success	200	{object}	contextx.Response{data=response.LoginResponse}	"鎴愬姛"
+////	@Router		/api/base/captcha [post]
+//func (slf *BaseApi) Captcha(c *gin.Context) {
+//	ctx, ok := contextx.NewContext(c, nil)
+//	if !ok {
+//		return
+//	}
+//
+//	// 鍒ゆ柇楠岃瘉鐮佹槸鍚﹀紑鍚�
+//	openCaptcha := conf.Conf.Captcha.OpenCaptcha               // 鏄惁寮�鍚槻鐖嗘鏁�
+//	openCaptchaTimeOut := conf.Conf.Captcha.OpenCaptchaTimeOut // 缂撳瓨瓒呮椂鏃堕棿
+//	key := c.ClientIP()
+//	v, ok := constvar.BlackCache.Get(key)
+//	if !ok {
+//		constvar.BlackCache.Set(key, 1, time.Second*time.Duration(openCaptchaTimeOut))
+//	}
+//
+//	var oc bool
+//	if openCaptcha == 0 || convertx.InterfaceToInt(v) > openCaptcha { // 0 琛ㄧず姣忔鐧诲綍閮介渶瑕侀獙璇佺爜 鎴栬�呭綋鍓嶆鏁板凡瓒呰繃闃茬垎娆℃暟
+//		oc = true
+//	}
+//	// 瀛楃,鍏紡,楠岃瘉鐮侀厤缃�
+//	// 鐢熸垚榛樿鏁板瓧鐨刣river
+//	driver := base64Captcha.NewDriverDigit(conf.Conf.Captcha.ImgHeight, conf.Conf.Captcha.ImgWidth, conf.Conf.Captcha.KeyLong, 0.7, 80)
+//	cp := base64Captcha.NewCaptcha(driver, store)
+//	id, b64s, err := cp.Generate()
+//	captcha := store.Get(id, false)
+//	logx.Infof("Captcha Generate captchaId:%v captcha:%v", id, captcha)
+//	if err != nil {
+//		logx.Errorf("Captcha Generate err:%v", err)
+//		ctx.Fail(ecode.CaptchaGenerateFailed)
+//		return
+//	}
+//
+//	ctx.OkWithDetailed(response.CaptchaResponse{
+//		CaptchaId:     id,
+//		PicPath:       b64s,
+//		CaptchaLength: conf.Conf.Captcha.KeyLong,
+//		OpenCaptcha:   oc,
+//	})
+//}

--
Gitblit v1.8.0