AboutController.class.php 7.1 KB

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