commit | author | age
|
90c639
|
1 |
<?php |
Z |
2 |
|
|
3 |
namespace app\models; |
|
4 |
|
|
5 |
use Yii; |
|
6 |
|
|
7 |
/** |
|
8 |
* This is the model class for table "{{%share_cash}}". |
|
9 |
* |
|
10 |
* @property int $id |
|
11 |
* @property int $mall_id |
|
12 |
* @property int $user_id |
|
13 |
* @property string $order_no 订单号 |
|
14 |
* @property string $price 提现金额 |
|
15 |
* @property string $service_charge 提现手续费(%) |
|
16 |
* @property string $type 提现方式 auto--自动打款 wechat--微信打款 alipay--支付宝打款 bank--银行转账 balance--打款到余额 |
|
17 |
* @property string $extra 额外信息 例如微信账号、支付宝账号等 |
|
18 |
* @property int $status 提现状态 0--申请 1--同意 2--已打款 3--驳回 |
|
19 |
* @property int $is_delete |
|
20 |
* @property string $created_at |
|
21 |
* @property string $updated_at |
|
22 |
* @property string $deleted_at |
|
23 |
* @property string $content |
|
24 |
* @property User $user |
|
25 |
*/ |
|
26 |
class ShareCash extends ModelActiveRecord |
|
27 |
{ |
|
28 |
/** |
|
29 |
* {@inheritdoc} |
|
30 |
*/ |
|
31 |
public static function tableName() |
|
32 |
{ |
|
33 |
return '{{%share_cash}}'; |
|
34 |
} |
|
35 |
|
|
36 |
/** |
|
37 |
* {@inheritdoc} |
|
38 |
*/ |
|
39 |
public function rules() |
|
40 |
{ |
|
41 |
return [ |
|
42 |
[['mall_id', 'user_id', 'created_at', 'updated_at', 'deleted_at'], 'required'], |
|
43 |
[['mall_id', 'user_id', 'status', 'is_delete'], 'integer'], |
|
44 |
[['price', 'service_charge'], 'number'], |
|
45 |
[['extra', 'content'], 'string'], |
|
46 |
[['created_at', 'updated_at', 'deleted_at'], 'safe'], |
|
47 |
[['order_no', 'type'], 'string', 'max' => 255], |
|
48 |
]; |
|
49 |
} |
|
50 |
|
|
51 |
/** |
|
52 |
* {@inheritdoc} |
|
53 |
*/ |
|
54 |
public function attributeLabels() |
|
55 |
{ |
|
56 |
return [ |
|
57 |
'id' => 'ID', |
|
58 |
'mall_id' => 'Mall ID', |
|
59 |
'user_id' => 'User ID', |
|
60 |
'order_no' => '订单号', |
|
61 |
'price' => '提现金额', |
|
62 |
'service_charge' => '提现手续费(%)', |
|
63 |
'type' => '提现方式 auto--自动打款 wechat--微信打款 alipay--支付宝打款 bank--银行转账 balance--打款到余额', |
|
64 |
'extra' => '额外信息 例如微信账号、支付宝账号等', |
|
65 |
'status' => '提现状态 0--申请 1--同意 2--已打款 3--驳回', |
|
66 |
'is_delete' => 'Is Delete', |
|
67 |
'created_at' => 'Created At', |
|
68 |
'updated_at' => 'Updated At', |
|
69 |
'deleted_at' => 'Deleted At', |
|
70 |
'content' => 'Content', |
|
71 |
]; |
|
72 |
} |
|
73 |
|
|
74 |
public function getUser() |
|
75 |
{ |
|
76 |
return $this->hasOne(User::className(), ['id' => 'user_id']); |
|
77 |
} |
|
78 |
|
|
79 |
public function getStatusText($status) |
|
80 |
{ |
|
81 |
$text = ['申请中', '同意申请,待打款', '已打款', '驳回']; |
|
82 |
return isset($text[$status]) ? $text[$status] : '未知状态' . $status; |
|
83 |
} |
|
84 |
|
|
85 |
public function getTypeText($type) |
|
86 |
{ |
|
87 |
$typeList = [ |
|
88 |
'auto' => '自动打款', |
|
89 |
'wechat' => '微信打款', |
|
90 |
'alipay' => '支付宝打款', |
|
91 |
'bank' => '银行转账', |
|
92 |
'balance' => '打款到余额' |
|
93 |
]; |
|
94 |
return isset($typeList[$type]) ? $typeList[$type] : '未知类型:' . $type; |
|
95 |
} |
|
96 |
|
|
97 |
public function getTypeText2($type) |
|
98 |
{ |
|
99 |
$typeList = [ |
|
100 |
'auto' => '自动打款', |
|
101 |
'wechat' => '微信钱包', |
|
102 |
'alipay' => '支付宝', |
|
103 |
'bank' => '银行卡', |
|
104 |
'balance' => '余额' |
|
105 |
]; |
|
106 |
return isset($typeList[$type]) ? $typeList[$type] : '未知类型:' . $type; |
|
107 |
} |
|
108 |
} |