get('p_sources'); } public static function tableName() { return '{{%coin_issue_coin}}'; } public function rules() { return [ [['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'charge'], 'required'], [['total', 'category', 'platform_id', 'chain_id'], 'integer'], ['introduction', 'string', 'length' => [1, 20]], ['symbol', 'string', 'length' => [1, 20]], ['msg', 'string', 'length' => [1, 10]], ['name', 'string', 'length' => [1, 6]], ['status', 'in', 'range' => [1, 2, 0]], ['symbol', 'unique'], ]; } public function scenarios() { $scenarios = [ self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'charge'], self:: SCENARIOS_UPDATE => ['status', 'msg'], ]; return array_merge(parent:: scenarios(), $scenarios); } // public function fields() // { // return [ // 'name', // 'symbol', // 'total', // 'owner', // 'introduction', // 'category', // 'chain_id', // 'charge' // ]; // } public function attributeLabels() { return [ 'name' => 'Token简称', 'symbol' => 'Token全称', 'total' => '发行数量', 'owner' => '接收地址', 'introduction' => 'Token简介', 'category' => '是否增发', 'chain_id' => '平行链名称', 'charge' => '手续费', 'msg' => '失败原因', 'status' => '状态' ]; } /** * 获取状态数组 * @return array */ public static function getAgentStatus() { return [ self::STATUS_SUCCESS => '发行成功', self::STATUS_FAIL => '发行失败', ]; } public function getChain() { return $this->hasOne(CoinIssueChain::className(), ['id' => 'chain_id']); } }