AboutController.class.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. * 最新门店
  89. * @author: linch
  90. */
  91. public function new_store() {
  92. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  93. $page_size = 6;
  94. $home_stores_model = new \Common\Model\HomeStoresModel();
  95. $search = array(
  96. 'is_new' => $home_stores_model::new_on,
  97. );
  98. $data = $home_stores_model->get_data($search, $page_num, $page_size);
  99. $store_list = $data['list'];
  100. if (!empty($store_list)) {
  101. $param = array('city_id' => $search['city_id']);
  102. $page = $this->get_page($data['count'], $page_size, $page_num, $param);
  103. $this->assign('data', $store_list);
  104. $this->assign('page', $page);
  105. }
  106. $this->display();
  107. }
  108. /**
  109. * 联系我们
  110. * @author: linch
  111. */
  112. public function contact() {
  113. $this->display();
  114. }
  115. /**
  116. * 优惠政策
  117. * @author: linch
  118. */
  119. public function discount() {
  120. $this->display();
  121. }
  122. /**
  123. * 留言
  124. * @author: linch
  125. */
  126. public function message() {
  127. if (IS_POST) {
  128. $data = I('post.data');
  129. $ad_message_model = new \Common\Model\AdMessageModel();
  130. $code = cookie($ad_message_model::ad_code_name);
  131. $ad_message_data = $ad_message_model->where(array('code' => $code))->find();
  132. $ad_message_id = $ad_message_data['id'];
  133. $message_board_model = new \Common\Model\MessageBoardModel();
  134. $result = $message_board_model->data_add($data, $message_board_model::source_official_wap, $ad_message_id);
  135. if ($result['code'] == false) {
  136. $this->error($result['msg']);
  137. } else {
  138. $this->success($result['msg']);
  139. }
  140. } else {
  141. $this->display();
  142. }
  143. }
  144. /**
  145. * 关于我们
  146. * @author: linch
  147. */
  148. public function company() {
  149. $this->display();
  150. }
  151. /**
  152. * 新闻
  153. * @author: linch
  154. */
  155. public function news() {
  156. $page_num = (int)(I('get.p') > 0 ? I('get.p') : 1);
  157. $page_size = 6;
  158. $home_new_model = new \Common\Model\HomeNewModel();
  159. $search = array(
  160. 'type' => intval(I('get.type', $home_new_model::type_company)),
  161. );
  162. $store_id = intval(I('get.store_id', 0));
  163. if (!empty($store_id)) {
  164. $search['store_id'] = $store_id;
  165. unset($search['type']);
  166. }
  167. $data = $home_new_model->get_data($search, $page_num, $page_size);
  168. $news_list = $data['list'];
  169. if (!empty($news_list)) {
  170. $param = array('type' => $search['type']);
  171. $page = $this->get_page($data['count'], $page_size, $page_num, $param);
  172. $this->assign('data', $news_list);
  173. $this->assign('page', $page);
  174. }
  175. $news_type_list = $home_new_model->get_type_list();
  176. $news_banner_list = $home_new_model->get_banner_data();
  177. $this->assign('type', $news_type_list);
  178. $this->assign('banner', $news_banner_list);
  179. $this->assign('search', $search);
  180. $this->display();
  181. }
  182. /**
  183. * 新闻详情
  184. * @author: linch
  185. */
  186. public function new_detail() {
  187. $id = intval(I('get.id', 0));
  188. $type = intval(I('get.type', 0));
  189. $home_new_model = new \Common\Model\HomeNewModel();
  190. $data = $home_new_model->where(array('status' => $home_new_model::status_on, 'id' => $id))->find();
  191. $recommend = $home_new_model->get_recommend();
  192. $next_data = $home_new_model->get_next_data($id, $type);
  193. $this->assign('type', $type);
  194. $this->assign('next', $next_data);
  195. $this->assign('recommend', $recommend);
  196. $this->assign('data', $data);
  197. $this->display();
  198. }
  199. /**
  200. * 订阅
  201. * @author: linch
  202. */
  203. public function subscription() {
  204. if (cookie('sub') < 10) {
  205. if (IS_POST) {
  206. $data = I('post.data');
  207. $home_sub_model = new \Common\Model\HomeSubscriptionModel();
  208. $result = $home_sub_model->data_add($data);
  209. $sub = cookie('sub');
  210. $time = 100 * 365 * 24 * 3600;
  211. cookie('sub', $sub + 1, $time);
  212. }
  213. }
  214. $this->success('订阅成功');
  215. }
  216. }