afa 7 달 전
부모
커밋
ad9004ec1b
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      application/api/controller/Market.php

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

@@ -11,6 +11,7 @@ use app\common\model\UserModel;
 use app\common\model\LedgerWalletModel;
 use app\common\model\ProductTransfer;
 use app\api\logic\MarketLogic;
+use app\common\model\ProductOrder;
 use app\common\model\UserBuying;
 use fast\Action;
 use fast\Asset;
@@ -140,7 +141,7 @@ class Market extends Api
 
 
     //出售求购
-    public function sellBuying(LedgerWalletModel $ledgerWalletModel, ProductBuying $productBuying, UserBuying $userBuying)
+    public function sellBuying(LedgerWalletModel $ledgerWalletModel, ProductBuying $productBuying, UserBuying $userBuying, ProductOrder $productOrder)
     {
         $params = $this->request->post();
         $validate = \think\Loader::validate('Market');
@@ -163,6 +164,9 @@ class Market extends Api
             // 扣除冻结金额
             $ledgerWalletModel->changeWalletOnly($buying->user_id, Asset::BUYING, -$chabao); //解冻金额
 
+            //关闭订单
+            $productOrder::where('id', $params['order_id'])->where('user_id', $this->auth->id)->setField(['status' => ProductOrder::collect]);
+
             if($buying->num == 1) $buying->status = ProductBuying::SaleOut;
             $buying->num = $buying->num +1;
             $buying->save();