- refactor bad comment
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model/legacymodel"
|
||||
"git.rosy.net.cn/jx-callback/business/model/legacymodel2"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego/orm"
|
||||
@@ -804,8 +805,6 @@ func ReProcessJdBadComment(ctx *jxcontext.Context, isForce, isAsync, isContinueW
|
||||
if len(comment2) > 0 {
|
||||
badComment.Updatetime = utils.Timestamp2Str(utils.MustInterface2Int64(comment2["createTime"].(map[string]interface{})["time"]) / 1000)
|
||||
badComment.UpdatedMsg = string(utils.MustMarshal(comment2))
|
||||
} else if badComment.UpdatedMsg != "" {
|
||||
badComment.OrderFlag = "1"
|
||||
}
|
||||
_, err = dao.UpdateEntity(db, badComment)
|
||||
}
|
||||
@@ -847,3 +846,29 @@ func unmarshalCommentText(commentStr string) (retVal map[string]interface{}, isN
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func RefreshEbaiBadComment(ctx *jxcontext.Context, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
if jxutils.IsTimeEmpty(fromTime) {
|
||||
fromTime = utils.Str2Time("2018-05-03 00:00:00")
|
||||
}
|
||||
if jxutils.IsTimeEmpty(toTime) {
|
||||
toTime = time.Now().Add(-3 * time.Hour)
|
||||
}
|
||||
days := int(toTime.Sub(fromTime)/24*time.Hour + 1)
|
||||
rootTask := tasksch.NewSeqTask("RefreshEbaiBadComment", ctx.GetUserName(), func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
batchFromTime := fromTime.Add(time.Duration(step) * 24 * time.Hour)
|
||||
batchToTime := batchFromTime.Add(24 * time.Hour)
|
||||
if batchToTime.Sub(toTime) > 0 {
|
||||
batchToTime = toTime
|
||||
}
|
||||
err = ebai.CurPurchaseHandler.RefreshComment(batchFromTime, batchToTime)
|
||||
return nil, err
|
||||
}, days)
|
||||
tasksch.ManageTask(rootTask).Run()
|
||||
if !isAsync {
|
||||
_, err = rootTask.GetResult(0)
|
||||
} else {
|
||||
hint = rootTask.ID
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user