afa 6 kuukautta sitten
vanhempi
sitoutus
bf124a8eb1

+ 10 - 0
application/admin/view/product/lists/add.html

@@ -33,6 +33,16 @@
             <input id="c-max_transfer_fee" data-rule="required" class="form-control" name="row[max_transfer_fee]" type="text"  value="">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('最低求购茶宝')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-min_buying_token" data-rule="required" class="form-control" name="row[min_buying_token]" type="text" value="">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('最高求购茶宝')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-max_buying_token" data-rule="required" class="form-control" name="row[max_buying_token]" type="text"  value="">
+        </div>
+    </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Gift_fee')}:</label>
         <div class="col-xs-12 col-sm-2">

+ 10 - 0
application/admin/view/product/lists/edit.html

@@ -32,6 +32,16 @@
             <input id="c-max_transfer_fee" data-rule="required" class="form-control" name="row[max_transfer_fee]" type="text"  value="{$row.max_transfer_fee|htmlentities}">
         </div>
     </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('最低求购茶宝')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-min_buying_token" data-rule="required" class="form-control" name="row[min_buying_token]" type="text" value="{$row.min_buying_token|htmlentities}">
+        </div>
+        <label class="control-label col-xs-12 col-sm-2">{:__('最高求购茶宝')}:</label>
+        <div class="col-xs-12 col-sm-3">
+            <input id="c-max_buying_token" data-rule="required" class="form-control" name="row[max_buying_token]" type="text"  value="{$row.max_buying_token|htmlentities}">
+        </div>
+    </div>
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Gift_fee')}:</label>
         <div class="col-xs-12 col-sm-2">

+ 6 - 0
application/api/controller/Market.php

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

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

@@ -69,7 +69,7 @@ class ProductBuying extends Model
     {
         return self::alias('a')
             ->join('product_list p', 'a.product_id = p.id')
-            ->field('a.*,p.' . $lan . '_name as name,p.thum')
+            ->field('a.*,p.' . $lan . '_name as name,p.thum,p.min_buying_token as min_buy_price,p.max_buying_token as max_buy_price')
             ->where('a.id', $buyingId)
             ->find();