- DeleteWrongSpu changed to Delete converted skuname

This commit is contained in:
gazebo
2019-01-12 10:11:11 +08:00
parent a64c024dd8
commit a6bbf3f582

View File

@@ -3,6 +3,7 @@ package initdata
import ( import (
"time" "time"
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxstore/cms" "git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
@@ -186,16 +187,16 @@ func PullJdOrder(ctx *jxcontext.Context, fromTime, toTime time.Time, isAsync, is
if subToTime.Sub(toTime) > 0 { if subToTime.Sub(toTime) > 0 {
subToTime = toTime subToTime = toTime
} }
if gapIndex < gapCount-1 { if true { //gapIndex < gapCount-1 {
subToTime = subToTime.Add(-1 * time.Second) // 减一秒 subToTime = subToTime.Add(-1 * time.Second) // 减一秒
} }
commonParams := map[string]interface{}{ commonParams := map[string]interface{}{
"pageSize": pageSize, jdapi.KeyPageSize: pageSize,
"orderPurchaseTime_begin": utils.Time2Str(subFromTime), "orderPurchaseTime_begin": utils.Time2Str(subFromTime),
"orderPurchaseTime_end": utils.Time2Str(subToTime), "orderPurchaseTime_end": utils.Time2Str(subToTime),
} }
globals.SugarLogger.Debugf("PullJdOrder, commonParams=%s", utils.Format4Output(commonParams, false)) // globals.SugarLogger.Debugf("PullJdOrder, commonParams=%s", utils.Format4Output(commonParams, false))
orderList, totalCount, err := api.JdAPI.OrderQuery(utils.MergeMaps(commonParams, utils.Params2Map("pageNo", 0))) orderList, totalCount, err := api.JdAPI.OrderQuery(commonParams)
if err != nil { if err != nil {
return "", err return "", err
} }
@@ -226,14 +227,14 @@ func UpdateJdOrderRealMobile(ctx *jxcontext.Context, fromTime, toTime time.Time,
func DeleteWrongSpu(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) { func DeleteWrongSpu(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) {
sql := ` sql := `
SELECT * SELECT t1.*
FROM sku_name t1 FROM sku_name t1
WHERE t1.link_id <> 0 AND t1.unit <> '份' JOIN sku_name t2 ON t2.link_id = t1.id AND t2.deleted_at = ?
AND t1.is_spu = 1 AND t1.deleted_at = ?; WHERE t1.deleted_at = ?;
` `
db := dao.GetDB() db := dao.GetDB()
var skuNameList []*model.SkuName var skuNameList []*model.SkuName
if err = dao.GetRows(db, &skuNameList, sql, utils.DefaultTimeValue); err != nil { if err = dao.GetRows(db, &skuNameList, sql, utils.DefaultTimeValue, utils.DefaultTimeValue); err != nil {
return "", err return "", err
} }
rootTask := tasksch.NewSeqTask("DeleteWrongSpu", ctx.GetUserName(), func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) { rootTask := tasksch.NewSeqTask("DeleteWrongSpu", ctx.GetUserName(), func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {