where(array('agent_id'=>$this->merchantId))->find(); $formbuider = []; $formbuider[] = Form::frameImageOne('logo', '站点Logo', Url::build('admin/widget.images/index', array('fodder' => 'logo')), $mer_list['logo'])->icon('image')->width('70%')->height('500px')->info('站点Logo')->col(13); $formbuider[] = Form::input('name', '站点名称',$mer_list['name'])->info("站点名称 ")->placeholder("请输入站点名称 ")->col(13); $formbuider[] = Form::input('title', '站点标题',$mer_list['title'])->info("站点标题 ")->placeholder("请输入站点标题 ")->col(13); $formbuider[] = Form::input('filings', '网站备案',$mer_list['filings'])->info("网站备案 ")->placeholder("请输入网站备案 ")->col(13); $formbuider[] = Form::textarea('content', '站点描述', $mer_list['content'])->placeholder('请输入站点描述')->info('站点描述')->rows(6)->col(13); $formbuider[] = Form::textarea('copyright', '底部版权', $mer_list['copyright'])->placeholder('请输入底部版权')->info('底部版权')->rows(6)->col(13); $form = Form::make_post_form('编辑配置', $formbuider, Url::build('save_basics'), 2); $this->assign(compact('form')); $this->assign('list', []); return $this->fetch(); } public function save_basics() { $request = Request::instance(); if ($request->isPost()) { $post = $request->post(); $menus = Db::name('agent_site')->where('agent_id',$this->merchantId)->find(); if($menus){ $post['add_time'] = time(); Db::name('agent_site')->where('agent_id',$this->merchantId)->update($post); }else{ $post['agent_id'] = $this->merchantId; $post['add_time'] = time(); Db::name('agent_site')->insert($post); } return Json::successful('修改成功'); } } /** * 获取文件名 * */ public function getImageName() { $request = Request::instance(); $post = $request->post(); $src = $post['src']; $data['name'] = basename($src); exit(json_encode($data)); } /** * 上传文件 * @return string */ public function file_upload() { $res = Upload::file('file', 'config/file'); if (!$res->status) return Json::fail($res->error); return Json::successful('上传成功!', ['filePath' => $res->filePath]); } }