AboutController.class.php 6.9 KB

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