FourBaogao.php
3.5 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
namespace app\admin\model;
use think\Model;
class FourBaogao extends Model
{
// 表名
protected $name = 'four_baogao';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'type_text'
];
public function getTypeList()
{
return ['1' => __('Type 1'), '2' => __('Type 2'), '3' => __('Type 3'), '4' => __('Type 4'), '5' => __('Type 5'), '6' => __('Type 6'), '7' => __('Type 7'), '8' => __('Type 8'), '9' => __('Type 9'), '10' => __('Type 10')];
}
public function getSportTypeList()
{
return ['1' => __('Sport_type 1'), '2' => __('Sport_type 2')];
}
public function getEatTypeList()
{
return ['1' => __('Eat_type 1'), '2' => __('Eat_type 2')];
}
public function getBodyTypeList()
{
return ['1' => __('Body_type 1'), '2' => __('Body_type 2')];
}
public function getSeasonTypeList()
{
return ['1' => __('Season_type 1'), '2' => __('Season_type 2')];
}
public function getWorkTypeList()
{
return ['1' => __('Work_type 1'), '2' => __('Work_type 2')];
}
public function getFaceTypeList()
{
return ['1' => __('Face_type 1'), '2' => __('Face_type 2')];
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getSportTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sport_type']) ? $data['sport_type'] : '');
$list = $this->getSportTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getEatTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['eat_type']) ? $data['eat_type'] : '');
$list = $this->getEatTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getBodyTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['bdoy_type']) ? $data['bdoy_type'] : '');
$list = $this->getBodyTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getSeasonTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['season_type']) ? $data['season_type'] : '');
$list = $this->getSeasonTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getWorkTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['work_type']) ? $data['work_type'] : '');
$list = $this->getWorkTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getFaceTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['face_type']) ? $data['face_type'] : '');
$list = $this->getFaceTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function activitycard()
{
return $this->belongsTo('ActivityCard', 'card_ids', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function goods()
{
return $this->belongsTo('Goods', 'eat_Goods_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}