package controller import ( "github.com/gin-gonic/gin" "search_server/pkg/common" "search_server/requests" "search_server/service" ) //查询联营型号是否有库存 func CheckHasStock(ctx *gin.Context) { noRule, _ := ctx.GetPostForm("no_rule") if noRule != "1122" { flag := common.CheckSignApi(ctx) if flag > 0 { common.Output(ctx,flag, "验证不通过:", nil) return } } goodsName, _ := ctx.GetPostForm("goods_name") if goodsName == "" { common.Output(ctx,1001, "型号不存在", nil) return } goodsName = common.DrawLetterNum(goodsName) otherService := service.OtherService{} hasStock, err := otherService.CheckHasStock(goodsName) if err != nil { common.Output(ctx,1, "查询失败,系统报错"+err.Error(), nil) return } common.Output(ctx,0, "查询成功:"+goodsName, hasStock) return } //精确搜索型号名称 func ExactGoods(c *gin.Context) { var r requests.ExactGoodsRequest c.ShouldBind(&r) if r.GoodsName == "" { common.Output(c,1, "查询型号名称不得为空", nil) return } //查询条件 otherService := service.OtherService{} otherService.ExactGoods(c,r.SupplierId, r.GoodsName) }