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 "{{%core_file}}". |
|
9 |
* |
|
10 |
* @property int $id |
|
11 |
* @property int $mall_id |
|
12 |
* @property int $mch_id |
|
13 |
* @property string $file_name 文件名称 |
|
14 |
* @property string $percent 下载进度 |
|
15 |
* @property int $status 是否完成 |
|
16 |
* @property int $is_delete |
|
17 |
* @property string $created_at |
|
18 |
* @property string $updated_at |
|
19 |
* @property string $deleted_at |
|
20 |
*/ |
|
21 |
class CoreFile extends \app\models\ModelActiveRecord |
|
22 |
{ |
|
23 |
/** |
|
24 |
* {@inheritdoc} |
|
25 |
*/ |
|
26 |
public static function tableName() |
|
27 |
{ |
|
28 |
return '{{%core_file}}'; |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* {@inheritdoc} |
|
33 |
*/ |
|
34 |
public function rules() |
|
35 |
{ |
|
36 |
return [ |
|
37 |
[['id', 'mall_id', 'mch_id', 'status', 'is_delete'], 'integer'], |
|
38 |
[['percent'], 'number'], |
|
39 |
[['created_at', 'updated_at', 'deleted_at'], 'safe'], |
|
40 |
[['file_name'], 'string', 'max' => 255], |
|
41 |
]; |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* {@inheritdoc} |
|
46 |
*/ |
|
47 |
public function attributeLabels() |
|
48 |
{ |
|
49 |
return [ |
|
50 |
'id' => 'ID', |
|
51 |
'mall_id' => 'Mall ID', |
|
52 |
'mch_id' => 'Mch ID', |
|
53 |
'file_name' => '文件名称', |
|
54 |
'percent' => '下载进度', |
|
55 |
'status' => '是否完成', |
|
56 |
'is_delete' => 'Is Delete', |
|
57 |
'created_at' => 'Created At', |
|
58 |
'updated_at' => 'Updated At', |
|
59 |
'deleted_at' => 'Deleted At', |
|
60 |
]; |
|
61 |
} |
|
62 |
|
|
63 |
|
|
64 |
public function getStatusText($item) |
|
65 |
{ |
|
66 |
switch ($item->status) { |
|
67 |
case 0: |
|
68 |
return '生成中'; |
|
69 |
break; |
|
70 |
case 1: |
|
71 |
return '已生成'; |
|
72 |
break; |
|
73 |
case 2: |
|
74 |
return '生成异常'; |
|
75 |
break; |
|
76 |
|
|
77 |
default: |
|
78 |
return '未知'; |
|
79 |
break; |
|
80 |
} |
|
81 |
} |
|
82 |
} |