<?php
|
|
namespace app\shop\controller\branch;
|
|
use app\shop\controller\Controller;
|
use app\shop\model\branch\ActivityComment as ActivityCommentModel;
|
|
/**
|
* 活动评论控制器
|
*/
|
class ActivityComment extends Controller
|
{
|
/**
|
* 评论列表
|
*/
|
public function index()
|
{
|
$model = new ActivityCommentModel;
|
$postData = $this->postData();
|
|
$where[] = ['is_delete', '=', 0];
|
|
// 列表
|
$list = $model->getList($postData);
|
// 待审核数量
|
$num = $model->getStatusNum($where);
|
return $this->renderSuccess('', compact('list', 'num'));
|
}
|
|
/**
|
* 评论详情
|
*/
|
public function detail($comment_id)
|
{
|
$data = ActivityCommentModel::detail($comment_id, ['user', 'activity', 'activity.branch', 'images'=>['file']]);
|
return $this->renderSuccess('', compact('data'));
|
}
|
|
/**
|
* 更新评论
|
*/
|
public function edit($comment_id)
|
{
|
$model = ActivityCommentModel::detail($comment_id);
|
if ($model->editComment($this->postData())) {
|
return $this->renderSuccess('修改成功');
|
}
|
return $this->renderError('修改失败');
|
}
|
|
/**
|
* 删除评论
|
*/
|
public function delete($comment_id)
|
{
|
$model = new ActivityCommentModel();
|
if (!$model->setDelete($comment_id)) {
|
return $this->renderError('删除失败');
|
}
|
return $this->renderSuccess('删除成功');
|
}
|
}
|