|
|
@@ -12,6 +12,7 @@ use app\common\model\LedgerWalletModel;
|
|
|
use app\common\model\ProductTransfer;
|
|
|
use app\api\logic\MarketLogic;
|
|
|
use app\common\logic\BscApi;
|
|
|
+use app\common\model\ProductLists;
|
|
|
use app\common\model\ProductOrder;
|
|
|
use app\common\model\UserBuying;
|
|
|
use fast\Action;
|
|
|
@@ -102,8 +103,13 @@ class Market extends Api
|
|
|
$validate = \think\Loader::validate('Market');
|
|
|
if(!$validate->scene('buying')->check($params)) $this->error($validate->getError());
|
|
|
if($productBuying::getProductBuyingCount($this->auth->id, $params['product_id']) > config('market_transfer.max_buying_count')) $this->error('您的求购次数已达上限');
|
|
|
+
|
|
|
+ $order_info = ProductLists::get($params['product_id']);
|
|
|
+ if($params['min_price'] < $order_info->min_buying_token || $params['min_price'] > $order_info->max_buying_token) $this->error(__("当前订单求购茶宝为").$order_info->min_buying_token.'~'.$order_info->max_buying_token);
|
|
|
+
|
|
|
$chabao = $ledgerWalletModel::getWalletChaBao($this->auth->id);
|
|
|
$total = bcmul($params['min_price'], $params['stock'], 6); // 所需茶宝
|
|
|
+
|
|
|
if($chabao < $total) $this->error('您的茶币不足');
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|