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 = DS_THEME_USER_URL . '/images/'; $file = request()->file('inc_logo'); if($file){ $oldFile = $imgurl . "backlogo.png"; if(file_exists($oldFile)){ unlink($oldFile); }; $imgname = "backlogo.png";//官网logo $file = $file->setSaveName($imgname);//设置保存文件名 $imgo = $file->move($imgurl, $savename = $imgname, $replace = true); if($imgo){ $img = 1; } } $result = IncInfoModel::updateIncInfo($update_array); if ($result || $img) { $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('修改失败')); } } } public function contact() { $getHomecontact = model('Homecontact')->getHomecontact(); $this->assign('homecontact', $getHomecontact); $this->setAdminCurItem('index'); return $this->fetch(); } public function edit() { $homecontact_id = input('param.homecontact_id'); if (!request()->isPost()) { $findHomecontact = model('Homecontact')->findHomecontact($homecontact_id); $this->assign('homecontact', $findHomecontact); $this->setAdminCurItem('edit'); return $this->fetch('form'); } else { $updateData = array( 'homecontact_name' => input('post.homecontact_name'), 'homecontact_content1' => input('post.homecontact_content1'), 'homecontact_content2' => input('post.homecontact_content2'), 'homecontact_content3' => input('post.homecontact_content3'), ); $result = model('Homecontact')->updateHomecontact($homecontact_id, $updateData); if ($result) { dsLayerOpenSuccess("编辑成功"); } else { $this->error("操作失败"); } } } }