PointsLog.php 1.6 KB

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