AreaLists.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\adminapi\lists;
  20. use app\common\lists\ListsExcelInterface;
  21. use app\common\lists\ListsSearchInterface;
  22. use app\common\model\Article;
  23. use app\common\model\ArticleCategory;
  24. use app\common\model\SpecialArea;
  25. class AreaLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
  26. {
  27. /**
  28. * @notes 设置导出字段
  29. * @return string[]
  30. * @author Tab
  31. * @date 2021/7/30 15:37
  32. */
  33. public function setExcelFields(): array
  34. {
  35. return [
  36. 'title' => '标题',
  37. 'cid_desc' => '分类',
  38. 'is_show_desc' => '文章状态',
  39. 'visit' => '浏览量',
  40. 'sort' => '排序',
  41. 'create_time' => '创建时间',
  42. ];
  43. }
  44. /**
  45. * @notes 设置默认表名
  46. * @return string
  47. * @author Tab
  48. * @date 2021/7/30 15:37
  49. */
  50. public function setFileName(): string
  51. {
  52. return '地址列表';
  53. }
  54. /**
  55. * @notes 设置搜索
  56. * @return \string[][]
  57. * @author Tab
  58. * @date 2021/7/14 9:48
  59. */
  60. public function setSearch(): array
  61. {
  62. return [
  63. '%like%' => ['name']
  64. ];
  65. }
  66. /**
  67. * @notes 地区列表
  68. * @return array
  69. * @throws \think\db\exception\DataNotFoundException
  70. * @throws \think\db\exception\DbException
  71. * @throws \think\db\exception\ModelNotFoundException
  72. * @author Tab
  73. * @date 2021/7/14 9:48
  74. */
  75. public function lists(): array
  76. {
  77. $lists = SpecialArea::field('id,name,reduce_shipping_money,reduce_shipping_fee,free_shipping_money,shipping_fee,is_show,is_show as is_show_desc,sort,create_time')
  78. ->where($this->searchWhere)
  79. ->order('sort desc,id desc')
  80. ->limit($this->limitOffset, $this->limitLength)
  81. ->select()
  82. ->toArray();
  83. return $lists;
  84. }
  85. /**
  86. * @notes 地区总记录数
  87. * @return int
  88. * @author Tab
  89. * @date 2021/7/14 9:48
  90. */
  91. public function count(): int
  92. {
  93. return SpecialArea::where($this->searchWhere)->count();
  94. }
  95. }