public function rules() { return array_merge([[['order_no', 'amount', 'channel', 'currency', 'subject', 'body'], 'required'], ['amount', 'number', 'min' => 1], ['channel', 'in', 'range' => Channel::$allChannel], ['currency', function ($attribute) { if ($this->{$attribute} != 'cny') { $this->addError($attribute, "The currency must be 'cny'"); } }], [['client_ip', 'time_expire', 'description'], 'safe']], parent::rules()); }
public function rules() { return array_merge([[['order_no', 'amount', 'channel', 'currency', 'type', 'description', 'recipient', 'user_name', 'force_check'], 'required'], [['order_no', 'amount'], 'number', 'min' => 1], ['order_no', 'string', 'max' => 50], ['amount', 'number', 'min' => 1], ['channel', 'in', 'range' => [Channel::WX, Channel::WX_PUB]], ['type', 'in', 'range' => ['b2c']], ['currency', function ($attribute) { if ($this->{$attribute} != 'cny') { $this->addError($attribute, "The currency must be 'cny'"); } }], [['description'], 'string', 'max' => 255], [['user_name', 'force_check'], 'safe']], parent::rules()); }