aa
This commit is contained in:
@@ -1911,6 +1911,38 @@ func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID,
|
|||||||
return num, err
|
return num, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UpdateJdsOrdersStatus(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd time.Time) (err error) {
|
||||||
|
var (
|
||||||
|
pageSize = 20
|
||||||
|
orderIDs []int64
|
||||||
|
)
|
||||||
|
orderResult, err := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), 1, pageSize)
|
||||||
|
if orderResult.TotalCount > pageSize {
|
||||||
|
for pageNO := 2; pageNO < orderResult.TotalCount/pageSize+1; pageNO++ {
|
||||||
|
orderResult, _ := jdshop.CurPurchaseHandler.GetJdsOrders(ctx, utils.Time2Str(orderCreatedStart), utils.Time2Str(orderCreatedEnd), pageNO, pageSize)
|
||||||
|
for _, order := range orderResult.OrderList {
|
||||||
|
if order.OrderStatus == jdshopapi.OrderStatusCancelm2 {
|
||||||
|
orderIDs = append(orderIDs, order.OrderID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, orderID := range orderIDs {
|
||||||
|
var goodsOrder *model.GoodsOrder
|
||||||
|
sql := `
|
||||||
|
SELECT * FROM goods_order WHERE vendor_order_id2 = ?
|
||||||
|
`
|
||||||
|
sqlParams := []interface{}{orderID}
|
||||||
|
if dao.GetRow(dao.GetDB(), &goodsOrder, sql, sqlParams); goodsOrder != nil {
|
||||||
|
if goodsOrder.Status != model.OrderStatusCanceled {
|
||||||
|
goodsOrder.Status = model.OrderStatusCanceled
|
||||||
|
dao.UpdateEntity(dao.GetDB(), goodsOrder, "Status")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd time.Time) (err error) {
|
func SaveJdsOrders(ctx *jxcontext.Context, orderCreatedStart, orderCreatedEnd time.Time) (err error) {
|
||||||
var (
|
var (
|
||||||
pageSize = 20
|
pageSize = 20
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ func Init() {
|
|||||||
|
|
||||||
ScheduleTimerFuncByInterval(func() {
|
ScheduleTimerFuncByInterval(func() {
|
||||||
orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-30*time.Minute), time.Now())
|
orderman.SaveJdsOrders(jxcontext.AdminCtx, time.Now().Add(-30*time.Minute), time.Now())
|
||||||
|
orderman.UpdateJdsOrdersStatus(jxcontext.AdminCtx, time.Now().AddDate(0, 0, -1), time.Now())
|
||||||
}, 5*time.Second, 5*time.Minute)
|
}, 5*time.Second, 5*time.Minute)
|
||||||
|
|
||||||
ScheduleTimerFuncByInterval(func() {
|
ScheduleTimerFuncByInterval(func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user