commit | author | age
|
90c639
|
1 |
<?php |
Z |
2 |
|
|
3 |
namespace app\models; |
|
4 |
|
|
5 |
use Yii; |
|
6 |
use app\models\MallMembers; |
|
7 |
|
|
8 |
/** |
|
9 |
* This is the model class for table "{{%user_identity}}". |
|
10 |
* |
|
11 |
* @property int $id 用户身份表 |
|
12 |
* @property int $user_id |
|
13 |
* @property int $is_super_admin 是否为超级管理员 |
|
14 |
* @property int $is_admin 是否为管理员 |
|
15 |
* @property int $is_operator 是否为操作员 |
|
16 |
* @property int $member_level 会员等级:0.普通成员 |
|
17 |
* @property int $is_distributor 是否为分销商 |
|
18 |
* @property int $is_delete 是否删除 |
|
19 |
*/ |
|
20 |
class UserIdentity extends ModelActiveRecord |
|
21 |
{ |
|
22 |
/** |
|
23 |
* {@inheritdoc} |
|
24 |
*/ |
|
25 |
public static function tableName() |
|
26 |
{ |
|
27 |
return '{{%user_identity}}'; |
|
28 |
} |
|
29 |
|
|
30 |
/** |
|
31 |
* {@inheritdoc} |
|
32 |
*/ |
|
33 |
public function rules() |
|
34 |
{ |
|
35 |
return [ |
|
36 |
[['is_super_admin', 'is_admin', 'is_operator', 'member_level', |
|
37 |
'is_distributor', 'user_id', 'is_delete'], 'integer'], |
|
38 |
]; |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* {@inheritdoc} |
|
43 |
*/ |
|
44 |
public function attributeLabels() |
|
45 |
{ |
|
46 |
return [ |
|
47 |
'id' => 'ID', |
|
48 |
'user_id' => 'User ID', |
|
49 |
'is_super_admin' => 'Is Super Admin', |
|
50 |
'is_admin' => 'Is Admin', |
|
51 |
'is_operator' => 'Is Operator', |
|
52 |
'is_delete' => 'Is Delete', |
|
53 |
'member_level' => 'Member Level', |
|
54 |
'is_distributor' => 'Is Distributor', |
|
55 |
]; |
|
56 |
} |
|
57 |
|
|
58 |
public function getMember() |
|
59 |
{ |
|
60 |
return $this->hasOne(MallMembers::className(), ['level' => 'member_level'])->andWhere(['mall_id' => \Yii::$app->mall->id, 'is_delete' => 0]); |
|
61 |
} |
|
62 |
} |