- test for Change2JDSPU4Store

This commit is contained in:
gazebo
2019-01-05 15:17:19 +08:00
parent d0abc189be
commit 8d6d9a9787
2 changed files with 11 additions and 1 deletions

View File

@@ -319,6 +319,16 @@ func Convert2JDSPU(ctx *jxcontext.Context, count int, isAsync, isContinueWhenErr
func Change2JDSPU4Store(ctx *jxcontext.Context, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
db := dao.GetDB()
if len(storeIDs) == 0 {
if err = dao.GetRows(db, &storeIDs, `
SELECT t1.id
FROM store t1
JOIN store_map t2 ON t2.store_id = t1.id AND t2.vendor_id = 0 AND t2.deleted_at = ? AND t2.status <> ?
WHERE t1.deleted_at = ? AND t1.status <> ? AND t1.city_code IN (110100, 120100, 440100, 440300, 510100)
`, utils.DefaultTimeValue, model.StoreStatusDisabled, utils.DefaultTimeValue, model.StoreStatusDisabled); err != nil {
return "", err
}
}
dao.Begin(db)
defer dao.Rollback(db)

View File

@@ -71,7 +71,7 @@ func (c *InitDataController) Convert2JDSPU() {
// @Title 将京东商店为份的SPU转换
// @Description 将京东商店为份的SPU转换
// @Param token header string true "认证token"
// @Param storeIDs formData string true "门店列表"
// @Param storeIDs formData string false "门店列表"
// @Param isAsync formData bool false "是否异步操作"
// @Param isContinueWhenError formData bool false "单个同步失败是否继续缺省false"
// @Success 200 {object} controllers.CallResult