You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
1.4 KiB

package abroad
import (
"github.com/gin-gonic/gin"
"recook/internal/back"
"recook/internal/v2/logic/app/abroad"
"recook/tools"
)
var GoodsAbroad goodsAbroad
type goodsAbroad struct {
}
//选择国家
func (a *goodsAbroad) ViewCountry(c *gin.Context) {
rest, err := abroad.Logic.ViewCountry()
if err != nil {
back.Fail(c, err.Error())
return
} else {
back.Suc(c, "success", rest)
}
return
}
type country struct {
CountryId uint `json:"country_id"`
}
//选择类目
func (a *goodsAbroad) SelectCategory(c *gin.Context) {
var p country
err := tools.ParseParams(&p, c)
if err != nil {
back.Fail(c, err.Error())
return
}
rest, err1 := abroad.Logic.ViewCategory(p.CountryId)
if err1 != nil {
back.Fail(c, err1.Error())
return
} else {
back.Suc(c, "success", rest)
}
return
}
//显示进口商品
func (a *goodsAbroad) ViewGoods(c *gin.Context) {
var p abroad.GoodsSelect
err := tools.ParseParams(&p, c)
if err != nil {
back.Fail(c, err.Error())
return
}
rest := abroad.Logic.ViewGoods(p)
back.Suc(c, "success", rest)
return
}
type countryName struct {
Name string `json:"name"`
}
//搜索国家
func (a *goodsAbroad) SearchCountry(c *gin.Context) {
var p countryName
err := tools.ParseParams(&p, c)
if err != nil {
back.Fail(c, err.Error())
return
}
rest := abroad.Logic.SearchCountry(p.Name)
back.Suc(c, "ok", rest)
}