aa
This commit is contained in:
@@ -1911,6 +1911,38 @@ func RefreshOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID string, vendorID,
|
||||
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) {
|
||||
var (
|
||||
pageSize = 20
|
||||
|
||||
Reference in New Issue
Block a user