Browse Source

出售求购

afa 7 tháng trước cách đây
mục cha
commit
564d843498
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      application/api/controller/Market.php

+ 1 - 1
application/api/controller/Market.php

@@ -168,7 +168,7 @@ class Market extends Api
             //关闭订单
             $productOrder::where('id', $params['order_id'])->where('user_id', $this->auth->id)->setField(['status' => ProductOrder::Closure]);
 
-            if($buying->stock == 1) $buying->status = ProductBuying::SaleOut;
+            if(($buying->stock - $buying->num) == 1) $buying->status = ProductBuying::SaleOut;
             $buying->num += 1;
             $buying->save();
             // 提交事务