浏览代码

寄售订单

afa 7 月之前
父节点
当前提交
47fcde06fa
共有 1 个文件被更改,包括 15 次插入14 次删除
  1. 15 14
      application/api/logic/MarketLogic.php

+ 15 - 14
application/api/logic/MarketLogic.php

@@ -23,7 +23,7 @@ class MarketLogic
             $minPrice = ProductTransfer::getTransferMinPrice($productId);
             if($price < $minPrice) $minPrice = $price;
 
-            $isUpdate = false;
+            
             //添加市场
             $rows = ProductMarket::where('product_id', $productId)->find();
             if(empty($rows)){
@@ -31,20 +31,21 @@ class MarketLogic
                   'product_id' => $productId, 
                   'type_id'    => ProductLists::getProductTypeById($productId), 
                   'price'      => $minPrice,'status' => ProductMarket::Normal]);
-            }
-            
-            //更新市场状态
-            if($rows->status != ProductMarket::Normal ){
-                  $rows->status = ProductMarket::Normal;
-                  $isUpdate = true;
-            }
-            //更新最低价
-            if($rows->price != $minPrice){
-                  $rows->price = $minPrice;
-                  $isUpdate = true;
-            }
-            if($isUpdate) $rows->save();
+            }else{
 
+                  $isUpdate = false;    
+                  //更新市场状态
+                  if($rows->status != ProductMarket::Normal ){
+                        $rows->status = ProductMarket::Normal;
+                        $isUpdate = true;
+                  }
+                  //更新最低价
+                  if($rows->price != $minPrice){
+                        $rows->price = $minPrice;
+                        $isUpdate = true;
+                  }
+                  if($isUpdate) $rows->save();
+            }
             //添加寄售订单
             $fee = getConfig('transfer_fee');
             $feeAmount = bcmul($price, $fee, 2) ;