update:rewrite request post,自动填入 creator_id 数据

This commit is contained in:
JaguarJack 2020-10-15 10:00:35 +08:00
parent e2399b6aa6
commit 538006c3c6

View File

@ -4,6 +4,7 @@ namespace catcher\base;
use app\Request;
use catcher\exceptions\FailedException;
use catcher\exceptions\ValidateFailedException;
use think\App;
class CatchRequest extends Request
{
@ -60,9 +61,27 @@ class CatchRequest extends Request
// 设置默认参数
if ($this->needCreatorId) {
$this->param['creator_id'] = $this->user()->id;
$this->post['creator_id'] = $this->user()->id;
}
return true;
}
/**
* rewrite post
*
* @time 2020年10月15日
* @param string $name
* @param null $default
* @param string $filter
* @return array|mixed|null
*/
public function post($name = '', $default = null, $filter = '')
{
if ($this->needCreatorId) {
$this->post['creator_id'] = $this->user()->id;
}
return parent::post($name, $default, $filter); // TODO: Change the autogenerated stub
}
}