diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 94015dbc1..18560f493 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2196,3 +2196,21 @@ func writeToExcel(excelTitle []string, dataList interface{}, ctx *jxcontext.Cont } return err } + +func RefreshJdDepot(ctx *jxcontext.Context) (err error) { + var thingMaps []model.ThingMap + sql := ` + SELECT * FROM thing_map WHERE thing_type = ? AND vendor_id = ? AND vendor_org = ? AND deleted_at = ? + ` + sqlParams := []interface{}{model.ThingTypeSku, model.VendorIDJD, "320406", utils.DefaultTimeValue} + err = dao.GetRows(dao.GetDB(), &thingMaps, sql, sqlParams) + if err != nil { + return err + } + if len(thingMaps) > 0 { + for _, v := range thingMaps { + _, err = api.JdAPI.RefreshJdDepot(int(v.ThingID)) + } + } + return err +} diff --git a/controllers/cms_sku.go b/controllers/cms_sku.go index 996dac8ef..1f5c9fe13 100644 --- a/controllers/cms_sku.go +++ b/controllers/cms_sku.go @@ -466,3 +466,16 @@ func (c *SkuController) CreateUpcSkuByExcel() { return retVal, "", err }) } + +// @Title 恢复被删除的京东商品库 +// @Description +// @Param token header string true "认证token" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /RefreshJdDepot [post] +func (c *SkuController) RefreshJdDepot() { + c.callRefreshJdDepot(func(params *tSkuRefreshJdDepotParams) (retVal interface{}, errCode string, err error) { + err = cms.RefreshJdDepot(params.Ctx) + return retVal, "", err + }) +}