Parcourir la source

更新:商城下单操作接口添加--从redis查询报价

shizhongqi il y a 11 mois
Parent
commit
bb55c7c2d1
1 fichiers modifiés avec 9 ajouts et 0 suppressions
  1. 9 0
      app-mall/controllers/OrderController.php

+ 9 - 0
app-mall/controllers/OrderController.php

@@ -411,6 +411,15 @@ class OrderController extends BaseController
         if ($stock <= 0) {
             util::fail('库存不足');
         }
+        // 从redis查询报价 shopId-userId-goodsId
+        $key = $this->shopId . '-' . $this->userId . '-' . $goodsId;
+        $val = Yii::$app->redis->executeCommand('GET', [$key]);
+        if (floatval($val) > 0) {
+            $goodsInfo->price = $val;
+            $goodsInfo->priceType = 2;
+        }
+        
+
         //事务处理
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();