Contact.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\admin\controller;
  3. use think\Lang;
  4. class Contact extends AdminControl {
  5. public function _initialize() {
  6. parent::_initialize();
  7. Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/config.lang.php');
  8. }
  9. /**
  10. * 联系我们
  11. * @return mixed
  12. */
  13. public function index() {
  14. $model_contact = model('Contact');
  15. $allpower = $this->qxhans();
  16. $this->assign('allpower',$allpower);
  17. if (!request()->isPost()) {
  18. $contact = $model_contact->getContact();
  19. $contact['update_time'] = date("Y-m-d h:i:s",$contact['update_time']);
  20. $this->assign('contact', $contact);
  21. $this->setAdminCurItem('index');
  22. return $this->fetch();
  23. } else {
  24. $update_array = array();
  25. $update_array['address'] = input('post.address');
  26. $update_array['phone'] = input('post.phone');
  27. $update_array['email'] = input('post.email');
  28. $update_array['fax'] = input('post.fax');
  29. $update_array['detail'] = input('post.detail');
  30. $update_array['update_time'] = time();
  31. $result = $model_contact->updateContact($update_array);
  32. if ($result === 1) {
  33. $this->log(lang('ds_edit') . lang('dis_dump'), 1);
  34. $this->success('修改成功', 'Contact/index');
  35. } else {
  36. $this->log(lang('ds_edit') . lang('dis_dump'), 0);
  37. $this->error(lang('修改失败'));
  38. }
  39. }
  40. }
  41. /**
  42. * 获取卖家栏目列表,针对控制器下的栏目
  43. */
  44. protected function getAdminItemList() {
  45. $menu_array = array(
  46. array(
  47. 'name' => 'base',
  48. 'text' => lang('site_set'),
  49. 'url' => url('Admin/Config/index')
  50. ),
  51. );
  52. return $menu_array;
  53. }
  54. }