解决添加节点报错的问题
This commit is contained in:
@@ -4,5 +4,27 @@ namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class Base extends Model {
|
||||
protected $param;
|
||||
protected $type = array(
|
||||
'id' => 'integer',
|
||||
'cover_id' => 'integer',
|
||||
);
|
||||
|
||||
public function initialize(){
|
||||
parent::initialize();
|
||||
$this->param = \think\Request::instance()->param();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据修改
|
||||
* @return [bool] [是否成功]
|
||||
*/
|
||||
public function change(){
|
||||
$data = \think\Request::instance()->post();
|
||||
if (isset($data['id']) && $data['id']) {
|
||||
return $this->save($data, array('id'=>$data['id']));
|
||||
}else{
|
||||
return $this->save($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user