get('p_sources'); } public function rules() { return [ [['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id'], 'required'], [['total', 'category', 'platform_id', 'chain_id'], 'integer'], ['introduction', 'string', 'length' => [1, 20]], ['symbol', 'string', 'length' => [1, 20]], ['name', 'string', 'length' => [1, 6]], ['symbol', 'unique'], [['total'], 'issuableAmout'] ]; } public function isExist($attribute, $params) { var_dump($attribute, $params);exit; } public function issuableAmout($attribute, $params) { return true; } public function scenarios() { $scenarios = [ self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id'], self:: SCENARIOS_UPDATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id'], ]; return array_merge(parent:: scenarios(), $scenarios); } public function attributeLabels() { return [ 'name' => 'Token简称', 'symbol' => 'Token全称', 'total' => '发行数量', 'owner' => '接收地址', 'introduction' => 'Token简介', 'category' => '是否增加发', 'chain_id' => '平行链名称' ]; } public function getIsNewRecord() { return $this->_issue_coin_list === null; } public function getIssueList($id) { $this->_issue_coin_list = CoinIssueCoin::find() ->where('agent_id = :agent_id', [':agent_id' => $id]) ->one(); if ($this->_issue_coin_list) { $this->agent_id = $this->_issue_coin_list->agent_id; $this->title = $this->_issue_coin_list->title; $this->etitle = $this->_issue_coin_list->etitle; $this->description = $this->_issue_coin_list->description; $this->requirement = $this->_issue_coin_list->requirement; $this->status = $this->_issue_coin_list->status; } return $this->_issue_coin_list; } /** * 保存代理人 * @return boolean */ public function save() { if ($this->validate()) { if ($this->getIsNewRecord()) { $this->_issue_coin_list = new CoinIssueCoin(); } $this->_issue_coin_list->name = $this->name; $this->_issue_coin_list->symbol = $this->symbol; $this->_issue_coin_list->total = $this->total; $this->_issue_coin_list->owner = $this->owner; $this->_issue_coin_list->introduction = $this->introduction; $this->_issue_coin_list->category = $this->category; $this->_issue_coin_list->platform_id = $this->platform_id; $this->_issue_coin_list->chain_id = $this->chain_id; return $this->_issue_coin_list->save(); } else { return false; } } }