<?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();
|
}
|
}
|