BalanceLog.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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\api\model\user;
  13. use app\api\service\User as UserService;
  14. use app\common\model\user\BalanceLog as BalanceLogModel;
  15. /**
  16. * 用户余额变动明细模型
  17. * Class BalanceLog
  18. * @package app\api\model\user
  19. */
  20. class BalanceLog extends BalanceLogModel
  21. {
  22. /**
  23. * 隐藏字段
  24. * @var array
  25. */
  26. protected $hidden = [
  27. 'store_id',
  28. ];
  29. /**
  30. * 获取账单明细列表
  31. * @return \think\Paginator
  32. * @throws \cores\exception\BaseException
  33. * @throws \think\db\exception\DbException
  34. */
  35. public function getList(): \think\Paginator
  36. {
  37. // 当前用户ID
  38. $userId = UserService::getCurrentLoginUserId();
  39. // 获取列表数据
  40. return $this->where('user_id', '=', $userId)
  41. ->order(['create_time' => 'desc'])
  42. ->paginate(15);
  43. }
  44. }