<?php
|
|
namespace app\api\controller\plus\release;
|
|
use app\api\controller\Controller;
|
use app\api\model\plus\release\Evaluate as EvaluateModel;
|
|
|
/**
|
* 模型
|
*/
|
class Evaluate extends Controller
|
{
|
// 当前用户
|
private $user;
|
|
/**
|
* 构造方法
|
*/
|
public function initialize()
|
{
|
// 用户信息
|
$this->user = $this->getUser();;
|
}
|
|
/**
|
* 列表
|
*/
|
public function lists($project_id, $scoreType = -1)
|
{
|
$model = new EvaluateModel;
|
$list = $model->getEvaluateList($project_id, $scoreType, $this->postData());
|
$total = $model->getTotal($project_id);
|
return $this->renderSuccess('', compact('list', 'total'));
|
}
|
|
|
|
/**
|
*评论
|
*/
|
public function evaluate()
|
{
|
$params = $this->request->param();
|
$model = new EvaluateModel;
|
$params['user_id'] = $this->user['user_id'];
|
$params['image_list'] = json_decode($params['image_list'],true);
|
$result = $model->evaluate($params);
|
if(!$result){
|
return $this->renderError($model->getError() ?: '评论失败');
|
}
|
return $this->renderSuccess('评论成功');
|
}
|
|
}
|