更新 Form.php

增加自定义表单下状态变更的Action缺失
This commit is contained in:
k先森
2019-06-19 13:56:53 +08:00
committed by Gitee
parent 8d64a14295
commit 73aabb230e

View File

@@ -273,4 +273,24 @@ class Form extends Admin {
array('name' => 'is_must', 'title' => '是否必填', 'help' => '用于自动验证', 'type' => 'select', 'option' => array('0' => '否', '1' => '是')),
);
}
/**
* @title 修改状态
* @author K先森 <77413254@qq.com>
*/
public function status() {
$id = $this->getArrayParam('id');
$status = input('status', '0', 'trim,intval');
if (!$id) {
return $this->error("非法操作!");
}
$map['id'] = array('IN', $id);
$result = db('form')->where($map)->setField('status', $status);
if ($result) {
return $this->success("设置成功!");
} else {
return $this->error("设置失败!");
}
}
}