Wallet.php 1.2 KB

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