2db47680
hexiaodong
chore: 初始提交 php 遗...
|
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
|
<?php
namespace app\admin\model\fastflow;
use app\admin\model\Admin;
use app\admin\model\fastflow\flow\Bill;
use fastflow\api;
use think\Model;
class Carbon extends Model
{
// 表名
protected $name = 'fastflow_carbon';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
'is_read_text',
'bill_name',
'bill_row_title',
'sender_name',
];
public function getIsReadList()
{
return ['0' => __('Is_Read 0'), '1' => __('Is_Read 1')];
}
public function getBillNameAttr($value, $data)
{
$bill_row = Bill::where(['bill_table' => $data['bill']])->find();
if ($bill_row) {
return $bill_row['bill_name'];
}
return $data['bill'];
}
public function getBillRowTitleAttr($value, $data)
{
$api = new api();
$bill_row = $api->getBillRow($data['bill'], $data['bill_id']);
if ($bill_row){
$name = '';
if (isset($bill_row['name'])) {
$name = $bill_row['name'];
}
elseif (isset($bill_row['titile'])){
$name = $bill_row['titile'];
}
return $name;
}
return '';
}
public function getSenderNameAttr($value, $data)
{
$admin=Admin::find($data['sender_id']);
if ($admin){
return $admin['nickname'];
}
else{
return '';
}
}
public function getIsReadTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['is_read']) ? $data['is_read'] : '');
$list = $this->getIsReadList();
return isset($list[$value]) ? $list[$value] : '';
}
}
|