优化
This commit is contained in:
@@ -18,21 +18,21 @@ class Form extends Base {
|
|||||||
* @title 表单页
|
* @title 表单页
|
||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
public function index(){
|
public function index() {
|
||||||
if($this->request->isAjax()){
|
if ($this->request->isAjax()) {
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$id = $this->request->param('id');
|
$id = $this->request->param('id');
|
||||||
|
|
||||||
$info = FormModel::where('id', $id)->find();
|
$info = FormModel::where('id', $id)->find();
|
||||||
|
|
||||||
$result = Db::name(ucfirst($info['name']))->save($data);
|
$result = Db::name('Form' . ucfirst($info['name']))->save($data);
|
||||||
if (false !== $result) {
|
if (false !== $result) {
|
||||||
$url = (isset($info['redirect_url']) && $info['redirect_url']) ? $info['redirect_url'] : '';
|
$url = (isset($info['redirect_url']) && $info['redirect_url']) ? $info['redirect_url'] : '';
|
||||||
return $this->success("提交成功!", $url);
|
return $this->success("提交成功!", $url);
|
||||||
}else{
|
} else {
|
||||||
return $this->error("提交失败!");
|
return $this->error("提交失败!");
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$id = $this->request->param('id');
|
$id = $this->request->param('id');
|
||||||
$name = $this->request->param('name');
|
$name = $this->request->param('name');
|
||||||
|
|
||||||
@@ -48,15 +48,15 @@ class Form extends Base {
|
|||||||
$relation = explode(",", $relation);
|
$relation = explode(",", $relation);
|
||||||
if (is_array($relation)) {
|
if (is_array($relation)) {
|
||||||
$rmap['id'] = ['IN', $relation];
|
$rmap['id'] = ['IN', $relation];
|
||||||
}elseif (is_string($relation)) {
|
} elseif (is_string($relation)) {
|
||||||
$rmap['id'] = $relation;
|
$rmap['id'] = $relation;
|
||||||
}
|
}
|
||||||
$info['relation_list'] = Db::name(ucfirst($model))->where($rmap)->order('sort desc, id asc')->select();
|
$info['relation_list'] = Db::name(ucfirst($model))->where($rmap)->order('sort desc, id asc')->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
'attr' => $attr
|
'attr' => $attr,
|
||||||
];
|
];
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ CREATE TABLE `sent_member_log` (
|
|||||||
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '操作名称',
|
`title` varchar(100) NOT NULL DEFAULT '' COMMENT '操作名称',
|
||||||
`method` varchar(20) NOT NULL DEFAULT 'GET' COMMENT '操作类型',
|
`method` varchar(20) NOT NULL DEFAULT 'GET' COMMENT '操作类型',
|
||||||
`url` varchar(150) NOT NULL DEFAULT '' COMMENT '操作地址',
|
`url` varchar(150) NOT NULL DEFAULT '' COMMENT '操作地址',
|
||||||
`param` varchar(150) NOT NULL DEFAULT '' COMMENT '操作参数',
|
`param` text DEFAULT '' COMMENT '操作参数',
|
||||||
`client_ip` varchar(30) NOT NULL DEFAULT '' COMMENT '客户端IP',
|
`client_ip` varchar(30) NOT NULL DEFAULT '' COMMENT '客户端IP',
|
||||||
`visite_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '访问时间',
|
`visite_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '访问时间',
|
||||||
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
|||||||
Reference in New Issue
Block a user