diff --git a/application/admin/controller/fc/Report.php b/application/admin/controller/fc/Report.php index 5b88a2e..62cbccc 100644 --- a/application/admin/controller/fc/Report.php +++ b/application/admin/controller/fc/Report.php @@ -6,19 +6,24 @@ use app\common\controller\Backend; use think\Db; /** - * 同城-举报 + * 同城-举报管理 * - * @icon fa fa-circle-o + * @icon fa fa-flag */ class Report extends Backend { - /** * FcReport模型对象 * @var \app\admin\model\FcReport */ protected $model = null; + /** + * 控制器初始化方法 + * 绑定数据模型与状态字典 + * + * @return void + */ public function _initialize() { parent::_initialize(); @@ -26,34 +31,423 @@ class Report extends Backend $this->view->assign("statusList", $this->model->getStatusList()); } - - /** - * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 - * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 - * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + * 举报详情与处置工作台 + * 聚合全景信息:举报方画像(实名/历史举报数)、被举报方画像(账号状态/发帖数/被举报总数)、 + * 被举报标的物全息数据(帖子交易要素/微信号/价格/完整正文/附图,或评价原文/关联原帖背景/双方回复)、 + * 用户举证凭证(大图预览)以及联动处置工作台。 + * + * @param int|null $ids 举报记录ID + * @return string */ + public function detail($ids = null) + { + $id = $ids ? $ids : $this->request->param('ids'); + $row = $this->model->get($id); + if (!$row) { + $this->error(__('No Results were found')); + } + $row = $row->toArray(); + $row['createtime_text'] = !empty($row['createtime']) ? date('Y-m-d H:i:s', (int)$row['createtime']) : '-'; + $row['updatetime_text'] = !empty($row['updatetime']) ? date('Y-m-d H:i:s', (int)$row['updatetime']) : '-'; + $row['status_tag_text'] = $row['status'] === 'handled' ? '已处理完毕' : '待核实处理'; + $row['status_tag_class'] = $row['status'] === 'handled' ? 'fc-tag-handled' : 'fc-tag-pending'; + $row['type_tag_text'] = $row['target_type'] === 'post' ? '信息举报' : '评价举报'; + $row['type_tag_class'] = $row['target_type'] === 'post' ? 'fc-tag-post' : 'fc-tag-comment'; + + // 1. 举报人(投诉方)画像 + $reporterUser = Db::name('user')->where('id', (int)$row['reporter_id'])->find(); + $reporterExt = $reporterUser ? Db::name('fc_user_ext')->where('user_id', $reporterUser['id'])->find() : null; + $reporterReportCount = Db::name('fc_report')->where('reporter_id', (int)$row['reporter_id'])->count(); + + $reporter = [ + 'id' => (int)$row['reporter_id'], + 'nickname' => $reporterUser ? ($reporterUser['nickname'] ?: $reporterUser['username']) : '未注册/匿名', + 'username' => $reporterUser['username'] ?? '-', + 'mobile' => $reporterUser['mobile'] ?? '未绑定', + 'avatar' => $reporterUser['avatar'] ?? '', + 'status' => $reporterUser['status'] ?? 'normal', + 'user_type' => $reporterExt ? ($reporterExt['user_type'] == 2 ? '商家' : '个人') : '个人', + 'realname' => $reporterExt['realname'] ?? '', + 'realname_status'=> $reporterExt ? (int)$reporterExt['realname_status'] : 0, + 'realname_text' => ($reporterExt && $reporterExt['realname_status'] == 1) ? ('已实名 (' . ($reporterExt['realname'] ?: '已认证') . ')') : '未实名认证', + 'realname_class' => ($reporterExt && $reporterExt['realname_status'] == 1) ? 'text-success' : 'text-muted', + 'report_count' => (int)$reporterReportCount, + 'createtime' => !empty($reporterUser['createtime']) ? date('Y-m-d', $reporterUser['createtime']) : '-', + ]; + + // 2. 被举报标的与被举报人画像 + $targetInfo = []; + $targetImages = []; + $targetAuthor = []; + $relatedPost = []; // 评价举报时关联的原帖全貌 + + // 本标的累计被举报次数 + $targetTotalReports = Db::name('fc_report') + ->where('target_type', $row['target_type']) + ->where('target_id', $row['target_id']) + ->count(); + + if ($row['target_type'] === 'post') { + $post = Db::name('fc_post')->where('id', (int)$row['target_id'])->find(); + if ($post) { + $categoryName = (string)Db::name('fc_category')->where('id', $post['category_id'])->value('name'); + $authorUser = Db::name('user')->where('id', $post['user_id'])->find(); + $authorExt = $authorUser ? Db::name('fc_user_ext')->where('user_id', $authorUser['id'])->find() : null; + + // 作者名下发帖总数与被举报总数 + $authorPostCount = Db::name('fc_post')->where('user_id', $post['user_id'])->count(); + $authorReportedCount = Db::name('fc_report')->where('target_type', 'post')->where('target_id', 'in', function ($q) use ($post) { + $q->name('fc_post')->where('user_id', $post['user_id'])->field('id'); + })->count(); + + $authorStatus = $authorUser ? ($authorUser['status'] ?? 'normal') : 'normal'; + $targetAuthor = [ + 'id' => $post['user_id'], + 'nickname' => $authorUser ? ($authorUser['nickname'] ?: $authorUser['username']) : ('用户' . $post['user_id']), + 'mobile' => $authorUser['mobile'] ?? '-', + 'status' => $authorStatus, + 'status_text' => $authorStatus === 'normal' ? '账号正常' : '账号已受限', + 'status_class' => $authorStatus === 'normal' ? 'label-success' : 'label-danger', + 'user_type' => $authorExt ? ($authorExt['user_type'] == 2 ? '商家' : '个人') : ($post['identity_type'] == 2 ? '商家' : '个人'), + 'realname' => $authorExt['realname'] ?? '', + 'realname_status'=> $authorExt ? (int)$authorExt['realname_status'] : 0, + 'realname_text' => ($authorExt && $authorExt['realname_status'] == 1) ? ('已实名 (' . ($authorExt['realname'] ?: '已认证') . ')') : '未实名', + 'realname_class' => ($authorExt && $authorExt['realname_status'] == 1) ? 'text-success' : 'text-muted', + 'is_member' => $authorExt ? (int)$authorExt['is_member'] : 0, + 'member_level' => $authorExt['member_level'] ?? '', + 'post_count' => (int)$authorPostCount, + 'reported_count' => (int)$authorReportedCount, + 'reported_class' => $authorReportedCount > 0 ? 'text-danger' : 'text-muted', + ]; + + // 解析帖子图片 + if (!empty($post['cover'])) { + $targetImages[] = $post['cover']; + } + if (!empty($post['media'])) { + $mediaList = json_decode($post['media'], true); + if (is_array($mediaList)) { + foreach ($mediaList as $m) { + if (is_string($m) && $m !== '' && !in_array($m, $targetImages, true)) { + $targetImages[] = $m; + } + } + } + } + + $targetInfo = [ + 'id' => $post['id'], + 'title' => $post['title'], + 'category' => $categoryName ?: '默认分类', + 'category_id' => $post['category_id'], + 'identity_type' => (int)$post['identity_type'] === 2 ? '商家发布' : '个人发布', + 'price' => (float)$post['price'] > 0 ? (string)$post['price'] : '面议', + 'price_unit' => $post['price_unit'] ?: '', + 'area' => $post['area'] ?: '-', + 'address' => $post['address'] ?: '未提供详细地址', + 'contact' => $post['contact'] ?: '-', + 'phone' => $post['phone'] ?: '-', + 'wechat' => $post['wechat'] ?: '-', + 'tags' => $post['tags'] ? explode(',', $post['tags']) : [], + 'views' => (int)$post['views'], + 'likes' => (int)$post['likes'], + 'comment_count' => (int)$post['comment_count'], + 'is_top' => (int)$post['is_top'] === 1 ? '置顶中' : '未置顶', + 'is_paid' => (int)$post['is_paid'] === 1 ? '付费发布' : '免费发布', + 'amount' => (float)$post['amount'], + 'content' => $post['content'], + 'status' => (int)$post['status'] === 1 ? '正常' : '已下架', + 'status_val' => (int)$post['status'], + 'status_class' => (int)$post['status'] === 1 ? 'label-success' : 'label-danger', + 'status_text' => (int)$post['status'] === 1 ? '正常' : '已下架', + 'audit_status' => (int)$post['audit_status'] === 1 ? '审核通过' : ((int)$post['audit_status'] === 2 ? '已驳回' : '待审核'), + 'createtime' => $post['createtime'] ? date('Y-m-d H:i:s', $post['createtime']) : '-', + 'updatetime' => $post['updatetime'] ? date('Y-m-d H:i:s', $post['updatetime']) : '-', + 'is_deleted' => false, + ]; + } else { + $targetInfo = [ + 'id' => (int)$row['target_id'], + 'title' => '(该信息已被物理删除或不存在)', + 'category' => '-', + 'category_id' => 0, + 'identity_type' => '-', + 'price' => '-', + 'price_unit' => '', + 'area' => '-', + 'address' => '-', + 'contact' => '-', + 'phone' => '-', + 'wechat' => '-', + 'tags' => [], + 'views' => 0, + 'likes' => 0, + 'comment_count' => 0, + 'is_top' => '未置顶', + 'is_paid' => '免费发布', + 'amount' => 0, + 'content' => '该帖子已被彻底删除或不存在,无法查看原文细节。', + 'status' => '已彻底删除', + 'status_val' => 0, + 'status_class' => 'label-default', + 'status_text' => '已彻底删除', + 'audit_status' => '-', + 'createtime' => '-', + 'updatetime' => '-', + 'is_deleted' => true, + ]; + $targetAuthor = [ + 'id' => 0, + 'nickname' => '未知/账号已注销', + 'mobile' => '-', + 'status' => 'normal', + 'status_text' => '账号未知', + 'status_class' => 'label-default', + 'user_type' => '个人', + 'realname' => '', + 'realname_status'=> 0, + 'realname_text' => '未实名', + 'realname_class' => 'text-muted', + 'is_member' => 0, + 'member_level' => '', + 'post_count' => 0, + 'reported_count' => 0, + 'reported_class' => 'text-muted', + ]; + } + } elseif ($row['target_type'] === 'comment') { + $comment = Db::name('fc_comment')->where('id', (int)$row['target_id'])->find(); + if ($comment) { + // 评价作者画像(被举报人) + $commentAuthorUser = Db::name('user')->where('id', $comment['user_id'])->find(); + $commentAuthorExt = $commentAuthorUser ? Db::name('fc_user_ext')->where('user_id', $commentAuthorUser['id'])->find() : null; + + $commentAuthorReportedCount = Db::name('fc_report')->where('target_type', 'comment')->where('target_id', 'in', function ($q) use ($comment) { + $q->name('fc_comment')->where('user_id', $comment['user_id'])->field('id'); + })->count(); + + $cAuthorStatus = $commentAuthorUser ? ($commentAuthorUser['status'] ?? 'normal') : 'normal'; + $targetAuthor = [ + 'id' => $comment['user_id'], + 'nickname' => $commentAuthorUser ? ($commentAuthorUser['nickname'] ?: $commentAuthorUser['username']) : ('用户' . $comment['user_id']), + 'mobile' => $commentAuthorUser['mobile'] ?? '-', + 'status' => $cAuthorStatus, + 'status_text' => $cAuthorStatus === 'normal' ? '账号正常' : '账号已受限', + 'status_class' => $cAuthorStatus === 'normal' ? 'label-success' : 'label-danger', + 'user_type' => $commentAuthorExt ? ($commentAuthorExt['user_type'] == 2 ? '商家' : '个人') : '个人', + 'realname' => $commentAuthorExt['realname'] ?? '', + 'realname_status'=> $commentAuthorExt ? (int)$commentAuthorExt['realname_status'] : 0, + 'realname_text' => ($commentAuthorExt && $commentAuthorExt['realname_status'] == 1) ? ('已实名 (' . ($commentAuthorExt['realname'] ?: '已认证') . ')') : '未实名', + 'realname_class' => ($commentAuthorExt && $commentAuthorExt['realname_status'] == 1) ? 'text-success' : 'text-muted', + 'is_member' => $commentAuthorExt ? (int)$commentAuthorExt['is_member'] : 0, + 'member_level' => $commentAuthorExt['member_level'] ?? '', + 'post_count' => (int)Db::name('fc_comment')->where('user_id', $comment['user_id'])->count(), + 'reported_count' => (int)$commentAuthorReportedCount, + 'reported_class' => $commentAuthorReportedCount > 0 ? 'text-danger' : 'text-muted', + ]; + + // 评价关联的原帖背景信息 + $relPost = Db::name('fc_post')->where('id', $comment['post_id'])->find(); + if ($relPost) { + $relAuthorUser = Db::name('user')->where('id', $relPost['user_id'])->find(); + $relCategoryName = (string)Db::name('fc_category')->where('id', $relPost['category_id'])->value('name'); + $relatedPost = [ + 'id' => $relPost['id'], + 'title' => $relPost['title'], + 'category' => $relCategoryName ?: '分类', + 'author' => $relAuthorUser ? ($relAuthorUser['nickname'] ?: $relAuthorUser['username']) : ('用户' . $relPost['user_id']), + 'author_id' => $relPost['user_id'], + 'author_mobile' => $relAuthorUser['mobile'] ?? '-', + 'price' => (float)$relPost['price'] > 0 ? (string)$relPost['price'] : '面议', + 'price_unit' => $relPost['price_unit'] ?: '', + 'cover' => $relPost['cover'] ?: '', + 'content' => mb_substr(strip_tags($relPost['content']), 0, 80) . '...', + 'status' => (int)$relPost['status'] === 1 ? '正常' : '已下架', + ]; + } + + // 评价图片 + if (!empty($comment['images'])) { + $cImages = json_decode($comment['images'], true); + if (is_array($cImages)) { + $targetImages = $cImages; + } elseif (is_string($comment['images'])) { + $targetImages = array_filter(explode(',', $comment['images'])); + } + } + + $cScore = (int)$comment['score']; + $targetInfo = [ + 'id' => $comment['id'], + 'post_id' => $comment['post_id'], + 'score' => $cScore, + 'score_stars' => str_repeat('★', max(1, min(5, $cScore))), + 'content' => $comment['content'], + 'reply' => $comment['reply'], + 'replytime' => $comment['replytime'] ? date('Y-m-d H:i:s', $comment['replytime']) : '', + 'status' => (int)$comment['status'] === 1 ? '正常' : '已屏蔽', + 'status_val' => (int)$comment['status'], + 'status_class' => (int)$comment['status'] === 1 ? 'label-success' : 'label-danger', + 'status_text' => (int)$comment['status'] === 1 ? '正常' : '已屏蔽', + 'createtime' => $comment['createtime'] ? date('Y-m-d H:i:s', $comment['createtime']) : '-', + 'is_deleted' => false, + ]; + } else { + $targetInfo = [ + 'id' => (int)$row['target_id'], + 'post_id' => 0, + 'score' => 5, + 'score_stars' => '★★★★★', + 'content' => '该评价已被彻底删除或不存在。', + 'reply' => '', + 'replytime' => '', + 'status' => '已彻底删除', + 'status_val' => 0, + 'status_class' => 'label-default', + 'status_text' => '已彻底删除', + 'createtime' => '-', + 'is_deleted' => true, + ]; + $targetAuthor = [ + 'id' => 0, + 'nickname' => '未知/账号已注销', + 'mobile' => '-', + 'status' => 'normal', + 'status_text' => '账号未知', + 'status_class' => 'label-default', + 'user_type' => '个人', + 'realname' => '', + 'realname_status'=> 0, + 'realname_text' => '未实名', + 'realname_class' => 'text-muted', + 'is_member' => 0, + 'member_level' => '', + 'post_count' => 0, + 'reported_count' => 0, + 'reported_class' => 'text-muted', + ]; + } + } + + // 3. 举报人上传的举证凭证 + $images = []; + if (!empty($row['images'])) { + $images = array_filter(explode(',', (string)$row['images'])); + } + + $this->view->assign('row', $row); + $this->view->assign('reporter', $reporter); + $this->view->assign('targetAuthor', $targetAuthor); + $this->view->assign('targetInfo', $targetInfo); + $this->view->assign('targetImages', $targetImages); + $this->view->assign('relatedPost', $relatedPost); + $this->view->assign('targetTotalReports', $targetTotalReports); + $this->view->assign('images', $images); + + return $this->view->fetch(); + } /** - * 处理举报 + * 处理举报操作 + * 支持单个或批量处理,更新 handle_remark 字段(保留用户的原始 remark 补充说明), + * 支持对违规帖子下架或违规评论屏蔽的一键联动处置, + * 并在处理完成后自动向举报人下发系统站内通知消息(附带小程序跳转参数)。 + * + * POST 入参: + * - ids: 举报记录 ID 或 ID 数组 + * - remark: 管理员处理备注 + * - action: 联动处置动作,可选 'none'(默认仅标记)、'offline'(下架被举报信息/屏蔽被举报评论) + * + * @return void */ public function handle() { $ids = $this->request->post('ids'); - $remark = $this->request->post('remark', ''); + $remark = trim((string)$this->request->post('remark', '')); + $action = trim((string)$this->request->post('action', 'none')); + $ids = is_array($ids) ? $ids : explode(',', (string)$ids); - $ids = array_filter($ids); + $ids = array_filter(array_map('intval', $ids)); if (!$ids) { $this->error('请选择要处理的举报'); } - Db::name('fc_report')->where('id', 'in', $ids)->update([ - 'status' => 'handled', - 'remark' => $remark, - 'updatetime' => time(), - ]); - $this->success('处理成功'); + + $now = time(); + $reports = Db::name('fc_report')->where('id', 'in', $ids)->select(); + + Db::startTrans(); + try { + foreach ($reports as $report) { + $targetTitle = ''; + $actionDesc = '平台已核实并记录处理'; + + // 如果勾选联动下架处置 + if ($action === 'offline') { + if ($report['target_type'] === 'post') { + $post = Db::name('fc_post')->where('id', $report['target_id'])->find(); + $targetTitle = $post ? (string)$post['title'] : '信息'; + $actionDesc = '已下架违规信息'; + + // 下架对应信息(status 置为 0,并记录 audit_reason) + Db::name('fc_post')->where('id', $report['target_id'])->update([ + 'status' => 0, + 'audit_reason' => '因用户举报违规被管理员下架:' . ($remark ?: $report['reason']), + 'updatetime' => $now, + ]); + } elseif ($report['target_type'] === 'comment') { + $cmt = Db::name('fc_comment')->where('id', $report['target_id'])->find(); + $targetTitle = $cmt ? (mb_substr($cmt['content'], 0, 20) . '...') : '评价'; + $actionDesc = '已屏蔽违规评价'; + + // 屏蔽对应评价(status 置为 0) + Db::name('fc_comment')->where('id', $report['target_id'])->update([ + 'status' => 0, + 'updatetime' => $now, + ]); + } + } else { + if ($report['target_type'] === 'post') { + $postTitle = Db::name('fc_post')->where('id', $report['target_id'])->value('title'); + $targetTitle = $postTitle ? (string)$postTitle : '信息'; + } else { + $cmtContent = Db::name('fc_comment')->where('id', $report['target_id'])->value('content'); + $targetTitle = $cmtContent ? (mb_substr($cmtContent, 0, 20) . '...') : '评价'; + } + } + + // 更新举报记录为已处理,写入管理员处理备注 + Db::name('fc_report')->where('id', $report['id'])->update([ + 'status' => 'handled', + 'handle_remark' => $remark, + 'updatetime' => $now, + ]); + + // 若举报人为平台注册用户,自动下发系统站内通知消息 + $reporterId = (int)$report['reporter_id']; + if ($reporterId > 0) { + $typeCn = $report['target_type'] === 'post' ? '信息' : '评价'; + $remarkNote = $remark !== '' ? ";管理员回复:{$remark}" : ''; + $msgContent = "您于 " . date('Y-m-d H:i', $report['createtime']) . " 举报的{$typeCn}《{$targetTitle}》(原因:{$report['reason']}),平台已核实完毕。处理结果:{$actionDesc}{$remarkNote}。点击查看我的举报记录详情。感谢您的监督与支持!"; + + Db::name('fc_message')->insert([ + 'user_id' => $reporterId, + 'type' => 'system', + 'title' => '举报处理结果通知', + 'content' => $msgContent, + 'extra' => json_encode(['path' => '/pages/mine/reports', 'id' => (int)$report['id']], JSON_UNESCAPED_UNICODE), + 'isread' => 0, + 'createtime' => $now, + 'updatetime' => $now, + ]); + } + } + Db::commit(); + } catch (\Exception $e) { + Db::rollback(); + $this->error('处理失败:' . $e->getMessage()); + } + + $this->success('处理成功并已下发用户通知'); } - - - } diff --git a/application/admin/controller/fc/Setting.php b/application/admin/controller/fc/Setting.php index 0a875b5..1726709 100644 --- a/application/admin/controller/fc/Setting.php +++ b/application/admin/controller/fc/Setting.php @@ -115,7 +115,7 @@ class Setting extends Backend return [ 'appName' => $pick('base.appName', '同城分类信息'), 'logo' => $pick('base.logo', ''), - 'servicePhone' => $pick('base.servicePhone', '400-000-0000'), + 'servicePhone' => $pick('base.servicePhone', ''), 'aboutUs' => $pick('base.aboutUs', ''), 'shareTitle' => $pick('base.shareTitle', ''), 'virtualPayAudit' => (int)$pick('pay.virtualPayAudit', 1), diff --git a/application/admin/lang/zh-cn/fc/report.php b/application/admin/lang/zh-cn/fc/report.php index 8d0de57..7142623 100644 --- a/application/admin/lang/zh-cn/fc/report.php +++ b/application/admin/lang/zh-cn/fc/report.php @@ -1,14 +1,14 @@ 'ID', - 'Target_type' => '举报对象', + 'Id' => '序号', + 'Target_type' => '举报类型', 'Target_id' => '对象ID', 'Reason' => '举报原因', - 'Reporter_id' => '举报人ID', + 'Reporter_id' => '举报人', 'Status' => '处理状态', - 'Remark' => '处理备注', - 'Createtime' => '创建时间', - 'Updatetime' => '更新时间', + 'Remark' => '用户说明', + 'Createtime' => '举报时间', + 'Updatetime' => '处理时间', 'HandleReport' => '处理' ]; diff --git a/application/admin/model/FcReport.php b/application/admin/model/FcReport.php index ed88d40..40815ef 100644 --- a/application/admin/model/FcReport.php +++ b/application/admin/model/FcReport.php @@ -5,17 +5,14 @@ namespace app\admin\model; use think\Model; use app\common\library\FcRelation; - +/** + * 同城-举报数据模型 + */ class FcReport extends Model { - - - - - // 表名 protected $name = 'fc_report'; - + // 自动写入时间戳字段 protected $autoWriteTimestamp = 'integer'; @@ -31,11 +28,25 @@ class FcReport extends Model 'target_title', ]; + /** + * 获取举报人昵称获取器 + * + * @param mixed $value 原值 + * @param array $data 行数据 + * @return string + */ public function getReporterNameAttr($value, $data) { return FcRelation::userName(isset($data['reporter_id']) ? $data['reporter_id'] : 0); } + /** + * 获取被举报对象标题/摘要获取器 + * + * @param mixed $value 原值 + * @param array $data 行数据 + * @return string + */ public function getTargetTitleAttr($value, $data) { $type = isset($data['target_type']) ? $data['target_type'] : ''; @@ -48,9 +59,12 @@ class FcReport extends Model } return ''; } - - + /** + * 获取状态字典 + * + * @return array + */ public function getStatusList() { return [ @@ -59,15 +73,17 @@ class FcReport extends Model ]; } - + /** + * 获取状态文本获取器 + * + * @param mixed $value 原值 + * @param array $data 行数据 + * @return string + */ public function getStatusTextAttr($value, $data) { $value = $value ?: ($data['status'] ?? ''); $list = $this->getStatusList(); return $list[$value] ?? ''; } - - - - } diff --git a/application/admin/view/fc/report/detail.html b/application/admin/view/fc/report/detail.html new file mode 100644 index 0000000..d9ee161 --- /dev/null +++ b/application/admin/view/fc/report/detail.html @@ -0,0 +1,755 @@ + + +
+ + +
+
+
+ 工单 #{$row.id} + {$row.type_tag_text} + + 举报原因:{$row.reason} + + + 提交时间:{$row.createtime_text} + +
+
+ {if condition="$targetTotalReports > 1"} + + 累计被举报 {$targetTotalReports} 次 + + {/if} + + {$row.status_tag_text} + +
+
+
+ + +
+ +
+
+
+ 举报人(投诉方)画像 + {$reporter.user_type} +
+
+ 用户昵称: + {$reporter.nickname} (UID: {$reporter.id}) +
+
+ 联系电话: + {$reporter.mobile} +
+
+ 实名认证: + + {$reporter.realname_text} + +
+
+
+ 历史举报: + 累计发起 {$reporter.report_count} 次举报 +
+
+ + +
+
+
+ 被举报责任人画像 + + {$targetAuthor.status_text} + +
+ {if condition="$targetAuthor.id > 0"} +
+ 责任作者: + {$targetAuthor.nickname} (UID: {$targetAuthor.id}) +
+
+ 绑定手机: + {$targetAuthor.mobile} +
+
+ 身份/实名: + + {$targetAuthor.user_type} · + {$targetAuthor.realname_text} + +
+ {else /} +
原作者账号已注销或原内容已彻底清理
+ {/if} +
+
+ 风控记录: + + 名下内容累计被举报 {$targetAuthor.reported_count} 次 + (历史发布: {$targetAuthor.post_count} 条) + +
+
+
+ + +
+
+

+ + {$row.target_type == 'post' ? '被举报信息(帖子)完整全貌' : '被举报评价原文及交易背景'} +

+ + 目标ID: #{$row.target_id}  |  + 当前状态:{$targetInfo.status_text} + +
+
+ {if condition="$row.target_type == 'post'"} + {if condition="!$targetInfo.is_deleted"} + +
+
+ {$targetInfo.category} + {$targetInfo.identity_type} + + {$targetInfo.is_paid} + +

{$targetInfo.title}

+
+
+ + +
+
+
商品/服务标价
+
+ {if condition="$targetInfo.price != '面议'"} + ¥{$targetInfo.price} {$targetInfo.price_unit} + {else /} + 面议 + {/if} +
+
+
+
联系人称呼
+
{$targetInfo.contact}
+
+
+
联系电话
+
{$targetInfo.phone}
+
+
+
微信号(重点排查引流)
+
{$targetInfo.wechat}
+
+
+
所在区域与位置
+
+ {$targetInfo.area} · {$targetInfo.address} +
+
+
+
发布与更新时间
+
{$targetInfo.createtime}
+
+
+
运营曝光数据
+
+ 浏览 {$targetInfo.views} · 点赞 {$targetInfo.likes} · 评论 {$targetInfo.comment_count} +
+
+
+
审核状态 / 置顶
+
{$targetInfo.audit_status} · {$targetInfo.is_top}
+
+
+ + +
+ +
{$targetInfo.content}
+
+ + + {if condition="!empty($targetImages)"} +
+ + +
+ {/if} + + {else /} +
+ 被举报的信息已被彻底删除或不存在,无法查看原文细节。 +
+ {/if} + + {else /} + + {if condition="!empty($relatedPost)"} + +
+
被评价的原信息背景:
+
+ 《{$relatedPost.title}》 + + {if condition="$relatedPost.price != '面议'"} + ¥{$relatedPost.price} {$relatedPost.price_unit} + {else /} + 面议 + {/if} + +
+
+ 分类:{$relatedPost.category}  ·  + 发帖商家:{$relatedPost.author} (UID: {$relatedPost.author_id} / 电话: {$relatedPost.author_mobile}) +
+
+ 原帖摘要:{$relatedPost.content} +
+
+ {/if} + + {if condition="!$targetInfo.is_deleted"} +
+
+
+ 评价星级: + + {$targetInfo.score_stars} + ({$targetInfo.score} 星) + +
+ 评价发表时间:{$targetInfo.createtime} +
+ +
+ {$targetInfo.content} +
+ + {if condition="!empty($targetImages)"} +
+ 评价配图(点击查看大图): + +
+ {/if} + + {if condition="!empty($targetInfo.reply)"} +
+
+ 商家公开回复({$targetInfo.replytime}): +
+
{$targetInfo.reply}
+
+ {/if} +
+ {else /} +
+ 被举报的评价已被彻底删除或不存在。 +
+ {/if} + {/if} +
+
+ + +
+
+

举报人提供的证据与违规说明

+
+
+
+ +
+ {$row.remark|default='举报人未填写补充文字说明'} +
+
+ + {if condition="!empty($images)"} +
+ + +
+ {else /} +
举报人未上传截图凭证
+ {/if} +
+
+ + + {if condition="$row.status == 'pending'"} +
+
+

举报核实处置工作台

+ 处置后系统将自动在数据库事务中向举报人推送通知消息 +
+
+
+ + +
+ +
+ + +
+
+ +
+ +
+ + + 提示:处理完成后,系统将自动向举报用户下发系统消息通知,用户可在小程序【我的举报】中直接查阅。 + +
+
+ +
+
+ + +
+
+
+
+
+ {else /} +
+
+

平台处理记录

+ 处理时间:{$row.updatetime_text} +
+
+
+

状态:已核实处理完毕

+

+ 处理说明 / 回复内容:{$row.handle_remark|default='已核实处理'} +

+
+
+
+ {/if} +
+ + \ No newline at end of file diff --git a/application/admin/view/fc/report/index.html b/application/admin/view/fc/report/index.html index ff81422..f2bdfb2 100644 --- a/application/admin/view/fc/report/index.html +++ b/application/admin/view/fc/report/index.html @@ -18,8 +18,8 @@ 刷新
diff --git a/application/api/controller/AdminSetting.php b/application/api/controller/AdminSetting.php index 1e2f40e..4278c15 100644 --- a/application/api/controller/AdminSetting.php +++ b/application/api/controller/AdminSetting.php @@ -40,7 +40,7 @@ class AdminSetting extends V1 $logo = (string)$this->input('logo', $this->cfg('base.logo', '')); $this->setCfg('base.appName', $appName); $this->setCfg('base.logo', $logo); - $this->setCfg('base.servicePhone', (string)$this->input('servicePhone', $this->cfg('base.servicePhone', '400-000-0000'))); + $this->setCfg('base.servicePhone', (string)$this->input('servicePhone', $this->cfg('base.servicePhone', ''))); $this->setCfg('base.aboutUs', (string)$this->input('aboutUs', $this->cfg('base.aboutUs', ''))); $this->setCfg('base.shareTitle', (string)$this->input('shareTitle', $this->cfg('base.shareTitle', ''))); // 兼容旧 ui.* 键,保持名称/LOGO 一致 @@ -337,7 +337,7 @@ class AdminSetting extends V1 return [ 'appName' => (string)$this->cfg('base.appName', '同城分类信息'), 'logo' => (string)$this->cfg('base.logo', ''), - 'servicePhone' => (string)$this->cfg('base.servicePhone', '400-000-0000'), + 'servicePhone' => (string)$this->cfg('base.servicePhone', ''), 'aboutUs' => (string)$this->cfg('base.aboutUs', ''), 'shareTitle' => (string)$this->cfg('base.shareTitle', ''), ]; diff --git a/application/api/controller/Message.php b/application/api/controller/Message.php index edbb0b5..4c49bf6 100644 --- a/application/api/controller/Message.php +++ b/application/api/controller/Message.php @@ -70,6 +70,7 @@ class Message extends V1 'type' => (string)$row['type'], 'title' => (string)$row['title'], 'content' => (string)$row['content'], + 'extra' => (string)($row['extra'] ?? ''), 'read' => $isRead, 'createdAt' => $this->iso($row['createtime']), ]; diff --git a/application/api/controller/Report.php b/application/api/controller/Report.php index 7e81d97..4bce4b5 100644 --- a/application/api/controller/Report.php +++ b/application/api/controller/Report.php @@ -7,20 +7,30 @@ use think\Db; /** * 用户端 · 举报(Module-REPORT) * 路由: - * POST /api/v1/report 举报信息/评价 + * POST /api/v1/report 举报信息/评价 + * GET /api/v1/report/my 我的举报记录 * * 说明:举报原因字典由后台配置 fc_config 的 report.reasons(JSON 数组)维护, - * 小程序端从站点配置读取;本接口只做「必填 + 类型合法 + 对象存在」校验, - * 允许举报原因使用字典外的自定义文案(前端传字典项,`detail` 传补充说明)。 + * 小程序端从站点配置读取;本接口做「必填 + 类型合法 + 对象存在 + 防重复提交」校验, + * 允许举报原因使用字典外的自定义文案(前端传字典项,`detail` 传补充说明,`images` 传截图凭证)。 */ class Report extends V1 { /** - * POST /api/v1/report {targetType:'post'|'comment',targetId,reason,detail?} - * → {reportId} - * 规则:targetType 仅 post/comment(否则 fail('举报类型不支持')); - * reason 必填(否则 fail('请选择举报原因'));被举报对象必须存在; - * detail 作为补充说明写入 fc_report.remark,状态默认 pending(待后台处理)。 + * 提交举报 + * POST /api/v1/report + * 入参:{targetType:'post'|'comment', targetId, reason, detail?, images?} + * 出参:{reportId} + * + * 业务规则: + * 1. 必须登录; + * 2. targetType 仅支持 'post' 或 'comment'; + * 3. reason 必填; + * 4. 被举报对象(信息/评价)必须真实存在; + * 5. 防重复提交:同用户对同一目标存在 pending 状态举报时拦截; + * 6. 频控保护:单日举报上限 15 次,防止恶意刷库。 + * + * @return void */ public function create() { @@ -56,20 +66,112 @@ class Report extends V1 } } + // 防重复举报:同一用户对同一条内容若已有待核实的举报,不允许重复提交 + $existsPending = Db::name('fc_report') + ->where('reporter_id', (int)$user['id']) + ->where('target_type', $targetType) + ->where('target_id', $targetId) + ->where('status', 'pending') + ->find(); + if ($existsPending) { + $this->fail('您已提交过该举报,平台正在核实中,请勿重复提交'); + } + + // 频控保护:单日单个用户举报上限 15 次 + $todayStart = strtotime('today'); + $todayCount = Db::name('fc_report') + ->where('reporter_id', (int)$user['id']) + ->where('createtime', '>=', $todayStart) + ->count(); + if ($todayCount >= 15) { + $this->fail('今日举报次数已达上限,感谢您的监督'); + } + $detail = trim((string)$this->input('detail', '')); + $rawImages = $this->input('images', ''); + if (is_array($rawImages)) { + $images = implode(',', array_filter(array_map('trim', $rawImages))); + } else { + $images = trim((string)$rawImages); + } + if (mb_strlen($images) > 1000) { + $images = mb_substr($images, 0, 1000); + } + $now = time(); $reportId = Db::name('fc_report')->insertGetId([ - 'target_type' => $targetType, - 'target_id' => $targetId, - 'reason' => $reason, - 'reporter_id' => (int)$user['id'], - 'status' => 'pending', - 'remark' => mb_substr($detail, 0, 200), - 'createtime' => $now, - 'updatetime' => $now, + 'target_type' => $targetType, + 'target_id' => $targetId, + 'reason' => $reason, + 'images' => $images, + 'reporter_id' => (int)$user['id'], + 'status' => 'pending', + 'remark' => mb_substr($detail, 0, 200), + 'handle_remark' => '', + 'createtime' => $now, + 'updatetime' => $now, ]); $this->ok(['reportId' => $reportId]); } + + /** + * 获取当前用户的举报历史记录 + * GET /api/v1/report/my + * 入参:{page, size} + * 出参:分页对象 {list:[...], page, size, total, hasMore} + * + * @return void + */ + public function my() + { + $user = $this->auth(); + + list($rows, $total, $page, $size) = $this->pageQuery(function ($forCount) use ($user) { + $q = Db::name('fc_report')->where('reporter_id', (int)$user['id']); + if ($forCount) { + return $q; + } + return $q->order('id desc'); + }); + + $list = []; + foreach ($rows as $row) { + $targetTitle = ''; + if ($row['target_type'] === 'post') { + $postTitle = Db::name('fc_post')->where('id', $row['target_id'])->value('title'); + $targetTitle = $postTitle ? (string)$postTitle : '信息已下架或删除'; + } elseif ($row['target_type'] === 'comment') { + $commentContent = Db::name('fc_comment')->where('id', $row['target_id'])->value('content'); + $targetTitle = $commentContent ? (mb_substr($commentContent, 0, 30) . (mb_strlen($commentContent) > 30 ? '...' : '')) : '评价已删除'; + } + + $rawImages = !empty($row['images']) ? explode(',', (string)$row['images']) : []; + $imgUrls = []; + foreach ($rawImages as $img) { + $img = trim((string)$img); + if ($img !== '') { + $imgUrls[] = cdnurl($img, true); + } + } + + $list[] = [ + 'id' => (int)$row['id'], + 'targetType' => (string)$row['target_type'], + 'targetId' => (int)$row['target_id'], + 'targetTitle' => $targetTitle, + 'reason' => (string)$row['reason'], + 'images' => $imgUrls, + 'detail' => (string)$row['remark'], + 'status' => (string)$row['status'], + 'statusText' => $row['status'] === 'handled' ? '已处理' : '核实中', + 'handleRemark' => (string)($row['handle_remark'] ?? ''), + 'createdAt' => $this->iso($row['createtime']), + 'updatedAt' => $this->iso($row['updatetime']), + ]; + } + + $this->ok($this->paginate($list, $total, $page, $size)); + } } diff --git a/application/api/controller/Setting.php b/application/api/controller/Setting.php index b1f1ba1..d9bde29 100644 --- a/application/api/controller/Setting.php +++ b/application/api/controller/Setting.php @@ -37,7 +37,8 @@ class Setting extends V1 'appName' => $siteName, 'siteName' => $siteName, 'logo' => $logo, - 'servicePhone' => (string)$this->cfg('base.servicePhone', ''), + 'servicePhone' => (string)$this->cfg('base.servicePhone', ''), + 'serviceWorkTime' => (string)$this->cfg('base.serviceWorkTime', '09:00 - 21:00'), 'aboutUs' => (string)$this->cfg('base.aboutUs', ''), 'shareTitle' => $shareTitle !== '' ? $shareTitle : $siteName, 'icons' => (object)$icons, @@ -48,6 +49,20 @@ class Setting extends V1 ], // 余额支付密码开关(开启后余额支付需验证 6 位支付密码,用户在余额中心设置) 'payPasswordEnabled' => (int)$this->cfg('pay.payPasswordEnabled', 0) === 1, + // 举报原因字典(后台 report.reasons 配置优先,默认兜底) + 'reportReasons' => (function() { + $raw = $this->cfg('report.reasons', null); + if (is_array($raw)) { + return $raw; + } + if (is_string($raw) && $raw !== '') { + $json = json_decode($raw, true); + if (is_array($json)) { + return $json; + } + } + return ['虚假信息', '违法违禁', '垃圾广告', '重复发布', '其他']; + })(), // 微信小程序虚拟支付提审合规保护开关(1=开启合规拦截,0=正式放开,默认1安全过审) 'virtualPayAudit' => (function() { $sysVal = \think\Db::name('config')->where('name', 'virtual_pay_audit')->value('value'); diff --git a/application/route.php b/application/route.php index 3bf45a8..9135113 100755 --- a/application/route.php +++ b/application/route.php @@ -78,6 +78,7 @@ return [ * 且本表未登记 favorite/:id、follow/:id、report/:id 之类通配规则,不存在被吞风险。 */ 'api/v1/report' => 'api/Report/create', + 'api/v1/report/my' => 'api/Report/my', 'api/v1/favorite/list' => 'api/Favorite/list', 'api/v1/favorite/toggle' => 'api/Favorite/toggle', 'api/v1/favorite/status' => 'api/Favorite/status', diff --git a/public/assets/js/backend/fc/report.js b/public/assets/js/backend/fc/report.js index 0f3dde5..39dc79d 100644 --- a/public/assets/js/backend/fc/report.js +++ b/public/assets/js/backend/fc/report.js @@ -2,75 +2,136 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu var Controller = { index: function () { - // 初始化表格参数配置 + // 初始化表格参数配置(举报工单为用户上报材料,关闭后台直接新增与编辑,防止数据篡改) Table.api.init({ extend: { index_url: 'fc/report/index' + location.search, - add_url: 'fc/report/add', - edit_url: 'fc/report/edit', - del_url: 'fc/report/del', + add_url: '', + edit_url: '', + del_url: '', multi_url: 'fc/report/multi', - import_url: 'fc/report/import', table: 'fc_report', } }); var table = $("#table"); - // 初始化表格 + // 初始化表格,固定操作列在右侧,只展示核心关键内容 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', + fixedColumns: true, + fixedRightNumber: 1, columns: [ [ {checkbox: true}, {field: 'id', title: __('SerialNo'), operate: false, sortable: false, align: 'center', width: '70px', class: 'fc-serial', table: table, formatter: Format.serial}, - {field: 'target_type', title: __('Target_type'), + { + field: 'target_type', + title: '举报类型', + width: '90px', + align: 'center', searchList: {post: __('信息'), comment: __('评价')}, formatter: function (value) { - var m = {post: __('信息'), comment: __('评价')}; - return m[value] !== undefined ? m[value] : '-'; + if (value === 'post') { + return '信息举报'; + } + if (value === 'comment') { + return '评价举报'; + } + return '-'; } }, - {field: 'target_title', title: '举报对象', operate: false, sortable: false, formatter: function (value) { - return value ? value : '-'; - }}, - {field: 'reason', title: __('Reason'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, - {field: 'reporter_id', title: '举报人', addClass: 'selectpage', extend: "data-source='user/user/index' data-field='nickname'", formatter: function (value, row) { - return row.reporter_name || '-'; - }}, - {field: 'status', title: __('Status'), + { + field: 'target_title', + title: '举报对象', + operate: false, + sortable: false, + formatter: function (value, row) { + var title = value ? value : ('目标ID: ' + row.target_id); + return '' + title + ''; + }, + events: { + 'click .btn-detail-link': function (e, value, row, index) { + e.stopPropagation(); + Fast.api.open('fc/report/detail?ids=' + row.id, (row.status === 'handled' ? '举报详情' : '审核处理举报') + ' - #' + row.id, { + area: ['880px', '820px'] + }); + } + } + }, + { + field: 'reason', + title: __('Reason'), + operate: 'LIKE', + table: table, + width: '120px', + formatter: function (value) { + return '' + (value || '-') + ''; + } + }, + { + field: 'reporter_id', + title: '举报人', + width: '110px', + addClass: 'selectpage', + extend: "data-source='user/user/index' data-field='nickname'", + formatter: function (value, row) { + return row.reporter_name || ('UID:' + value); + } + }, + { + field: 'status', + title: __('Status'), + width: '90px', + align: 'center', searchList: {pending: __('待处理'), handled: __('已处理')}, formatter: Format.statusFormatter({pending: __('待处理'), handled: __('已处理')}, {pending: 'warning', handled: 'success'}) }, - {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, - {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, - {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime, visible: false}, { - field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, - formatter: Table.api.formatter.operate, + field: 'createtime', + title: __('Createtime'), + width: '150px', + operate: 'RANGE', + addclass: 'datetimerange', + autocomplete: false, + formatter: Table.api.formatter.datetime + }, + {field: 'updatetime', title: __('Updatetime'), operate: false, visible: false}, + { + field: 'operate', + title: __('Operate'), + table: table, + align: 'center', + width: '140px', + events: Table.api.events.operate, + formatter: Table.api.formatter.buttons, buttons: [ { name: 'handle', - text: '处理', - title: '处理', - classname: 'btn btn-xs btn-success btn-click', + text: '审核处理', + title: function (row) { + return '审核处理举报 - #' + row.id; + }, + icon: 'fa fa-gavel', + classname: 'btn btn-xs btn-success btn-dialog', + url: 'fc/report/detail', + extend: 'data-area=\'["920px", "860px"]\'', visible: function (row) { return row.status !== 'handled'; - }, - click: function (options, row) { - Layer.prompt({title: __('请输入处理备注(可选)'), formType: 2}, function (value, index) { - Fast.api.ajax({ - url: 'fc/report/handle', - data: {ids: row.id, remark: value} - }, function () { - $('#' + options.tableId).bootstrapTable('refresh'); - return false; - }); - Layer.close(index); - }); } + }, + { + name: 'detail', + text: '详情', + title: function (row) { + return '举报详情 - #' + row.id; + }, + classname: 'btn btn-xs btn-info btn-dialog', + icon: 'fa fa-eye', + url: 'fc/report/detail', + extend: 'data-area=\'["920px", "860px"]\'' } ] } @@ -81,13 +142,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu // 为表格绑定事件 Table.api.bindevent(table); - // 处理 + // 批量处理 $(document).on('click', '.btn-handle', function () { var ids = Table.api.selectedids(table); - Layer.prompt({title: __('请输入处理备注(可选)'), formType: 2}, function (value, index) { + if (!ids.length) { + Toastr.warning(__('Please select item')); + return; + } + Layer.prompt({title: __('请输入处理备注(可选,将通知举报人)'), formType: 2}, function (value, index) { Fast.api.ajax({ url: 'fc/report/handle', - data: {ids: ids.join(','), remark: value} + data: {ids: ids.join(','), remark: value, action: 'none'} }, function (data) { table.bootstrapTable('refresh'); return false; @@ -97,6 +162,116 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/format'], fu }); }, + detail: function () { + Controller.api.bindevent(); + + var Layer = window.Layer || (window.parent && window.parent.Layer) || window.layer || (window.parent && window.parent.layer); + var Fast = window.Fast || (window.parent && window.parent.Fast) || Backend.api; + var Toastr = window.Toastr || (window.parent && window.parent.Toastr); + + // 1. 动态切换处置话术 + $(document).off('change', 'input[name="action"]').on('change', 'input[name="action"]', function () { + if ($(this).val() === 'offline') { + $('#remark').val('经平台核实情况属实,已予以处置。感谢您的监督与支持!'); + } else { + $('#remark').val('经平台核实该内容暂未构成违规。感谢您的反馈与对平台的关注!'); + } + }); + + // 2. 确认处理并通知用户 + $(document).off('click', '#btn-submit-handle').on('click', '#btn-submit-handle', function () { + var $btn = $(this); + if ($btn.prop('disabled')) return; + var form = $('#handle-form'); + var data = form.serialize(); + + var doSubmit = function () { + $btn.prop('disabled', true).html(' 正在提交处理...'); + Fast.api.ajax({ + url: 'fc/report/handle', + data: data + }, function (res, ret) { + if (Toastr) Toastr.success(ret && ret.msg ? ret.msg : '处理成功'); + + // 1. 立即刷新父级页面或Tab中的列表表格 + try { + if (window.parent && window.parent.$ && window.parent.$("#table").length) { + window.parent.$("#table").bootstrapTable('refresh'); + } + } catch (e) {} + try { + if (window.top && window.top.$) { + window.top.$('.tab-pane.active iframe').each(function () { + if (this.contentWindow && this.contentWindow.$ && this.contentWindow.$("#table").length) { + this.contentWindow.$("#table").bootstrapTable('refresh'); + } + }); + } + } catch (e) {} + + // 2. 立即关闭当前弹窗 + setTimeout(function () { + if (Fast.api && Fast.api.close) { + Fast.api.close(); + } else if (window.parent && window.parent.layer) { + var idx = window.parent.layer.getFrameIndex(window.name); + window.parent.layer.close(idx); + } + }, 350); + return false; + }, function () { + $btn.prop('disabled', false).html(' 确认处理并通知用户'); + }); + }; + + if (Layer && Layer.confirm) { + Layer.confirm('确定要执行该处置操作吗?系统将自动下发通知给举报人。', { + title: '审核处置确认', + icon: 3 + }, function (index) { + Layer.close(index); + doSubmit(); + }); + } else { + if (confirm('确定要执行该处置操作吗?系统将自动下发通知给举报人。')) { + doSubmit(); + } + } + }); + + // 3. 取消关闭 + $(document).off('click', '#btn-close-handle').on('click', '#btn-close-handle', function () { + if (Fast && Fast.api && Fast.api.close) { + Fast.api.close(); + } else if (parent && parent.layer) { + var idx = parent.layer.getFrameIndex(window.name); + parent.layer.close(idx); + } else { + window.close(); + } + }); + + // 4. 图片点击大图预览 + $(document).off('click', '.fc-evidence-img').on('click', '.fc-evidence-img', function (e) { + e.preventDefault(); + var src = $(this).attr('src'); + if (!src) return; + var l = (window.parent && window.parent.Layer) || window.Layer || window.layer || (window.parent && window.parent.layer); + if (l && l.open) { + l.open({ + type: 1, + title: false, + closeBtn: 1, + area: ['auto', 'auto'], + skin: 'layui-layer-nobg', + shadeClose: true, + content: '
' + }); + } else { + window.open(src, '_blank'); + } + }); + }, add: function () { Controller.api.bindevent(); }, diff --git a/public/uploads/20261117/c3492a0cb5deeb44d6cdd1640f14d154.jpg b/public/uploads/20261117/c3492a0cb5deeb44d6cdd1640f14d154.jpg new file mode 100644 index 0000000..5484de7 Binary files /dev/null and b/public/uploads/20261117/c3492a0cb5deeb44d6cdd1640f14d154.jpg differ diff --git a/uniapp/common/api/report.js b/uniapp/common/api/report.js index 94bb9d0..1015377 100644 --- a/uniapp/common/api/report.js +++ b/uniapp/common/api/report.js @@ -1,14 +1,35 @@ /** * 接口模块 · 举报(用户端) - * 对应契约 §2.1:POST /report {targetType:'post'|'comment', targetId, reason, detail?} → {reportId} + * 对应接口契约: + * - POST /report 提交举报 {targetType:'post'|'comment', targetId, reason, detail?, images?} → {reportId} + * - GET /report/my 查询我的举报记录 {page, size} → 分页列表 */ -import { post } from '../utils/request.js' +import { post, get } from '../utils/request.js' import { REPORT_REASONS } from '../constants/report.js' export const reportApi = { - /** 提交举报(原因取自常量清单,默认与后端 report.reasons 一致) */ + /** + * 提交举报 + * @param {Object} payload 举报载荷 + * @param {'post'|'comment'} payload.targetType 举报对象类型 + * @param {number} payload.targetId 被举报对象ID + * @param {string} payload.reason 举报原因 + * @param {string} [payload.detail] 详细说明 + * @param {string|string[]} [payload.images] 凭证图片 + * @returns {Promise<{reportId: number}>} + */ create: (payload = {}) => post('/report', payload, { silent: true }), - /** 举报原因清单(供页面 uni.showActionSheet 使用) */ + + /** + * 查询我的举报历史记录 + * @param {Object} [params] 分页参数 + * @param {number} [params.page] 当前页 + * @param {number} [params.size] 每页条数 + * @returns {Promise<{list: Array, page: number, size: number, total: number}>} + */ + my: (params = {}) => get('/report/my', params, { silent: true }), + + /** 举报原因默认清单 */ reasons: REPORT_REASONS, } diff --git a/uniapp/common/assets/icons.js b/uniapp/common/assets/icons.js index 7d40276..0b8dcc6 100644 --- a/uniapp/common/assets/icons.js +++ b/uniapp/common/assets/icons.js @@ -77,6 +77,7 @@ export const ICON_GROUPS = [ { key: 'crown', name: '会员王冠', file: 'crown.png' }, { key: 'check', name: '权益已享', file: 'check.png' }, { key: 'shield', name: '认证/安全', file: 'shield.png' }, + { key: 'verify', name: '举报/合规', file: 'verify.png' }, { key: 'image', name: '图片', file: 'image.png' }, { key: 'image-white', name: '图片(白)', file: 'image-white.png' }, { key: 'video', name: '视频', file: 'video.png' }, diff --git a/uniapp/common/config/index.js b/uniapp/common/config/index.js index d405313..0704bcb 100644 --- a/uniapp/common/config/index.js +++ b/uniapp/common/config/index.js @@ -48,7 +48,7 @@ const ENV = IS_PROD ? 'production' : 'development' // 各环境后端域名(dev=运行 / prod=发行) const HOSTS = { - dev: 'https://5c789ab7.r9.cpolar.cn', // 本地后端(phpstudy 虚拟域名与端口 9980) + dev: 'https://412b20ec.r9.cpolar.cn', // 本地后端(phpstudy 虚拟域名与端口 9980) prod: 'https://shanjianxiaocang.com', // 远程正式后端 } // 接口统一前缀 diff --git a/uniapp/common/store/ui.js b/uniapp/common/store/ui.js index 7010713..48351d6 100644 --- a/uniapp/common/store/ui.js +++ b/uniapp/common/store/ui.js @@ -23,6 +23,7 @@ export const uiState = reactive({ siteName: '', appName: '', servicePhone: '', + serviceWorkTime: '09:00 - 21:00', aboutUs: '', shareTitle: '', subscribe: {}, @@ -30,6 +31,8 @@ export const uiState = reactive({ payPasswordEnabled: false, // 微信小程序虚拟支付提审防审模式(默认开启,杜绝提审首屏闪现付费会员) virtualPayAudit: true, + // 举报原因字典(后台下发) + reportReasons: [], loaded: false, }) @@ -43,11 +46,13 @@ export function applyUiConfig(cfg = {}) { uiState.siteName = cfg.siteName || cfg.appName || '' uiState.appName = cfg.appName || cfg.siteName || '' uiState.servicePhone = cfg.servicePhone || '' + uiState.serviceWorkTime = cfg.serviceWorkTime || '09:00 - 21:00' uiState.aboutUs = cfg.aboutUs || '' uiState.shareTitle = cfg.shareTitle || cfg.siteName || cfg.appName || '' uiState.subscribe = cfg.subscribe || {} uiState.payPasswordEnabled = !!(cfg && cfg.payPasswordEnabled) uiState.virtualPayAudit = cfg.virtualPayAudit !== undefined ? !!cfg.virtualPayAudit : true + uiState.reportReasons = Array.isArray(cfg.reportReasons) ? cfg.reportReasons : [] setRemoteUi(cfg) } diff --git a/uniapp/common/utils/nav.js b/uniapp/common/utils/nav.js index e9a7efc..f98882c 100644 --- a/uniapp/common/utils/nav.js +++ b/uniapp/common/utils/nav.js @@ -145,8 +145,14 @@ export function safeNavigateBack(fallbackUrl = '/pages/index/index', delta = 1) } } +/** + * 安全返回上一页的快捷别名 + */ +export const safeBack = safeNavigateBack + export default { safeNavigateTo, safeRedirectTo, safeNavigateBack, + safeBack, } diff --git a/uniapp/common/utils/navbar.js b/uniapp/common/utils/navbar.js index aa52bae..c2ff69a 100644 --- a/uniapp/common/utils/navbar.js +++ b/uniapp/common/utils/navbar.js @@ -25,7 +25,12 @@ export function getNavMetrics() { // #endif // #ifndef H5 - const sys = uni.getSystemInfoSync ? uni.getSystemInfoSync() : null + let sys = null + if (typeof uni.getWindowInfo === 'function') { + sys = uni.getWindowInfo() + } else if (typeof uni.getSystemInfoSync === 'function') { + sys = uni.getSystemInfoSync() + } if (sys && sys.statusBarHeight) { statusBarHeight = sys.statusBarHeight } diff --git a/uniapp/components/fc-contact-modal/fc-contact-modal.vue b/uniapp/components/fc-contact-modal/fc-contact-modal.vue new file mode 100644 index 0000000..397cd63 --- /dev/null +++ b/uniapp/components/fc-contact-modal/fc-contact-modal.vue @@ -0,0 +1,419 @@ + + + + + diff --git a/uniapp/components/fc-report-modal/fc-report-modal.vue b/uniapp/components/fc-report-modal/fc-report-modal.vue new file mode 100644 index 0000000..03d87c2 --- /dev/null +++ b/uniapp/components/fc-report-modal/fc-report-modal.vue @@ -0,0 +1,700 @@ +