From bd4804d2d629815192cec9a3cbafed82dfff25d8 Mon Sep 17 00:00:00 2001 From: Rico Date: Sun, 24 Nov 2019 19:29:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=85=85=E5=80=BC=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E8=B5=8C=E5=8D=9A=EF=BC=8C=E8=AE=BE=E5=AE=9A=E6=A6=82?= =?UTF-8?q?=E7=8E=87=E5=86=85=EF=BC=8C=E5=A2=9E=E5=8A=A0=EF=BC=880?= =?UTF-8?q?=EF=BC=8C=E5=85=85=E5=80=BC=E9=87=91=E9=A2=9D=EF=BC=89=E7=9A=84?= =?UTF-8?q?=E6=95=B4=E6=95=B0=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Gateway/AbstractPayment.php | 7 ++++++- config/.config.example.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Services/Gateway/AbstractPayment.php b/app/Services/Gateway/AbstractPayment.php index 039f8013..b9efdd81 100644 --- a/app/Services/Gateway/AbstractPayment.php +++ b/app/Services/Gateway/AbstractPayment.php @@ -16,7 +16,9 @@ use App\Services\Config; use App\Utils\Telegram; abstract class AbstractPayment -{ +{ function randFloat($min = 0, $max = 1) { + return $min + mt_rand() / mt_getrandmax() * ($max - $min); +} abstract public function purchase($request, $response, $args); abstract public function notify($request, $response, $args); @@ -39,6 +41,9 @@ abstract class AbstractPayment $p->save(); $user = User::find($p->userid); $user->money += $p->total; + if (Config::get("double_probability")>$this->randFloat()){ + $user->money += rand(0,$p->total); + } $user->save(); $codeq = new Code(); $codeq->code = $method; diff --git a/config/.config.example.php b/config/.config.example.php index 44588cf1..82da63f0 100644 --- a/config/.config.example.php +++ b/config/.config.example.php @@ -113,7 +113,7 @@ $_ENV['enable_bought_reset']='true'; //购买时是否重置流量 $_ENV['enable_bought_extend']='true'; //购买时是否延长等级期限(同等级配套) $_ENV['port_price']='-1'; //用户随机重置端口所需要的价格,价格小于0时视为不开放购买 $_ENV['port_price_specify']='-1'; //用户指明钦定端口所需要的价格,价格小于0时视为不开放购买 - +$_ENV['double_probability'] = 0.0; #高级 $_ENV['class_expire_reset_traffic']='0'; //等级到期时重置为的流量值,单位GB,小于0时不重置 $_ENV['account_expire_delete_days']='-1'; //账户到期几天之后会删除账户,小于0时不删除