Evaluate.php
1.0 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
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2020/5/7
* Time: 14:29
*/
namespace app\index\model;
use think\Model;
class Evaluate extends Model
{
public function getThumbnailAttr($value){
$images = [];
if(!empty($value)){
$images = explode(',',$value);
foreach($images as $key => $image){
$images[$key] = cdnurl($image);
}
}
return $images;
}
public function getCreatetimeAttr($value){
return date('Y-m-d H:i:s',$value);
}
public function countData($where){
$where['status'] = ['eq','1'];
$data = $this->where($where)->count();
return $data;
}
public function selectData($where){
$where['status'] = ['eq','1'];
$data = $this->where($where)->order('createtime desc')->select();
$userModel = new User();
foreach($data as $key => $vo){
$data[$key]['user'] = $userModel->findData(['id'=>$vo['user_id']]);
}
return $data;
}
}