ExportExcel.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\store\export;
  12. use app\controller\store\AuthController;
  13. use app\services\other\export\ExportServices;
  14. use app\services\store\finance\StoreFinanceFlowServices;
  15. use think\facade\App;
  16. /**
  17. * 导出excel类
  18. * Class ExportExcel
  19. * @package app\controller\store\export
  20. */
  21. class ExportExcel extends AuthController
  22. {
  23. /**
  24. * @var ExportServices
  25. */
  26. protected $service;
  27. /**
  28. * ExportExcel constructor.
  29. * @param App $app
  30. * @param ExportServices $services
  31. */
  32. public function __construct(App $app, ExportServices $services)
  33. {
  34. parent::__construct($app);
  35. $this->service = $services;
  36. }
  37. /**
  38. * 门店账单下载
  39. * @param StoreFinanceFlowServices $services
  40. * @return mixed
  41. */
  42. public function financeRecord(StoreFinanceFlowServices $services)
  43. {
  44. [$ids] = $this->request->getMore([
  45. ['ids', '']
  46. ], true);
  47. $where['id'] = $ids ? explode(',', $ids) : [];
  48. $where['is_del'] = 0;
  49. $where['store_id'] = $this->storeId;
  50. $where['no_type'] = 1;
  51. $data = $services->getList($where);
  52. return $this->success($this->service->financeRecord($data['list'] ?? []));
  53. }
  54. }