23 lines
419 B
Go
23 lines
419 B
Go
package controller
|
|
|
|
import (
|
|
"net/http"
|
|
err2 "yintai-api/app/common/err"
|
|
"yintai-api/app/common/response"
|
|
"yintai-api/app/common/service"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Translate struct{}
|
|
|
|
func (Translate) Translate2En(ctx *gin.Context) {
|
|
text := ctx.Query("text")
|
|
en, err := service.NewBaiduTranslate().ZH2EN(text)
|
|
if err != nil {
|
|
err2.TranslateErr()
|
|
}
|
|
|
|
ctx.JSON(http.StatusOK, response.NewRsp(en))
|
|
}
|