|
|
@@ -10,6 +10,7 @@ use App\Services\WiwiPay;
|
|
|
use App\Services\PayConfig;
|
|
|
use App\Services\PayUtils;
|
|
|
use App\Util;
|
|
|
+use App\Utility\SetNXLock;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
@@ -79,6 +80,18 @@ class WiwiPayController implements PayMentInterFace
|
|
|
}
|
|
|
|
|
|
$order_sn = @$post['mchOrderNo'];
|
|
|
+ if (empty($order_sn)) {
|
|
|
+ Util::WriteLog('WiwiPay', '缺少订单号');
|
|
|
+ return 'fail';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 代收回调加锁,防止并发重复处理
|
|
|
+ $lockKey = 'pay_notify_WiwiPay_' . $order_sn;
|
|
|
+ if (!SetNXLock::getExclusiveLock($lockKey, 60)) {
|
|
|
+ Util::WriteLog('WiwiPay', '代收回调并发,订单已处理或处理中: ' . $order_sn);
|
|
|
+ return 'success';
|
|
|
+ }
|
|
|
+
|
|
|
$logic = new WiwiPayLogic();
|
|
|
try {
|
|
|
$redis = Redis::connection();
|
|
|
@@ -91,6 +104,8 @@ class WiwiPayController implements PayMentInterFace
|
|
|
TelegramBot::getDefault()->sendProgramNotify("WiwiPay 订单回调执行 异常 ", json_encode($post), $exception);
|
|
|
Util::WriteLog("WiwiPay_error", $post);
|
|
|
return '{"success":false,"message":"商户自定义出错信息"}';
|
|
|
+ } finally {
|
|
|
+ SetNXLock::release($lockKey);
|
|
|
}
|
|
|
}
|
|
|
|