Files
YwxAppThink/addon/paycenter/library/contract/Channel.php
T
yangwx 18101cf11a feat: 上线前安全加固与发布工程化;appmall 由插件迁移为独立应用
安全(P0)
- 发布包签名:新增 scripts/package_keygen.php、scripts/package_verify.php、
  ywxapp\service\PackageVerifier;FrameworkService::apply() 解压前强制验签
  (ywxapp.framework_package_verify,默认开启)
- JWT 收紧:config/jwt.php 移除公开默认密钥,JwtService::assertStrongSecret()
  校验非空 / 长度≥32 / 已知弱值;.env.production.example 键名由 JWT_SECRET_KEY 修正为 JWT_SECRET
- /api/v1/Article:免登录白名单收窄为只读接口,写操作字段白名单 + assertOwner() 越权校验
- 开发者令牌:查找接口不再回显明文、统一失败文案 + 限流
- TemplateInstaller:文件名白名单 + realpath 归一化 + 目录内断言,修复 Zip Slip;补 use ZipArchive
- 后台登录:接入验证码、失败锁定与登录限流(config/ratelimit.php)
- 缓存 / Session 驱动可由 .env 覆盖(CACHE_DRIVER / SESSION_TYPE),集群部署改 redis
- paycenter 支付日志开关改为 PAY_LOG,不再跟随 APP_DEBUG

工程化 / 交付
- 新增 CHANGELOG.md 与 .env.production.example;composer.lock 入库锁定依赖版本
- 插件离线安装 CLI 增加 --uid,后台上传安装透传 uid,付费插件授权校验可通过
- 授权拒绝文案区分「未携带 uid」与「未找到有效授权」,便于排障
- .gitignore 放行 .env.production.example / .env.addon.example / .gitattributes / public/.htaccess

结构
- appmall 由 addon/appmall 迁移为独立应用 app/appmall(市场 / 开发者中心 / 审核 / 分润)
2026-10-22 00:53:39 +08:00

59 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace addon\paycenter\library\contract;
use think\Response;
/**
* 支付渠道契约。
*
* 新增渠道(如银联、PayPal)只需实现本接口并在 service\Payment::CHANNELS 登记,
* 业务侧(应用市场等)一行都不用改。
*/
interface Channel
{
/** 渠道标识:alipay / wechat */
public function code(): string;
/** 渠道中文名(后台展示 / 支付方式列表) */
public function name(): string;
/** 是否已配置商户参数(未配置时 methods() 不返回该渠道) */
public function configured(): bool;
/** 本渠道支持的场景 */
public function scenes(): array;
/**
* 下单(拉起支付)
*
* @param array $order ['trade_no','amount','subject','biz','biz_id','attach','openid'?]
* @param string $scene web / wap / qr / h5 / mp / mini / app
* @param array $urls ['notify' => 绝对回调地址, 'return' => 同步跳转地址]
* @return array ['type' => form|qrcode|url|params, 'content' => mixed, 'trade_no' => string]
*/
public function create(array $order, string $scene, array $urls): array;
/**
* 主动查单(回调丢失 / 用户跳回落地页时兜底)
* @return array ['paid' => bool, 'amount' => float, 'gateway_no' => string]
*/
public function query(string $tradeNo): array;
/**
* 解析并验签异步回调
* @return array ['paid'=>bool,'trade_no'=>string,'amount'=>float,'gateway_no'=>string]
*/
public function notify(): array;
/** 给网关的应答(支付宝要 'success',微信要 JSON {code:SUCCESS}) */
public function ack(bool $ok = true): Response;
/**
* 退款
* @return array ['ok'=>bool,'message'=>string]
*/
public function refund(string $tradeNo, float $amount, float $total): array;
}