RechargeLists.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\api\lists\recharge;
  3. use app\api\lists\BaseApiDataLists;
  4. use app\common\enum\PayEnum;
  5. use app\common\model\recharge\RechargeOrder;
  6. /**
  7. * 充值记录列表
  8. * Class RechargeLists
  9. * @package app\api\lists\recharge
  10. */
  11. class RechargeLists extends BaseApiDataLists
  12. {
  13. /**
  14. * @notes 获取列表
  15. * @return array
  16. * @throws \think\db\exception\DataNotFoundException
  17. * @throws \think\db\exception\DbException
  18. * @throws \think\db\exception\ModelNotFoundException
  19. */
  20. public function lists(): array
  21. {
  22. $lists = RechargeOrder::field('order_amount,create_time')
  23. ->where([
  24. 'order_type' => 1,
  25. 'user_id' => $this->userId,
  26. ])
  27. ->order('id', 'desc')
  28. ->select()
  29. ->toArray();
  30. return $lists;
  31. }
  32. /**
  33. * @notes 获取数量
  34. * @return int
  35. */
  36. public function count(): int
  37. {
  38. return RechargeOrder::where([
  39. 'order_type' => 1,
  40. 'user_id' => $this->userId,
  41. ])
  42. ->count();
  43. }
  44. }