where(array('code' => $code))->find(); $ad_message_id = $ad_message_data['id']; $store_application_model = new \Common\Model\StoreApplicationModel(); $result = $store_application_model->data_add($data, $store_application_model::source_official_wap, $ad_message_id); if ($result['code'] != 1000) { $this->error($result['msg']); } else { $this->success($result['msg']); } } else { $ad_message_model = new \Common\Model\AdMessageModel(); $code = $_COOKIE[$ad_message_model::ad_code_name]; $ad_message_data = $ad_message_model->where(array('code' => $code))->find(); $tt_code = $ad_message_data['tt_code']; $this->assign('tt_code', $tt_code); $this->display('join1'); } } /** * 加盟 * @author: linch */ public function join1() { $this->join(); } /** * 产品 * @author: linch */ public function product() { $this->display(); } /** * 关于我们 * @author: linch */ public function about() { $this->display(); } /** * 全部门店 * @author: linch */ public function store() { $search = array( 'city_id' => intval(I('get.city_id', 0)), ); if ($search['city_id'] != 0) { $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1); $page_size = 6; $home_stores_model = new \Common\Model\HomeStoresModel(); $data = $home_stores_model->get_data($search, $page_num, $page_size); $store_list = $data['list']; if (!empty($store_list)) { $param = array('city_id' => $search['city_id']); $page = $this->get_page($data['count'], $page_size, $page_num, $param); $this->assign('data', $store_list); $this->assign('page', $page); } } $home_city_model = new \Common\Model\HomeCityModel(); $home_city = $home_city_model->get_data(); $this->assign('home_city', $home_city); $this->assign('search', $search); $this->display(); } /** * 最新门店 * @author: linch */ public function new_store() { $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1); $page_size = 6; $home_stores_model = new \Common\Model\HomeStoresModel(); $search = array( 'is_new' => $home_stores_model::new_on, ); $data = $home_stores_model->get_data($search, $page_num, $page_size); $store_list = $data['list']; if (!empty($store_list)) { $param = array('city_id' => $search['city_id']); $page = $this->get_page($data['count'], $page_size, $page_num, $param); $this->assign('data', $store_list); $this->assign('page', $page); } $this->display(); } /** * 联系我们 * @author: linch */ public function contact() { $this->display(); } /** * 优惠政策 * @author: linch */ public function discount() { $this->display(); } /** * 留言 * @author: linch */ public function message() { if (IS_POST) { $data = I('post.data'); $ad_message_model = new \Common\Model\AdMessageModel(); $code = cookie($ad_message_model::ad_code_name); $ad_message_data = $ad_message_model->where(array('code' => $code))->find(); $ad_message_id = $ad_message_data['id']; $message_board_model = new \Common\Model\MessageBoardModel(); $result = $message_board_model->data_add($data, $message_board_model::source_official_wap, $ad_message_id); if ($result['code'] == false) { $this->error($result['msg']); } else { $this->success($result['msg']); } } else { $this->display(); } } /** * 关于我们 * @author: linch */ public function company() { $this->display(); } /** * 新闻 * @author: linch */ public function news() { $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1); $page_size = 6; $home_new_model = new \Common\Model\HomeNewModel(); $search = array( 'type' => intval(I('get.type', $home_new_model::type_company)), ); $store_id = intval(I('get.store_id', 0)); if (!empty($store_id)) { $search['store_id'] = $store_id; unset($search['type']); } $data = $home_new_model->get_data($search, $page_num, $page_size); $news_list = $data['list']; if (!empty($news_list)) { $param = array('type' => $search['type']); $page = $this->get_page($data['count'], $page_size, $page_num, $param); $this->assign('data', $news_list); $this->assign('page', $page); } $news_type_list = $home_new_model->get_type_list(); $news_banner_list = $home_new_model->get_banner_data(); $this->assign('type', $news_type_list); $this->assign('banner', $news_banner_list); $this->assign('search', $search); $this->display(); } /** * 新闻详情 * @author: linch */ public function new_detail() { $id = intval(I('get.id', 0)); $type = intval(I('get.type', 0)); $home_new_model = new \Common\Model\HomeNewModel(); $data = $home_new_model->where(array('status' => $home_new_model::status_on, 'id' => $id))->find(); $recommend = $home_new_model->get_recommend(); $next_data = $home_new_model->get_next_data($id, $type); $this->assign('type', $type); $this->assign('next', $next_data); $this->assign('recommend', $recommend); $this->assign('data', $data); $this->display(); } /** * 订阅 * @author: linch */ public function subscription() { if (cookie('sub') < 10) { if (IS_POST) { $data = I('post.data'); $home_sub_model = new \Common\Model\HomeSubscriptionModel(); $result = $home_sub_model->data_add($data); $sub = cookie('sub'); $time = 100 * 365 * 24 * 3600; cookie('sub', $sub + 1, $time); } } $this->success('订阅成功'); } }