feat(app): update
This commit is contained in:
@ -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()
|
||||
|
||||
@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user