Преглед изворни кода

feat(order): 添加订单导出功能并优化Excel处理逻辑

- 新增createNoJob方法用于创建无队列任务的Excel记录
- 修改订单导出逻辑,使用ExcelService处理订单导出
- 移除原有的队列任务创建方式,改用直接服务调用
- 更新订单列表导出的数据处理流程
- 添加Excel日志记录功能用于跟踪导出状态
shichen пре 4 месеци
родитељ
комит
f33ab1e5bd

+ 18 - 0
app/common/repositories/store/ExcelRepository.php

@@ -56,6 +56,24 @@ class ExcelRepository extends BaseRepository
56 56
     }
57 57
 
58 58
     /**
59
+     * @param array $where
60
+     * @param int $admin_id
61
+     * @param string $type
62
+     * @param int $merId
63
+     * @return \app\common\dao\BaseDao|\think\Model
64
+     * @author 史晨
65
+     * @date 2026/3/10 14:48
66
+     */
67
+    public function createNoJob(array $where ,int $admin_id, string $type,int $merId)
68
+    {
69
+        return $this->dao->create([
70
+            'mer_id'    => $merId,
71
+            'admin_id'  => $admin_id,
72
+            'type'      => $type
73
+        ]);
74
+    }
75
+
76
+    /**
59 77
      * TODO
60 78
      * @param array $where
61 79
      * @param int $page

+ 7 - 3
app/controller/merchant/store/order/Order.php

@@ -337,10 +337,14 @@ class Order extends BaseController
337 337
         if($data['count']<1){
338 338
             return app('json')->fail('没有数据');
339 339
         }
340
-        $list=$this->orderList2($data['list']->toArray());
341
-//        var_dump($list);die;
340
+        $list = $this->orderList2($data['list']->toArray());
341
+
342
+        // app()->make(ExcelRepository::class)->create($list, $this->request->adminId(), 'order', $this->request->merId());
343
+        $adminId = $this->request->adminId();
344
+        $excelLog = app()->make(ExcelRepository::class)->createNoJob($list, $adminId, 'order', $where['mer_id']);
345
+
346
+        app()->make(ExcelService::class)->order($list,$excelLog->excel_id);
342 347
 
343
-        app()->make(ExcelRepository::class)->create($list, $this->request->adminId(), 'order', $this->request->merId());
344 348
         return app('json')->success('开始导出数据');
345 349
     }
346 350
     public function orderList2(array $data){