Browse Source

teac最大价格

afa 6 tháng trước cách đây
mục cha
commit
bc9c246878

+ 4 - 2
application/api/controller/Teac.php

@@ -44,7 +44,9 @@ class Teac extends Api
         $validate = \think\Loader::validate('Teac');
         if(!$validate->scene('buying')->check($params)) $this->error($validate->getError());
         if(config('teac_trade.buy_min_num') > $params['stock']) $this->error('数量不能低于'.config('teac_trade.buy_min_num'));
-        if(config('teac_trade.buy_min_price') > $params['price']) $this->error('价格不能低于'.config('teac_trade.buy_min_price'));
+        // 最小最大价格
+        if(config('teac_trade.buy_min_price') > $params['price'] && config('teac_trade.buy_max_price') < $params['price']) $this->error('价格不在'.config('teac_trade.buy_min_price').'~'.config('teac_trade.buy_max_price').'之间');
+
         $chabao = bcmul($params['price'], $params['stock'], 4) ;
         if($ledgerWalletModel->getWalletChaBao($this->auth->id) < $chabao) $this->error('您的钱包茶宝余额不足');
       
@@ -74,7 +76,7 @@ class Teac extends Api
         if(!$validate->scene('sell')->check($params)) $this->error($validate->getError());
         
         if(config('teac_trade.sell_min_num') > $params['stock']) $this->error('数量不能低于'.config('teac_trade.sell_min_num'));
-        if(config('teac_trade.sell_min_price') > $params['price']) $this->error('价格不能低于'.config('teac_trade.sell_min_price'));
+        if(config('teac_trade.sell_min_price') > $params['price'] && config('teac_trade.sell_max_price') < $params['price']) $this->error('价格不在'.config('teac_trade.sell_min_price').'~'.config('teac_trade.sell_max_price').'之间');
 
         if($ledgerWalletModel->getWalletTeac($this->auth->id) < $params['stock']) $this->error('您的钱包Teac余额不足');
 

+ 1 - 1
application/api/logic/WelfareLoginc.php

@@ -50,7 +50,7 @@ class WelfareLoginc
      */
     public static function getUserRwaProductNum(int $productId, int $rwa_num, $mod, $num): int
     {   
-        //读取当前新增数据
+        //读取当前持有RWa数据
         $list = ProductOrder::getUserOrderByProductId($productId, $rwa_num);
         if(empty($list)) return 0;
         $total = 0; //总数量

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

@@ -128,7 +128,7 @@ class ProductOrder extends Model
         return $productId;
     }
 
-    //空投产品向达到一定持有量的用户
+    //空投产品向达到一定持有量的用户 total_num
     public static function getUserOrderByProductId(int $rwaProductId, int $rwaNum){
         return ProductOrder::whereIn('status', [self::Paid, self::Transferred, self::Freeze])
         ->where('product_id', $rwaProductId)

+ 7 - 5
application/config.php

@@ -344,12 +344,14 @@ return [
     ],
     //Teac配置
     'teac_trade' => [
-        'sell_min_price'         => 0.027,    //最小出售价格
-        'sell_min_num'           => 100,    //最小出售数量
+        'sell_min_price'         => 0.019,  //最小出售价格
+        'sell_max_price'         => 0.031,  //最大出售价格
+        'sell_min_num'           => 100,   //最小出售数量
         'sell_serve_fee'         => 0.05,  //出售服务费
-        'buy_min_price'          => 0.01,    //最小求购价格
-        'buy_min_num'            => 100,    //最小求购数量
-        'buy_serve_fee'          => 0.05, //求购服务费
+        'buy_min_price'          => 0.01,  //最小求购价格
+        'buy_max_price'          => 0.018,  //最大求购价格
+        'buy_min_num'            => 100,   //最小求购数量
+        'buy_serve_fee'          => 0.05,  //求购服务费
         'sell_desc'              => "
             1.TeaC未经购买前,可取消出售订单。一经购买,无法取消出售。<br/>
             2.您将获得除综合服务费(5%)之外的所有出售收入。<br/>