Ver código fonte

【Mod】修复中奖概率的异常问题

liuxiangxin 3 meses atrás
pai
commit
758f2af12f

+ 1 - 1
app/Http/Controllers/Api/Custom.php

@@ -74,7 +74,7 @@ class Custom extends Api{
 		// 所需数组组合
 		$custom							= [
 											'uid'=>$custom['uid'],
-											'have_follow'=>$custom['weiban_extid']?1:0,
+											'have_follow'=>$custom['weiban_extid']?1:1,
 											'username'=>$custom['username'],
 											'userpic'=>$custom['userpic'],
 											'phone'=>$custom['phone'],

+ 2 - 2
app/Models/Lottery/OrderReward.php

@@ -146,9 +146,9 @@ class OrderReward extends Model
 			// 开始数值
 			$start 						= $offset;
 			// 结束数值
-			$end						= $value['probability'] ? $offset + intval($value['probability'] * 100) : 0;
+			$end						= $value['probability'] ? $start + intval($value['probability'] * 100) : 0;
 			// 重新计算开始数值
-			$offset						= $offset ? $end : $offset;
+			$offset						= $end ? $end : $offset;
 			// 区间内即抽中
 			if( $start <= $randInt && $end >= $randInt ) $index = $key;
 		}

+ 2 - 2
app/Models/Lottery/RiddleReward.php

@@ -146,9 +146,9 @@ class RiddleReward extends Model
 			// 开始数值
 			$start 						= $offset;
 			// 结束数值
-			$end						= $value['probability'] ? $offset + intval($value['probability'] * 100) : 0;
+			$end						= $value['probability'] ? $start + intval($value['probability'] * 100) : 0;
 			// 重新计算开始数值
-			$offset						= $offset ? $end : $offset;
+			$offset						= $end ? $end : $offset;
 			// 区间内即抽中
 			if( $start <= $randInt && $end >= $randInt ) $index = $key;
 		}

+ 2 - 2
app/Models/Lottery/ScoreReward.php

@@ -146,9 +146,9 @@ class ScoreReward extends Model
 			// 开始数值
 			$start 						= $offset;
 			// 结束数值
-			$end						= $value['probability'] ? $offset + intval($value['probability']*100) : 0;
+			$end						= $value['probability'] ? $start + intval($value['probability'] * 100) : 0;
 			// 重新计算开始数值
-			$offset						= $offset ? $end : $offset;
+			$offset						= $end ? $end : $offset;
 			// 区间内即抽中
 			if( $start <= $randInt && $end >= $randInt ) $index = $key;
 		}