|
@@ -2,13 +2,14 @@ package ocr
|
|
|
|
|
|
import (
|
|
import (
|
|
"encoding/base64"
|
|
"encoding/base64"
|
|
|
|
+ "net/http"
|
|
|
|
+ "os"
|
|
|
|
+ "time"
|
|
|
|
+
|
|
"git.listensoft.net/tool/jspkit/common"
|
|
"git.listensoft.net/tool/jspkit/common"
|
|
"git.listensoft.net/tool/jspkit/common/lxhttp"
|
|
"git.listensoft.net/tool/jspkit/common/lxhttp"
|
|
"github.com/go-kratos/kratos/v2/log"
|
|
"github.com/go-kratos/kratos/v2/log"
|
|
"github.com/tidwall/gjson"
|
|
"github.com/tidwall/gjson"
|
|
- "io/ioutil"
|
|
|
|
- "net/http"
|
|
|
|
- "time"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
func GetCaptchaCodeBeijing(imgPath string) string {
|
|
func GetCaptchaCodeBeijing(imgPath string) string {
|
|
@@ -57,14 +58,14 @@ func GetX(captchaPathJpg, captchaPathPng string) float64 {
|
|
func GetXPython(captchaPathJpg, captchaPathPng string) float64 {
|
|
func GetXPython(captchaPathJpg, captchaPathPng string) float64 {
|
|
var encodedJpg, encodedPng string
|
|
var encodedJpg, encodedPng string
|
|
{
|
|
{
|
|
- imgData, err := ioutil.ReadFile(captchaPathJpg)
|
|
|
|
|
|
+ imgData, err := os.ReadFile(captchaPathJpg)
|
|
if err != nil {
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
log.Fatal(err)
|
|
}
|
|
}
|
|
|
|
|
|
// 将图片数据编码为 Base64
|
|
// 将图片数据编码为 Base64
|
|
encodedJpg = base64.StdEncoding.EncodeToString(imgData)
|
|
encodedJpg = base64.StdEncoding.EncodeToString(imgData)
|
|
- imgData, err = ioutil.ReadFile(captchaPathPng)
|
|
|
|
|
|
+ imgData, err = os.ReadFile(captchaPathPng)
|
|
if err != nil {
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
log.Fatal(err)
|
|
}
|
|
}
|