account_controller.go 810 B

1234567891011121314151617181920212223242526272829303132
  1. package controller
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_b_api/app/service/review_service"
  6. )
  7. type AccountController struct{}
  8. type IdentifyParam struct {
  9. BusinessLicenseUrl string `json:"business_license_url"`
  10. }
  11. // 营业执照OCR识别
  12. func (t AccountController) OCRIdentify(c *gin.Context) {
  13. param := &IdentifyParam{}
  14. err := c.BindJSON(param)
  15. if err != nil {
  16. logrus.Errorf("Request bind err:%+v\n", err)
  17. returnError(c, 40000, "Parameter Error: "+err.Error())
  18. return
  19. }
  20. reviewService := review_service.GetConfig()
  21. resultMap, err := reviewService.CheckBusinessLicense(param.BusinessLicenseUrl)
  22. if err != nil {
  23. logrus.Errorf("[OCRIdentify] call Show err:%+v\n", err)
  24. returnError(c, 40000, err.Error())
  25. return
  26. }
  27. returnSuccess(c, 20000, resultMap)
  28. }