zwl hace 5 años
padre
commit
747d5dd396
Se han modificado 2 ficheros con 8 adiciones y 8 borrados
  1. 7 7
      goods/goods.go
  2. 1 1
      main.go

+ 7 - 7
goods/goods.go

@@ -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",

+ 1 - 1
main.go

@@ -19,7 +19,7 @@ func main() {
 	gr := r.Group("/goods")
 	gropt := gr.Group("/goodsopt")
 	{
-		gropt.POST("/get_goods_info", goods.GetGoodsInfo)
+		gropt.POST("/QueryGoods", goods.QueryGoods)
 	}
 
 	r.Run(":8080")