feat(withdraw): 落地方案B一体化商城余额提现与手续费内扣模式,完善多端打款退款与对账闭环

这个提交包含在:
chen
2026-09-20 14:35:38 +08:00
父节点 bee5288e88
当前提交 2b7c34c7f7
共有 65 个文件被更改,包括 3554 次插入 和 579 次删除

查看文件

@@ -21,6 +21,63 @@ class Base
public $config = null; // 支付参数
/**
* 确保 Yansongda Pay V3 类库与命名空间正确加载
*/
public static function ensurePayLoaded()
{
if (class_exists('\Yansongda\Pay\Pay') && method_exists('\Yansongda\Pay\Pay', 'config')) {
return;
}
// 尝试触发 epay 钩子
\think\Hook::listen('epay_config_init');
if (class_exists('\Yansongda\Pay\Pay') && method_exists('\Yansongda\Pay\Pay', 'config')) {
return;
}
// 保障性直接注册 epay 插件中的 Yansongda V3 类库
$libraryDir = (defined('ADDON_PATH') ? ADDON_PATH : (ROOT_PATH . 'addons' . DS)) . 'epay' . DS . 'library' . DS;
if (is_dir($libraryDir)) {
$versionDir = (PHP_VERSION_ID >= 80000 && is_dir($libraryDir . 'v3new')) ? 'v3new' : 'v3';
$yansongdaDir = $libraryDir . $versionDir . DS . 'Yansongda' . DS;
if (is_dir($yansongdaDir)) {
if (is_dir($yansongdaDir . 'Artful')) {
\think\Loader::addNamespace('Yansongda\Artful', $yansongdaDir . 'Artful' . DS);
if (file_exists($yansongdaDir . 'Artful' . DS . 'Functions.php')) {
require_once $yansongdaDir . 'Artful' . DS . 'Functions.php';
}
}
\think\Loader::addNamespace('Yansongda\Pay', $yansongdaDir . 'Pay' . DS);
$checkArr = [
'\Hyperf\Context\Context' => 'context',
'\Hyperf\Contract\Castable' => 'contract',
'\Hyperf\Engine\Constant' => 'engine',
'\Hyperf\Macroable\Macroable' => 'macroable',
'\Hyperf\Pimple\Container' => 'pimple',
'\Hyperf\Utils\Arr' => 'utils',
];
foreach ($checkArr as $index => $item) {
if (!class_exists($index) && is_dir($libraryDir . 'hyperf' . DS . $item . DS . 'src' . DS)) {
\think\Loader::addNamespace(substr($index, 1, strrpos($index, '\\') - 1), $libraryDir . 'hyperf' . DS . $item . DS . 'src' . DS);
}
}
if (!class_exists('\Yansongda\Supports\Logger') && is_dir($yansongdaDir . 'Supports')) {
\think\Loader::addNamespace('Yansongda\Supports', $yansongdaDir . 'Supports' . DS);
}
if (file_exists($yansongdaDir . 'Pay' . DS . 'Functions.php')) {
require_once $yansongdaDir . 'Pay' . DS . 'Functions.php';
}
}
}
}
/**
* yansongda 支付初始化
*
@@ -30,6 +87,8 @@ class Base
*/
public function init($payment, $config = [], $type = 'normal')
{
self::ensurePayLoaded();
$this->config = $this->getConfig($payment, $config, $type);
$this->pay = Pay::config($this->config);