get('p_sources'); } public static function tableName() { return '{{%coin_ctoc_transfer}}'; } //定义场景 const SCENARIOS_CREATE = 'create'; public function rules() { return [ [['is_sell', 'type', 'address', 'token_name', 'market_name', 'price', 'amount', 'step', 'txhex', 'transfer_url', 'transfer_number', 'consensus'], 'required'], [['send_result', 'query_result', 'msg', 'consensus_platform'], 'safe'], ['consensus_platform', 'verfiyConsensusPlatform'] ]; } public function verfiyConsensusPlatform($attribute, $params) { if ($this->consensus == self::CONSENSUE_YES && empty($this->consensus_platform)){ $this->addError($attribute, '共识平台错误'); return false; } } public function scenarios() { $scenarios = [ self:: SCENARIOS_CREATE => ['is_sell', 'type', 'address', 'token_name', 'market_name', 'price', 'amount', 'step', 'txhex', 'transfer_url', 'transfer_number', 'consensus', 'consensus_platform'], ]; return array_merge(parent:: scenarios(), $scenarios); } }