feat: 对接真实数据并移除前端假数据
本次提交完成多模块真实数据对接,移除前端硬编码假数据: - 新增后端接口:区域列表、未读消息数、详情页评价列表、最低提现金额 - 前端对应修改:移除首页/列表/详情页硬编码区域选项、未读消息数、评价内容,分销页最低提现金额 - 修复登录页微信授权不伪造code、营业执照不伪造文件名,避免绕过校验 - 新增集成测试用例,验证真实数据对接正确性
这个提交包含在:
@@ -17,6 +17,7 @@ use think\Db;
|
||||
* GET /api/v1/post/:id P5 信息详情
|
||||
* POST /api/v1/post/:id/pay-view P6 付费查看联系方式
|
||||
* POST /api/v1/post/:id/comment P7 发表评价
|
||||
* GET /api/v1/post/:id/comments P10 评价列表(详情页「用户评价」)
|
||||
*
|
||||
* 计费口径(后台「发布与费用配置」维护,真源=fc_config);
|
||||
* 金额一律由服务端按配置计算,**不接受客户端传入金额**;
|
||||
@@ -809,6 +810,42 @@ class Post extends V1
|
||||
$this->ok(['commentId' => $commentId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* P10 评价列表(详情页「用户评价」)
|
||||
* GET /api/v1/post/:id/comments → [{id,user,score,content,reply,createdAt}]
|
||||
* 规则:仅 status=1(正常/审核通过)的评价;置顶优先,其余按时间倒序。
|
||||
* 替代前端详情页原先写死的两条假评价。
|
||||
*/
|
||||
public function comments()
|
||||
{
|
||||
$id = $this->routeId();
|
||||
if ($id <= 0) {
|
||||
$this->fail('信息不存在', 404);
|
||||
}
|
||||
|
||||
$rows = Db::name('fc_comment')->alias('co')
|
||||
->join('user u', 'u.id = co.user_id', 'LEFT')
|
||||
->where('co.post_id', $id)
|
||||
->where('co.status', 1)
|
||||
->field('co.id, co.score, co.content, co.reply, co.top, co.createtime, u.nickname AS nickname')
|
||||
->order('co.top desc, co.id desc')
|
||||
->select();
|
||||
|
||||
$list = [];
|
||||
foreach ($rows as $row) {
|
||||
$list[] = [
|
||||
'id' => (int)$row['id'],
|
||||
'user' => (string)$row['nickname'],
|
||||
'score' => (int)$row['score'],
|
||||
'content' => (string)$row['content'],
|
||||
'reply' => (string)$row['reply'],
|
||||
'createdAt' => $this->iso($row['createtime']),
|
||||
];
|
||||
}
|
||||
|
||||
$this->ok($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取路由 :id 参数(兼容 POST 体/查询串传入)
|
||||
* @return int
|
||||
|
||||
在新工单中引用
屏蔽一个用户