- FullSyncStoresSkus

This commit is contained in:
gazebo
2018-11-13 22:26:48 +08:00
parent b692f9adae
commit 22eb6b76dd
6 changed files with 94 additions and 8 deletions

View File

@@ -113,3 +113,29 @@ func (c *SyncController) RefreshAllSkusID() {
return retVal, "", err
})
}
// @Title 全新初始化商家商品信息
// @Description 全新初始化商家商品信息(!!!此操作会先清除平台上已有的商品及分类信息),此操作只适用于单门店模式平台
// @Param token header string true "认证token"
// @Param storeIDs formData string true "门店ID列表"
// @Param vendorIDs formData string true "厂商ID列表"
// @Param isAsync formData bool true "是否异步操作"
// @Param isContinueWhenError formData bool false "单个同步失败是否继续缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /FullSyncStoresSkus [put]
func (c *SyncController) FullSyncStoresSkus() {
c.callFullSyncStoresSkus(func(params *tSyncFullSyncStoresSkusParams) (retVal interface{}, errCode string, err error) {
db := dao.GetDB()
var storeIDs []int
var vendorIDs []int
if err = utils.UnmarshalUseNumber([]byte(params.StoreIDs), &storeIDs); err != nil {
return retVal, "", err
}
if err = utils.UnmarshalUseNumber([]byte(params.VendorIDs), &vendorIDs); err != nil {
return retVal, "", err
}
retVal, err = cms.CurVendorSync.FullSyncStoresSkus(params.Ctx, db, vendorIDs, storeIDs, params.IsAsync, params.IsContinueWhenError)
return retVal, "", err
})
}