update:rewrite request post,自动填入 creator_id 数据
This commit is contained in:
parent
e2399b6aa6
commit
538006c3c6
@ -4,6 +4,7 @@ namespace catcher\base;
|
|||||||
use app\Request;
|
use app\Request;
|
||||||
use catcher\exceptions\FailedException;
|
use catcher\exceptions\FailedException;
|
||||||
use catcher\exceptions\ValidateFailedException;
|
use catcher\exceptions\ValidateFailedException;
|
||||||
|
use think\App;
|
||||||
|
|
||||||
class CatchRequest extends Request
|
class CatchRequest extends Request
|
||||||
{
|
{
|
||||||
@ -60,9 +61,27 @@ class CatchRequest extends Request
|
|||||||
// 设置默认参数
|
// 设置默认参数
|
||||||
if ($this->needCreatorId) {
|
if ($this->needCreatorId) {
|
||||||
$this->param['creator_id'] = $this->user()->id;
|
$this->param['creator_id'] = $this->user()->id;
|
||||||
$this->post['creator_id'] = $this->user()->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
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
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user