|
|
@@ -847,13 +847,13 @@ class OrderController extends BaseController
|
|
|
$shopAdminId = $this->shopAdminId;
|
|
|
$shopAdminName = $shopAdmin->name ?? '';
|
|
|
|
|
|
- //n秒内不允许重复提交
|
|
|
- $cacheKey = 'ghs_custom_create_order_' . $customId . '_' . $shopAdminId;
|
|
|
- $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
+ //n秒内不允许重复提交,有多个地方要同步修改,关键词ghs_custom_create_order_redis
|
|
|
+ $createOrderCacheKey = 'ghs_custom_create_order_' . $customId . '_' . $shopAdminId;
|
|
|
+ $has = Yii::$app->redis->executeCommand('GET', [$createOrderCacheKey]);
|
|
|
if (!empty($has)) {
|
|
|
- util::fail('已提交过,3秒后再试');
|
|
|
+ util::fail('已提交过,5秒后再试');
|
|
|
}
|
|
|
- Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 3, 'has']);
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$createOrderCacheKey, 5, 'has']);
|
|
|
|
|
|
CustomClass::valid($custom, $this->shopId);
|
|
|
if (isset($custom['mainId']) && !empty($custom['mainId']) && $custom['mainId'] == $custom['ownMainId']) {
|
|
|
@@ -1015,6 +1015,8 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
if (!empty($diff)) {
|
|
|
+ //n秒内不允许重复提交,有多个地方要同步修改,关键词ghs_custom_create_order_redis
|
|
|
+ Yii::$app->redis->executeCommand('DEL', [$createOrderCacheKey]);
|
|
|
util::success(['diff' => $diff, 'respondType' => 'priceError']);
|
|
|
}
|
|
|
}
|
|
|
@@ -1037,15 +1039,6 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //4秒内不允许重复开单
|
|
|
- $staffId = $this->shopAdminId ?? 0;
|
|
|
- $cacheKey = 'ghs_create_order_' . $staffId . '_' . $customId;
|
|
|
- $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
- if (!empty($has)) {
|
|
|
- util::fail('请稍等');
|
|
|
- }
|
|
|
- Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 4, 'has']);
|
|
|
-
|
|
|
$connection = Yii::$app->db;//事务处理
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|