MoneyLog.php 879 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\admin\controller\user;
  3. use app\common\controller\Backend;
  4. use app\admin\model\UserMoneyLog;
  5. use app\admin\model\User;
  6. class MoneyLog extends Backend
  7. {
  8. protected $model = null;
  9. protected $withJoinTable = ['user'];
  10. // 排除字段
  11. protected $preExcludeFields = ['createtime'];
  12. protected $quickSearchField = ['user.username', 'user.nickname'];
  13. public function initialize()
  14. {
  15. parent::initialize();
  16. $this->model = new UserMoneyLog();
  17. }
  18. /**
  19. * 添加
  20. */
  21. public function add($userId = 0)
  22. {
  23. if ($this->request->isPost()) {
  24. parent::add();
  25. }
  26. $user = User::where('id', (int)$userId)->find();
  27. if (!$user) {
  28. $this->error(__("The user can't find it"));
  29. }
  30. $this->success('', [
  31. 'user' => $user
  32. ]);
  33. }
  34. }