2023-01-29 10:26:52 +08:00

39 lines
865 B
PHP

<?php
// +----------------------------------------------------------------------
// | 小说系统 [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
namespace app\common\model;
/**
* 设置模型
*/
class Category extends Base{
protected $name = "Category";
protected $auto = array('update_time', 'icon'=>1, 'status'=>1);
protected $type = array(
'icon' => 'integer',
);
public function change(){
$data = input('post.');
if ($data['id']) {
$result = $this->save($data,array('id'=>$data['id']));
}else{
unset($data['id']);
$result = $this->save($data);
}
if (false !== $result) {
return true;
}else{
$this->error = "失败!";
return false;
}
}
public function info($id, $field = true){
return $this->db()->where(array('id'=>$id))->field($field)->find();
}
}