123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <?php
- namespace app\controller\supplier\export;
- use app\controller\supplier\AuthController;
- use app\services\other\export\ExportServices;
- use app\services\order\StoreOrderServices;
- use app\services\other\ExpressServices;
- use app\services\other\queue\QueueAuxiliaryServices;
- use app\services\other\queue\QueueServices;
- use app\services\supplier\finance\SupplierFlowingWaterServices;
- use think\facade\App;
- class ExportExcel extends AuthController
- {
-
- protected $service;
-
- public function __construct(App $app, ExportServices $services)
- {
- parent::__construct($app);
- $this->service = $services;
- }
-
- public function storeOrder(StoreOrderServices $services)
- {
- $where_tmp = $this->request->getMore([
- ['status', ''],
- ['real_name', ''],
- ['data', '', '', 'time'],
- ['type', ''],
- ['ids', '']
- ]);
- $type = $where_tmp['type'];
- $with = [];
- if ($where_tmp['ids']) {
- $where['id'] = explode(',', $where_tmp['ids']);
- }
- if ($type) {
- $where['status'] = 1;
- $where['paid'] = 1;
- $where['is_del'] = 0;
- $where['is_system_del'] = 0;
- $with = ['pink', 'refund' => function ($query) {
- $query->whereIn('refund_type', [1, 2, 4, 5])->where('is_cancel', 0)->where('is_del', 0)->field('id,store_order_id');
- }];
- }
- if (!$where_tmp['ids'] && !$type) {
- unset($where_tmp['ids']);
- unset($where_tmp['type']);
- $where = $where_tmp;
- }
- if (!$where_tmp['real_name'] && !in_array($where_tmp['status'], [-1, -2, -3])) {
- $where['pid'] = 0;
- }
- $where['is_system_del'] = 0;
- $where['supplier_id'] = $this->supplierId;
- $data = $services->getExportList($where, $with, $this->service->limit);
- return $this->success($this->service->storeOrder($data, $type));
- }
-
- public function batchOrderDelivery($id, $queueType, $cacheType)
- {
-
- $auxiliaryService = app()->make(QueueAuxiliaryServices::class);
-
- $queueService = app()->make(QueueServices::class);
- $queueInfo = $queueService->getQueueOne(['id' => $id]);
- if (!$queueInfo) return $this->fail("数据不存在");
- $queueValue = json_decode($queueInfo['queue_in_value'], true);
- if (!$queueValue || !isset($queueValue['cacheType'])) return $this->fail("数据参数缺失");
- $data = $auxiliaryService->getExportData(['binding_id' => $id, 'type' => $cacheType], $this->service->limit);
- return $this->success($this->service->batchOrderDelivery($data, $queueType));
- }
-
- public function expressList()
- {
-
- $expressService = app()->make(ExpressServices::class);
- $data = $expressService->apiExpressList();
- return $this->success($this->service->expressList($data));
- }
-
- public function financeRecord(SupplierFlowingWaterServices $services)
- {
- [$ids] = $this->request->getMore([
- ['ids', '']
- ], true);
- $where['id'] = $ids ? explode(',', $ids) : [];
- $where['is_del'] = 0;
- $where['supplier_id'] = $this->supplierId;
- $data = $services->getList($where);
- return $this->success($this->service->SupplierFinanceRecord($data['list'] ?? []));
- }
- }
|