1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace common\models\psources;
use Yii;
use common\core\BaseActiveRecord;
class CoinCurrency extends BaseActiveRecord
{
public static function getDb()
{
return Yii::$app->get('p_sources');
}
public static function tableName()
{
return '{{coin_currency}}';
}
//定义场景
const SCENARIOS_CREATE = 'create';
const SCENARIOS_UPDATE = 'update';
public function rules()
{
return [
[['pj_id', 'pj_name'], 'required'],
[['pj_symbol', 'lang'], 'safe'],
[['platform_id', 'currency_id'], 'integer'],
];
}
public function attributeLabels()
{
return [
'platform_id' => '钱包Id',
'currency_id' => '货币Id',
];
}
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['pj_id', 'pj_name', 'pj_symbol', 'lang'],
self:: SCENARIOS_UPDATE => ['id', 'pj_id', 'pj_name', 'pj_symbol', 'lang'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
}