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
<?php
 
namespace app\common\model\plus\release;
 
use app\common\model\BaseModel;
 
/**
 * 模型
 */
class Evaluate extends BaseModel
{
    protected $name = 'release_project_evaluate';
    protected $pk = 'id';
 
    /**
     * 关联会员记录表
     * @return \think\model\relation\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo('app\\common\\model\\user\\User');
    }
 
    /**
     * 预售结束时间
     */
    public function getImageListAttr($value, $data)
    {
        return (isset($data['image_list']) && $data['image_list']) ? json_decode($data['image_list'],true) : '';
    }
 
    /**
     * 获取详情
     */
    public static function detail($id)
    {
        return (new static())->find($id);
    }
 
    /**
     * 获取列表记录
     */
    public static function getAll($prject_id)
    {
        return (new static())->with('user')->where('project_id', '=', $prject_id)
            ->order(['create_time' => 'asc'])
            ->select();
    }
 
     /**
     * 获取好评条数
     */
    public static function getGoodsEvaluateNum($project_user_id)
    {
        return (new static())->where('project_user_id', '=', $project_user_id)
            ->where('score', '=', 10)
            ->count();
    }
}