32], [['title'], 'string', 'max' => 128], [['amount'], function ($attribute, $params) { if (!is_float($this->amount) && !is_int($this->amount) && !is_double($this->amount)) { $this->addError($attribute, '`amount`必须是数字类型。'); } }], [['amount'], 'number', 'min' => 0.01, 'max' => 100000000], [['transfer_type'], 'in', 'range' => [1,2]],//@TODO 其他 ['user', function ($attribute, $param) { if (!$this->user instanceof User) { $this->addError($attribute, 'user必须是app\\models\User的对象'); } }] ]; } /** * PaymentTransfer constructor. * @param array $config */ public function __construct(array $config = []) { parent::__construct($config); if(!$this->validate()){ $this->dde($this->errors); } } }