Grade.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 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\console\model\user;
  13. use app\common\model\user\Grade as GradeModel;
  14. /**
  15. * 用户会员等级模型
  16. * Class Grade
  17. * @package app\console\model\user
  18. */
  19. class Grade extends GradeModel
  20. {
  21. /**
  22. * 获取可用的会员等级列表
  23. * @param int $storeId
  24. * @return \think\Collection
  25. * @throws \think\db\exception\DataNotFoundException
  26. * @throws \think\db\exception\DbException
  27. * @throws \think\db\exception\ModelNotFoundException
  28. */
  29. public static function getUsableList(int $storeId)
  30. {
  31. return (new static)->where('status', '=', 1)
  32. ->where('is_delete', '=', 0)
  33. ->where('store_id', '=', $storeId)
  34. ->order(['weight' => 'desc'])
  35. ->select();
  36. }
  37. }