docs(admin): 同步 v1.0.7 发布侧能力(发布与费用配置 / 置顶 / 路由登记 / 实测记录)
- 数据表:fc_plan 增 post_quota、fc_user_ext 增 post_quota_left/post_quota_expire - 新增 post.* 配置契约块(发布模式 + 单条/月卡/年卡价格与条数、计费顺序、默认 free 的原因、幂等升级) - §六 编码约定:route.php 由「勿改」改为「新增接口必须登记(漏登记线上 404)」;Auth/V1 既有行为仍不动 - §7.3 菜单树补「发布与费用配置」;§7.4 补 fc/post/top 动作 - 新增 §7.7:v1.0.7 线上实测记录(迁移输出、php -l、verify-api 183/183、后台页面/置顶/配置保存实测、测试数据恢复)
这个提交包含在:
@@ -62,8 +62,8 @@ $this->fail('信息不存在', 404); // 自定义业务码
|
||||
| `fc_comment` | id, post_id, user_id, score, content, images, reply, replytime, top, status |
|
||||
| `fc_report` | id, target_type, target_id, reason, reporter_id, status(pending/handled), remark |
|
||||
| `fc_order` | id, order_no, user_id, type(post/member/recharge), title, amount, pay_type, status(pending/paid/refunded/closed), paytime, refund_amount, refund_reason, related_id |
|
||||
| `fc_plan` | id, plan_code, name, price, origin_price, days, tag, sort, enabled |
|
||||
| `fc_user_ext` | user_id, openid, user_type(1/2), realname_status, is_member, member_level, member_expiretime, invite_code, inviter_id, free_view_date, free_view_used |
|
||||
| `fc_plan` | id, plan_code, name, price, origin_price, days, **post_quota**(含发布条数), tag, sort, enabled |
|
||||
| `fc_user_ext` | user_id, openid, user_type(1/2), realname_status, is_member, member_level, member_expiretime, invite_code, inviter_id, free_view_date, free_view_used, **post_quota_left**(剩余发布条数), **post_quota_expire**(额度有效期=会员到期时间) |
|
||||
| `fc_dist_relation` | user_id, parent_id, level(1/2) |
|
||||
| `fc_commission` | user_id, from_user_id, order_id, order_no, order_type, amount, rate, level, status(0/1) |
|
||||
| `fc_withdraw` | id, withdraw_no, user_id, amount, channel, status(auditing/paid/rejected), reason, paytime |
|
||||
@@ -78,6 +78,25 @@ $this->fail('信息不存在', 404); // 自定义业务码
|
||||
> 小程序会回落内置春绿渐变(不再出现旧配色/空白卡)。`image` 为空时前端按位置取内置白色插画渲染,无需后端出图。
|
||||
> 需要把线上老库对齐主题时执行 `php think fc:install`(幂等,见 §7.6)。
|
||||
|
||||
> **发布模式与发布套餐配置(v1.0.7,`fc_config` 的 `post.*` 分组)**:这是「免费/付费发布」与价格、条数的**唯一真源**,
|
||||
> 由后台「同城业务 → 基础数据 → 发布与费用配置」(`fc/publish`)维护,保存时会**同步** `fc_plan` 的月卡(M1)/年卡(M12)
|
||||
> 价格与 `post_quota`,保证「发布页价格 / 会员中心套餐价 / 后端计费」三者一致。
|
||||
>
|
||||
> | 配置键 | 默认值 | 含义 |
|
||||
> | --- | --- | --- |
|
||||
> | `post.mode` | `free` | `free` 免费发布(所有人免费)/ `paid` 付费发布 |
|
||||
> | `post.singlePrice` | `5` | 会员单条发布价格(元/条) |
|
||||
> | `post.monthPrice` | `19.9` | 按月发布价格(元) |
|
||||
> | `post.monthQuota` | `30` | 按月含发布条数 |
|
||||
> | `post.yearPrice` | `168` | 按年发布价格(元) |
|
||||
> | `post.yearQuota` | `500` | 按年含发布条数 |
|
||||
>
|
||||
> 计费顺序(付费模式):**套餐额度(`post_quota_left`,开通月/年卡赠送,随会员有效期)→ 每日免费条数(`fee.freePostPerDay`)
|
||||
> → 单条付费(`post.singlePrice`)**;金额一律服务端计算,客户端传入的 `amount` 被忽略。
|
||||
> 默认 `free` 是为了**避免上线即撞付费墙**;要开始收费,在后台把「发布模式」切到「付费发布」即可(一处生效)。
|
||||
> 老库升级:`php think fc:install` 会补齐 `post.*` 六项配置、`fc_user_ext` 两列与 `fc_plan.post_quota`,并同步月/年卡
|
||||
> (幂等:已存在的配置不覆盖、已存在的列不重复加)。
|
||||
|
||||
用户主表:`fa_user`(`Db::name('user')`):id, username, nickname, avatar, mobile, `money`(余额), score, status。
|
||||
后台:`fa_admin`、`fa_auth_group`(角色)、`fa_admin_log`(日志)。
|
||||
|
||||
@@ -138,7 +157,8 @@ $this->fail('信息不存在', 404); // 自定义业务码
|
||||
- 字符串用单引号;数组用 `[]`;不加 `declare(strict_types=1)`
|
||||
- 金额 `round($x, 2)`;时间统一 `time()`
|
||||
- 后台写入类动作需调用 `$this->adminLog('动作描述')` 留痕
|
||||
- **不要**修改 `V1.php` / `route.php` / `Auth.php`;`FcInstall.php` 仅在「表结构、菜单 ID、种子文案」明确需要时改,
|
||||
- **不要**修改 `V1.php` / `Auth.php` 的既有行为;`route.php` 是显式白名单路由——**新增接口必须登记**(漏登记线上直接 404,
|
||||
本地 mock 测试不会暴露),既有条目不要改动;`FcInstall.php` 仅在「表结构、菜单 ID、种子文案」明确需要时改,
|
||||
且必须保持**幂等**(`CREATE TABLE IF NOT EXISTS` + 存在即跳过 + 升级步骤只覆盖已知种子行)
|
||||
|
||||
---
|
||||
@@ -183,7 +203,7 @@ php think crud -t fc_post -c fc/post -m FcPost -u 1 -f 1 --no-interaction \
|
||||
├── 用户与商家 商家管理 / 会员管理 / 消息管理
|
||||
├── 交易管理 订单管理 / 会员套餐 / 资金流水 / 佣金明细 / 付费查看记录
|
||||
├── 分销管理 分销关系 / 提现审核
|
||||
└── 基础数据 服务区域 / 草稿箱
|
||||
└── 基础数据 服务区域 / 发布与费用配置 / 草稿箱
|
||||
```
|
||||
|
||||
> 超级管理员组(`fa_auth_group.id=1`)的 `rules` 为 `*`,新菜单自动全部可见。
|
||||
@@ -195,6 +215,7 @@ php think crud -t fc_post -c fc/post -m FcPost -u 1 -f 1 --no-interaction \
|
||||
| --- | --- | --- |
|
||||
| `fc/post/audit` | 审核通过/驳回 | BR-11 校验;通过时分类信息量 +1;发站内信 |
|
||||
| `fc/post/offline` | 下架 | `status=0` + 站内信 |
|
||||
| **`fc/post/top`** | **置顶 / 取消置顶(批量)** | 入参 `{ids, isTop:1\|0}`;只改 `is_top` 与 `updatetime`,并给发布者发站内信(v1.0.7);置顶信息在用户端首页与「我的发布」优先展示(BR-15) |
|
||||
| `fc/merchant/audit` | 商家资质审核 | 通过时同步用户身份为商家、`shop_status=normal` |
|
||||
| `fc/withdraw/pay` | 打款/驳回 | 驳回必须填原因(BR-09);打款写资金流水 |
|
||||
| `fc/order/refund` | 退款 | 金额须 >0(BR-10) |
|
||||
@@ -276,7 +297,37 @@ php think fc:install # 幂等:建表 + 存在则跳过种子 + 按标
|
||||
> 若指纹只写生态绿,这 3 条会被误判成「运营自定义配色」而**漏升级**(前端护栏虽能兜住显示,但数据层仍是旧色)。
|
||||
> `tools/check-theme.mjs` 已把「两族指纹覆盖度」纳入守卫,后续再换主题时先补新指纹再上线。
|
||||
|
||||
## 八、小程序账号凭据(AppID / AppSecret)
|
||||
### 7.7 发布模式与发布套餐升级(v1.0.7 · 已上线)
|
||||
|
||||
新增内容与 `php think fc:install` 的幂等补齐(配置契约见 §三 的 `post.*` 说明):
|
||||
|
||||
```text
|
||||
==> 发布模式与发布套餐升级
|
||||
- fa_fc_user_ext 新增列 post_quota_left
|
||||
- fa_fc_user_ext 新增列 post_quota_expire
|
||||
- fa_fc_plan 新增列 post_quota
|
||||
- 新增配置 6 项:post.mode / post.singlePrice / post.monthPrice / post.monthQuota / post.yearPrice / post.yearQuota
|
||||
- 会员套餐已与发布配置对齐 2 条(月/年卡价格与含条数)
|
||||
- 完成(发布模式 free)
|
||||
```
|
||||
|
||||
**v1.0.7 线上实测(2026-10-15,服务器 `8.137.181.63:/www/wwwroot/fenleixinxi.gzyakj.com.cn`)**
|
||||
|
||||
| 验证项 | 结果 |
|
||||
| --- | --- |
|
||||
| 推送与自动部署 | `git push origin main` → GitCode + 部署裸仓库同推,hook 输出 `[deploy] 后端代码已更新到 … 完成` |
|
||||
| 语法检查 | 6 个 PHP 文件 `php -l` 全部 `No syntax errors`;2 个后台 JS `node --check` 通过 |
|
||||
| 数据库迁移 | 上述输出(3 列 + 6 配置 + 套餐同步),业务记录数不变 |
|
||||
| 接口端到端 | `node tools/verify-api.mjs` → **183 / 183 通过**(含新增 `P8 GET /post/mine`、`P9 GET /post/publish-config`、置顶排序与「刚发布即出现在我的发布」断言) |
|
||||
| 后台新页面 | `s.php/fc/publish/index` 渲染正常(发布模式 / 单条价格 / 按月 + 条数 / 按年 + 条数 / 当前会员套餐 全中文标签) |
|
||||
| 后台置顶 | `fc/post/top` → `{"code":1,"msg":"置顶成功"}`,列表复查 `is_top=1`;取消置顶返回「已取消置顶」 |
|
||||
| 配置保存 | 保存返回「发布配置已保存并同步会员套餐」,`fc_plan` 月/年卡价格与 `post_quota` 同步 |
|
||||
| 收尾 | 测试期间的「付费发布 + 置顶」已恢复为**免费发布 + 无置顶**,线上保持默认安全态(要收费只需在后台把「发布模式」切成「付费发布」) |
|
||||
|
||||
> 踩坑:新接口若忘记在 `application/route.php` 登记,线上直接 `HTTP 404`(本地 mock 全绿也发现不了)——
|
||||
> 本次即先 404 后补登记,已在 §六 编码约定与 `docs/03 §6.0` 明确为强制项。
|
||||
|
||||
|
||||
|
||||
`POST /api/v1/auth/wx-login` 会把前端 `wx.login()` 拿到的 `code` 交给微信 `sns/jscode2session` 换 `openid`,
|
||||
所以**服务端必须持有该小程序的 AppID + AppSecret**。
|
||||
|
||||
在新工单中引用
屏蔽一个用户