|
@@ -10,6 +10,7 @@ use App\Services\WDPay;
|
|
|
use App\Services\PayConfig;
|
|
use App\Services\PayConfig;
|
|
|
use App\Services\PayUtils;
|
|
use App\Services\PayUtils;
|
|
|
use App\Util;
|
|
use App\Util;
|
|
|
|
|
+use App\Utility\SetNXLock;
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
use Illuminate\Support\Facades\Redis;
|
|
@@ -95,6 +96,13 @@ class WDPayController implements PayMentInterFace
|
|
|
return response()->json(['success' => false, 'message' => 'Missing customerOrderNo']);
|
|
return response()->json(['success' => false, 'message' => 'Missing customerOrderNo']);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 代收回调加锁,防止并发重复处理
|
|
|
|
|
+ $lockKey = 'pay_notify_WDPay_' . $order_sn;
|
|
|
|
|
+ if (!SetNXLock::getExclusiveLock($lockKey, 60)) {
|
|
|
|
|
+ Util::WriteLog('WDPay', '代收回调并发,订单已处理或处理中: ' . $order_sn);
|
|
|
|
|
+ return '{"msg":"success","code":200}';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$logic = new WDPayLogic();
|
|
$logic = new WDPayLogic();
|
|
|
try {
|
|
try {
|
|
|
$redis = Redis::connection();
|
|
$redis = Redis::connection();
|
|
@@ -109,6 +117,8 @@ class WDPayController implements PayMentInterFace
|
|
|
TelegramBot::getDefault()->sendProgramNotify("WDPay 订单回调执行 异常 ", json_encode($post), $exception);
|
|
TelegramBot::getDefault()->sendProgramNotify("WDPay 订单回调执行 异常 ", json_encode($post), $exception);
|
|
|
Util::WriteLog("WDPay_error", $exception->getMessage());
|
|
Util::WriteLog("WDPay_error", $exception->getMessage());
|
|
|
return response()->json(['success' => false, 'message' => 'Process failed']);
|
|
return response()->json(['success' => false, 'message' => 'Process failed']);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ SetNXLock::release($lockKey);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|