80 lines
3.7 KiB
PHP
80 lines
3.7 KiB
PHP
<?php
|
||
/**
|
||
* This file is part of webman.
|
||
*
|
||
* Licensed under The MIT License
|
||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||
* Redistributions of files must retain the above copyright notice.
|
||
*
|
||
* @author walkor<walkor@workerman.net>
|
||
* @copyright walkor<walkor@workerman.net>
|
||
* @link http://www.workerman.net/
|
||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||
*/
|
||
|
||
use support\Request;
|
||
|
||
return [
|
||
/**
|
||
* DDPay(Payment Gateway)全量配置来自环境变量,见仓库根目录 `.env-example` 中 DDPAY_* 说明。
|
||
*
|
||
* - DDPAY_PUBLIC_BASE_URL:站点对外的 HTTPS 根地址(无尾斜杠),用于拼接入金/出金 callback_url;不配置则从请求头推导(本地可能为 http,生产务必配置)。
|
||
* - DDPAY_CLIENT_ID / DDPAY_IDENTIFIER / DDPAY_API_SECRET:商户标识与签名密钥(文档 Authentication)。
|
||
* - DDPAY_DEPOSIT_INIT_URL / DDPAY_DEPOSIT_STATUS_URL:入金发起、入金状态查询(文档 §3.1 / §3.3)。
|
||
* - DDPAY_PAYOUT_INIT_URL / DDPAY_PAYOUT_STATUS_URL:出金发起、出金状态查询(文档 §3.2 / §3.4)。
|
||
*/
|
||
'ddpay_public_base_url' => is_string(getenv('DDPAY_PUBLIC_BASE_URL')) ? trim(getenv('DDPAY_PUBLIC_BASE_URL')) : '',
|
||
|
||
'ddpay_client_id' => is_string(getenv('DDPAY_CLIENT_ID')) ? trim(getenv('DDPAY_CLIENT_ID')) : '',
|
||
'ddpay_identifier' => is_string(getenv('DDPAY_IDENTIFIER')) ? trim(getenv('DDPAY_IDENTIFIER')) : '',
|
||
'ddpay_api_secret' => is_string(getenv('DDPAY_API_SECRET')) ? trim(getenv('DDPAY_API_SECRET')) : '',
|
||
|
||
'ddpay_deposit_init_url' => is_string(getenv('DDPAY_DEPOSIT_INIT_URL')) ? trim(getenv('DDPAY_DEPOSIT_INIT_URL')) : '',
|
||
'ddpay_deposit_status_url' => is_string(getenv('DDPAY_DEPOSIT_STATUS_URL')) ? trim(getenv('DDPAY_DEPOSIT_STATUS_URL')) : '',
|
||
|
||
'ddpay_payout_init_url' => is_string(getenv('DDPAY_PAYOUT_INIT_URL')) ? trim(getenv('DDPAY_PAYOUT_INIT_URL')) : '',
|
||
'ddpay_payout_status_url' => is_string(getenv('DDPAY_PAYOUT_STATUS_URL')) ? trim(getenv('DDPAY_PAYOUT_STATUS_URL')) : '',
|
||
|
||
// 模拟支付(channel_code=mock):未接入 DDPay 时用于联调;FINANCE_MOCK_PAY_ENABLED=0 可关闭
|
||
'finance_mock_pay_enabled' => (static function (): bool {
|
||
$raw = getenv('FINANCE_MOCK_PAY_ENABLED');
|
||
if (is_string($raw) && $raw !== '') {
|
||
$norm = strtolower(trim($raw));
|
||
if (in_array($norm, ['0', 'false', 'no', 'off'], true)) {
|
||
return false;
|
||
}
|
||
if (in_array($norm, ['1', 'true', 'yes', 'on'], true)) {
|
||
return true;
|
||
}
|
||
}
|
||
$debugRaw = getenv('APP_DEBUG');
|
||
if ($debugRaw === false || $debugRaw === '') {
|
||
return true;
|
||
}
|
||
|
||
return in_array(strtolower(trim((string) $debugRaw)), ['1', 'true', 'yes', 'on'], true);
|
||
})(),
|
||
|
||
/** 充值待支付订单有效秒数(超时未支付自动失败;支付链接倒计时与此一致) */
|
||
'deposit_pending_expire_seconds' => (static function (): int {
|
||
$raw = getenv('DEPOSIT_PENDING_EXPIRE_SECONDS');
|
||
if (is_string($raw) && trim($raw) !== '') {
|
||
$v = filter_var(trim($raw), FILTER_VALIDATE_INT);
|
||
if ($v !== false && $v > 0) {
|
||
return $v;
|
||
}
|
||
}
|
||
|
||
return 60;
|
||
})(),
|
||
|
||
'debug' => true,
|
||
'error_reporting' => E_ALL,
|
||
'default_timezone' => 'Asia/Shanghai',
|
||
'request_class' => Request::class,
|
||
'public_path' => base_path() . DIRECTORY_SEPARATOR . 'public',
|
||
'runtime_path' => base_path(false) . DIRECTORY_SEPARATOR . 'runtime',
|
||
'controller_suffix' => 'Controller',
|
||
'controller_reuse' => false,
|
||
];
|