wangshan 5 сар өмнө
parent
commit
1bebcedf03

BIN
src/fonts/D3Parallelism.ttf


BIN
src/fonts/Flim-Flam.ttf


BIN
src/fonts/chromohv.ttf


+ 9 - 7
src/go.mod

@@ -4,7 +4,7 @@ go 1.20
 
 require (
 	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230308011651-df591d32df88
-	app.yhyue.com/moapp/jybase v0.0.0-20250218064808-f3105db833dd
+	app.yhyue.com/moapp/jybase v0.0.0-20250219114929-2abd3672b53b
 	app.yhyue.com/moapp/jylog v0.0.0-20230522075550-05d7230ca545
 	app.yhyue.com/moapp/jypkg v1.31.8
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.21
@@ -50,6 +50,7 @@ require (
 	github.com/go-openapi/swag v0.22.4 // indirect
 	github.com/go-sql-driver/mysql v1.8.1 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
+	github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
 	github.com/golang/mock v1.6.0 // indirect
 	github.com/golang/protobuf v1.5.4 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
@@ -130,13 +131,14 @@ require (
 	go.uber.org/automaxprocs v1.5.3 // indirect
 	go.uber.org/multierr v1.9.0 // indirect
 	go.uber.org/zap v1.24.0 // indirect
-	golang.org/x/crypto v0.22.0 // indirect
-	golang.org/x/net v0.24.0 // indirect
+	golang.org/x/crypto v0.23.0 // indirect
+	golang.org/x/image v0.24.0 // indirect
+	golang.org/x/net v0.25.0 // indirect
 	golang.org/x/oauth2 v0.17.0 // indirect
-	golang.org/x/sync v0.6.0 // indirect
-	golang.org/x/sys v0.19.0 // indirect
-	golang.org/x/term v0.19.0 // indirect
-	golang.org/x/text v0.14.0 // indirect
+	golang.org/x/sync v0.11.0 // indirect
+	golang.org/x/sys v0.20.0 // indirect
+	golang.org/x/term v0.20.0 // indirect
+	golang.org/x/text v0.22.0 // indirect
 	golang.org/x/time v0.5.0 // indirect
 	google.golang.org/appengine v1.6.8 // indirect
 	google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect

+ 4 - 3
src/jfw/front/login.go

@@ -14,7 +14,6 @@ import (
 	"github.com/gogf/gf/v2/util/gconv"
 
 	qutil "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/dchest/captcha"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
@@ -137,7 +136,8 @@ func (l *Login) Login() error {
 			}
 			if !phoneReg.MatchString(phone) {
 				return -1, false
-			} else if tmp := l.GetSession("CheckCodeId"); tmp == nil || !captcha.VerifyString(tmp.(string), l.GetString("code")) {
+			} else if tmp := l.GetSession("CheckCodeId"); tmp == nil || !(tmp.(string) == l.GetString("code")) { //!captcha.VerifyString(tmp.(string), l.GetString("code"))
+				log.Println(tmp.(string), "----", l.GetString("code"))
 				return -2, false
 			} else if jy.SendPhoneIdentCode(l.Request, qutil.ObjToString(config.Sysconfig["smsServiceRpc"]), phone, l.Session()) {
 				return 1, false
@@ -334,7 +334,8 @@ func (l *Login) ForgetPwd() error {
 			if !phoneReg.MatchString(phone) {
 				return "phoneError"
 			}
-			if tmp := l.GetSession("CheckCodeId"); tmp == nil || !captcha.VerifyString(tmp.(string), l.GetString("code")) {
+			if tmp := l.GetSession("CheckCodeId"); tmp == nil || !(tmp.(string) == l.GetString("code")) { //!captcha.VerifyString(tmp.(string), l.GetString("code"))
+				log.Println(tmp.(string), "----", l.GetString("code"))
 				return "codeError"
 			}
 			//手机号是否已被注册

+ 18 - 14
src/jfw/front/otherAct.go

@@ -1,10 +1,12 @@
 package front
 
 import (
+	"app.yhyue.com/moapp/jybase/gocaptcha"
 	"app.yhyue.com/moapp/jypkg/public"
 	"fmt"
 	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/config"
+	"log"
 	"regexp"
 	"time"
 
@@ -12,7 +14,6 @@ import (
 
 	util "app.yhyue.com/moapp/jybase/common"
 
-	"app.yhyue.com/moapp/jybase/dchest/captcha"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 )
 
@@ -34,18 +35,20 @@ func (f *Front) CheckPhoneNum() error {
 }
 
 // 图片验证码
-func (c *Front) Captcha() error {
-	id := captcha.NewLen(4) //此id为生成验证码的ID,并不是实际显示的数字,在提交校验时,需要根据此ID进行查询。
-	c.SetSession("CheckCodeId", id)
-	//校验时调用以下代码
-	//ccid,_:=c.GetSession("CheckCodeId").(string)
-	//captcha.VerifyString(ccid,"用户输入的校验码")//返回bool
-	w := c.ResponseWriter
-	w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
-	w.Header().Set("Pragma", "no-cache")
-	w.Header().Set("Expires", "0")
-	w.Header().Set("Content-Type", "image/png")
-	return captcha.WriteImage(w, id, 90, 30)
+func (c *Front) Captcha() {
+	gocaptcha.Get(c.Session(), "CheckCodeId", c.ResponseWriter, c.Request)
+	//return
+	//id := captcha.NewLen(4) //此id为生成验证码的ID,并不是实际显示的数字,在提交校验时,需要根据此ID进行查询。
+	//c.SetSession("CheckCodeId", id)
+	////校验时调用以下代码
+	////ccid,_:=c.GetSession("CheckCodeId").(string)
+	////captcha.VerifyString(ccid,"用户输入的校验码")//返回bool
+	//w := c.ResponseWriter
+	//w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
+	//w.Header().Set("Pragma", "no-cache")
+	//w.Header().Set("Expires", "0")
+	//w.Header().Set("Content-Type", "image/png")
+	//return captcha.WriteImage(w, id, 90, 30)
 }
 
 // 发送短信验证
@@ -59,7 +62,8 @@ func (f *Front) SendMessage() {
 	ccid, _ := getsession["CheckCodeId"].(string)
 	lastSendMsgTime := util.Int64All(getsession["lastSendMsgTime"])
 	//通过图片验证
-	if captcha.VerifyString(ccid, imgCancode) {
+	log.Println(imgCancode, "---", ccid)
+	if imgCancode == ccid { //captcha.VerifyString(ccid, imgCancode)
 		//当前时间-上次发送时间>60s
 		if time.Now().Unix()-lastSendMsgTime > 60 {
 			if !userIsExists(phoneNum) && phoneReg.MatchString(phoneNum) {