瀏覽代碼

出售冻结金额

afa 7 月之前
父節點
當前提交
39f292c4c8
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      application/api/controller/Market.php

+ 4 - 2
application/api/controller/Market.php

@@ -161,7 +161,7 @@ class Market extends Api
             $ledgerWalletModel->changeWalletAccount($this->auth->id,  Asset::TOKEN, $chabao, LedgerTokenChangeModel::BuySellg, $buying->user_id);
 
             // 扣除冻结金额
-            $ledgerWalletModel->changeWalletOnly($this->auth->id, Asset::BUYING, -$chabao); //解冻金额
+            $ledgerWalletModel->changeWalletOnly($buying->user_id, Asset::BUYING, -$chabao); //解冻金额
 
             if($buying->num == 1) $buying->status = ProductBuying::SaleOut;
             $buying->num = $buying->num +1;
@@ -187,7 +187,6 @@ class Market extends Api
         if(empty($buying)) $this->error('订单不存在');
         if($buying->user_id!= $this->auth->id) $this->error('无权操作');
         if($buying->status != ProductBuying::Normal) $this->error('订单已完成');
-
         Db::startTrans();
         try {
 
@@ -195,6 +194,9 @@ class Market extends Api
             // 添加扣除茶币
             $ledgerWalletModel->changeWalletAccount($this->auth->id,  Asset::TOKEN, $buying, LedgerTokenChangeModel::BuyCancel, $buying->user_id);
 
+            // 扣除冻结金额
+            $ledgerWalletModel->changeWalletOnly($buying->user_id, Asset::BUYING, -$buying); //解冻金额
+
             $buying->status = ProductBuying::Close;
             $buying->save();
             // 提交事务