|
|
@@ -17,6 +17,8 @@ import (
|
|
|
//BaseBackRoleRouter(group)
|
|
|
//BaseBackRoleAuthorityRouter(group)
|
|
|
//BaseBackRoleMenuRouter(group)
|
|
|
+//BaseGenTableRouter(group)
|
|
|
+//BaseGenTableColumnRouter(group)
|
|
|
//BaseGoodsRouter(group)
|
|
|
//BaseGoodsCommodityAreaRouter(group)
|
|
|
//BaseGoodsCouponRouter(group)
|
|
|
@@ -111,6 +113,26 @@ func BaseBackRoleMenuRouter(group *gin.RouterGroup) {
|
|
|
PushRouter(BaseBackRoleMenuGroup, "DELETE", "/backRoleMenu", DeleteBaseBackRoleMenu)
|
|
|
}
|
|
|
|
|
|
+func BaseGenTableRouter(group *gin.RouterGroup) {
|
|
|
+ BaseGenTableGroup := group.Group("/back/base")
|
|
|
+ PushRouter(BaseGenTableGroup, "GET", "/genTable", GetBaseGenTableById)
|
|
|
+ PushRouter(BaseGenTableGroup, "POST", "/genTable/list", GetBaseGenTableList)
|
|
|
+ PushRouter(BaseGenTableGroup, "POST", "/genTable/in", GetBaseGenTableListInId)
|
|
|
+ PushRouter(BaseGenTableGroup, "POST", "/genTable", SaveBaseGenTable)
|
|
|
+ PushRouter(BaseGenTableGroup, "PUT", "/genTable", UpdateBaseGenTable)
|
|
|
+ PushRouter(BaseGenTableGroup, "DELETE", "/genTable", DeleteBaseGenTable)
|
|
|
+}
|
|
|
+
|
|
|
+func BaseGenTableColumnRouter(group *gin.RouterGroup) {
|
|
|
+ BaseGenTableColumnGroup := group.Group("/back/base")
|
|
|
+ PushRouter(BaseGenTableColumnGroup, "GET", "/genTableColumn", GetBaseGenTableColumnById)
|
|
|
+ PushRouter(BaseGenTableColumnGroup, "POST", "/genTableColumn/list", GetBaseGenTableColumnList)
|
|
|
+ PushRouter(BaseGenTableColumnGroup, "POST", "/genTableColumn/in", GetBaseGenTableColumnListInId)
|
|
|
+ PushRouter(BaseGenTableColumnGroup, "POST", "/genTableColumn", SaveBaseGenTableColumn)
|
|
|
+ PushRouter(BaseGenTableColumnGroup, "PUT", "/genTableColumn", UpdateBaseGenTableColumn)
|
|
|
+ PushRouter(BaseGenTableColumnGroup, "DELETE", "/genTableColumn", DeleteBaseGenTableColumn)
|
|
|
+}
|
|
|
+
|
|
|
func BaseGoodsRouter(group *gin.RouterGroup) {
|
|
|
BaseGoodsGroup := group.Group("/back/base")
|
|
|
PushRouter(BaseGoodsGroup, "GET", "/goods", GetBaseGoodsById)
|
|
|
@@ -256,7 +278,10 @@ func GetBaseArticleList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
article := domain.Article{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &article)
|
|
|
+ err := mapstructure.Decode(param, &article)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetArticleList(article, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -324,7 +349,10 @@ func GetBaseArticleTagList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
articleTag := domain.ArticleTag{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &articleTag)
|
|
|
+ err := mapstructure.Decode(param, &articleTag)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetArticleTagList(articleTag, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -392,7 +420,10 @@ func GetBaseArticleTopicList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
articleTopic := domain.ArticleTopic{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &articleTopic)
|
|
|
+ err := mapstructure.Decode(param, &articleTopic)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetArticleTopicList(articleTopic, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -460,7 +491,10 @@ func GetBaseBackAuthorityList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
backAuthority := domain.BackAuthority{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &backAuthority)
|
|
|
+ err := mapstructure.Decode(param, &backAuthority)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetBackAuthorityList(backAuthority, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -528,7 +562,10 @@ func GetBaseBackMenuList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
backMenu := domain.BackMenu{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &backMenu)
|
|
|
+ err := mapstructure.Decode(param, &backMenu)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetBackMenuList(backMenu, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -596,7 +633,10 @@ func GetBaseBackRoleList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
backRole := domain.BackRole{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &backRole)
|
|
|
+ err := mapstructure.Decode(param, &backRole)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetBackRoleList(backRole, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -664,7 +704,10 @@ func GetBaseBackRoleAuthorityList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
backRoleAuthority := domain.BackRoleAuthority{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &backRoleAuthority)
|
|
|
+ err := mapstructure.Decode(param, &backRoleAuthority)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetBackRoleAuthorityList(backRoleAuthority, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -732,7 +775,10 @@ func GetBaseBackRoleMenuList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
backRoleMenu := domain.BackRoleMenu{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &backRoleMenu)
|
|
|
+ err := mapstructure.Decode(param, &backRoleMenu)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetBackRoleMenuList(backRoleMenu, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -785,6 +831,148 @@ func DeleteBaseBackRoleMenu(c *gin.Context) {
|
|
|
c.JSON(200, CreateResult())
|
|
|
}
|
|
|
|
|
|
+func GetBaseGenTableById(c *gin.Context) {
|
|
|
+ id := c.Param("id")
|
|
|
+ genTable, err := manage.GetGenTableById(cast.ToInt64(id))
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(genTable))
|
|
|
+}
|
|
|
+
|
|
|
+func GetBaseGenTableList(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ param, _ := data("param")
|
|
|
+ pageNum, _ := data("pageNum")
|
|
|
+ pageSize, _ := data("pageSize")
|
|
|
+ genTable := domain.GenTable{}
|
|
|
+ err := mapstructure.Decode(param, &genTable)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
+ list, err := manage.GetGenTableList(genTable, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
+}
|
|
|
+
|
|
|
+func GetBaseGenTableListInId(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ idsString, _ := data("ids")
|
|
|
+ var ids []int64
|
|
|
+ err := json.Unmarshal([]byte(cast.ToString(idsString)), &ids)
|
|
|
+ list, err := manage.GetGenTableListInId(ids)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
+}
|
|
|
+
|
|
|
+func SaveBaseGenTable(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ genTableParam, _ := data("genTable")
|
|
|
+ genTable := domain.GenTable{}
|
|
|
+ err := json.Unmarshal([]byte(cast.ToString(genTableParam)), &genTable)
|
|
|
+ saveGenTable, err := manage.SaveGenTable(&genTable)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(saveGenTable))
|
|
|
+}
|
|
|
+
|
|
|
+func UpdateBaseGenTable(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ genTable, _ := data("genTable")
|
|
|
+ id, _ := data("id")
|
|
|
+
|
|
|
+ setGenTable, b, err := manage.SetGenTable(cast.ToStringMap(genTable), cast.ToInt64(id))
|
|
|
+ if err != nil || !b {
|
|
|
+ c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(setGenTable))
|
|
|
+}
|
|
|
+
|
|
|
+func DeleteBaseGenTable(c *gin.Context) {
|
|
|
+ id := c.Param("id")
|
|
|
+ res := manage.DeleteGenTable(cast.ToInt64(id))
|
|
|
+ if !res {
|
|
|
+ c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResult())
|
|
|
+}
|
|
|
+
|
|
|
+func GetBaseGenTableColumnById(c *gin.Context) {
|
|
|
+ id := c.Param("id")
|
|
|
+ genTableColumn, err := manage.GetGenTableColumnById(cast.ToInt64(id))
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(genTableColumn))
|
|
|
+}
|
|
|
+
|
|
|
+func GetBaseGenTableColumnList(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ param, _ := data("param")
|
|
|
+ pageNum, _ := data("pageNum")
|
|
|
+ pageSize, _ := data("pageSize")
|
|
|
+ genTableColumn := domain.GenTableColumn{}
|
|
|
+ err := mapstructure.Decode(param, &genTableColumn)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
+ list, err := manage.GetGenTableColumnList(genTableColumn, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
+}
|
|
|
+
|
|
|
+func GetBaseGenTableColumnListInId(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ idsString, _ := data("ids")
|
|
|
+ var ids []int64
|
|
|
+ err := json.Unmarshal([]byte(cast.ToString(idsString)), &ids)
|
|
|
+ list, err := manage.GetGenTableColumnListInId(ids)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
+}
|
|
|
+
|
|
|
+func SaveBaseGenTableColumn(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ genTableColumnParam, _ := data("genTableColumn")
|
|
|
+ genTableColumn := domain.GenTableColumn{}
|
|
|
+ err := json.Unmarshal([]byte(cast.ToString(genTableColumnParam)), &genTableColumn)
|
|
|
+ saveGenTableColumn, err := manage.SaveGenTableColumn(&genTableColumn)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(saveGenTableColumn))
|
|
|
+}
|
|
|
+
|
|
|
+func UpdateBaseGenTableColumn(c *gin.Context) {
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
+ genTableColumn, _ := data("genTableColumn")
|
|
|
+ id, _ := data("id")
|
|
|
+
|
|
|
+ setGenTableColumn, b, err := manage.SetGenTableColumn(cast.ToStringMap(genTableColumn), cast.ToInt64(id))
|
|
|
+ if err != nil || !b {
|
|
|
+ c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResultData(setGenTableColumn))
|
|
|
+}
|
|
|
+
|
|
|
+func DeleteBaseGenTableColumn(c *gin.Context) {
|
|
|
+ id := c.Param("id")
|
|
|
+ res := manage.DeleteGenTableColumn(cast.ToInt64(id))
|
|
|
+ if !res {
|
|
|
+ c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
+ }
|
|
|
+ c.JSON(200, CreateResult())
|
|
|
+}
|
|
|
+
|
|
|
func GetBaseGoodsById(c *gin.Context) {
|
|
|
id := c.Param("id")
|
|
|
goods, err := manage.GetGoodsById(cast.ToInt64(id))
|
|
|
@@ -800,7 +988,10 @@ func GetBaseGoodsList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goods := domain.Goods{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goods)
|
|
|
+ err := mapstructure.Decode(param, &goods)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsList(goods, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -868,7 +1059,10 @@ func GetBaseGoodsCommodityAreaList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsCommodityArea := domain.GoodsCommodityArea{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsCommodityArea)
|
|
|
+ err := mapstructure.Decode(param, &goodsCommodityArea)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsCommodityAreaList(goodsCommodityArea, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -936,7 +1130,10 @@ func GetBaseGoodsCouponList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsCoupon := domain.GoodsCoupon{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsCoupon)
|
|
|
+ err := mapstructure.Decode(param, &goodsCoupon)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsCouponList(goodsCoupon, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1004,7 +1201,10 @@ func GetBaseGoodsCouponUserList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsCouponUser := domain.GoodsCouponUser{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsCouponUser)
|
|
|
+ err := mapstructure.Decode(param, &goodsCouponUser)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsCouponUserList(goodsCouponUser, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1072,7 +1272,10 @@ func GetBaseGoodsIntroductionList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsIntroduction := domain.GoodsIntroduction{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsIntroduction)
|
|
|
+ err := mapstructure.Decode(param, &goodsIntroduction)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsIntroductionList(goodsIntroduction, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1140,7 +1343,10 @@ func GetBaseGoodsOrderList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsOrder := domain.GoodsOrder{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsOrder)
|
|
|
+ err := mapstructure.Decode(param, &goodsOrder)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsOrderList(goodsOrder, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1208,7 +1414,10 @@ func GetBaseGoodsSkuList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsSku := domain.GoodsSku{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsSku)
|
|
|
+ err := mapstructure.Decode(param, &goodsSku)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsSkuList(goodsSku, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1276,7 +1485,10 @@ func GetBaseGoodsSkuCardList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsSkuCard := domain.GoodsSkuCard{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsSkuCard)
|
|
|
+ err := mapstructure.Decode(param, &goodsSkuCard)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsSkuCardList(goodsSkuCard, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1344,7 +1556,10 @@ func GetBaseGoodsTagList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsTag := domain.GoodsTag{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsTag)
|
|
|
+ err := mapstructure.Decode(param, &goodsTag)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsTagList(goodsTag, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1412,7 +1627,10 @@ func GetBaseGoodsTopicList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsTopic := domain.GoodsTopic{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsTopic)
|
|
|
+ err := mapstructure.Decode(param, &goodsTopic)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsTopicList(goodsTopic, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1480,7 +1698,10 @@ func GetBaseGoodsTypeList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
goodsType := domain.GoodsType{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &goodsType)
|
|
|
+ err := mapstructure.Decode(param, &goodsType)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetGoodsTypeList(goodsType, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1548,7 +1769,10 @@ func GetBaseUserList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
user := domain.User{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &user)
|
|
|
+ err := mapstructure.Decode(param, &user)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetUserList(user, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
@@ -1616,7 +1840,10 @@ func GetBaseUserWalletList(c *gin.Context) {
|
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
|
userWallet := domain.UserWallet{}
|
|
|
- err := json.Unmarshal([]byte(cast.ToString(param)), &userWallet)
|
|
|
+ err := mapstructure.Decode(param, &userWallet)
|
|
|
+ if err != nil {
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
+ }
|
|
|
list, err := manage.GetUserWalletList(userWallet, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|