feat: 植物识别
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package plant
|
||||
|
||||
import (
|
||||
"sundynix-go/global"
|
||||
"sundynix-go/model/commom/response"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type OcrApi struct{}
|
||||
|
||||
// ClassifyPlant
|
||||
// @tags 识别相关
|
||||
// @Summary base64植物识别
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "植物识别"
|
||||
// @Success 200 {object} response.Response{msg=string} "文件OCR"
|
||||
// @router /ocr/base64 [post]
|
||||
func (o *OcrApi) ClassifyPlant(c *gin.Context) {
|
||||
multipartFile, header, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
global.Logger.Error("接收文件失败!", zap.Error(err))
|
||||
response.FailWithMsg("接收文件失败!", c)
|
||||
return
|
||||
}
|
||||
res, err := ocrService.ClassifyPlant(multipartFile, header)
|
||||
if err != nil {
|
||||
global.Logger.Error("植物识别识别!", zap.Error(err))
|
||||
response.FailWithMsg("植物识别失败!", c)
|
||||
return
|
||||
}
|
||||
response.OkWithData(res, c)
|
||||
}
|
||||
Reference in New Issue
Block a user