!21 更新Ad和自定义表单

Merge pull request !21 from k先森/master
This commit is contained in:
2019-07-02 16:55:51 +08:00
committed by Gitee
2 changed files with 29 additions and 4 deletions

View File

@@ -51,10 +51,15 @@ class Ad extends Admin {
$place = model('AdPlace');
if ($this->request->isPost()) {
$result = $place->change();
if (false !== false) {
return $this->success("添加成功!");
} else {
return $this->error($place->getError());
if (!empty($_POST['name'])){
$result = $place->change();
if ($result) {
return $this->success("添加成功!");
} else {
return $this->error($place->getError());
}
}else{
return $this->error("标识不能为空!");
}
} else {
$data = array(

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("设置失败!");
}
}
}