Wallet.php 1019 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\api\controller\user;
  3. use app\api\controller\Controller;
  4. use app\api\model\Setting as SettingModel;
  5. class Wallet extends Controller
  6. {
  7. /* @var \app\api\model\User $user */
  8. private $user;
  9. /**
  10. * 构造方法
  11. * @throws \app\common\exception\BaseException
  12. * @throws \think\exception\DbException
  13. */
  14. public function _initialize()
  15. {
  16. parent::_initialize();
  17. $this->user = $this->getUser(); // 用户信息
  18. }
  19. /**
  20. * 我的钱包信息
  21. * @return array
  22. * @throws \app\common\exception\BaseException
  23. * @throws \think\exception\DbException
  24. */
  25. public function index()
  26. {
  27. // 当前用户信息
  28. $user = $this->getUser();
  29. // 获取充值设置
  30. $setting = SettingModel::getItem('recharge');
  31. return $this->renderSuccess([
  32. 'userInfo' => $user,
  33. 'setting' => [
  34. 'is_entrance' => (bool)$setting['is_entrance']
  35. ]
  36. ]);
  37. }
  38. }