|
@@ -1,6 +1,8 @@
|
|
|
package controller
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
+ "fmt"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"github.com/sirupsen/logrus"
|
|
|
"youngee_b_api/app/dao"
|
|
@@ -23,8 +25,23 @@ func (t AccountController) OCRIdentify(c *gin.Context) {
|
|
|
reviewService := review_service.GetConfig()
|
|
|
resultMap, err := reviewService.CheckBusinessLicense(param)
|
|
|
if err != nil {
|
|
|
+ type ErrorResponse struct {
|
|
|
+ StatusCode int `json:"status_code"`
|
|
|
+ RequestID string `json:"request_id"`
|
|
|
+ ErrorCode string `json:"error_code"`
|
|
|
+ ErrorMessage string `json:"error_message"`
|
|
|
+ EncodedAuthorizationMessage string `json:"encoded_authorization_message"`
|
|
|
+ }
|
|
|
+ var errorResp ErrorResponse
|
|
|
+ // 解析 JSON 字符串
|
|
|
+ err1 := json.Unmarshal([]byte(err.Error()), &errorResp)
|
|
|
+ if err1 != nil {
|
|
|
+ fmt.Printf("Error parsing JSON: %v\n", err)
|
|
|
+ returnError(c, 40000, err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
logrus.Errorf("[OCRIdentify] call Show err:%+v\n", err)
|
|
|
- returnError(c, 40000, err.Error())
|
|
|
+ returnError(c, 40000, errorResp.ErrorMessage)
|
|
|
return
|
|
|
}
|
|
|
returnSuccess(c, 20000, resultMap)
|