afa 7 сар өмнө
parent
commit
a86bfd39a8

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

@@ -102,7 +102,7 @@ class Market extends Api
         $params = $this->request->post();
         $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_buying.max_buying_num')) $this->error('您的求购次数已达上限');
+        if($productBuying::getProductBuyingCount($this->auth->id, $params['product_id']) > config('market_transfer.max_buying_num')) $this->error('您的求购次数已达上限');
         $chabao     =  $ledgerWalletModel::getWalletChaBao($this->auth->id);
         $total      = bcmul($params['min_price'], $params['num'], 6); // 所需茶宝
         if($chabao < $total) $this->error('您的茶币不足');
@@ -195,6 +195,7 @@ class Market extends Api
         try {
 
             $buying =$ledgerWalletModel::getWalletBuying($this->auth->id);
+
             // 添加扣除茶币
             $ledgerWalletModel->changeWalletAccount($this->auth->id,  Asset::TOKEN, $buying, LedgerTokenChangeModel::BuyCancel, $buying->user_id);
 

+ 1 - 1
application/common/model/ProductBuying.php

@@ -48,7 +48,7 @@ class ProductBuying extends Model
     //用户购买套数
     public static function getProductBuyingCount(int $userId, int $productId)
     {
-        return self::where('product_id', $productId)->where('user_id', $userId)->where('status', self::Normal)->count();
+        return self::where('user_id', $userId)->where('status', self::Normal)->count();
     }
 
     //创建订单