- 重构GetStoresSkus

This commit is contained in:
gazebo
2019-06-22 20:44:35 +08:00
parent c3feea5ff4
commit c3119f4932
2 changed files with 43 additions and 30 deletions

View File

@@ -48,7 +48,10 @@ type StoreSkuController struct {
// @router /GetStoreSkus [get]
func (c *StoreSkuController) GetStoreSkus() {
c.callGetStoreSkus(func(params *tStoreSkuGetStoreSkusParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetStoreSkus(params.Ctx, params.StoreID, params.IsFocus, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
var skuIDs []int
if err = jxutils.Strings2Objs(params.SkuIDs, &skuIDs); err == nil {
retVal, err = cms.GetStoreSkus(params.Ctx, params.StoreID, skuIDs, params.IsFocus, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
}
return retVal, "", err
})
}
@@ -84,9 +87,9 @@ func (c *StoreSkuController) GetStoreSkus() {
// @router /GetStoresSkus [get]
func (c *StoreSkuController) GetStoresSkus() {
c.callGetStoresSkus(func(params *tStoreSkuGetStoresSkusParams) (retVal interface{}, errCode string, err error) {
var storeIDs []int
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs); err == nil {
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, params.IsFocus, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
var storeIDs, skuIDs []int
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs); err == nil {
retVal, err = cms.GetStoresSkus(params.Ctx, storeIDs, skuIDs, params.IsFocus, params.Keyword, params.IsBySku, params.MapData, params.Offset, params.PageSize)
}
return retVal, "", err
})