|
|
@@ -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\logic\BscApi;
|
|
|
use app\common\model\ProductOrder;
|
|
|
use app\common\model\UserBuying;
|
|
|
use fast\Action;
|
|
|
@@ -194,13 +195,14 @@ class Market extends Api
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
|
|
|
- $buying =$ledgerWalletModel::getWalletBuying($this->auth->id);
|
|
|
+ //退回金额
|
|
|
+ $amount = bcmul($buying->min_price, ($buying->stock - $buying->num), 6);
|
|
|
|
|
|
// 添加扣除茶币
|
|
|
- $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, $buying, LedgerTokenChangeModel::BuyCancel, $buying->user_id);
|
|
|
+ $ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, $amount, LedgerTokenChangeModel::BuyCancel, $buying->user_id);
|
|
|
|
|
|
// 扣除冻结金额
|
|
|
- $ledgerWalletModel->changeWalletOnly($buying->user_id, Asset::BUYING, -$buying); //解冻金额
|
|
|
+ $ledgerWalletModel->changeWalletOnly($buying->user_id, Asset::BUYING, -$amount); //解冻金额
|
|
|
|
|
|
$buying->status = ProductBuying::Close;
|
|
|
$buying->save();
|