This commit is contained in:
苏尹岚
2021-01-05 16:43:04 +08:00
parent ac6e76a4a6
commit baef83d986
4 changed files with 141 additions and 0 deletions

View File

@@ -938,3 +938,52 @@ func (c *StoreController) GetJddjStoreInfo() {
return retVal, "", err
})
}
// @Title 查询品牌
// @Description 查询品牌
// @Param token header string true "认证token"
// @Param name query string false "品牌名"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetBrands [get]
func (c *StoreController) GetBrands() {
c.callGetBrands(func(params *tStoreGetBrandsParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetBrands(params.Ctx, params.Name)
return retVal, "", err
})
}
// @Title 新增品牌
// @Description 新增品牌
// @Param token header string true "认证token"
// @Param payload formData string true "brand payload"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AddBrand [post]
func (c *StoreController) AddBrand() {
c.callAddBrand(func(params *tStoreAddBrandParams) (retVal interface{}, errCode string, err error) {
var brand = &model.Brand{}
if err = utils.UnmarshalUseNumber([]byte(params.Payload), brand); err == nil {
err = cms.AddBrand(params.Ctx, brand)
}
return retVal, "", err
})
}
// @Title 修改品牌
// @Description 修改品牌
// @Param token header string true "认证token"
// @Param payload formData string true "brand payload"
// @Param isDel formData bool false "是否是删除"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateBrand [post]
func (c *StoreController) UpdateBrand() {
c.callUpdateBrand(func(params *tStoreUpdateBrandParams) (retVal interface{}, errCode string, err error) {
payload := make(map[string]interface{})
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &payload); err == nil {
err = cms.UpdateBrand(params.Ctx, payload, params.IsDel)
}
return retVal, "", err
})
}