From 97f0b7a5f807ec41487afadcc5ecf48442dedf68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 18 Apr 2025 09:57:44 +0800 Subject: [PATCH] 1 --- business/jxcallback/orderman/orderman_ext.go | 16 ++++++++++++++-- controllers/jx_order.go | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index 521165499..eaf99ae5b 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -443,7 +443,7 @@ type AfsOrderExt struct { ShopPrice int64 `json:"shopPrice"` } -func (c *OrderManager) ExportOrders(ctx *jxcontext.Context, fromDateStr, toDateStr string, mapParams map[string]interface{}) (hint string, err error) { +func (c *OrderManager) ExportOrders(ctx *jxcontext.Context, fromDateStr, toDateStr string, mapParams map[string]interface{}, isAsync bool) (hint string, err error) { var ( orders []*model.GoodsOrderExt afsSkuMap map[string]map[int]*model.OrderSkuFinancial @@ -638,11 +638,23 @@ func (c *OrderManager) ExportOrders(ctx *jxcontext.Context, fromDateStr, toDateS if err = err2; err == nil { task.SetNoticeMsg(excelURL) } + return excelURL, nil } return nil, err }, 5) tasksch.ManageTask(task).Run() - hint = task.GetID() + if !isAsync { + resultList, err2 := task.GetResult(0) + if err = err2; err == nil { + if len(resultList) == 0 { + hint = "1" // todo 暂时这样 + } else { + hint = jxutils.TaskResult2Hint(resultList) + } + } + } else { + hint = task.GetID() + } return hint, err } diff --git a/controllers/jx_order.go b/controllers/jx_order.go index 1116c86ce..06c096850 100644 --- a/controllers/jx_order.go +++ b/controllers/jx_order.go @@ -354,12 +354,13 @@ func (c *OrderController) GetOrders() { // @Param statuss query string false "订单状态列表[1,2,3],缺省不限制" // @Param lockStatuss query string false "订单锁定状态列表[1,2,3],缺省不限制" // @Param cities query string false "城市code列表[1,2,3],缺省不限制" +// @Param isAsync query bool false "是否异步" // @Success 200 {object} controllers.CallResult // @Failure 200 {object} controllers.CallResult // @router /ExportOrders [get] func (c *OrderController) ExportOrders() { c.callExportOrders(func(params *tOrderExportOrdersParams) (retVal interface{}, errCode string, err error) { - retVal, err = orderman.FixedOrderManager.ExportOrders(params.Ctx, params.FromDate, params.ToDate, params.MapData) + retVal, err = orderman.FixedOrderManager.ExportOrders(params.Ctx, params.FromDate, params.ToDate, params.MapData, params.IsAsync) return retVal, "", err }) }