|
|
@@ -6,14 +6,14 @@ import (
|
|
|
"github.com/gin-gonic/gin"
|
|
|
)
|
|
|
|
|
|
-// GoodsQuery 商品查询请求结构
|
|
|
-type GoodsQuery struct {
|
|
|
+// GoodsQueryReq 商品查询请求
|
|
|
+type GoodsQueryReq struct {
|
|
|
Token string `json:"token" binding:"required"`
|
|
|
GoodsID int `json:"goodsid" binding:"required"`
|
|
|
}
|
|
|
|
|
|
-// GoodsQueryResult 商品查询结果结构
|
|
|
-type GoodsQueryResult struct {
|
|
|
+// GoodsQueryRsp 商品查询结果
|
|
|
+type GoodsQueryRsp struct {
|
|
|
GoodsID int `json:"goodsid" binding:"required"`
|
|
|
GoodsCode string `json:"goodscode" binding:"required"`
|
|
|
GoodsName string `json:"goodsname" binding:"required"`
|
|
|
@@ -21,14 +21,14 @@ type GoodsQueryResult struct {
|
|
|
}
|
|
|
|
|
|
// GetGoodsInfo 商品信息查询
|
|
|
-func GetGoodsInfo(c *gin.Context) {
|
|
|
- var goods GoodsQuery
|
|
|
+func QueryGoods(c *gin.Context) {
|
|
|
+ var goods GoodsQueryReq
|
|
|
err := c.ShouldBind(&goods)
|
|
|
if err != nil {
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
|
}
|
|
|
|
|
|
- ret := GoodsQueryResult{
|
|
|
+ ret := GoodsQueryRsp{
|
|
|
GoodsID: 1,
|
|
|
GoodsCode: "Ag100",
|
|
|
GoodsName: "银100",
|