Log.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace app\agent\controller\finance;
  3. use app\common\controller\AgentController;
  4. use app\http\IResponse;
  5. use Lettered\Support\Auth as IAuth;
  6. use think\App;
  7. use think\Request;
  8. class Log extends AgentController
  9. {
  10. protected $model;
  11. public function __construct(App $app = null, IAuth $auth)
  12. {
  13. parent::__construct($app, $auth);
  14. $this->model = new \app\agent\model\finance\Log();
  15. }
  16. /**
  17. * 显示资源列表
  18. *
  19. * @return \think\Response
  20. * @throws \think\exception\DbException
  21. */
  22. public function index()
  23. {
  24. $params = input();
  25. $params['tag'] = input('tag', '');
  26. $params['limit'] = input('limit', 10);
  27. $params['created_at'] = input('created_at', '');
  28. $where['user_id'] = $this->auth->user()['user_id'];
  29. if ($params['tag']) {
  30. $where['tag'] = $params['tag'];
  31. }
  32. if ($params['created_at']) {
  33. list($start, $end) = str2arr($params['created_at'], '-');
  34. $where['created_at'] = ['between', [$start, $end]];
  35. }
  36. $list = $this->model->where($where)
  37. ->order(['id' => 'desc'])
  38. ->paginate($params['limit'],false);
  39. return IResponse::paginate($list);
  40. }
  41. /**
  42. * 显示创建资源表单页.
  43. *
  44. * @return \think\Response
  45. */
  46. public function create()
  47. {
  48. //
  49. }
  50. /**
  51. * 保存新建的资源
  52. *
  53. * @param \think\Request $request
  54. * @return \think\Response
  55. */
  56. public function save(Request $request)
  57. {
  58. //
  59. }
  60. /**
  61. * 显示指定的资源
  62. *
  63. * @param int $id
  64. * @return \think\Response
  65. */
  66. public function read($id)
  67. {
  68. //
  69. }
  70. /**
  71. * 显示编辑资源表单页.
  72. *
  73. * @param int $id
  74. * @return \think\Response
  75. */
  76. public function edit($id)
  77. {
  78. //
  79. }
  80. /**
  81. * 保存更新的资源
  82. *
  83. * @param \think\Request $request
  84. * @param int $id
  85. * @return \think\Response
  86. */
  87. public function update(Request $request, $id)
  88. {
  89. //
  90. }
  91. /**
  92. * 删除指定资源
  93. *
  94. * @param int $id
  95. * @return \think\Response
  96. */
  97. public function delete($id)
  98. {
  99. //
  100. }
  101. }