feat(admin): 信息置顶 + 发布与费用配置(免费/付费开关、单条与月年卡价格含条数)
需求落地: - 置顶:fc/post 新增 top 动作(批量置顶/取消置顶 + 站内消息通知),列表加「置顶/取消置顶」工具栏按钮、 行内按钮与置顶状态徽章;置顶信息在用户端首页与「我的发布」中优先展示(Home::feed 按 is_top desc) - 发布与费用配置(新增页面:同城业务 → 基础数据 → 发布与费用配置,fc/publish): 发布模式(免费发布 / 付费发布)、会员单条发布价格、按月(价格 + 含条数)、按年(价格 + 含条数); 真源为 fc_config 的 post.*,保存时同步 fc_plan 的月卡(M1)/年卡(M12) 价格与 post_quota - FcInstall:新增 post.* 六项配置(默认免费发布,避免上线即撞付费墙);fc_user_ext 加 post_quota_left / post_quota_expire(套餐额度与有效期)、fc_plan 加 post_quota;新增 upgradePublish() 幂等升级老库并同步月/年卡 - tools/verify-api.mjs:新增 P9 发布配置 / P8 我的发布 契约校验,P1 发布改为「免费模式/额度内发布」并按付费模式容错 - 语言包与视图同步中文,均通过 php -l 与 node --check
这个提交包含在:
@@ -78,6 +78,46 @@ class Post extends Backend
|
||||
$this->success('审核成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 置顶 / 取消置顶(支持批量)
|
||||
* POST fc/post/top {ids:'1,2', isTop:1|0}
|
||||
* 说明:置顶信息在用户端主页与列表**排在非置顶之前**(Home::feed / Post::mine 均按 is_top desc 排序)
|
||||
*/
|
||||
public function top()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$isTop = (int)$this->request->post('isTop', 1);
|
||||
if (!in_array($isTop, [0, 1], true)) {
|
||||
$this->error('置顶状态仅支持置顶(1)/取消置顶(0)');
|
||||
}
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要操作的信息');
|
||||
}
|
||||
$posts = Db::name('fc_post')->where('id', 'in', $ids)->select();
|
||||
if (!$posts) {
|
||||
$this->error('信息不存在');
|
||||
}
|
||||
foreach ($posts as $post) {
|
||||
Db::name('fc_post')->where('id', $post['id'])->update([
|
||||
'is_top' => $isTop,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $post['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => $isTop === 1 ? '信息已置顶' : '已取消置顶',
|
||||
'content' => $isTop === 1
|
||||
? '您发布的信息「' . $post['title'] . '」已被置顶,将在首页优先展示'
|
||||
: '您发布的信息「' . $post['title'] . '」已取消置顶',
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
}
|
||||
$this->success($isTop === 1 ? '置顶成功' : '已取消置顶');
|
||||
}
|
||||
|
||||
/**
|
||||
* 下架信息
|
||||
*/
|
||||
|
||||
在新工单中引用
屏蔽一个用户