diff --git a/home/controllers/h5/paic/Base.php b/home/controllers/h5/paic/Base.php index b324e71a..9c0741ef 100644 --- a/home/controllers/h5/paic/Base.php +++ b/home/controllers/h5/paic/Base.php @@ -126,11 +126,22 @@ abstract class Base extends HD_Controller /** * @param $view + * @param false $refresh */ - protected function show_view($view) + protected function show_view($view, $refresh = false) { $this->load->view('h5/paic/header', $this->data); $this->load->view($view); $this->load->view('h5/paic/footer'); } + + /** + * 获取用户信息 + * @return string + */ + protected function getUser() + { + $user = $this->session->userdata(self::LOGIN_USER_INFO); + return $user ?: ''; + } } \ No newline at end of file diff --git a/home/controllers/h5/paic/Home.php b/home/controllers/h5/paic/Home.php index d1174377..951467ca 100644 --- a/home/controllers/h5/paic/Home.php +++ b/home/controllers/h5/paic/Home.php @@ -29,6 +29,12 @@ class Home extends Base } } } + $user = $this->getUser(); + $userInfo = [ + 'name' => $user['name'] ?: '', + 'belong_to' => App_paic_users_model::BELONG_TO_LIST[$user['belong_to']] + ]; + $this->data['userInfo'] = $userInfo; $this->data['tabList'] = $tabList; $this->data['_title'] = '我的推广'; $this->show_view('h5/paic/home/enroll'); diff --git a/home/controllers/h5/paic/Login.php b/home/controllers/h5/paic/Login.php index 351cc13f..77735bf9 100644 --- a/home/controllers/h5/paic/Login.php +++ b/home/controllers/h5/paic/Login.php @@ -15,7 +15,7 @@ class Login extends Base public function index() { - if($this->uid){ + if ($this->uid) { header('Location:/h5/paic/home'); } if ($this->input->is_ajax_request()) { @@ -67,7 +67,7 @@ class Login extends Base public function logout() { -// $_SESSION[self::SESSION_KEY] = ''; - $this->show_json('', 200, '退出成功'); + $this->session->set_userdata(self::LOGIN_USER_INFO, ''); + $this->success('', '退出成功'); } } diff --git a/home/views/h5/paic/home/enroll.php b/home/views/h5/paic/home/enroll.php index 4c58a1fc..85671b7e 100644 --- a/home/views/h5/paic/home/enroll.php +++ b/home/views/h5/paic/home/enroll.php @@ -25,6 +25,20 @@