打印机
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
"git.rosy.net.cn/jx-print/model"
|
||||
"git.rosy.net.cn/jx-print/putils"
|
||||
"git.rosy.net.cn/jx-print/services"
|
||||
"git.rosy.net.cn/jx-print/services/print_server"
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
@@ -105,28 +105,15 @@ func callFunc(c *gin.Context, worker func() (retVal interface{}, errCode string,
|
||||
}
|
||||
|
||||
func captchaVerify(c *gin.Context, code string) bool {
|
||||
//session := sessions.Default(c)
|
||||
if captchaId := putils.GetKey(c.ClientIP() + model.SessionKey).(string); captchaId != "" {
|
||||
putils.DelKey(c.ClientIP() + model.SessionKey)
|
||||
if captcha.VerifyString(captchaId, code) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
verifyCode := putils.GetKey(c.ClientIP() + model.SessionKey)
|
||||
if verifyCode == nil {
|
||||
return true
|
||||
}
|
||||
//if captchaId := session.Get(c.ClientIP() + model.SessionKey); captchaId != nil {
|
||||
// session.Delete(c.ClientIP() + model.SessionKey)
|
||||
// _ = session.Save()
|
||||
// if captcha.VerifyString(captchaId.(string), code) {
|
||||
// return true
|
||||
// } else {
|
||||
// return false
|
||||
// }
|
||||
//} else {
|
||||
// return false
|
||||
//}
|
||||
if captchaId := verifyCode.(string); captchaId != "" {
|
||||
putils.DelKey(c.ClientIP() + model.SessionKey)
|
||||
return captcha.VerifyString(captchaId, code)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func buildErrJson(c *gin.Context, err error) {
|
||||
@@ -150,7 +137,7 @@ func GetConfig(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if !callFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = services.GetConfig(c, param.Type, param.Key)
|
||||
retVal, err = print_server.GetConfig(c, param.Type, param.Key)
|
||||
return retVal, "", err
|
||||
}) {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user