Export.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\store\model\order;
  13. use app\common\model\order\Export as ExportModel;
  14. /**
  15. * 订单导出Excel记录模型
  16. * Class Export
  17. * @package app\store\model\order
  18. */
  19. class Export extends ExportModel
  20. {
  21. /**
  22. * 获取导出记录
  23. * @return \think\Paginator
  24. * @throws \think\db\exception\DbException
  25. */
  26. public function getList(): \think\Paginator
  27. {
  28. // 获取列表记录
  29. $list = $this->order(['create_time' => 'desc'])->paginate(10);
  30. // 生成下载url
  31. foreach ($list as &$item) {
  32. $item['download_url'] = base_url() . $item['file_path'];
  33. }
  34. return $list;
  35. }
  36. /**
  37. * 新增数据
  38. * @param $data
  39. * @return bool
  40. */
  41. public function add($data): bool
  42. {
  43. return $this->save($data);
  44. }
  45. }