StoreApplicationController.class.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <?php
  2. namespace Admin\Controller;
  3. use Common\Controller\AuthController;
  4. use Think\Controller;
  5. /**
  6. * 加盟申请
  7. * @author: linch
  8. * Class StoreApplicationController
  9. * @package Admin\Controller
  10. */
  11. class StoreApplicationController extends AuthController
  12. {
  13. /**
  14. * 申请列表
  15. * @author: linch
  16. */
  17. public function application_list() {
  18. $search = array(
  19. 's_time' => I('get.s_time'),
  20. 'e_time' => I('get.e_time'),
  21. );
  22. $page_size = 20;
  23. $page_num = I('p', 1);
  24. $store_application_model = new \Admin\Model\StoreApplicationModel();
  25. $data = $store_application_model->get_list($search, $page_num, $page_size);;
  26. $status = $store_application_model->get_status_list();
  27. $source = $store_application_model->get_source_list();
  28. $this->assign('search', $search);
  29. $this->assign('list', $data['list']);
  30. $this->assign('pager', $data['pager']);
  31. $this->assign('status', $status);
  32. $this->assign('source', $source);
  33. $this->display();
  34. }
  35. /**
  36. * 设置已联系
  37. * @author: linch
  38. */
  39. public function application_set_finish() {
  40. $data = I('post.data');
  41. if (empty($data)) {
  42. $this->error('无数据操作,请勾选要修改的数据');
  43. } else {
  44. $store_application_model = new \Admin\Model\StoreApplicationModel();
  45. foreach ($data as $key => $val) {
  46. $id = intval($val['id']);
  47. $store_application_model->data_set_finish($id);
  48. }
  49. $this->success('操作成功');
  50. }
  51. }
  52. /**
  53. * 设置已删除
  54. * @author: linch
  55. */
  56. public function application_del() {
  57. $data = I('post.data');
  58. if (empty($data)) {
  59. $this->error('无数据操作,请勾选要修改的数据');
  60. } else {
  61. $store_application_model = new \Admin\Model\StoreApplicationModel();
  62. foreach ($data as $key => $val) {
  63. $id = intval($val['id']);
  64. $store_application_model->data_del($id);
  65. }
  66. $this->success('操作成功');
  67. }
  68. }
  69. /**
  70. * 留言板管理
  71. * @author: linch
  72. */
  73. public function message_board_list() {
  74. $search = array(
  75. 's_time' => I('get.s_time'),
  76. 'e_time' => I('get.e_time'),
  77. );
  78. $page_size = 20;
  79. $page_num = I('p', 1);
  80. $message_board_model = new \Admin\Model\MessageBoardModel();
  81. $data = $message_board_model->get_list($search, $page_num, $page_size);;
  82. $status = $message_board_model->get_status_list();
  83. $source = $message_board_model->get_source_list();
  84. $this->assign('search', $search);
  85. $this->assign('list', $data['list']);
  86. $this->assign('pager', $data['pager']);
  87. $this->assign('status', $status);
  88. $this->assign('source', $source);
  89. $this->display();
  90. }
  91. /**
  92. * 留言板设置已联系
  93. * @author: linch
  94. */
  95. public function message_board_set_finish() {
  96. $data = I('post.data');
  97. if (empty($data)) {
  98. $this->error('无数据操作,请勾选要修改的数据');
  99. } else {
  100. $message_board_model = new \Admin\Model\MessageBoardModel();
  101. foreach ($data as $key => $val) {
  102. $id = intval($val['id']);
  103. $message_board_model->data_set_finish($id);
  104. }
  105. $this->success('操作成功');
  106. }
  107. }
  108. /**
  109. * 设置已删除
  110. * @author: linch
  111. */
  112. public function message_board_del() {
  113. $data = I('post.data');
  114. if (empty($data)) {
  115. $this->error('无数据操作,请勾选要修改的数据');
  116. } else {
  117. $message_board_model = new \Admin\Model\MessageBoardModel();
  118. foreach ($data as $key => $val) {
  119. $id = intval($val['id']);
  120. $message_board_model->data_del($id);
  121. }
  122. $this->success('操作成功');
  123. }
  124. }
  125. /**
  126. * 广告列表
  127. * @author: linch
  128. */
  129. public function ad_message_list() {
  130. $search = array();
  131. $page_size = 20;
  132. $page_num = I('p', 1);
  133. $ad_message_model = new \Admin\Model\AdMessageModel();
  134. $data = $ad_message_model->get_list($search, $page_num, $page_size);
  135. $this->assign('search', $search);
  136. $this->assign('list', $data['list']);
  137. $this->assign('pager', $data['pager']);
  138. $this->display();
  139. }
  140. /**
  141. * 添加广告
  142. * @author: linch
  143. */
  144. public function ad_message_add() {
  145. if (IS_POST) { //新增操作
  146. $ad_message_model = new \Admin\Model\AdMessageModel();
  147. $data = I('post.data');
  148. $info = $this->get_my_info(); //获取登录信息
  149. $data['admin_id'] = (int)$info['aid'];
  150. $result = $ad_message_model->data_add($data);
  151. if ($result['code'] == true) {
  152. $this->success('操作成功');
  153. } else {
  154. $this->error($result['msg']);
  155. }
  156. } else { //新增页面
  157. $this->display('ad_message_edit');
  158. }
  159. }
  160. /**
  161. * 删除广告
  162. * @author: linch
  163. */
  164. public function ad_message_del() {
  165. $data = I('post.data');
  166. if (empty($data)) {
  167. $this->error('无数据操作,请勾选要修改的数据');
  168. } else {
  169. $ad_message_model = new \Admin\Model\AdMessageModel();
  170. foreach ($data as $key => $val) {
  171. $id = intval($val['id']);
  172. $ad_message_model->data_del($id);
  173. }
  174. $this->success('操作成功');
  175. }
  176. }
  177. /**
  178. * 官网门店列表
  179. * @author: linch
  180. */
  181. public function home_store() {
  182. $search = array(
  183. 'name' => trim(I('get.name')),
  184. );
  185. $page_size = 20;
  186. $page_num = I('p', 1);
  187. $home_store_model = new \Admin\Model\HomeStoresModel();
  188. $data = $home_store_model->get_list($search, $page_num, $page_size);
  189. $is_new_list = $home_store_model->get_is_new_list();
  190. $this->assign('is_new_list', $is_new_list);
  191. $this->assign('search', $search);
  192. $this->assign('list', $data['list']);
  193. $this->assign('pager', $data['pager']);
  194. $this->display();
  195. }
  196. /**
  197. * 官网门店新增
  198. * @author: linch
  199. */
  200. public function home_store_add() {
  201. $home_store_model = new \Admin\Model\HomeStoresModel();
  202. if (IS_POST) { //新增操作
  203. $data = I('post.data');
  204. $result = $home_store_model->data_add($data);
  205. if ($result['code'] == true) {
  206. $this->success('操作成功');
  207. } else {
  208. $this->error($result['msg']);
  209. }
  210. } else { //新增页面
  211. //城市
  212. $home_city_model = new \Common\Model\HomeCityModel();
  213. $city_data = $home_city_model->where(array('status' => $home_city_model::status_on))->select();
  214. $is_new_list = $home_store_model->get_is_new_list();
  215. $this->assign('is_new_list', $is_new_list);
  216. $this->assign('city', $city_data);
  217. $this->display('home_store_edit');
  218. }
  219. }
  220. /**
  221. * 官网门店编辑
  222. * @author: linch
  223. */
  224. public function home_store_edit() {
  225. $home_store_model = new \Admin\Model\HomeStoresModel();
  226. if (IS_POST) { //编辑操作
  227. $data = I('post.data');
  228. $result = $home_store_model->data_edit($data);
  229. if ($result['code'] == true) {
  230. $this->success('操作成功');
  231. } else {
  232. $this->error($result['msg']);
  233. }
  234. } else { //编辑页面
  235. $id = intval(I('get.id'));
  236. $data = $home_store_model->find($id);
  237. $home_city_model = new \Common\Model\HomeCityModel();
  238. $city_data = $home_city_model->where(array('status' => $home_city_model::status_on))->select();
  239. $is_new_list = $home_store_model->get_is_new_list();
  240. $this->assign('is_new_list', $is_new_list);
  241. $this->assign('city', $city_data);
  242. $this->assign('data', $data);
  243. $this->display();
  244. }
  245. }
  246. /**
  247. * 官网门店删除
  248. * @author: linch
  249. */
  250. public function home_store_del() {
  251. $data = I('post.data');
  252. if (empty($data)) {
  253. $this->error('无数据操作,请勾选要修改的数据');
  254. } else {
  255. $home_store_model = new \Admin\Model\HomeStoresModel();
  256. foreach ($data as $key => $val) {
  257. $id = intval($val['id']);
  258. $home_store_model->data_del($id);
  259. }
  260. $this->success('操作成功');
  261. }
  262. }
  263. /**
  264. * 官网门店下架
  265. * @author: linch
  266. */
  267. public function home_store_set_off() {
  268. $data = I('post.data');
  269. if (empty($data)) {
  270. $this->error('无数据操作,请勾选要修改的数据');
  271. } else {
  272. $home_store_model = new \Admin\Model\HomeStoresModel();
  273. foreach ($data as $key => $val) {
  274. $id = intval($val['id']);
  275. $home_store_model->data_set_off($id);
  276. }
  277. $this->success('操作成功');
  278. }
  279. }
  280. /**
  281. * 官网门店上架
  282. * @author: linch
  283. */
  284. public function home_store_set_on() {
  285. $data = I('post.data');
  286. if (empty($data)) {
  287. $this->error('无数据操作,请勾选要修改的数据');
  288. } else {
  289. $home_store_model = new \Admin\Model\HomeStoresModel();
  290. foreach ($data as $key => $val) {
  291. $id = intval($val['id']);
  292. $home_store_model->data_set_on($id);
  293. }
  294. $this->success('操作成功');
  295. }
  296. }
  297. /**
  298. * 官网城市列表
  299. * @author: linch
  300. */
  301. public function home_city() {
  302. $search = array(
  303. 'name' => trim(I('get.name')),
  304. );
  305. $page_size = 20;
  306. $page_num = I('p', 1);
  307. $home_city_model = new \Admin\Model\HomeCityModel();
  308. $data = $home_city_model->get_list($search, $page_num, $page_size);
  309. $this->assign('search', $search);
  310. $this->assign('list', $data['list']);
  311. $this->assign('pager', $data['pager']);
  312. $this->display();
  313. }
  314. /**
  315. * 官网城市新增
  316. * @author: linch
  317. */
  318. public function home_city_add() {
  319. if (IS_POST) { //新增操作
  320. $home_city_model = new \Admin\Model\HomeCityModel();
  321. $data = I('post.data');
  322. $result = $home_city_model->data_add($data);
  323. if ($result['code'] == true) {
  324. $this->success('操作成功');
  325. } else {
  326. $this->error($result['msg']);
  327. }
  328. } else { //新增页面
  329. $this->display('home_city_edit');
  330. }
  331. }
  332. /**
  333. * 官网城市编辑
  334. * @author: linch
  335. */
  336. public function home_city_edit() {
  337. $home_city_model = new \Admin\Model\HomeCityModel();
  338. if (IS_POST) { //编辑操作
  339. $data = I('post.data');
  340. $result = $home_city_model->data_edit($data);
  341. if ($result['code'] == true) {
  342. $this->success('操作成功');
  343. } else {
  344. $this->error($result['msg']);
  345. }
  346. } else { //编辑页面
  347. $id = intval(I('get.id'));
  348. $data = $home_city_model->find($id);
  349. $this->assign('data', $data);
  350. $this->display();
  351. }
  352. }
  353. /**
  354. * 官网城市删除
  355. * @author: linch
  356. */
  357. public function home_city_del() {
  358. $data = I('post.data');
  359. if (empty($data)) {
  360. $this->error('无数据操作,请勾选要修改的数据');
  361. } else {
  362. $home_city_model = new \Admin\Model\HomeCityModel();
  363. foreach ($data as $key => $val) {
  364. $id = intval($val['id']);
  365. $home_city_model->data_del($id);
  366. }
  367. $this->success('操作成功');
  368. }
  369. }
  370. /**
  371. * 官网新闻列表
  372. * @author: linch
  373. */
  374. public function home_new() {
  375. $search = array(
  376. 'title' => trim(I('get.title')),
  377. );
  378. $page_size = 20;
  379. $page_num = I('p', 1);
  380. $home_new_model = new \Admin\Model\HomeNewModel();
  381. $data = $home_new_model->get_list($search, $page_num, $page_size);
  382. //类型、状态
  383. $type_list = $home_new_model->get_type_list();
  384. $recommend_list = $home_new_model->get_recommend_list();
  385. $status_list = $home_new_model->get_status_list();
  386. $banner_list = $home_new_model->get_banner_list();
  387. $this->assign('type', $type_list);
  388. $this->assign('recommend', $recommend_list);
  389. $this->assign('status', $status_list);
  390. $this->assign('banner', $banner_list);
  391. $this->assign('search', $search);
  392. $this->assign('list', $data['list']);
  393. $this->assign('pager', $data['pager']);
  394. $this->display();
  395. }
  396. /**
  397. * 官网新闻新增
  398. * @author: linch
  399. */
  400. public function home_new_add() {
  401. $home_new_model = new \Admin\Model\HomeNewModel();
  402. if (IS_POST) { //新增操作
  403. $data = I('post.data');
  404. $result = $home_new_model->data_add($data);
  405. if ($result['code'] == true) {
  406. $this->success('操作成功');
  407. } else {
  408. $this->error($result['msg']);
  409. }
  410. } else { //新增页面
  411. //类型、状态、门店
  412. $home_store_model = new \Common\Model\HomeStoresModel();
  413. $store_list = $home_store_model->where(array('status' => $home_store_model::status_on))->select();
  414. $type_list = $home_new_model->get_type_list();
  415. $recommend_list = $home_new_model->get_recommend_list();
  416. $this->assign('store', $store_list);
  417. $this->assign('type', $type_list);
  418. $this->assign('recommend', $recommend_list);
  419. $this->display('home_new_edit');
  420. }
  421. }
  422. /**
  423. * 官网新闻编辑
  424. * @author: linch
  425. */
  426. public function home_new_edit() {
  427. $home_new_model = new \Admin\Model\HomeNewModel();
  428. if (IS_POST) { //编辑操作
  429. $data = I('post.data');
  430. $result = $home_new_model->data_edit($data);
  431. if ($result['code'] == true) {
  432. $this->success('操作成功');
  433. } else {
  434. $this->error($result['msg']);
  435. }
  436. } else { //编辑页面
  437. $id = intval(I('get.id'));
  438. $data = $home_new_model->find($id);
  439. //类型、状态、店铺
  440. $home_store_model = new \Common\Model\HomeStoresModel();
  441. $store_list = $home_store_model->where(array('status' => $home_store_model::status_on))->select();
  442. $type_list = $home_new_model->get_type_list();
  443. $recommend_list = $home_new_model->get_recommend_list();
  444. $this->assign('store', $store_list);
  445. $this->assign('type', $type_list);
  446. $this->assign('recommend', $recommend_list);
  447. $this->assign('data', $data);
  448. $this->display();
  449. }
  450. }
  451. /**
  452. * 官网新闻删除
  453. * @author: linch
  454. */
  455. public function home_new_del() {
  456. $data = I('post.data');
  457. if (empty($data)) {
  458. $this->error('无数据操作,请勾选要修改的数据');
  459. } else {
  460. $home_new_model = new \Admin\Model\HomeNewModel();
  461. foreach ($data as $key => $val) {
  462. $id = intval($val['id']);
  463. $home_new_model->data_del($id);
  464. }
  465. $this->success('操作成功');
  466. }
  467. }
  468. /**
  469. * 官网新闻下架
  470. * @author: linch
  471. */
  472. public function home_new_set_off() {
  473. $data = I('post.data');
  474. if (empty($data)) {
  475. $this->error('无数据操作,请勾选要修改的数据');
  476. } else {
  477. $home_new_model = new \Admin\Model\HomeNewModel();
  478. foreach ($data as $key => $val) {
  479. $id = intval($val['id']);
  480. $home_new_model->data_set_off($id);
  481. }
  482. $this->success('操作成功');
  483. }
  484. }
  485. /**
  486. * 官网新闻上架
  487. * @author: linch
  488. */
  489. public function home_new_set_on() {
  490. $data = I('post.data');
  491. if (empty($data)) {
  492. $this->error('无数据操作,请勾选要修改的数据');
  493. } else {
  494. $home_new_model = new \Admin\Model\HomeNewModel();
  495. foreach ($data as $key => $val) {
  496. $id = intval($val['id']);
  497. $home_new_model->data_set_on($id);
  498. }
  499. $this->success('操作成功');
  500. }
  501. }
  502. /**
  503. * 官网新闻设置成banner
  504. * @author: linch
  505. */
  506. public function home_new_set_banner_on(){
  507. $data = I('post.data');
  508. if (empty($data)) {
  509. $this->error('无数据操作,请勾选要修改的数据');
  510. } else {
  511. $home_new_model = new \Admin\Model\HomeNewModel();
  512. foreach ($data as $key => $val) {
  513. $id = intval($val['id']);
  514. $home_new_model->data_set_banner_on($id);
  515. }
  516. $this->success('操作成功');
  517. }
  518. }
  519. /**
  520. * 官网新闻取消设置banner
  521. * @author: linch
  522. */
  523. public function home_new_set_banner_off(){
  524. $data = I('post.data');
  525. if (empty($data)) {
  526. $this->error('无数据操作,请勾选要修改的数据');
  527. } else {
  528. $home_new_model = new \Admin\Model\HomeNewModel();
  529. foreach ($data as $key => $val) {
  530. $id = intval($val['id']);
  531. $home_new_model->data_set_banner_off($id);
  532. }
  533. $this->success('操作成功');
  534. }
  535. }
  536. /**
  537. * email邮箱列表
  538. * @author: linch
  539. */
  540. public function home_email(){
  541. $search = array();
  542. $page_size = 20;
  543. $page_num = I('p', 1);
  544. $home_sub_model = new \Admin\Model\HomeSubscriptionModel();
  545. $data = $home_sub_model->get_list($search, $page_num, $page_size);
  546. //状态
  547. $status_list = $home_sub_model->get_status_list();
  548. $this->assign('status', $status_list);
  549. $this->assign('search', $search);
  550. $this->assign('list', $data['list']);
  551. $this->assign('pager', $data['pager']);
  552. $this->display();
  553. }
  554. /**
  555. * email邮箱删除
  556. * @author: linch
  557. */
  558. public function home_email_del() {
  559. $data = I('post.data');
  560. if (empty($data)) {
  561. $this->error('无数据操作,请勾选要修改的数据');
  562. } else {
  563. $home_sub_model = new \Admin\Model\HomeSubscriptionModel();
  564. foreach ($data as $key => $val) {
  565. $id = intval($val['id']);
  566. $home_sub_model->data_del($id);
  567. }
  568. $this->success('操作成功');
  569. }
  570. }
  571. }