|
@@ -7,8 +7,6 @@
|
|
* Time: 上午11:33
|
|
* Time: 上午11:33
|
|
*/
|
|
*/
|
|
|
|
|
|
-use bonus\account;
|
|
|
|
-
|
|
|
|
require_once (BASE_ROOT_PATH . '/helper/account_helper.php');
|
|
require_once (BASE_ROOT_PATH . '/helper/account_helper.php');
|
|
require_once (BASE_ROOT_PATH . '/helper/bonus_helper.php');
|
|
require_once (BASE_ROOT_PATH . '/helper/bonus_helper.php');
|
|
|
|
|
|
@@ -47,7 +45,7 @@ class friend
|
|
|
|
|
|
class gain_policy
|
|
class gain_policy
|
|
{
|
|
{
|
|
- const max_amount = 10;
|
|
|
|
|
|
+ const max_amount = 5;
|
|
|
|
|
|
private $strength;
|
|
private $strength;
|
|
private $total_amount;
|
|
private $total_amount;
|
|
@@ -76,19 +74,19 @@ class gain_policy
|
|
private function scale()
|
|
private function scale()
|
|
{
|
|
{
|
|
if($this->strength == 5) {
|
|
if($this->strength == 5) {
|
|
- $start = 0.8;
|
|
|
|
|
|
+ $start = 0.4;
|
|
$end = 1.0;
|
|
$end = 1.0;
|
|
}
|
|
}
|
|
elseif ($this->strength == 4) {
|
|
elseif ($this->strength == 4) {
|
|
- $start = 0.6;
|
|
|
|
|
|
+ $start = 0.3;
|
|
$end = 0.8;
|
|
$end = 0.8;
|
|
}
|
|
}
|
|
elseif ($this->strength == 3) {
|
|
elseif ($this->strength == 3) {
|
|
- $start = 0.4;
|
|
|
|
|
|
+ $start = 0.2;
|
|
$end = 0.6;
|
|
$end = 0.6;
|
|
}
|
|
}
|
|
elseif ($this->strength == 2) {
|
|
elseif ($this->strength == 2) {
|
|
- $start = 0.2;
|
|
|
|
|
|
+ $start = 0.1;
|
|
$end = 0.4;
|
|
$end = 0.4;
|
|
}
|
|
}
|
|
elseif ($this->strength == 1) {
|
|
elseif ($this->strength == 1) {
|
|
@@ -100,7 +98,7 @@ class gain_policy
|
|
}
|
|
}
|
|
|
|
|
|
$start = intval($start * 100 + 0.5);
|
|
$start = intval($start * 100 + 0.5);
|
|
- $end = intval($end * 100 + 0.5);
|
|
|
|
|
|
+ $end = intval($end * 100 + 0.5);
|
|
|
|
|
|
$ret = mt_rand($start,$end);
|
|
$ret = mt_rand($start,$end);
|
|
return $ret / 100;
|
|
return $ret / 100;
|
|
@@ -136,6 +134,7 @@ class shaker_helper
|
|
$err = array('code' => errcode::ErrShake, 'msg' => self::err_msg);
|
|
$err = array('code' => errcode::ErrShake, 'msg' => self::err_msg);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ Log::record(__METHOD__ . " gain amount={$value}",Log::DEBUG);
|
|
|
|
|
|
$bonus = account_helper::gain_bonus($user_id, $_SESSION['member_id'], $value);
|
|
$bonus = account_helper::gain_bonus($user_id, $_SESSION['member_id'], $value);
|
|
if($bonus != false) {
|
|
if($bonus != false) {
|
|
@@ -160,6 +159,7 @@ class shaker_helper
|
|
$err = array('code' => errcode::ErrShake, 'msg' => self::err_msg);
|
|
$err = array('code' => errcode::ErrShake, 'msg' => self::err_msg);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ Log::record(__METHOD__ . " lost amount={$value}",Log::DEBUG);
|
|
|
|
|
|
$bonus = account_helper::gain_system($_SESSION['member_id'], $value);
|
|
$bonus = account_helper::gain_system($_SESSION['member_id'], $value);
|
|
if($bonus != false) {
|
|
if($bonus != false) {
|
|
@@ -174,7 +174,7 @@ class shaker_helper
|
|
|
|
|
|
private function lost(&$err)
|
|
private function lost(&$err)
|
|
{
|
|
{
|
|
- $pred = new account($_SESSION['member_id']);
|
|
|
|
|
|
+ $pred = new bonus\account($_SESSION['member_id']);
|
|
$total_amount = $pred->total_bonus();
|
|
$total_amount = $pred->total_bonus();
|
|
|
|
|
|
if(intval($total_amount * 100 + 0.5) <= 0) {
|
|
if(intval($total_amount * 100 + 0.5) <= 0) {
|
|
@@ -241,6 +241,20 @@ class shaker_helper
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function calc_strength($strength)
|
|
|
|
+ {
|
|
|
|
+ while (true)
|
|
|
|
+ {
|
|
|
|
+ $strength = intval($strength + 0.5);
|
|
|
|
+ if($strength >= 10) {
|
|
|
|
+ $strength = intval($strength + 0.5) / 10;
|
|
|
|
+ } else {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return $strength;
|
|
|
|
+ }
|
|
|
|
+
|
|
public function shake($strength,&$err)
|
|
public function shake($strength,&$err)
|
|
{
|
|
{
|
|
if($this->can_shake() == false) {
|
|
if($this->can_shake() == false) {
|
|
@@ -249,7 +263,7 @@ class shaker_helper
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- $this->strength = $strength;
|
|
|
|
|
|
+ $this->strength = $this->calc_strength($strength);
|
|
$direct = $this->direction();
|
|
$direct = $this->direction();
|
|
if($direct == self::direct_gain) {
|
|
if($direct == self::direct_gain) {
|
|
$bonuses = $this->gain($err);
|
|
$bonuses = $this->gain($err);
|