AboutController.class.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <?php
  2. namespace Home\Controller;
  3. use Common\Controller\HomeBaseController as Base;
  4. /**
  5. * 关于控制器
  6. * @author: linch
  7. * Class AboutController
  8. * @package Home\Controller
  9. */
  10. class AboutController extends Base
  11. {
  12. /**
  13. * 产品
  14. * @author: linch
  15. */
  16. public function product() {
  17. $this->display($this->the_view);
  18. }
  19. /**
  20. * 关于我们
  21. * @author: linch
  22. */
  23. public function about() {
  24. $this->display($this->the_view);
  25. }
  26. /**
  27. * 全部门店
  28. * @author: linch
  29. */
  30. public function store() {
  31. $search = array(
  32. 'city_id' => intval(I('get.city_id', 0)),
  33. );
  34. if ($search['city_id'] != 0) {
  35. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  36. $page_size = 6;
  37. $home_stores_model = new \Common\Model\HomeStoresModel();
  38. $data = $home_stores_model->get_data($search, $page_num, $page_size);
  39. $store_list = $data['list'];
  40. if (!empty($store_list)) {
  41. $param = array('city_id' => $search['city_id']);
  42. $page = $this->get_page($data['count'], $page_size, $page_num, $param);
  43. $this->assign('data', $store_list);
  44. $this->assign('page', $page);
  45. $this->assign('pager', $data['pager']);
  46. }
  47. }
  48. $home_city_model = new \Common\Model\HomeCityModel();
  49. $home_city = $home_city_model->get_data();
  50. $city_id_string = '';
  51. foreach ($home_city as $k => $v) {
  52. $city_id_string = $city_id_string . '"' . $v['id'] . '",';
  53. }
  54. $city_id_string = substr($city_id_string, 0, strlen($city_id_string) - 1);
  55. $this->assign('home_city', $home_city);
  56. $this->assign('city_id_string', $city_id_string);
  57. $this->assign('search', $search);
  58. $this->display($this->the_view);
  59. }
  60. /**
  61. * vr学车
  62. * @author:linch
  63. */
  64. public function vr() {
  65. $this->display($this->the_view);
  66. }
  67. /**
  68. * 门店--废弃
  69. * @author: linch
  70. */
  71. private function store1() {
  72. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  73. $page_size = 4;
  74. $home_stores_model = new \Common\Model\HomeStoresModel();
  75. $search = array();
  76. $type = 1;
  77. $data = $home_stores_model->get_data($search, $page_num, $page_size, $type);
  78. $store_list = $data['list'];
  79. if (empty($store_list)) {
  80. $this->_empty();
  81. die;
  82. }
  83. $store_count = $data['count'];
  84. $page_count = ceil($store_count / $page_size);
  85. $this->assign('data', $store_list);
  86. $this->assign('page_num', $page_num);
  87. $this->assign('page_count', $page_count);
  88. $this->display();
  89. }
  90. /**
  91. * 加盟
  92. * @author: linch
  93. */
  94. public function join() {
  95. if (IS_POST) {
  96. $data = I('post.data');
  97. $ad_message_model = new \Common\Model\AdMessageModel();
  98. $code = cookie($ad_message_model::ad_code_name);
  99. $ad_message_data = $ad_message_model->where(array('code' => $code))->find();
  100. $ad_message_id = $ad_message_data['id'];
  101. $store_application_model = new \Common\Model\StoreApplicationModel();
  102. $result = $store_application_model->data_add($data, $store_application_model::source_official_web, $ad_message_id);
  103. if ($result['code'] != 1000) {
  104. $this->error($result['msg']);
  105. } else {
  106. $this->success($result['msg']);
  107. }
  108. } else {
  109. $ad_message_model = new \Common\Model\AdMessageModel();
  110. $code = $_COOKIE[$ad_message_model::ad_code_name];
  111. $ad_message_data = $ad_message_model->where(array('code' => $code))->find();
  112. $tt_code = $ad_message_data['tt_code'];
  113. $this->assign('tt_code', $tt_code);
  114. $this->display($this->the_view);
  115. }
  116. }
  117. /**
  118. * 联系我们
  119. * @author: linch
  120. */
  121. public function contact() {
  122. $this->display($this->the_view);
  123. }
  124. /**
  125. * 留言
  126. * @author: linch
  127. */
  128. public function message() {
  129. if (IS_POST) {
  130. $data = I('post.data');
  131. $ad_message_model = new \Common\Model\AdMessageModel();
  132. $code = cookie($ad_message_model::ad_code_name);
  133. $ad_message_data = $ad_message_model->where(array('code' => $code))->find();
  134. $ad_message_id = $ad_message_data['id'];
  135. $message_board_model = new \Common\Model\MessageBoardModel();
  136. if ($this->is_mobile == true) {
  137. $source = $message_board_model::source_official_wap;
  138. } else {
  139. $source = $message_board_model::source_official_web;
  140. }
  141. $result = $message_board_model->data_add($data, $source, $ad_message_id);
  142. if ($result['code'] == false) {
  143. $this->error($result['msg']);
  144. } else {
  145. $this->success($result['msg']);
  146. }
  147. } else {
  148. $this->display($this->the_view);
  149. }
  150. }
  151. /**
  152. * 关于我们
  153. * @author: linch
  154. */
  155. public function company() {
  156. $this->display($this->the_view);
  157. }
  158. /**
  159. * 优惠政策
  160. * @author: linch
  161. */
  162. public function discount() {
  163. $this->display($this->the_view);
  164. }
  165. /**
  166. * 新闻
  167. * @author: linch
  168. */
  169. public function news() {
  170. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  171. $page_size = 6;
  172. $home_new_model = new \Common\Model\HomeNewModel();
  173. $search = array(
  174. 'type' => intval(I('get.type', $home_new_model::type_company)),
  175. );
  176. $store_id = intval(I('get.store_id', 0));
  177. if (!empty($store_id)) {
  178. $search['store_id'] = $store_id;
  179. unset($search['type']);
  180. }
  181. $data = $home_new_model->get_data($search, $page_num, $page_size);
  182. $news_list = $data['list'];
  183. if (!empty($news_list)) {
  184. $param = array('type' => $search['type']);
  185. $page = $this->get_page($data['count'], $page_size, $page_num, $param);
  186. $this->assign('data', $news_list);
  187. $this->assign('pager', $data['pager']);
  188. $this->assign('page', $page);
  189. }
  190. $news_type_list = $home_new_model->get_type_list();
  191. $news_banner_list = $home_new_model->get_banner_data();
  192. $this->assign('type', $news_type_list);
  193. $this->assign('banner', $news_banner_list);
  194. $this->assign('search', $search);
  195. $this->display($this->the_view);
  196. }
  197. /**
  198. * 新闻详情
  199. * @author: linch
  200. */
  201. public function new_detail() {
  202. $id = intval(I('get.id', 0));
  203. $type = intval(I('get.type', 0));
  204. $home_new_model = new \Common\Model\HomeNewModel();
  205. $data = $home_new_model->where(array('status' => $home_new_model::status_on, 'id' => $id))->find();
  206. $recommend = $home_new_model->get_recommend();
  207. $next_data = $home_new_model->get_next_data($id, $type);
  208. $pre_data = $home_new_model->get_pre_data($id, $type);
  209. $this->assign('type', $type);
  210. $this->assign('next', $next_data);
  211. $this->assign('pre', $pre_data);
  212. $this->assign('recommend', $recommend);
  213. $this->assign('data', $data);
  214. $this->display($this->the_view);
  215. }
  216. /**
  217. * 最新门店
  218. * @author: linch
  219. */
  220. public function new_store() {
  221. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  222. $page_size = 6;
  223. $home_stores_model = new \Common\Model\HomeStoresModel();
  224. $search = array(
  225. 'is_new' => $home_stores_model::new_on,
  226. );
  227. $data = $home_stores_model->get_data($search, $page_num, $page_size);
  228. $store_list = $data['list'];
  229. if (!empty($store_list)) {
  230. $page = $this->get_page($data['count'], $page_size, $page_num);
  231. $this->assign('data', $store_list);
  232. $this->assign('pager', $data['pager']);
  233. $this->assign('page', $page);
  234. }
  235. $this->display($this->the_view);
  236. }
  237. /**
  238. * 订阅
  239. * @author: linch
  240. */
  241. public function subscription() {
  242. if (cookie('sub') < 10) {
  243. if (IS_POST) {
  244. $data = I('post.data');
  245. $home_sub_model = new \Common\Model\HomeSubscriptionModel();
  246. $result = $home_sub_model->data_add($data);
  247. $sub = cookie('sub');
  248. $time = 100 * 365 * 24 * 3600;
  249. cookie('sub', $sub + 1, $time);
  250. }
  251. }
  252. $this->success('订阅成功');
  253. }
  254. }