private function init() { $apiUser = new api_userMod(); $cur_action = $_GET['_action']; if ($cur_action != 'suss') { if (isset($_GET['code'])) { $code = $this->in_get('code', None, 2, 'True'); $flag = $apiUser->login($code); if ($flag) { $this->p_id = $flag; } else { # 此用户没注册,跳转到注册页面 $this->redirect(__ROOT__ . '/register'); } } else { $check_res = $apiUser->check_login_normal(); if (!$check_res) { ################## echo "cookie 已过期需要重新登陆"; $this->redirect(__ROOT__ . '/index'); exit; } else { $this->p_id = $check_res; } } $this->apiUser = $apiUser; } }
public function index() { $code = $this->in_get('code', '', 2, 'True'); $apiUser = new api_userMod(); $res = $apiUser->login($code); if ($res) { $this->redirect(__ROOT__ . '/order/water'); } else { $this->redirect(__ROOT__ . '/register'); } }