139 lines
3.8 KiB
PHP
139 lines
3.8 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 小说系统 评论管理 [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\admin\controller;
|
|
use app\common\controller\Admin;
|
|
|
|
class Feedback extends Admin {
|
|
|
|
public function _initialize() {
|
|
parent::_initialize();
|
|
}
|
|
|
|
public function index() {
|
|
$keyword = input('keyword');
|
|
$model = input('model')?input('model'):1;
|
|
$map['content'] = array("LIKE", "%$keyword%");
|
|
if($model==2){
|
|
$list = db('CartoonFeedback')->where($map)->order('id DESC')->paginate(20);
|
|
}else{
|
|
$list = db('novel_review')->where($map)->order('id DESC')->paginate(20);
|
|
}
|
|
$this->assign('model', $model);
|
|
$this->assign('keyword', $keyword);
|
|
$this->assign('list', $list);
|
|
$this->assign('page', $list->render());
|
|
$this->setMeta("评论列表");
|
|
return $this->fetch();
|
|
}
|
|
|
|
|
|
public function replies() {
|
|
$keyword = input('keyword');
|
|
$model = input('model')?input('model'):2;
|
|
$map['content'] = array("LIKE", "%$keyword%");
|
|
if($model==2){
|
|
$map['feed_id'] = input('reviewid');
|
|
$list = db('cartoon_feedback_review')->where($map)->order('id DESC')->paginate(20);
|
|
}else{
|
|
$map['reviewid'] = input('reviewid');
|
|
$list = db('novel_replies')->where($map)->order('id DESC')->paginate(20);
|
|
}
|
|
$this->assign('model', $model);
|
|
$this->assign('keyword', $keyword);
|
|
$this->assign('list', $list);
|
|
$this->assign('page', $list->render());
|
|
$this->setMeta([["url"=>url('feedback/index',array('model'=>$model)),"title"=>"评论列表"],["url"=>'',"title"=>"回复列表"]]);
|
|
return $this->fetch();
|
|
}
|
|
|
|
|
|
/**
|
|
* 内容删除
|
|
* @author netlife <40150501@qq.com>
|
|
*/
|
|
public function del() {
|
|
$id = $this->getArrayParam('id');
|
|
$model = input('model');
|
|
if (empty($id)) {
|
|
return $this->error("非法操作!");
|
|
}
|
|
|
|
$map['id'] = array('IN', $id);
|
|
if($model==2){
|
|
$result = db('CartoonFeedback')->where($map)->delete();
|
|
}else{
|
|
$result = db('novel_review')->where($map)->delete();
|
|
}
|
|
if (false !== $result) {
|
|
//记录行为
|
|
action_log('delete_content', 'content', $result, session('user_auth.uid'));
|
|
return $this->success("删除成功!");
|
|
} else {
|
|
return $this->error("删除失败!");
|
|
}
|
|
}
|
|
/******回复删除****/
|
|
public function repliesdel() {
|
|
$id = $this->getArrayParam('id');
|
|
$model = input('model');
|
|
if (empty($id)) {
|
|
return $this->error("非法操作!");
|
|
}
|
|
|
|
$map['id'] = array('IN', $id);
|
|
if($model==2){
|
|
$result = db('cartoon_feedback_review')->where($map)->delete();
|
|
}else{
|
|
$result = db('novel_replies')->where($map)->delete();
|
|
}
|
|
if (false !== $result) {
|
|
//记录行为
|
|
action_log('delete_content', 'content', $result, session('user_auth.uid'));
|
|
return $this->success("删除成功!");
|
|
} else {
|
|
return $this->error("删除失败!");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 设置状态
|
|
* @author netlife <40150501@qq.com>
|
|
*/
|
|
public function status($id, $status) {
|
|
$model = input('model');
|
|
$map['id'] = $id;
|
|
if($model==2){
|
|
$result = db('CartoonFeedback')->where($map)->setField('status', $status);
|
|
}else{
|
|
$result = db('novel_review')->where($map)->setField('status', $status);
|
|
}
|
|
if (false !== $result) {
|
|
return $this->success("操作成功!");
|
|
} else {
|
|
return $this->error("操作失败!!");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 设置回复状态
|
|
* @author netlife <40150501@qq.com>
|
|
*/
|
|
public function repliesstatus($id, $status) {
|
|
$model = input('model');
|
|
$map['id'] = $id;
|
|
if($model==2){
|
|
$result = db('cartoon_feedback_review')->where($map)->setField('status', $status);
|
|
}else{
|
|
$result = db('novel_replies')->where($map)->setField('status', $status);
|
|
}
|
|
if (false !== $result) {
|
|
return $this->success("操作成功!");
|
|
} else {
|
|
return $this->error("操作失败!!");
|
|
}
|
|
}
|
|
} |