| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Jun.peng
- * Date: 2019/6/19
- * Time: 9:28
- */
- namespace app\admin\controller;
- use map\Map;
- use think\Lang;
- use app\admin\model\IncInfo as IncInfoModel;
- /**
- * Class Information
- * @package app\admin\controller
- * 企业信息管理
- */
- class Information extends AdminControl
- {
- public function _initialize()
- {
- parent::_initialize();
- Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/inc_info.lang.php');
- }
- public function index() {
- $allpower = $this->qxhans();
- $this->assign('allpower',$allpower);
- if (!request()->isPost()) {
- $incData = IncInfoModel::get(1);
- $this->assign('IncData', $incData);
- $this->setAdminCurItem('index');
- return $this->fetch();
- } else {
- $update_array = array();
- $update_array['inc_name'] = $_POST['inc_name'];
- $update_array['inc_phone'] = $_POST['inc_phone'];
- $update_array['inc_email'] = $_POST['inc_email'];
- $update_array['inc_weixin'] = $_POST['inc_weixin'];
- $update_array['inc_qq'] = $_POST['inc_qq'];
- $update_array['inc_address'] = $_POST['inc_address'];
- //获取地址经纬度
- $map = Map::getLngLat($_POST['inc_address']);
- $update_array['inc_location'] = json_encode($map['location']);
- $imgurl = USER_SITE_ROOT . '/images/';
- $file = request()->file('inc_logo');
- if($file){
- $imgname = "logo";//官网logo
- $file = $file->setSaveName($imgname);//设置保存文件名
- $imgo = $file->move($imgurl, $savename = false, $replace = true);
- if($imgo){
- $update_array['inc_logo'] = $imgname.'.png';
- }
- }
- $result = IncInfoModel::updateIncInfo($update_array);
- if ($result === true) {
- $this->log(lang('ds_edit') . lang('dis_dump'), 1);
- $this->success('修改成功', 'Information/index');
- } else {
- $this->log(lang('ds_edit') . lang('dis_dump'), 0);
- $this->error(lang('修改失败'));
- }
- }
- }
- }
|