protected function loadHeader($title = '') { //城市列表 $city_model = M("City"); $city = getCurrentDealCity(); $this->assign("page_title", $title); if ($title) { $title .= "_" . $city['city'] . '_小米团'; } else { $title = $city['city'] . '_小米团'; } $this->assign("title", $title); $city_list = $city_model->select(); $this->assign("city", $city); $this->assign("city_list", $city_list); //菜单什么的 //用户信息 $user_info = session("user_info"); $this->assign("user_info", $user_info); $this->assign('nav_menu', getNavMenu()); $this->assign('user_menu', getUserMenu()); }
/** * 注册 */ public function reg() { //reg form if (!$this->isPost()) { $this->display('', '注册'); exit; } $model = D("User"); if (!$model->create()) { $this->error($model->getError()); } if ($model->add()) { //订阅 if ($this->_post('subscribe')) { $deal_city = getCurrentDealCity(); $sub_model = D("Subscription"); $sub_data = $sub_model->create(); $sub_data['city'] = $deal_city['id']; $sub_model->add($sub_data); } $this->success("注册成功!", __URL__ . '/login'); } }