- 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 (
"time"
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"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 {
subToTime = toTime
}
if gapIndex < gapCount-1 {
if true { //gapIndex < gapCount-1 {
subToTime = subToTime.Add(-1 * time.Second) // 减一秒
}
commonParams := map[string]interface{}{
"pageSize": pageSize,
jdapi.KeyPageSize: pageSize,
"orderPurchaseTime_begin": utils.Time2Str(subFromTime),
"orderPurchaseTime_end": utils.Time2Str(subToTime),
}
globals.SugarLogger.Debugf("PullJdOrder, commonParams=%s", utils.Format4Output(commonParams, false))
orderList, totalCount, err := api.JdAPI.OrderQuery(utils.MergeMaps(commonParams, utils.Params2Map("pageNo", 0)))
// globals.SugarLogger.Debugf("PullJdOrder, commonParams=%s", utils.Format4Output(commonParams, false))
orderList, totalCount, err := api.JdAPI.OrderQuery(commonParams)
if err != nil {
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) {
sql := `
SELECT *
SELECT t1.*
FROM sku_name t1
WHERE t1.link_id <> 0 AND t1.unit <> '份'
AND t1.is_spu = 1 AND t1.deleted_at = ?;
JOIN sku_name t2 ON t2.link_id = t1.id AND t2.deleted_at = ?
WHERE t1.deleted_at = ?;
`
db := dao.GetDB()
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
}
rootTask := tasksch.NewSeqTask("DeleteWrongSpu", ctx.GetUserName(), func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {