login($this->request->post()); return $this->renderSuccess('', [ 'user_id' => $user_id, 'token' => $model->getToken() ]); } /** * 企业微信 */ public function qyLogin() { $model = new UserModel; $is_exist = $model->qyLogin($this->request->post()); return $this->renderSuccess('', [ 'is_exist' => $is_exist, ]); } /** * 当前用户详情 */ public function detail() { // 当前用户信息 $userInfo = $this->getUser(); $gift_name = SettingModel::getItem('live')['gift_name']; return $this->renderSuccess('', compact('userInfo', 'gift_name')); } public function getSession($code) { // 微信登录 获取session_key $app = AppWx::getApp(); $session_key = null; $session = AppWx::sessionKey($app, $code); if($session != null){ $session_key = $session['session_key']; } return $this->renderSuccess('', compact('session_key')); } /** * 绑定手机号 */ public function bindMobile() { $model = $this->getUser(); if ($model->bindMobile($this->request->post())) { return $this->renderSuccess(''); } return $this->renderError('绑定失败'); } /** * 修改用户信息 */ public function updateInfo() { // 当前用户信息 $model = $this->getUser(); if ($model->edit($this->request->post())) { return $this->renderSuccess('修改成功'); } return $this->renderError($model->getError() ?: '修改失败'); } /** * 积分转换余额 */ public function transPoints($points = 0) { // 当前用户信息 $model = $this->getUser(); if ($model->transPoints($points)) { return $this->renderSuccess('转换成功'); } return $this->renderError($model->getError() ?: '转换失败'); } /** * 获取注册设置 by lyzflash */ public function registerSetting() { $register = SettingModel::getItem('register'); return $this->renderSuccess('', compact('register')); } }