更新
This commit is contained in:
parent
838e55ccb2
commit
904bee84bb
@ -95,6 +95,33 @@ func SaveRegister(c *gin.Context) {
|
|||||||
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
img := resp.Data.IdCardBackPhoto
|
||||||
|
|
||||||
|
response1, err := http.Get(img)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("网络请求错误:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
defer response1.Body.Close()
|
||||||
|
|
||||||
|
// 读取图片数据
|
||||||
|
imageData, err := ioutil.ReadAll(response1.Body)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("读取图片数据错误:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将图片数据转换为base64编码
|
||||||
|
base64Data := base64.StdEncoding.EncodeToString(imageData)
|
||||||
|
result, err := model.OcrGetIdCard(base64Data, "back")
|
||||||
|
if err != nil {
|
||||||
|
response.ResponseQuickMsg(c, msg.Fail, err.Error(), nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp.Data.IdCardStartDate = result.IssueDate
|
||||||
|
resp.Data.IdCardEndDate = result.ExpirationDate
|
||||||
response.ResponseQuickMsg(c, msg.Ok, resp.Msg, resp)
|
response.ResponseQuickMsg(c, msg.Ok, resp.Msg, resp)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user