|
@@ -43,15 +43,16 @@ func UtilStructToMap(m map[string]interface{}) map[string]interface{} {
|
|
|
//BaseGoodsCommodityAreaRouter(group)
|
|
//BaseGoodsCommodityAreaRouter(group)
|
|
|
//BaseGoodsCouponRouter(group)
|
|
//BaseGoodsCouponRouter(group)
|
|
|
//BaseGoodsCouponUserRouter(group)
|
|
//BaseGoodsCouponUserRouter(group)
|
|
|
-//BaseGoodsIndexBannerRouter(group)
|
|
|
|
|
//BaseGoodsIntroductionRouter(group)
|
|
//BaseGoodsIntroductionRouter(group)
|
|
|
//BaseGoodsOrderRouter(group)
|
|
//BaseGoodsOrderRouter(group)
|
|
|
//BaseGoodsSkuRouter(group)
|
|
//BaseGoodsSkuRouter(group)
|
|
|
//BaseGoodsSkuCardRouter(group)
|
|
//BaseGoodsSkuCardRouter(group)
|
|
|
//BaseGoodsTagRouter(group)
|
|
//BaseGoodsTagRouter(group)
|
|
|
-//BaseGoodsTopicRouter(group)
|
|
|
|
|
//BaseGoodsTypeRouter(group)
|
|
//BaseGoodsTypeRouter(group)
|
|
|
//BaseManageUserRouter(group)
|
|
//BaseManageUserRouter(group)
|
|
|
|
|
+//BaseShopAdviceCarouselRouter(group)
|
|
|
|
|
+//BaseShopTopicRouter(group)
|
|
|
|
|
+//BaseShopTopicSkuRouter(group)
|
|
|
//BaseUserRouter(group)
|
|
//BaseUserRouter(group)
|
|
|
//BaseUserWalletRouter(group)
|
|
//BaseUserWalletRouter(group)
|
|
|
|
|
|
|
@@ -225,16 +226,6 @@ func BaseGoodsCouponUserRouter(group *gin.RouterGroup) {
|
|
|
PushRouter(BaseGoodsCouponUserGroup, "DELETE", "/goodsCouponUser", DeleteBaseGoodsCouponUser)
|
|
PushRouter(BaseGoodsCouponUserGroup, "DELETE", "/goodsCouponUser", DeleteBaseGoodsCouponUser)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func BaseGoodsIndexBannerRouter(group *gin.RouterGroup) {
|
|
|
|
|
- BaseGoodsIndexBannerGroup := group.Group("/back/base")
|
|
|
|
|
- PushRouter(BaseGoodsIndexBannerGroup, "GET", "/goodsIndexBanner", GetBaseGoodsIndexBannerById)
|
|
|
|
|
- PushRouter(BaseGoodsIndexBannerGroup, "POST", "/goodsIndexBanner/list", GetBaseGoodsIndexBannerList)
|
|
|
|
|
- PushRouter(BaseGoodsIndexBannerGroup, "POST", "/goodsIndexBanner/in", GetBaseGoodsIndexBannerListInId)
|
|
|
|
|
- PushRouter(BaseGoodsIndexBannerGroup, "POST", "/goodsIndexBanner", SaveBaseGoodsIndexBanner)
|
|
|
|
|
- PushRouter(BaseGoodsIndexBannerGroup, "PUT", "/goodsIndexBanner", UpdateBaseGoodsIndexBanner)
|
|
|
|
|
- PushRouter(BaseGoodsIndexBannerGroup, "DELETE", "/goodsIndexBanner", DeleteBaseGoodsIndexBanner)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func BaseGoodsIntroductionRouter(group *gin.RouterGroup) {
|
|
func BaseGoodsIntroductionRouter(group *gin.RouterGroup) {
|
|
|
BaseGoodsIntroductionGroup := group.Group("/back/base")
|
|
BaseGoodsIntroductionGroup := group.Group("/back/base")
|
|
|
PushRouter(BaseGoodsIntroductionGroup, "GET", "/goodsIntroduction", GetBaseGoodsIntroductionById)
|
|
PushRouter(BaseGoodsIntroductionGroup, "GET", "/goodsIntroduction", GetBaseGoodsIntroductionById)
|
|
@@ -285,16 +276,6 @@ func BaseGoodsTagRouter(group *gin.RouterGroup) {
|
|
|
PushRouter(BaseGoodsTagGroup, "DELETE", "/goodsTag", DeleteBaseGoodsTag)
|
|
PushRouter(BaseGoodsTagGroup, "DELETE", "/goodsTag", DeleteBaseGoodsTag)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func BaseGoodsTopicRouter(group *gin.RouterGroup) {
|
|
|
|
|
- BaseGoodsTopicGroup := group.Group("/back/base")
|
|
|
|
|
- PushRouter(BaseGoodsTopicGroup, "GET", "/goodsTopic", GetBaseGoodsTopicById)
|
|
|
|
|
- PushRouter(BaseGoodsTopicGroup, "POST", "/goodsTopic/list", GetBaseGoodsTopicList)
|
|
|
|
|
- PushRouter(BaseGoodsTopicGroup, "POST", "/goodsTopic/in", GetBaseGoodsTopicListInId)
|
|
|
|
|
- PushRouter(BaseGoodsTopicGroup, "POST", "/goodsTopic", SaveBaseGoodsTopic)
|
|
|
|
|
- PushRouter(BaseGoodsTopicGroup, "PUT", "/goodsTopic", UpdateBaseGoodsTopic)
|
|
|
|
|
- PushRouter(BaseGoodsTopicGroup, "DELETE", "/goodsTopic", DeleteBaseGoodsTopic)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func BaseGoodsTypeRouter(group *gin.RouterGroup) {
|
|
func BaseGoodsTypeRouter(group *gin.RouterGroup) {
|
|
|
BaseGoodsTypeGroup := group.Group("/back/base")
|
|
BaseGoodsTypeGroup := group.Group("/back/base")
|
|
|
PushRouter(BaseGoodsTypeGroup, "GET", "/goodsType", GetBaseGoodsTypeById)
|
|
PushRouter(BaseGoodsTypeGroup, "GET", "/goodsType", GetBaseGoodsTypeById)
|
|
@@ -315,6 +296,36 @@ func BaseManageUserRouter(group *gin.RouterGroup) {
|
|
|
PushRouter(BaseManageUserGroup, "DELETE", "/manageUser", DeleteBaseManageUser)
|
|
PushRouter(BaseManageUserGroup, "DELETE", "/manageUser", DeleteBaseManageUser)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func BaseShopAdviceCarouselRouter(group *gin.RouterGroup) {
|
|
|
|
|
+ BaseShopAdviceCarouselGroup := group.Group("/back/base")
|
|
|
|
|
+ PushRouter(BaseShopAdviceCarouselGroup, "GET", "/shopAdviceCarousel", GetBaseShopAdviceCarouselById)
|
|
|
|
|
+ PushRouter(BaseShopAdviceCarouselGroup, "POST", "/shopAdviceCarousel/list", GetBaseShopAdviceCarouselList)
|
|
|
|
|
+ PushRouter(BaseShopAdviceCarouselGroup, "POST", "/shopAdviceCarousel/in", GetBaseShopAdviceCarouselListInId)
|
|
|
|
|
+ PushRouter(BaseShopAdviceCarouselGroup, "POST", "/shopAdviceCarousel", SaveBaseShopAdviceCarousel)
|
|
|
|
|
+ PushRouter(BaseShopAdviceCarouselGroup, "PUT", "/shopAdviceCarousel", UpdateBaseShopAdviceCarousel)
|
|
|
|
|
+ PushRouter(BaseShopAdviceCarouselGroup, "DELETE", "/shopAdviceCarousel", DeleteBaseShopAdviceCarousel)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func BaseShopTopicRouter(group *gin.RouterGroup) {
|
|
|
|
|
+ BaseShopTopicGroup := group.Group("/back/base")
|
|
|
|
|
+ PushRouter(BaseShopTopicGroup, "GET", "/shopTopic", GetBaseShopTopicById)
|
|
|
|
|
+ PushRouter(BaseShopTopicGroup, "POST", "/shopTopic/list", GetBaseShopTopicList)
|
|
|
|
|
+ PushRouter(BaseShopTopicGroup, "POST", "/shopTopic/in", GetBaseShopTopicListInId)
|
|
|
|
|
+ PushRouter(BaseShopTopicGroup, "POST", "/shopTopic", SaveBaseShopTopic)
|
|
|
|
|
+ PushRouter(BaseShopTopicGroup, "PUT", "/shopTopic", UpdateBaseShopTopic)
|
|
|
|
|
+ PushRouter(BaseShopTopicGroup, "DELETE", "/shopTopic", DeleteBaseShopTopic)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func BaseShopTopicSkuRouter(group *gin.RouterGroup) {
|
|
|
|
|
+ BaseShopTopicSkuGroup := group.Group("/back/base")
|
|
|
|
|
+ PushRouter(BaseShopTopicSkuGroup, "GET", "/shopTopicSku", GetBaseShopTopicSkuById)
|
|
|
|
|
+ PushRouter(BaseShopTopicSkuGroup, "POST", "/shopTopicSku/list", GetBaseShopTopicSkuList)
|
|
|
|
|
+ PushRouter(BaseShopTopicSkuGroup, "POST", "/shopTopicSku/in", GetBaseShopTopicSkuListInId)
|
|
|
|
|
+ PushRouter(BaseShopTopicSkuGroup, "POST", "/shopTopicSku", SaveBaseShopTopicSku)
|
|
|
|
|
+ PushRouter(BaseShopTopicSkuGroup, "PUT", "/shopTopicSku", UpdateBaseShopTopicSku)
|
|
|
|
|
+ PushRouter(BaseShopTopicSkuGroup, "DELETE", "/shopTopicSku", DeleteBaseShopTopicSku)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func BaseUserRouter(group *gin.RouterGroup) {
|
|
func BaseUserRouter(group *gin.RouterGroup) {
|
|
|
BaseUserGroup := group.Group("/back/base")
|
|
BaseUserGroup := group.Group("/back/base")
|
|
|
PushRouter(BaseUserGroup, "GET", "/user", GetBaseUserById)
|
|
PushRouter(BaseUserGroup, "GET", "/user", GetBaseUserById)
|
|
@@ -1682,88 +1693,6 @@ func DeleteBaseGoodsCouponUser(c *gin.Context) {
|
|
|
c.JSON(200, CreateResult())
|
|
c.JSON(200, CreateResult())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseGoodsIndexBannerById(c *gin.Context) {
|
|
|
|
|
- id := c.Query("id")
|
|
|
|
|
- goodsIndexBanner, err := manage.GetGoodsIndexBannerById(cast.ToInt64(id))
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- c.JSON(200, CreateResultData(goodsIndexBanner))
|
|
|
|
|
- return
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func GetBaseGoodsIndexBannerList(c *gin.Context) {
|
|
|
|
|
- data := share.GetJsonAnyParam(c)
|
|
|
|
|
- param, _ := data("param")
|
|
|
|
|
- pageNum, _ := data("pageNum")
|
|
|
|
|
- pageSize, _ := data("pageSize")
|
|
|
|
|
- goodsIndexBanner := domain.GoodsIndexBanner{}
|
|
|
|
|
- err := mapstructure.Decode(param, &goodsIndexBanner)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- list, err := manage.GetGoodsIndexBannerList(goodsIndexBanner, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- c.JSON(200, CreateResultData(list))
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func GetBaseGoodsIndexBannerListInId(c *gin.Context) {
|
|
|
|
|
- data := share.GetJsonAnyParam(c)
|
|
|
|
|
- idsString, _ := data("ids")
|
|
|
|
|
- var ids []int64
|
|
|
|
|
- err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
|
|
|
- list, err := manage.GetGoodsIndexBannerListInId(ids)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- c.JSON(200, CreateResultData(list))
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func SaveBaseGoodsIndexBanner(c *gin.Context) {
|
|
|
|
|
- data := share.GetJsonAnyParam(c)
|
|
|
|
|
- goodsIndexBannerParam, _ := data("goodsIndexBanner")
|
|
|
|
|
- goodsIndexBanner := domain.GoodsIndexBanner{}
|
|
|
|
|
- err := mapstructure.Decode(goodsIndexBannerParam, &goodsIndexBanner)
|
|
|
|
|
- goodsIndexBanner.CreateBy = fmt.Sprint(GetUserIdByToken(c))
|
|
|
|
|
- goodsIndexBanner.CreateTime = time.Now()
|
|
|
|
|
- saveGoodsIndexBanner, err := manage.SaveGoodsIndexBanner(&goodsIndexBanner)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- c.JSON(200, CreateResultData(saveGoodsIndexBanner))
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func UpdateBaseGoodsIndexBanner(c *gin.Context) {
|
|
|
|
|
- data := share.GetJsonAnyParam(c)
|
|
|
|
|
- goodsIndexBanner, _ := data("goodsIndexBanner")
|
|
|
|
|
- id, _ := data("id")
|
|
|
|
|
- toMap := UtilStructToMap(cast.ToStringMap(goodsIndexBanner))
|
|
|
|
|
- toMap["create_by"] = "fmt.Sprint(GetUserIdByToken(c))"
|
|
|
|
|
- setGoodsIndexBanner, b, err := manage.SetGoodsIndexBanner(toMap, cast.ToInt64(id))
|
|
|
|
|
- if err != nil || !b {
|
|
|
|
|
- c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- c.JSON(200, CreateResultData(setGoodsIndexBanner))
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-func DeleteBaseGoodsIndexBanner(c *gin.Context) {
|
|
|
|
|
- id := c.Query("id")
|
|
|
|
|
- res := manage.DeleteGoodsIndexBanner(cast.ToInt64(id))
|
|
|
|
|
- if !res {
|
|
|
|
|
- c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- c.JSON(200, CreateResult())
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
func GetBaseGoodsIntroductionById(c *gin.Context) {
|
|
func GetBaseGoodsIntroductionById(c *gin.Context) {
|
|
|
id := c.Query("id")
|
|
id := c.Query("id")
|
|
|
goodsIntroduction, err := manage.GetGoodsIntroductionById(cast.ToInt64(id))
|
|
goodsIntroduction, err := manage.GetGoodsIntroductionById(cast.ToInt64(id))
|
|
@@ -2166,29 +2095,29 @@ func DeleteBaseGoodsTag(c *gin.Context) {
|
|
|
c.JSON(200, CreateResult())
|
|
c.JSON(200, CreateResult())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseGoodsTopicById(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseGoodsTypeById(c *gin.Context) {
|
|
|
id := c.Query("id")
|
|
id := c.Query("id")
|
|
|
- goodsTopic, err := manage.GetGoodsTopicById(cast.ToInt64(id))
|
|
|
|
|
|
|
+ goodsType, err := manage.GetGoodsTypeById(cast.ToInt64(id))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(goodsTopic))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(goodsType))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseGoodsTopicList(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseGoodsTypeList(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
param, _ := data("param")
|
|
param, _ := data("param")
|
|
|
pageNum, _ := data("pageNum")
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
pageSize, _ := data("pageSize")
|
|
|
- goodsTopic := domain.GoodsTopic{}
|
|
|
|
|
- err := mapstructure.Decode(param, &goodsTopic)
|
|
|
|
|
|
|
+ goodsType := domain.GoodsType{}
|
|
|
|
|
+ err := mapstructure.Decode(param, &goodsType)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- list, err := manage.GetGoodsTopicList(goodsTopic, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
|
|
|
|
+ list, err := manage.GetGoodsTypeList(goodsType, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
return
|
|
return
|
|
@@ -2196,12 +2125,12 @@ func GetBaseGoodsTopicList(c *gin.Context) {
|
|
|
c.JSON(200, CreateResultData(list))
|
|
c.JSON(200, CreateResultData(list))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseGoodsTopicListInId(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseGoodsTypeListInId(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
idsString, _ := data("ids")
|
|
idsString, _ := data("ids")
|
|
|
var ids []int64
|
|
var ids []int64
|
|
|
err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
|
- list, err := manage.GetGoodsTopicListInId(ids)
|
|
|
|
|
|
|
+ list, err := manage.GetGoodsTypeListInId(ids)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
return
|
|
return
|
|
@@ -2209,35 +2138,36 @@ func GetBaseGoodsTopicListInId(c *gin.Context) {
|
|
|
c.JSON(200, CreateResultData(list))
|
|
c.JSON(200, CreateResultData(list))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func SaveBaseGoodsTopic(c *gin.Context) {
|
|
|
|
|
|
|
+func SaveBaseGoodsType(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
- goodsTopicParam, _ := data("goodsTopic")
|
|
|
|
|
- goodsTopic := domain.GoodsTopic{}
|
|
|
|
|
- err := mapstructure.Decode(goodsTopicParam, &goodsTopic)
|
|
|
|
|
- saveGoodsTopic, err := manage.SaveGoodsTopic(&goodsTopic)
|
|
|
|
|
|
|
+ goodsTypeParam, _ := data("goodsType")
|
|
|
|
|
+ goodsType := domain.GoodsType{}
|
|
|
|
|
+ err := mapstructure.Decode(goodsTypeParam, &goodsType)
|
|
|
|
|
+ goodsType.CreateTime = time.Now()
|
|
|
|
|
+ saveGoodsType, err := manage.SaveGoodsType(&goodsType)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "保存错误"))
|
|
c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(saveGoodsTopic))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(saveGoodsType))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func UpdateBaseGoodsTopic(c *gin.Context) {
|
|
|
|
|
|
|
+func UpdateBaseGoodsType(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
- goodsTopic, _ := data("goodsTopic")
|
|
|
|
|
|
|
+ goodsType, _ := data("goodsType")
|
|
|
id, _ := data("id")
|
|
id, _ := data("id")
|
|
|
- toMap := UtilStructToMap(cast.ToStringMap(goodsTopic))
|
|
|
|
|
- setGoodsTopic, b, err := manage.SetGoodsTopic(toMap, cast.ToInt64(id))
|
|
|
|
|
|
|
+ toMap := UtilStructToMap(cast.ToStringMap(goodsType))
|
|
|
|
|
+ setGoodsType, b, err := manage.SetGoodsType(toMap, cast.ToInt64(id))
|
|
|
if err != nil || !b {
|
|
if err != nil || !b {
|
|
|
c.JSON(200, CreateResultError(500, "修改错误"))
|
|
c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(setGoodsTopic))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(setGoodsType))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func DeleteBaseGoodsTopic(c *gin.Context) {
|
|
|
|
|
|
|
+func DeleteBaseGoodsType(c *gin.Context) {
|
|
|
id := c.Query("id")
|
|
id := c.Query("id")
|
|
|
- res := manage.DeleteGoodsTopic(cast.ToInt64(id))
|
|
|
|
|
|
|
+ res := manage.DeleteGoodsType(cast.ToInt64(id))
|
|
|
if !res {
|
|
if !res {
|
|
|
c.JSON(200, CreateResultError(500, "删除错误"))
|
|
c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
return
|
|
return
|
|
@@ -2245,29 +2175,29 @@ func DeleteBaseGoodsTopic(c *gin.Context) {
|
|
|
c.JSON(200, CreateResult())
|
|
c.JSON(200, CreateResult())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseGoodsTypeById(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseManageUserById(c *gin.Context) {
|
|
|
id := c.Query("id")
|
|
id := c.Query("id")
|
|
|
- goodsType, err := manage.GetGoodsTypeById(cast.ToInt64(id))
|
|
|
|
|
|
|
+ manageUser, err := manage.GetManageUserById(cast.ToInt64(id))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(goodsType))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(manageUser))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseGoodsTypeList(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseManageUserList(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
param, _ := data("param")
|
|
param, _ := data("param")
|
|
|
pageNum, _ := data("pageNum")
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
pageSize, _ := data("pageSize")
|
|
|
- goodsType := domain.GoodsType{}
|
|
|
|
|
- err := mapstructure.Decode(param, &goodsType)
|
|
|
|
|
|
|
+ manageUser := domain.ManageUser{}
|
|
|
|
|
+ err := mapstructure.Decode(param, &manageUser)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- list, err := manage.GetGoodsTypeList(goodsType, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
|
|
|
|
+ list, err := manage.GetManageUserList(manageUser, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
return
|
|
return
|
|
@@ -2275,12 +2205,12 @@ func GetBaseGoodsTypeList(c *gin.Context) {
|
|
|
c.JSON(200, CreateResultData(list))
|
|
c.JSON(200, CreateResultData(list))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseGoodsTypeListInId(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseManageUserListInId(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
idsString, _ := data("ids")
|
|
idsString, _ := data("ids")
|
|
|
var ids []int64
|
|
var ids []int64
|
|
|
err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
|
- list, err := manage.GetGoodsTypeListInId(ids)
|
|
|
|
|
|
|
+ list, err := manage.GetManageUserListInId(ids)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
return
|
|
return
|
|
@@ -2288,36 +2218,35 @@ func GetBaseGoodsTypeListInId(c *gin.Context) {
|
|
|
c.JSON(200, CreateResultData(list))
|
|
c.JSON(200, CreateResultData(list))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func SaveBaseGoodsType(c *gin.Context) {
|
|
|
|
|
|
|
+func SaveBaseManageUser(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
- goodsTypeParam, _ := data("goodsType")
|
|
|
|
|
- goodsType := domain.GoodsType{}
|
|
|
|
|
- err := mapstructure.Decode(goodsTypeParam, &goodsType)
|
|
|
|
|
- goodsType.CreateTime = time.Now()
|
|
|
|
|
- saveGoodsType, err := manage.SaveGoodsType(&goodsType)
|
|
|
|
|
|
|
+ manageUserParam, _ := data("manageUser")
|
|
|
|
|
+ manageUser := domain.ManageUser{}
|
|
|
|
|
+ err := mapstructure.Decode(manageUserParam, &manageUser)
|
|
|
|
|
+ saveManageUser, err := manage.SaveManageUser(&manageUser)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "保存错误"))
|
|
c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(saveGoodsType))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(saveManageUser))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func UpdateBaseGoodsType(c *gin.Context) {
|
|
|
|
|
|
|
+func UpdateBaseManageUser(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
- goodsType, _ := data("goodsType")
|
|
|
|
|
|
|
+ manageUser, _ := data("manageUser")
|
|
|
id, _ := data("id")
|
|
id, _ := data("id")
|
|
|
- toMap := UtilStructToMap(cast.ToStringMap(goodsType))
|
|
|
|
|
- setGoodsType, b, err := manage.SetGoodsType(toMap, cast.ToInt64(id))
|
|
|
|
|
|
|
+ toMap := UtilStructToMap(cast.ToStringMap(manageUser))
|
|
|
|
|
+ setManageUser, b, err := manage.SetManageUser(toMap, cast.ToInt64(id))
|
|
|
if err != nil || !b {
|
|
if err != nil || !b {
|
|
|
c.JSON(200, CreateResultError(500, "修改错误"))
|
|
c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(setGoodsType))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(setManageUser))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func DeleteBaseGoodsType(c *gin.Context) {
|
|
|
|
|
|
|
+func DeleteBaseManageUser(c *gin.Context) {
|
|
|
id := c.Query("id")
|
|
id := c.Query("id")
|
|
|
- res := manage.DeleteGoodsType(cast.ToInt64(id))
|
|
|
|
|
|
|
+ res := manage.DeleteManageUser(cast.ToInt64(id))
|
|
|
if !res {
|
|
if !res {
|
|
|
c.JSON(200, CreateResultError(500, "删除错误"))
|
|
c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
return
|
|
return
|
|
@@ -2325,29 +2254,29 @@ func DeleteBaseGoodsType(c *gin.Context) {
|
|
|
c.JSON(200, CreateResult())
|
|
c.JSON(200, CreateResult())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseManageUserById(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseShopAdviceCarouselById(c *gin.Context) {
|
|
|
id := c.Query("id")
|
|
id := c.Query("id")
|
|
|
- manageUser, err := manage.GetManageUserById(cast.ToInt64(id))
|
|
|
|
|
|
|
+ shopAdviceCarousel, err := manage.GetShopAdviceCarouselById(cast.ToInt64(id))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(manageUser))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(shopAdviceCarousel))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseManageUserList(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseShopAdviceCarouselList(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
param, _ := data("param")
|
|
param, _ := data("param")
|
|
|
pageNum, _ := data("pageNum")
|
|
pageNum, _ := data("pageNum")
|
|
|
pageSize, _ := data("pageSize")
|
|
pageSize, _ := data("pageSize")
|
|
|
- manageUser := domain.ManageUser{}
|
|
|
|
|
- err := mapstructure.Decode(param, &manageUser)
|
|
|
|
|
|
|
+ shopAdviceCarousel := domain.ShopAdviceCarousel{}
|
|
|
|
|
+ err := mapstructure.Decode(param, &shopAdviceCarousel)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- list, err := manage.GetManageUserList(manageUser, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
|
|
|
|
+ list, err := manage.GetShopAdviceCarouselList(shopAdviceCarousel, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
return
|
|
return
|
|
@@ -2355,12 +2284,12 @@ func GetBaseManageUserList(c *gin.Context) {
|
|
|
c.JSON(200, CreateResultData(list))
|
|
c.JSON(200, CreateResultData(list))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func GetBaseManageUserListInId(c *gin.Context) {
|
|
|
|
|
|
|
+func GetBaseShopAdviceCarouselListInId(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
idsString, _ := data("ids")
|
|
idsString, _ := data("ids")
|
|
|
var ids []int64
|
|
var ids []int64
|
|
|
err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
|
- list, err := manage.GetManageUserListInId(ids)
|
|
|
|
|
|
|
+ list, err := manage.GetShopAdviceCarouselListInId(ids)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
return
|
|
return
|
|
@@ -2368,35 +2297,196 @@ func GetBaseManageUserListInId(c *gin.Context) {
|
|
|
c.JSON(200, CreateResultData(list))
|
|
c.JSON(200, CreateResultData(list))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func SaveBaseManageUser(c *gin.Context) {
|
|
|
|
|
|
|
+func SaveBaseShopAdviceCarousel(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
- manageUserParam, _ := data("manageUser")
|
|
|
|
|
- manageUser := domain.ManageUser{}
|
|
|
|
|
- err := mapstructure.Decode(manageUserParam, &manageUser)
|
|
|
|
|
- saveManageUser, err := manage.SaveManageUser(&manageUser)
|
|
|
|
|
|
|
+ shopAdviceCarouselParam, _ := data("shopAdviceCarousel")
|
|
|
|
|
+ shopAdviceCarousel := domain.ShopAdviceCarousel{}
|
|
|
|
|
+ err := mapstructure.Decode(shopAdviceCarouselParam, &shopAdviceCarousel)
|
|
|
|
|
+ shopAdviceCarousel.CreateBy = fmt.Sprint(GetUserIdByToken(c))
|
|
|
|
|
+ shopAdviceCarousel.CreateTime = time.Now()
|
|
|
|
|
+ saveShopAdviceCarousel, err := manage.SaveShopAdviceCarousel(&shopAdviceCarousel)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
c.JSON(200, CreateResultError(500, "保存错误"))
|
|
c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(saveManageUser))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(saveShopAdviceCarousel))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func UpdateBaseManageUser(c *gin.Context) {
|
|
|
|
|
|
|
+func UpdateBaseShopAdviceCarousel(c *gin.Context) {
|
|
|
data := share.GetJsonAnyParam(c)
|
|
data := share.GetJsonAnyParam(c)
|
|
|
- manageUser, _ := data("manageUser")
|
|
|
|
|
|
|
+ shopAdviceCarousel, _ := data("shopAdviceCarousel")
|
|
|
id, _ := data("id")
|
|
id, _ := data("id")
|
|
|
- toMap := UtilStructToMap(cast.ToStringMap(manageUser))
|
|
|
|
|
- setManageUser, b, err := manage.SetManageUser(toMap, cast.ToInt64(id))
|
|
|
|
|
|
|
+ toMap := UtilStructToMap(cast.ToStringMap(shopAdviceCarousel))
|
|
|
|
|
+ toMap["create_by"] = "fmt.Sprint(GetUserIdByToken(c))"
|
|
|
|
|
+ setShopAdviceCarousel, b, err := manage.SetShopAdviceCarousel(toMap, cast.ToInt64(id))
|
|
|
if err != nil || !b {
|
|
if err != nil || !b {
|
|
|
c.JSON(200, CreateResultError(500, "修改错误"))
|
|
c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- c.JSON(200, CreateResultData(setManageUser))
|
|
|
|
|
|
|
+ c.JSON(200, CreateResultData(setShopAdviceCarousel))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func DeleteBaseManageUser(c *gin.Context) {
|
|
|
|
|
|
|
+func DeleteBaseShopAdviceCarousel(c *gin.Context) {
|
|
|
id := c.Query("id")
|
|
id := c.Query("id")
|
|
|
- res := manage.DeleteManageUser(cast.ToInt64(id))
|
|
|
|
|
|
|
+ res := manage.DeleteShopAdviceCarousel(cast.ToInt64(id))
|
|
|
|
|
+ if !res {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResult())
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func GetBaseShopTopicById(c *gin.Context) {
|
|
|
|
|
+ id := c.Query("id")
|
|
|
|
|
+ shopTopic, err := manage.GetShopTopicById(cast.ToInt64(id))
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(shopTopic))
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func GetBaseShopTopicList(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ param, _ := data("param")
|
|
|
|
|
+ pageNum, _ := data("pageNum")
|
|
|
|
|
+ pageSize, _ := data("pageSize")
|
|
|
|
|
+ shopTopic := domain.ShopTopic{}
|
|
|
|
|
+ err := mapstructure.Decode(param, &shopTopic)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ list, err := manage.GetShopTopicList(shopTopic, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func GetBaseShopTopicListInId(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ idsString, _ := data("ids")
|
|
|
|
|
+ var ids []int64
|
|
|
|
|
+ err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
|
|
|
+ list, err := manage.GetShopTopicListInId(ids)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func SaveBaseShopTopic(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ shopTopicParam, _ := data("shopTopic")
|
|
|
|
|
+ shopTopic := domain.ShopTopic{}
|
|
|
|
|
+ err := mapstructure.Decode(shopTopicParam, &shopTopic)
|
|
|
|
|
+ saveShopTopic, err := manage.SaveShopTopic(&shopTopic)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(saveShopTopic))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func UpdateBaseShopTopic(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ shopTopic, _ := data("shopTopic")
|
|
|
|
|
+ id, _ := data("id")
|
|
|
|
|
+ toMap := UtilStructToMap(cast.ToStringMap(shopTopic))
|
|
|
|
|
+ setShopTopic, b, err := manage.SetShopTopic(toMap, cast.ToInt64(id))
|
|
|
|
|
+ if err != nil || !b {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(setShopTopic))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func DeleteBaseShopTopic(c *gin.Context) {
|
|
|
|
|
+ id := c.Query("id")
|
|
|
|
|
+ res := manage.DeleteShopTopic(cast.ToInt64(id))
|
|
|
|
|
+ if !res {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResult())
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func GetBaseShopTopicSkuById(c *gin.Context) {
|
|
|
|
|
+ id := c.Query("id")
|
|
|
|
|
+ shopTopicSku, err := manage.GetShopTopicSkuById(cast.ToInt64(id))
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "用户查询不存在"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(shopTopicSku))
|
|
|
|
|
+ return
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func GetBaseShopTopicSkuList(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ param, _ := data("param")
|
|
|
|
|
+ pageNum, _ := data("pageNum")
|
|
|
|
|
+ pageSize, _ := data("pageSize")
|
|
|
|
|
+ shopTopicSku := domain.ShopTopicSku{}
|
|
|
|
|
+ err := mapstructure.Decode(param, &shopTopicSku)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "json转换错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ list, err := manage.GetShopTopicSkuList(shopTopicSku, cast.ToInt(pageNum), cast.ToInt(pageSize))
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func GetBaseShopTopicSkuListInId(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ idsString, _ := data("ids")
|
|
|
|
|
+ var ids []int64
|
|
|
|
|
+ err := mapstructure.Decode([]byte(cast.ToString(idsString)), &ids)
|
|
|
|
|
+ list, err := manage.GetShopTopicSkuListInId(ids)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "查询错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(list))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func SaveBaseShopTopicSku(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ shopTopicSkuParam, _ := data("shopTopicSku")
|
|
|
|
|
+ shopTopicSku := domain.ShopTopicSku{}
|
|
|
|
|
+ err := mapstructure.Decode(shopTopicSkuParam, &shopTopicSku)
|
|
|
|
|
+ saveShopTopicSku, err := manage.SaveShopTopicSku(&shopTopicSku)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "保存错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(saveShopTopicSku))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func UpdateBaseShopTopicSku(c *gin.Context) {
|
|
|
|
|
+ data := share.GetJsonAnyParam(c)
|
|
|
|
|
+ shopTopicSku, _ := data("shopTopicSku")
|
|
|
|
|
+ id, _ := data("id")
|
|
|
|
|
+ toMap := UtilStructToMap(cast.ToStringMap(shopTopicSku))
|
|
|
|
|
+ setShopTopicSku, b, err := manage.SetShopTopicSku(toMap, cast.ToInt64(id))
|
|
|
|
|
+ if err != nil || !b {
|
|
|
|
|
+ c.JSON(200, CreateResultError(500, "修改错误"))
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ c.JSON(200, CreateResultData(setShopTopicSku))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func DeleteBaseShopTopicSku(c *gin.Context) {
|
|
|
|
|
+ id := c.Query("id")
|
|
|
|
|
+ res := manage.DeleteShopTopicSku(cast.ToInt64(id))
|
|
|
if !res {
|
|
if !res {
|
|
|
c.JSON(200, CreateResultError(500, "删除错误"))
|
|
c.JSON(200, CreateResultError(500, "删除错误"))
|
|
|
return
|
|
return
|