56 lines
2.5 KiB
Go
56 lines
2.5 KiB
Go
package controllers
|
||
|
||
import (
|
||
"git.rosy.net.cn/baseapi/utils"
|
||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||
"github.com/astaxie/beego"
|
||
)
|
||
|
||
type StoreSkuController struct {
|
||
beego.Controller
|
||
}
|
||
|
||
// @Title 得到商家商品信息
|
||
// @Description 得到商家商品信息,如下条件之间是与的关系
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID query int true "门店ID"
|
||
// @Param keyword query string false "查询关键字(可以为空,为空表示不限制)"
|
||
// @Param nameID query int false "SkuName ID"
|
||
// @Param skuID query int false "Sku ID"
|
||
// @Param name query string false "商品名称(不要求完全一致)"
|
||
// @Param prefix query string false "商品前缀(不要求完全一致)"
|
||
// @Param categoryID query int false "商品所属类别ID"
|
||
// @Param unit query string false "商品单位"
|
||
// @Param jdID query int false "商品京东ID"
|
||
// @Param fromStatus query int false "查询起始状态(0:正常,1:下架)"
|
||
// @Param toStatus query int false "查询结束状态(0:正常,1:下架)"
|
||
// @Param offset query int false "门店列表起始序号(以0开始,缺省为0)"
|
||
// @Param pageSize query int false "门店列表页大小(缺省为50)"
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /GetStoreSkus [get]
|
||
func (c *StoreSkuController) GetStoreSkus() {
|
||
c.callGetStoreSkus(func(params *tStoreSkuGetStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||
retVal, err = cms.GetStoreSkus(params.StoreID, params.Keyword, params.MapData, params.Offset, params.PageSize)
|
||
return retVal, "", err
|
||
})
|
||
}
|
||
|
||
// @Title 修改商家商品绑定
|
||
// @Description 修改商家商品绑定
|
||
// @Param token header string true "认证token"
|
||
// @Param storeID formData int true "需要修改的商品名ID,payload中的相应数据会被忽略"
|
||
// @Param payload formData string true "json数据,StoreSkuBindInfo对象数组
|
||
// @Success 200 {object} controllers.CallResult
|
||
// @Failure 200 {object} controllers.CallResult
|
||
// @router /UpdateStoreSku [put]
|
||
func (c *StoreSkuController) UpdateStoreSku() {
|
||
c.callUpdateStoreSku(func(params *tStoreSkuUpdateStoreSkuParams) (retVal interface{}, errCode string, err error) {
|
||
var skuBinds []*cms.StoreSkuBindInfo
|
||
if err = utils.UnmarshalUseNumber([]byte(params.Payload), &skuBinds); err == nil {
|
||
retVal, err = cms.UpdateStoreSku(params.StoreID, skuBinds, GetUserNameFromToken(params.Token))
|
||
}
|
||
return retVal, "", err
|
||
})
|
||
}
|