|
|
@@ -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();
|