|
@@ -233,6 +233,30 @@ class ActiveProc {
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
+ public static function prizeTypeRand($str) {
|
|
|
+ if(strpos($str,';')){//包含;说明里面奖品类型不同获得的概率不同
|
|
|
+ $sList = explode(';',$str);
|
|
|
+ $dic= new \stdClass();
|
|
|
+
|
|
|
+ $rand = rand(1,100);
|
|
|
+ $start = 0;
|
|
|
+ $end = 0;
|
|
|
+ foreach ($sList as $val) {
|
|
|
+ $itemList = explode('-', $val);
|
|
|
+
|
|
|
+ $end = $itemList[1] + $start;
|
|
|
+ if($rand > $start && $rand <= $end){
|
|
|
+ $id = self::randList(explode(',', $itemList[0]));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $start = $end;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $id = self::randList(explode(',',$str));
|
|
|
+ }
|
|
|
+ return $id;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 抽奖消耗
|
|
|
*/
|
|
@@ -268,6 +292,7 @@ class ActiveProc {
|
|
|
}
|
|
|
return $type;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @param type $arr
|
|
@@ -287,14 +312,17 @@ class ActiveProc {
|
|
|
public static function getActiveRandomItem($type,$mo) {
|
|
|
$id = 0;
|
|
|
switch ($type) {
|
|
|
- case Enum_ActiveItemType::Sr:
|
|
|
- $id = self::randList(explode(',', $mo->srList));
|
|
|
+ case Enum_ActiveItemType::Sr:
|
|
|
+ $id = self::prizeTypeRand($mo->srList);
|
|
|
+ //$id = self::randList(explode(',', $mo->srList));
|
|
|
break;
|
|
|
case Enum_ActiveItemType::Ssr:
|
|
|
- $id = self::randList(explode(',', $mo->ssrList));
|
|
|
+ $id = self::prizeTypeRand($mo->ssrList);
|
|
|
+ //$id = self::randList(explode(',', $mo->ssrList));
|
|
|
break;
|
|
|
case Enum_ActiveItemType::Ur:
|
|
|
- $id = self::randList(explode(',', $mo->urList));
|
|
|
+ $id = self::prizeTypeRand($mo->urList);
|
|
|
+ //$id = self::randList(explode(',', $mo->urList));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -314,7 +342,8 @@ class ActiveProc {
|
|
|
$id = 0;
|
|
|
switch ($type) {
|
|
|
case Enum_ActiveItemType::Sr:
|
|
|
- $id = self::randList(explode(',', $mo->srList));
|
|
|
+ $id = self::prizeTypeRand($mo->srList);
|
|
|
+ //$id = self::randList(explode(',', $mo->srList));
|
|
|
break;
|
|
|
case Enum_ActiveItemType::Ssr:
|
|
|
if($mo->ssrUp != null){
|
|
@@ -343,22 +372,28 @@ class ActiveProc {
|
|
|
$shenmiaoInfo->activeDic->$activeType->isUpSsr = 0;
|
|
|
} else {
|
|
|
$rand = rand(1,10000);
|
|
|
- $start = 0;
|
|
|
+ $start = 0;
|
|
|
+ $sNum = 0;
|
|
|
+ $count = StlUtil::count($dic);
|
|
|
foreach ($dic as $k=>$val) {
|
|
|
+ $sNum += 1;
|
|
|
$end = $val + $start;
|
|
|
if($rand > $start && $rand <= $end){//随机到Up得id
|
|
|
$id = $k;
|
|
|
break;
|
|
|
- } else {//随机到普通的id
|
|
|
+ }
|
|
|
+ if($sNum >= $count){ //随机到普通的id
|
|
|
$shenmiaoInfo->activeDic->$activeType->isUpSsr = 1;
|
|
|
- $id = self::randList(explode(',', $mo->ssrList));
|
|
|
+ $id =self::prizeTypeRand($mo->ssrList);
|
|
|
+ //$id = self::randList(explode(',', $mo->ssrList));
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
$start = $end;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- $id = self::randList(explode(',', $mo->ssrList));
|
|
|
+ $id =self::prizeTypeRand($mo->ssrList);
|
|
|
+ //$id = self::randList(explode(',', $mo->ssrList));
|
|
|
}
|
|
|
break;
|
|
|
case Enum_ActiveItemType::Ur:
|
|
@@ -388,21 +423,28 @@ class ActiveProc {
|
|
|
} else {
|
|
|
$rand = rand(1,10000);
|
|
|
$start = 0;
|
|
|
+
|
|
|
+ $sNum = 0;
|
|
|
+ $count = StlUtil::count($dic);
|
|
|
foreach ($dic as $k=>$val) {
|
|
|
+ $sNum += 1;
|
|
|
$end = $val + $start;
|
|
|
if($rand > $start && $rand <= $end){
|
|
|
$id = $k;
|
|
|
break;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ if($sNum >= $count){
|
|
|
$shenmiaoInfo->activeDic->$activeType->isUpUr = 1;
|
|
|
- $id = self::randList(explode(',', $mo->urList));
|
|
|
+ $id =self::prizeTypeRand($mo->urList);
|
|
|
+ //$id = self::randList(explode(',', $mo->urList));
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
$start = $end;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- $id = self::randList(explode(',', $mo->urList));
|
|
|
+ //$id = self::randList(explode(',', $mo->urList));
|
|
|
+ $id =self::prizeTypeRand($mo->urList);
|
|
|
}
|
|
|
break;
|
|
|
default:
|