mirror of
https://gitee.com/liuxioabin/fengketrade.git
synced 2026-04-17 12:57:32 +08:00
代码优化
This commit is contained in:
parent
2752693d3e
commit
cc42c047d1
@ -77,8 +77,11 @@ class Withdraw extends Common
|
|||||||
// 支付宝提现+自动打款
|
// 支付宝提现+自动打款
|
||||||
if ($withdraw->withdraw_type === 'alipay' && $withdrawService->config['auto_arrival']) {
|
if ($withdraw->withdraw_type === 'alipay' && $withdrawService->config['auto_arrival']) {
|
||||||
try {
|
try {
|
||||||
// 记录提现日志
|
// 记录提现日志(会自动检查时间限制)
|
||||||
$withdrawService->handleAlipayWithdraw($withdraw);
|
$withdrawService->handleAlipayWithdraw($withdraw);
|
||||||
|
} catch (\addons\shopro\exception\ShoproException $e) {
|
||||||
|
// 时间限制检查失败,不自动打款,保持待审核状态
|
||||||
|
$this->error($e->getMessage());
|
||||||
} catch (HttpResponseException $e) {
|
} catch (HttpResponseException $e) {
|
||||||
$data = $e->getResponse()->getData();
|
$data = $e->getResponse()->getData();
|
||||||
$message = $data ? ($data['msg'] ?? '') : $e->getMessage();
|
$message = $data ? ($data['msg'] ?? '') : $e->getMessage();
|
||||||
|
|||||||
@ -277,18 +277,17 @@ class Withdraw
|
|||||||
throw new ShoproException('请勿重复操作');
|
throw new ShoproException('请勿重复操作');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查提现打款时间限制(小时)
|
// 检查提现打款时间限制(小时)- 每次都重新读取配置确保最新
|
||||||
$limitHours = isset($this->config['days_7']) ? intval($this->config['days_7']) : 0;
|
$freshConfig = sheep_config('shop.recharge_withdraw.withdraw', false);
|
||||||
|
$limitHours = 0;
|
||||||
// 如果配置中没有读取到,尝试重新读取一次(不使用缓存)
|
if (is_array($freshConfig) && isset($freshConfig['days_7'])) {
|
||||||
if (!isset($this->config['days_7'])) {
|
$limitHours = intval($freshConfig['days_7']);
|
||||||
$freshConfig = sheep_config('shop.recharge_withdraw.withdraw', false);
|
$this->config['days_7'] = $limitHours; // 更新实例配置
|
||||||
if (is_array($freshConfig) && isset($freshConfig['days_7'])) {
|
} elseif (isset($this->config['days_7'])) {
|
||||||
$limitHours = intval($freshConfig['days_7']);
|
$limitHours = intval($this->config['days_7']);
|
||||||
$this->config['days_7'] = $limitHours;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果配置了时间限制,检查是否满足条件
|
||||||
if ($limitHours > 0) {
|
if ($limitHours > 0) {
|
||||||
$createtime = intval($withdraw->createtime);
|
$createtime = intval($withdraw->createtime);
|
||||||
if ($createtime > 0) {
|
if ($createtime > 0) {
|
||||||
|
|||||||
@ -116,10 +116,11 @@ class Withdraw extends Common
|
|||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (ShoproException $e) {
|
} catch (ShoproException $e) {
|
||||||
// 不回滚,记录错误日志
|
// 时间限制检查失败等业务异常,需要回滚事务
|
||||||
Db::commit();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
} catch (HttpResponseException $e) {
|
} catch (HttpResponseException $e) {
|
||||||
|
Db::rollback();
|
||||||
$data = $e->getResponse()->getData();
|
$data = $e->getResponse()->getData();
|
||||||
$message = $data ? ($data['msg'] ?? '') : $e->getMessage();
|
$message = $data ? ($data['msg'] ?? '') : $e->getMessage();
|
||||||
$this->error($message);
|
$this->error($message);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user