commit | author | age
|
2207d6
|
1 |
<?php |
W |
2 |
|
|
3 |
namespace app\models; |
|
4 |
|
|
5 |
use Yii; |
|
6 |
|
|
7 |
/** |
|
8 |
* This is the model class for table "zjhj_bd_finance". |
|
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 string $name 真实姓名 |
|
25 |
* @property string $model 提现插件(share,bonus,stock,region,mch) |
|
26 |
* @property int $transfer_status 0.待转账 | 1.已转账 | 2.拒绝转账 |
|
27 |
* @property string $phone 手机号 |
|
28 |
* @property User $user |
|
29 |
*/ |
|
30 |
class Finance extends ModelActiveRecord |
|
31 |
{ |
|
32 |
/** |
|
33 |
* {@inheritdoc} |
|
34 |
*/ |
|
35 |
public static function tableName() |
|
36 |
{ |
|
37 |
return '{{%finance}}'; |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* {@inheritdoc} |
|
42 |
*/ |
|
43 |
public function rules() |
|
44 |
{ |
|
45 |
return [ |
|
46 |
[['mall_id', 'user_id', 'created_at', 'updated_at', 'deleted_at'], 'required'], |
|
47 |
[['mall_id', 'user_id', 'status', 'is_delete', 'transfer_status'], 'integer'], |
|
48 |
[['price', 'service_charge'], 'number'], |
|
49 |
[['extra', 'content'], 'string'], |
|
50 |
[['created_at', 'updated_at', 'deleted_at'], 'safe'], |
|
51 |
[['order_no', 'type', 'name', 'model', 'phone'], 'string', 'max' => 255], |
|
52 |
]; |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* {@inheritdoc} |
|
57 |
*/ |
|
58 |
public function attributeLabels() |
|
59 |
{ |
|
60 |
return [ |
|
61 |
'id' => 'ID', |
|
62 |
'mall_id' => 'Mall ID', |
|
63 |
'user_id' => 'User ID', |
|
64 |
'order_no' => 'Order No', |
|
65 |
'price' => 'Price', |
|
66 |
'service_charge' => 'Service Charge', |
|
67 |
'type' => 'Type', |
|
68 |
'extra' => 'Extra', |
|
69 |
'status' => 'Status', |
|
70 |
'is_delete' => 'Is Delete', |
|
71 |
'created_at' => 'Created At', |
|
72 |
'updated_at' => 'Updated At', |
|
73 |
'deleted_at' => 'Deleted At', |
|
74 |
'content' => 'Content', |
|
75 |
'name' => 'Name', |
|
76 |
'model' => 'Model', |
|
77 |
'transfer_status' => 'Transfer Status', |
|
78 |
'phone' => 'Phone', |
|
79 |
]; |
|
80 |
} |
|
81 |
|
|
82 |
const PAY_TYPE = 'pay_type'; // 提现方式 |
|
83 |
const PAY_TYPE_LIST = ['auto' => '自动打款', 'wechat' => '微信线下转账', 'alipay' => '支付宝线下转账', |
|
84 |
'bank' => '银行线下转账', 'balance' => '提现到余额']; |
|
85 |
const CASH_SERVICE_CHARGE = 'cash_service_charge'; // 提现手续费 |
|
86 |
|
|
87 |
public function getUser() |
|
88 |
{ |
|
89 |
return $this->hasOne(User::className(), ['id' => 'user_id']); |
|
90 |
} |
|
91 |
|
|
92 |
public function getStatusText($status) |
|
93 |
{ |
|
94 |
$text = ['申请中', '同意申请,待打款', '已打款', '驳回']; |
|
95 |
return isset($text[$status]) ? $text[$status] : '未知状态' . $status; |
|
96 |
} |
|
97 |
|
|
98 |
public function getTypeText($type) |
|
99 |
{ |
|
100 |
$typeList = [ |
|
101 |
'auto' => '自动打款', |
|
102 |
'wechat' => '微信打款', |
|
103 |
'alipay' => '支付宝打款', |
|
104 |
'bank' => '银行转账', |
|
105 |
'balance' => '打款到余额' |
|
106 |
]; |
|
107 |
return isset($typeList[$type]) ? $typeList[$type] : '未知类型:' . $type; |
|
108 |
} |
|
109 |
|
|
110 |
public function getTypeText2($type) |
|
111 |
{ |
|
112 |
$typeList = [ |
|
113 |
'auto' => '自动打款', |
|
114 |
'wechat' => '微信钱包', |
|
115 |
'alipay' => '支付宝', |
|
116 |
'bank' => '银行卡', |
|
117 |
'balance' => '余额' |
|
118 |
]; |
|
119 |
return isset($typeList[$type]) ? $typeList[$type] : '未知类型:' . $type; |
|
120 |
} |
|
121 |
} |