|
|
@@ -602,15 +602,6 @@ class ProductController extends BaseController
|
|
|
$targetId = Yii::$app->request->post('targetId', 0);
|
|
|
$changeParams = ['staffId' => $shopAdmin->id, 'staffName' => $shopAdmin->name, 'changeType' => $changeType, 'targetId' => $targetId];
|
|
|
|
|
|
-
|
|
|
- //解决重复请求问题
|
|
|
- $cacheKey = 'batch_change_price_' . $targetId;
|
|
|
- $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
- if (!empty($has)) {
|
|
|
- util::fail('请稍等30秒');
|
|
|
- }
|
|
|
- Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 30, 'has']);
|
|
|
-
|
|
|
$post = Yii::$app->request->post();
|
|
|
$data = $post['data'] ?? '';
|
|
|
if (empty($data)) {
|
|
|
@@ -626,6 +617,14 @@ class ProductController extends BaseController
|
|
|
util::fail('请先升级应用');
|
|
|
}
|
|
|
|
|
|
+ //解决重复请求问题
|
|
|
+ $cacheKey = 'batch_change_price_' . $targetId;
|
|
|
+ $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
|
|
|
+ if (!empty($has)) {
|
|
|
+ util::fail('请稍等5秒操作');
|
|
|
+ }
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 5, 'has']);
|
|
|
+
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|