This commit is contained in:
2024-10-29 14:04:59 +08:00
commit 48bf3e6f33
2839 changed files with 762707 additions and 0 deletions

83
app/admin/controller/Report.php Executable file
View File

@@ -0,0 +1,83 @@
<?php
namespace app\admin\controller;
use think\Lang;
use think\Loader;
use think\Config;
class Report extends BaseController {
public function test()
{
return view();
}
public function index() {
$this->redirect('/admin/report/lists');
}
public function lists() {
$arg_where['stat'] = 0;
$arg_order = ['id' => 'desc'];
$dataObject = model('report')->getPageList($arg_where, $arg_order);
// tiaoshi($dataObject->items());die;
$value = [
'list' => $dataObject->isEmpty() ? null : $dataObject->items(),
'page' => $dataObject->render(),
];
$this->assign($value);
return $this->fetch();
}
public function handle_report()
{
$id = $this->request->param('id');
if ($id < 0)
return $this->error('数据错误');
model('report')->where(['id' => $id])->update(['status' => 1]);
return $this->success('处理成功', url('/admin/report/lists'));
}
public function detail()
{
$id = $this->request->param('id');
if ($id < 0)
return $this->error('数据错误');
$report = model('report')->where(['id' => $id, 'stat' => 0])->find();
if (empty($report))
return $this->error('举报信息有误');
$this->assign('report', $report);
return $this->fetch();
}
public function delete($id = 0) {
$id = intval($id);
if ($id > 0) {
$result = model('report')->deleteRow($id);
if ($result) {
return $this->success(Lang::get('operation successed'), url('/admin/report/lists'));
} else {
return $this->error(Lang::get('operation failed'));
}
}
return $this->error(Lang::get('incorrect operation'));
}
public function deletes() {
$ids = $this->request->post('ids');
if ($this->request->isPost() && $ids) {
$result = model('report')->deleteRows($ids);
if ($result) {
return $this->success(Lang::get('operation successed'), url('/admin/report/lists'));
} else {
return $this->error(Lang::get('operation failed'));
}
}
return $this->error(Lang::get('incorrect operation'));
}
}