123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?php
- namespace M\Controller;
- use Common\Controller\MBaseController as Base;
- /**
- * 关于控制器
- * @author: linch
- * Class AboutController
- * @package M\Controller
- */
- class AboutController extends Base
- {
- /**
- * 加盟
- * @author: linch
- */
- public function join() {
- 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'];
- $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('订阅成功');
- }
- }
|