feat(v1.1.0): 支付改由 epay 插件承载、插件纳入版本库,补齐媒体上传/LBS/互动/优惠券/后台看板,并修复余额充值资损

## 一、支付:改由已安装的 epay 插件承载(不再自研签名)
- 下单:\addons\epay\library\Service::submitOrder($amount 元, $orderNo, 'wechat', $body, $notifyUrl, null, 'miniapp', $openid)
- 验签:Service::checkNotify('wechat')(内部 $pay->verify());应答:$pay->success()(v2 = XML)
- 业务编排仍在 application/api/controller/Pay.php,不改插件源码:
  POST /pay/prepay(取调起参数,下发前剔除 appId);POST /pay/notify(公开路由:插件验签 → 金额核对 → 幂等分派)
- 配置真源 = addons/epay/config.php(后台「插件管理 → 微信支付宝整合插件 → 配置」);
  fc_config 的 wx.mchId / wx.apiKey / wx.payNotifyUrl 废弃;后台「系统设置」支付表单改只读并跳插件配置页
- 插件 API 保持 version=v2(PHP 7.4 可跑);certs/* 为 0 字节占位,不含任何真实密钥
- 修复 BUG-015:Pay::notify() 与基类站内信同名且签名不兼容导致 /pay/* 全 500,动作改名 notifyCallback()

## 二、插件纳入 Git 版本管理
- .gitignore 移除 /addons/* 与 /public/assets/addons/*(保留 .gitkeep 占位)
- 入库 addons/epay、addons/wechat、public/assets/addons/*、addons/.htaccess(deny from all)
- config.php 入库为空白模板;服务器请在填好密钥后执行
  git update-index --skip-worktree addons/epay/config.php,避免真实密钥回传仓库

## 三、安全修复:余额充值资损(高危,已实测复现)
- 现象:POST /order/recharge {payType:'balance'} 只加余额不扣款(余额 134.50 → 1022.50),等于凭空增发余额,
  可再去买会员 / 付费发布 / 解锁联系方式
- 修复:/order/recharge 仅接受 payType=wxpay,balance → 「余额充值仅支持微信支付」,其它 → 「支付方式不支持」;
  订单恒为 status=pending、pay_type=wxpay、paytime=null;入账只发生在 /pay/notify 回调(Order::creditRecharge)
  或后台「会员管理 → 余额充值」(fc/userext/recharge)
- 小程序充值页同步为「仅微信支付」+ 防重复提交 + onShow 刷新资产;mock / 用例 / 文档同步

## 四、其他 v1.1.0 能力
- 媒体上传:POST /post/upload(图片 ≤10MB / 视频 ≤50MB,真落盘),发布页 uni.uploadFile 真上传
- LBS:fc_post.lat/lng、首页 sort=nearby(距离升序、无坐标排最后)、卡片 distance、详情页地图
- 互动:举报 POST /report(原因字典)、收藏 / 关注(fc_favorite / fc_follow、/favorite/*、/follow/toggle)
- 交易:余额充值 POST /order/recharge、优惠券 /coupon/list|receive(fc_coupon / fc_user_coupon、我的资产券)
- 发布计费:会员发布折扣(discountRate/discountText)+ 免费发布条数(freeQuota*)
- 后台新增:数据总览 fc/dashboard、系统设置 fc/setting、优惠券管理 fc/coupon(含菜单与权限节点)

## 五、本批审核修复
- 详情页:游客不再请求登录态接口(避免 401 被清 token 踢去登录);微信付费查看改为支付后轮询解锁,
  不再读取 wxpay 分支未返回的 contact;加防重复提交
- 发布页:freeLeftToday → freeQuotaLeft / freeQuotaCycle / freeUnlimited(对齐后端出参);
  上传图预览拼后端域名(新增 format.js#assetUrl,后端返回相对路径)
- 收藏空态「去首页」:switchTab → reLaunch(项目用自绘 fc-tabbar,无 tabBar,switchTab 必然失败)
- 会员券 days=0 显示「永久有效」;manifest.json 补 requiredPrivateInfos(getLocation / chooseLocation)
- 后端:publishConfig 补 discountRate/discountText 与 memberPostDiscountText();优惠券总开关 coupon.enabled
  真生效(关闭后 list/receive 拒绝);后台 fc/Coupon 的 add/edit 补 strip_tags 过滤(防存储型 XSS)、
  补 searchFields='name',列表 name 列再做一次 HTML 转义
- FcInstall:补清理后台菜单缓存 __menu__(否则新菜单要等缓存过期才显示),并同步 README 说明
- 后台语言包 fc/setting.php 按「支付只读 + 跳插件配置」的新页面重写
- 文档同步:uniapp/docs/{01,03,04}、uniapp/README.md、docs/05-后端实现规范.md、后台 README 上线步骤

## 六、校验结果(全部通过)
- 后端端到端:tools/verify-api.mjs 226/226(含新增「拒绝余额充值(资损防护)」用例)
- 小程序:uniapp/tests/run.mjs 167/167;validate.mjs 0 错 0 警;check-scss 19/19
- 后台:check-admin-i18n 0 错 0 警;check-theme 0 错 0 警;9 个页面 HTTP 200 全中文
- php -l 改动/新增 PHP 文件 0 语法错误;探针复测:余额不再增长、epay 插件下单/验签链路通
这个提交包含在:
2026-10-19 10:03:13 +08:00
父节点 592c5af931
当前提交 63fdfe87d7
共有 1086 个文件被更改,包括 68849 次插入 和 276 次删除

查看文件

@@ -44,7 +44,7 @@ export const datasets = {
/** 热门搜索 */
hotKeywords: ['租房 一室一厅', '二手电动车', '急招快递员', '钢琴家教', '空调维修'],
/** 信息流(含待审核/已通过/已驳回,供两端联调) */
/** 信息流(含待审核/已通过/已驳回,供两端联调;lat/lng 为 LBS 坐标,distance 单位 km 一位小数) */
posts: [
{
id: 101, categoryId: 1, categoryName: '招聘求职', title: '急招快递分拣员(日结)',
@@ -53,7 +53,7 @@ export const datasets = {
contact: '139****8888', contactFull: '13988888888', views: 1892, likes: 32,
isPaid: false, auditStatus: 1, createdAt: iso(0.2), tags: ['日结', '包吃'],
publisher: { id: 2001, name: '顺捷物流', avatar: '', isMerchant: true, verified: true },
commentCount: 12, distance: 1200,
commentCount: 12, lat: 26.6157, lng: 106.6979, distance: 7.6,
},
{
id: 102, categoryId: 2, categoryName: '房产租售', title: '整租·未来方舟精装一室一厅',
@@ -62,7 +62,7 @@ export const datasets = {
contact: '135****6666', contactFull: '13566666666', views: 3204, likes: 88,
isPaid: true, auditStatus: 1, createdAt: iso(0.5), tags: ['精装', '近地铁'],
publisher: { id: 2002, name: '安家房产', avatar: '', isMerchant: true, verified: true },
commentCount: 26, distance: 3400,
commentCount: 26, lat: 26.5716, lng: 106.7314, distance: 13.1,
},
{
id: 103, categoryId: 3, categoryName: '二手闲置', title: '九成新山地自行车 转让',
@@ -71,7 +71,7 @@ export const datasets = {
contact: '137****1234', contactFull: '13712341234', views: 640, likes: 21,
isPaid: false, isTop: true, auditStatus: 1, createdAt: iso(1), tags: ['自提', '9成新'],
publisher: { id: 2003, name: '骑行爱好者', avatar: '', isMerchant: false, verified: false },
commentCount: 4, distance: 820,
commentCount: 4, lat: 26.6300, lng: 106.6250, distance: 1.9,
},
{
id: 104, categoryId: 4, categoryName: '车辆买卖', title: '2019 款家用轿车 一手车',
@@ -80,7 +80,7 @@ export const datasets = {
contact: '138****0000', contactFull: '13800000000', views: 1120, likes: 40,
isPaid: true, auditStatus: 0, createdAt: iso(0.1), tags: ['无事故', '可检测'],
publisher: { id: 2004, name: '车行天下', avatar: '', isMerchant: true, verified: true },
commentCount: 0, distance: 5100,
commentCount: 0, lat: 26.6049, lng: 106.7194, distance: 10.0,
},
{
id: 105, categoryId: 5, categoryName: '本地服务', title: '专业空调清洗 / 加氟上门',
@@ -89,7 +89,7 @@ export const datasets = {
contact: '131****5678', contactFull: '13156785678', views: 2310, likes: 66,
isPaid: false, auditStatus: 0, createdAt: iso(0.05), tags: ['上门', '不满意不收费'],
publisher: { id: 2005, name: '洁净到家', avatar: '', isMerchant: true, verified: true },
commentCount: 18, distance: 2600,
commentCount: 18, lat: 26.5600, lng: 106.6870, distance: 11.2,
},
{
id: 106, categoryId: 3, categoryName: '二手闲置', title: 'iPad 2021 64G 深空灰',
@@ -98,7 +98,7 @@ export const datasets = {
contact: '150****3344', contactFull: '15033443344', views: 480, likes: 15,
isPaid: false, auditStatus: 2, createdAt: iso(2), tags: ['验机'],
publisher: { id: 2006, name: '小王同学', avatar: '', isMerchant: false, verified: false },
commentCount: 1, distance: 1500,
commentCount: 1, lat: 26.6230, lng: 106.6400, distance: 2.8,
},
],
@@ -114,17 +114,25 @@ export const datasets = {
* 发布配置(后台「发布与费用配置」下发;与 fa_fc_config 的 post.* 对齐)
* mode:free 免费发布 / paid 付费发布(付费模式下按 singlePrice 或套餐额度)
* quotaLeft:当前用户的剩余发布条数(套餐额度,随会员有效期)
* discountRate:会员发布折扣率(1 = 无折扣,0.8 = 8 折);单条金额 = round(singlePrice * discountRate, 2)
* discountText:折扣展示文案(如「8 折」),无折扣时为空
*/
publishRule: {
mode: 'paid',
singlePrice: 5,
discountRate: 1,
discountText: '',
monthPrice: 19.9,
monthQuota: 30,
yearPrice: 168,
yearQuota: 500,
quotaLeft: 30,
freePerDay: 2, // 每日免费发布条数(付费模式下仍保留的免费次数)
freeUsedToday: 0,
// 免费发布条数(字段名与后端 Post::publishConfig 对齐:freeQuota/freeQuotaCycle/freeQuotaUsed/freeQuotaLeft/freeUnlimited)
freeQuota: 2, // 周期内免费发布条数
freeQuotaCycle: 'daily',
freeQuotaUsed: 0,
freeQuotaLeft: 2, // -1 表示不限制
freeUnlimited: false,
quotaExpireAt: iso(-25),
isMember: true,
memberExpireAt: iso(-25),
@@ -183,13 +191,38 @@ export const datasets = {
benefits: ['每日免费查看 20 条联系方式', '发布信息 8 折', '专属会员标识', '分销佣金加速结算'],
},
/** 我的资产 */
/** 我的资产(coupons / couponCount 由 /member/assets 从 fc_user_coupon 实时聚合) */
assets: {
balance: 128.5,
coupons: [{ id: 1, name: '发布立减 3 元', amount: 3, expireAt: iso(-20) }],
points: 320,
},
/** 可领取的优惠券定义(fc_coupon) */
coupons: [
{ id: 1, name: '发布立减 3 元', type: 'fixed', amount: 3, minAmount: 0, total: 1000, receivedCount: 12, enabled: true, sort: 1, days: 30 },
{ id: 2, name: '满 50 减 10', type: 'fixed', amount: 10, minAmount: 50, total: 500, receivedCount: 88, enabled: true, sort: 2, days: 15 },
{ id: 3, name: '会员开通 9 折', type: 'discount', amount: 0.9, minAmount: 0, total: 200, receivedCount: 30, enabled: true, sort: 3, days: 7 },
{ id: 4, name: '已停发券', type: 'fixed', amount: 5, minAmount: 20, total: 100, receivedCount: 100, enabled: false, sort: 4, days: 10 },
],
/** 我已领取的优惠券(fc_user_coupon) */
userCoupons: [
{ id: 1, couponId: 1, status: 'unused', orderNo: '', usetime: '', expiretime: iso(-20), createtime: iso(2) },
],
/** 我的收藏(fc_favorite:user_id + post_id) */
favorites: [
{ id: 1, postId: 101, createtime: iso(1) },
],
/** 我的关注(fc_follow:user_id + target_user_id) */
follows: [
{ id: 1, targetUserId: 2001, createtime: iso(2) },
],
/** 微信支付商户参数是否已配置(未配置时 /pay/prepay 返回「微信支付未配置」,余额支付不受影响) */
wxPayConfigured: true,
/** 订单(发布/会员/充值 三类,供用户端与后台共用) */
orders: [
{ id: 3001, orderNo: 'PO20240101001', type: 'post', title: '单条付费发布', amount: 5, payType: 'wxpay', status: 'paid', createdAt: iso(1) },