afa 7 月之前
父节点
当前提交
2eb4f92d71
共有 2 个文件被更改,包括 22 次插入18 次删除
  1. 2 0
      application/api/controller/Order.php
  2. 20 18
      application/api/logic/MarketLogic.php

+ 2 - 0
application/api/controller/Order.php

@@ -254,6 +254,8 @@ class Order extends Api
         $this->success('ok');
     }
 
+    
+
     //查看快递信息
     public function getTracking(UserArea $userArea)
     {

+ 20 - 18
application/api/logic/MarketLogic.php

@@ -57,27 +57,29 @@ class MarketLogic
       {
             //市场
             $market = ProductMarket::where('product_id', $orderInfo['product_id'])->find();
-            $isUpdate = false;
-            //是否全部取消
-            $rows  = ProductTransfer::where('order_id', $orderId)->find();
-            $count = ProductTransfer::where('product_id', $orderInfo['product_id'])->where('status', ProductTransfer::Normal)->count();
-            if($count == 1){
-                  $isUpdate = true;
-                  $market->status = ProductMarket::Hidden;
-            }else{
-                  //取消最小价格
-                  if($rows->price < $market->price){
+            if($market){
+                  $isUpdate = false;
+                  //是否全部取消
+                  $rows  = ProductTransfer::where('order_id', $orderId)->find();
+                  $count = ProductTransfer::where('product_id', $orderInfo['product_id'])->where('status', ProductTransfer::Normal)->count();
+              
+                  if($count == 1){
                         $isUpdate = true;
-                        $market->price = ProductTransfer::getTransferMinPriceByProduct($orderInfo['product_id'], $rows->price);
+                        $market->status = ProductMarket::Hidden;
+                  }else{
+                        //取消最小价格
+                        if($rows->price < $market->price){
+                              $isUpdate = true;
+                              $market->price = ProductTransfer::getTransferMinPriceByProduct($orderInfo['product_id'], $rows->price);
+                        }
                   }
+                  //市场状态
+                  if($isUpdate) $market->save();
+      
+                  //转让列表取消
+                  $rows->status = ProductTransfer::Stop;
+                  $rows->save();
             }
-            //市场状态
-            if($isUpdate) $market->save();
-
-            //转让列表取消
-            $rows->status = ProductTransfer::Stop;
-            $rows->save();
-
             //新增记录
             return ProductOrder::setCreateOrder($orderInfo['order_id'], $orderInfo, ProductOrder::Popular, $userId, $orderInfo['from_user'], getOrderSN('R'.$orderInfo['order_id']), 0, $orderInfo->popular_price);
       }