|
|
@@ -54,6 +54,17 @@ class MtController extends PublicController
|
|
|
public function actionConfirmOrder()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
+ $orderId = $post['order_id'] ?? 0;
|
|
|
+
|
|
|
+ //4秒内不允许第三方重复通知
|
|
|
+ $cacheKey = 'mt_confirm_order_' . $orderId;
|
|
|
+ $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
+ if (!empty($has)) {
|
|
|
+ Yii::info("美团已确认订单通知,出现重复通知,流水类型:orderId:{$orderId}");
|
|
|
+ return Json::encode(['data' => 'ok']);
|
|
|
+ }
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 4, 'has']);
|
|
|
+
|
|
|
// 无数据过来时,是美团对接口进行存活试探,请保留此段代码,好让请求在此被中断返回
|
|
|
if (empty($post)) {
|
|
|
return Json::encode(['data' => 'ok']);
|
|
|
@@ -62,7 +73,6 @@ class MtController extends PublicController
|
|
|
|
|
|
$connection = Yii::$app->db;//事务处理
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
- $orderId = $post['order_id'] ?? 0;
|
|
|
try {
|
|
|
|
|
|
$shopId = $post['app_poi_code'] ?? '';
|