feat(app): update

This commit is contained in:
Yangtao
2025-11-18 18:33:22 +08:00
parent 6e56cab848
commit 7c0ad28e96
27 changed files with 20 additions and 673 deletions

View File

@ -1,18 +1,14 @@
package Netease
import (
"servicebase/pkg/log"
"encoding/json"
"servicebase/pkg/log"
"github.com/pkg/errors"
"github.com/spf13/viper"
captcha "github.com/yidun/yidun-golang-sdk/yidun/service/captcha"
)
var (
CaptchaId = "28a052c000324d2e992e9e184291c92d"
)
// CaptchaSecondVerify 验证码二次校验请求
func CaptchaSecondVerify(captchaId, validate string) (bool, error) {
request := captcha.NewCaptchaVerifyRequest()

View File

@ -1,78 +0,0 @@
package Netease
import (
"servicebase/pkg/common/HyTools"
"servicebase/pkg/log"
"servicebase/pkg/partner/qiniu"
"context"
"github.com/spf13/viper"
"io"
"net/http"
"testing"
)
func TestApplyH5LivePerson(t *testing.T) {
log.Init()
rst, err := H5ApplyLivePerson(context.Background(), &ApplyInfoReq{
Name: "xxx", // 姓名
CardNo: "xxxxxxx", // 身份证号码x需要变成大写X
RedirectUrl: "https://www.baidu.com",
CallBackUrl: "",
DataId: "",
CallbackValidate: "",
EncryptType: "",
})
if err != nil {
t.Error(err)
}
println(rst.AuthToken)
println(rst.AuthUrl)
}
func TestH5ReCheckLivePersonToken(t *testing.T) {
log.Init()
_, err := H5ReCheckLivePersonToken(context.Background(), "6ZgHU-x9XsRVF8aS7PIFppBho28QEUAR")
if err != nil {
t.Error(err)
}
}
func TestB(t *testing.T) {
log.Init()
// key: CwGN8XGmbEZr7qqJl-y-QodcUYREz8ph_glVKCqp
// secret: KbZKt8WwQcZ6II0tygMLsO3KWpm50aMz737VaMV0
viper.Set("qiniu.key", "CwGN8XGmbEZr7qqJl-y-QodcUYREz8ph_glVKCqp")
viper.Set("qiniu.secret", "KbZKt8WwQcZ6II0tygMLsO3KWpm50aMz737VaMV0")
viper.Set("qiniu.bucket.photo", "ddphoto")
key := func() string {
resp, err := http.Get("xxx")
if err != nil {
log.ErrorF("获取人脸核身正面照图片错误:%+v", err)
return ""
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
log.ErrorF("获取人脸核身正面照图片错误 http code为%d", resp.StatusCode)
return ""
}
imageData, err := io.ReadAll(resp.Body)
if err != nil {
log.ErrorF("")
return ""
}
key := "upload/" + HyTools.GetUUID() + ".jpg"
//上传文件
newKey := qiniu.UploadFile(context.Background(), viper.GetString("qiniu.bucket.photo"), imageData, key)
if len(newKey) == 0 {
log.ErrorF("获取人脸核身正面照图片上传到七牛oss失败")
return ""
}
return key
}()
println(key)
}