Store.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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\admin\model;
  13. use app\common\model\Store as StoreModel;
  14. /**
  15. * 商家记录表模型
  16. * Class Store
  17. * @package app\admin\model
  18. */
  19. class Store extends StoreModel
  20. {
  21. /**
  22. * 获取列表数据
  23. * @param bool $isRecycle
  24. * @return \think\Paginator
  25. * @throws \think\db\exception\DbException
  26. */
  27. public function getList(bool $isRecycle = false): \think\Paginator
  28. {
  29. return $this->where('is_recycle', '=', (int)$isRecycle)
  30. ->where('is_delete', '=', 0)
  31. ->order(['sort' => 'asc', 'create_time' => 'desc'])
  32. ->paginate(15);
  33. }
  34. /**
  35. * 移入移出回收站
  36. * @param bool $isRecycle
  37. * @return bool|false
  38. */
  39. public function recycle(bool $isRecycle = true): bool
  40. {
  41. return $this->save(['is_recycle' => (int)$isRecycle]);
  42. }
  43. }