AboutController.class.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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();
  18. }
  19. /**
  20. * 关于我们
  21. * @author: linch
  22. */
  23. public function about() {
  24. $this->display();
  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 = 4;
  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. $this->assign('data', $store_list);
  42. $this->assign('pager', $data['pager']);
  43. }
  44. }
  45. $home_city_model = new \Common\Model\HomeCityModel();
  46. $home_city = $home_city_model->get_data();
  47. $city_id_string = '';
  48. foreach ($home_city as $k => $v) {
  49. $city_id_string = $city_id_string . '"' . $v['id'] . '",';
  50. }
  51. $city_id_string = substr($city_id_string, 0, strlen($city_id_string) - 1);
  52. $this->assign('home_city', $home_city);
  53. $this->assign('city_id_string', $city_id_string);
  54. $this->assign('search', $search);
  55. $this->display();
  56. }
  57. /**
  58. * vr学车
  59. * @author:linch
  60. */
  61. public function vr() {
  62. $this->display();
  63. }
  64. /**
  65. * 门店--废弃
  66. * @author: linch
  67. */
  68. private function store1() {
  69. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  70. $page_size = 4;
  71. $home_stores_model = new \Common\Model\HomeStoresModel();
  72. $search = array();
  73. $type = 1;
  74. $data = $home_stores_model->get_data($search, $page_num, $page_size, $type);
  75. $store_list = $data['list'];
  76. if (empty($store_list)) {
  77. $this->_empty();
  78. die;
  79. }
  80. $store_count = $data['count'];
  81. $page_count = ceil($store_count / $page_size);
  82. $this->assign('data', $store_list);
  83. $this->assign('page_num', $page_num);
  84. $this->assign('page_count', $page_count);
  85. $this->display();
  86. }
  87. /**
  88. * 加盟
  89. * @author: linch
  90. */
  91. public function join() {
  92. if (IS_POST) {
  93. $data = I('post.data');
  94. $ad_message_model = new \Common\Model\AdMessageModel();
  95. $code = cookie($ad_message_model::ad_code_name);
  96. $ad_message_data = $ad_message_model->where(array('code' => $code))->find();
  97. $ad_message_id = $ad_message_data['id'];
  98. $store_application_model = new \Common\Model\StoreApplicationModel();
  99. $result = $store_application_model->data_add($data, $store_application_model::source_official_web, $ad_message_id);
  100. if ($result['code'] != 1000) {
  101. $this->error($result['msg']);
  102. } else {
  103. $this->success($result['msg']);
  104. }
  105. } else {
  106. $this->display();
  107. }
  108. }
  109. /**
  110. * 联系我们
  111. * @author: linch
  112. */
  113. public function contact() {
  114. $this->display();
  115. }
  116. /**
  117. * 留言
  118. * @author: linch
  119. */
  120. public function message() {
  121. if (IS_POST) {
  122. $data = I('post.data');
  123. $ad_message_model = new \Common\Model\AdMessageModel();
  124. $code = cookie($ad_message_model::ad_code_name);
  125. $ad_message_data = $ad_message_model->where(array('code' => $code))->find();
  126. $ad_message_id = $ad_message_data['id'];
  127. $message_board_model = new \Common\Model\MessageBoardModel();
  128. $result = $message_board_model->data_add($data, $message_board_model::source_official_web, $ad_message_id);
  129. if ($result['code'] == false) {
  130. $this->error($result['msg']);
  131. } else {
  132. $this->success($result['msg']);
  133. }
  134. } else {
  135. $this->display();
  136. }
  137. }
  138. /**
  139. * 关于我们
  140. * @author: linch
  141. */
  142. public function company() {
  143. $this->display();
  144. }
  145. /**
  146. * 优惠政策
  147. * @author: linch
  148. */
  149. public function discount() {
  150. $this->display();
  151. }
  152. /**
  153. * 新闻
  154. * @author: linch
  155. */
  156. public function news() {
  157. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  158. $page_size = 4;
  159. $home_new_model = new \Common\Model\HomeNewModel();
  160. $search = array(
  161. 'type' => intval(I('get.type', $home_new_model::type_company)),
  162. );
  163. $store_id = intval(I('get.store_id', 0));
  164. if (!empty($store_id)) {
  165. $search['store_id'] = $store_id;
  166. unset($search['type']);
  167. }
  168. $data = $home_new_model->get_data($search, $page_num, $page_size);
  169. $news_list = $data['list'];
  170. if (!empty($news_list)) {
  171. $param = array('type' => $search['type']);
  172. // $page = $this->get_page($data['count'], $page_size, $page_num, $param);
  173. $this->assign('data', $news_list);
  174. $this->assign('pager', $data['pager']);
  175. }
  176. $news_type_list = $home_new_model->get_type_list();
  177. $news_banner_list = $home_new_model->get_banner_data();
  178. $this->assign('type', $news_type_list);
  179. $this->assign('banner', $news_banner_list);
  180. $this->assign('search', $search);
  181. $this->display();
  182. }
  183. /**
  184. * 新闻详情
  185. * @author: linch
  186. */
  187. public function new_detail() {
  188. $id = intval(I('get.id', 0));
  189. $type = intval(I('get.type', 0));
  190. $home_new_model = new \Common\Model\HomeNewModel();
  191. $data = $home_new_model->where(array('status' => $home_new_model::status_on, 'id' => $id))->find();
  192. $recommend = $home_new_model->get_recommend();
  193. $next_data = $home_new_model->get_next_data($id, $type);
  194. $pre_data = $home_new_model->get_pre_data($id, $type);
  195. $this->assign('type', $type);
  196. $this->assign('next', $next_data);
  197. $this->assign('pre', $pre_data);
  198. $this->assign('recommend', $recommend);
  199. $this->assign('data', $data);
  200. $this->display();
  201. }
  202. /**
  203. * 最新门店
  204. * @author: linch
  205. */
  206. public function new_store() {
  207. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  208. $page_size = 4;
  209. $home_stores_model = new \Common\Model\HomeStoresModel();
  210. $search = array(
  211. 'is_new' => $home_stores_model::new_on,
  212. );
  213. $data = $home_stores_model->get_data($search, $page_num, $page_size);
  214. $store_list = $data['list'];
  215. if (!empty($store_list)) {
  216. $this->assign('data', $store_list);
  217. $this->assign('pager', $data['pager']);
  218. }
  219. $this->display();
  220. }
  221. }