Эх сурвалжийг харах

新增几种任务类型.

gwang 3 жил өмнө
parent
commit
492cceb269

+ 246 - 251
Gameserver/Amfphp/process/ActiveProc.php

@@ -16,7 +16,7 @@ class ActiveProc {
 
     /**
      * 逻辑分发
-     * 所有的Proc中必须有这样一个方法 
+     * 所有的Proc中必须有这样一个方法
      */
     public static function procMain() {
         switch (req()->cmd) {
@@ -50,7 +50,7 @@ class ActiveProc {
     }
 
     /**
-     * 每天重置 
+     * 每天重置
      */
     static function DailyReset() {
         self::DailyResetDay7Task();
@@ -59,140 +59,137 @@ class ActiveProc {
     }
 
 // <editor-fold defaultstate="collapsed" desc="    赠送体力    ">
-    
+
     /**
      * 获取神庙的主界面信息
      */
     static function GetShenmiaoData() {
-        $req = req();          
+        $req = req();
         //$shenmiaoInfo = $req->userInfo->game->shenmiao;
-       
+
         $shenmiaoInfo = new Info_ShenMiao($req->userInfo->game->shenmiao);
         $shenmiaoInfo->initActiveItem();
         $req->userInfo->game->shenmiao = $shenmiaoInfo;
-        
+
         UserProc::updateUserInfo();
         return Resp::ok(array(#                                                 # 返回值
-                    'shenmiaoInfo' => $shenmiaoInfo,                 
+                    'shenmiaoInfo' => $shenmiaoInfo,
         ));
     }
+
     /**
      * 购买神庙券 临时
      * @return type
      */
     static function buyShenmiaoDrawTicket() {
-        $req = req();  
-        list($costId,$num) = $req->paras;  
-     
-        $dic = GameConfig::shop_getItem($costId);      
+        $req = req();
+        list($costId, $num) = $req->paras;
+
+        $dic = GameConfig::shop_getItem($costId);
         my_Assert($dic != null, ErrCode::err_const_no);
         $baseInfo = $req->userInfo->game->baseInfo;
         $costNum = $dic->price * $num;
         my_Assert($baseInfo->cash >= $costNum, ErrCode::notenough_cash_msg);
-                      
-        req()->userInfo->game->base()->Consume_Cash($costNum); 
-        if ($costId == 801022)
-        {
+
+        req()->userInfo->game->base()->Consume_Cash($costNum);
+        if ($costId == 801022) {
             $costId = 3320001;
-        }
-        else
-        {
+        } else {
             $costId = 3330001;
-        }           
-        StoreProc::AddMultiItemInStore($costId.','.$num);       
+        }
+        StoreProc::AddMultiItemInStore($costId . ',' . $num);
         UserProc::updateUserInfo();
         return Resp::ok(array(#                                                 # 返回值
-                    'cash' => $req->userInfo->game->baseInfo->cash,         
+                    'cash' => $req->userInfo->game->baseInfo->cash,
                     'store' => $req->userInfo->game->store,
         ));
     }
 
-
     /**
      * 神庙抽奖
      */
     static function ShenmiaoDrawPrize() {
         $req = req();
-        list($type,$num) = $req->paras;  
+        list($type, $num) = $req->paras;
         $shenmiaoInfo = $req->userInfo->game->shenmiao;
-       
-        my_Assert(StlUtil::dictHasProperty($shenmiaoInfo->activeDic, $type), ErrCode::active_activeNoExistent);        
-        $list = array();      
-        if(Enum_Active::NewWish == $type){                     
+
+        my_Assert(StlUtil::dictHasProperty($shenmiaoInfo->activeDic, $type), ErrCode::active_activeNoExistent);
+        $list = array();
+        if (Enum_Active::NewWish == $type) {
             my_Assert($shenmiaoInfo->activeDic->$type->num < glc()->UserWishNumLimit, ErrCode::active_NewUserActiveNumLimit);
             my_Assert($num == 10, ErrCode::active_NewUserActiveNumLimit);
-            
-            $shenmiaoInfo->activeDic->$type->num += $num;   
+
+            $shenmiaoInfo->activeDic->$type->num += $num;
             $shenmiaoInfo->activeDic->$type->totalNum += $num;
-            
+
             $shenmo = GameConfig::shenmiao_getItem($shenmiaoInfo->activeDic->$type->id);
-            self::cost($req, $shenmo,$num);
-           
+            self::cost($req, $shenmo, $num);
+
             $tag = false;
             $n = 0;
             for ($index = 0; $index < $num; $index++) {
-                $n+=1;
-                $itemType = self::activeRandom($shenmo->per, $shenmo);                                           
-                if($itemType >= 2){
+                $n += 1;
+                $itemType = self::activeRandom($shenmo->per, $shenmo);
+                if ($itemType >= 2) {
                     $tag = true;
                 }
-                if($n==10 && $tag == false && $shenmiaoInfo->activeDic->$type->totalNum > 10){                             
-                    $list[] =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo);//self::randSsrUr($shenmo->per)
-                } else {                   
-                    if($shenmiaoInfo->activeDic->$type->totalNum <= 10){
+                if ($n == 10 && $tag == false && $shenmiaoInfo->activeDic->$type->totalNum > 10) {
+                    $list[] = self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo); //self::randSsrUr($shenmo->per)
+                } else {
+                    if ($shenmiaoInfo->activeDic->$type->totalNum <= 10) {
                         $itemType = Enum_ActiveItemType::Sr;
-                    }                     
-                    $nId =self::getActiveRandomItem($itemType, $shenmo);                  
+                    }
+                    $nId = self::getActiveRandomItem($itemType, $shenmo);
                     $list[] = $nId;
-                }                            
-            }       
-            if($shenmiaoInfo->activeDic->$type->totalNum == 10 && !in_array($shenmo->must, $list)){//首次10连抽有必出--临时
+                }
+            }
+            if ($shenmiaoInfo->activeDic->$type->totalNum == 10 && !in_array($shenmo->must, $list)) {//首次10连抽有必出--临时
                 $list[0] = $shenmo->must;
             }
-                
-            if($shenmiaoInfo->activeDic->$type->totalNum >= glc()->UserWishNumLimit){
+
+            if ($shenmiaoInfo->activeDic->$type->totalNum >= glc()->UserWishNumLimit) {
                 $shenmiaoInfo->isComNewWish = 1;
                 StlUtil::dictRemove($shenmiaoInfo->activeDic, $type);
-            }                                                     
-        } else if(Enum_Active::OpenWish == $type){                             
-            $shenmo = GameConfig::shenmiao_getItem($shenmiaoInfo->activeDic->$type->id);                
-            if($num == 1){
-                $shenmiaoInfo->activeDic->$type->num += $num; 
+            }
+        } else if (Enum_Active::OpenWish == $type) {
+            $shenmo = GameConfig::shenmiao_getItem($shenmiaoInfo->activeDic->$type->id);
+            if ($num == 1) {
+                $shenmiaoInfo->activeDic->$type->num += $num;
                 self::cost($req, $shenmo);
-                $list[] = self::drawOneLottery($shenmo, $type);                                                 
+                $list[] = self::drawOneLottery($shenmo, $type);
             } else {//10连抽
-                self::cost($req, $shenmo,$num);               
-                $shenmiaoInfo->activeDic->$type->totalNum += $num;       
-                $list = self::drawTenLottery($shenmo, $type, $num);                                                                          
-            }          
-        } else {//不定期活动                                  
-            $shenmo = GameConfig::shenmiao_getItem($shenmiaoInfo->activeDic->$type->id);            
-            if($num == 1){
-                self::cost($req, $shenmo,$num);
-                $shenmiaoInfo->activeDic->$type->num += $num;                                
-                 $list[] = self::drawOneLottery($shenmo, $type);                                        
+                self::cost($req, $shenmo, $num);
+                $shenmiaoInfo->activeDic->$type->totalNum += $num;
+                $list = self::drawTenLottery($shenmo, $type, $num);
+            }
+        } else {//不定期活动
+            $shenmo = GameConfig::shenmiao_getItem($shenmiaoInfo->activeDic->$type->id);
+            if ($num == 1) {
+                self::cost($req, $shenmo, $num);
+                $shenmiaoInfo->activeDic->$type->num += $num;
+                $list[] = self::drawOneLottery($shenmo, $type);
             } else {
-                self::cost($req, $shenmo,$num);                           
-                $shenmiaoInfo->activeDic->$type->totalNum += $num;               
-                $list = self::drawTenLottery($shenmo, $type, $num);                                              
-            }          
-        }  
-        
+                self::cost($req, $shenmo, $num);
+                $shenmiaoInfo->activeDic->$type->totalNum += $num;
+                $list = self::drawTenLottery($shenmo, $type, $num);
+            }
+        }
+
         foreach ($list as $id) {
-            $s = $id.',1';
+            $s = $id . ',1';
             StoreProc::AddMultiItemInStore($s);
         }
-        
+
         $req->userInfo->game->shenmiao = $shenmiaoInfo;
         UserProc::updateUserInfo();
-        
+        TaskProc::OnTempleLottery();                                            # 检测神庙抽奖任务
         return Resp::ok(array(#                                                 # 返回值
                     'shenmiaoInfo' => $shenmiaoInfo,
-                    'list'=>$list,
-                    'store'=>$req->userInfo->game->store,
+                    'list' => $list,
+                    'store' => $req->userInfo->game->store,
         ));
     }
-    
+
     /**
      * 1连抽
      * @param type $shenmo
@@ -200,318 +197,319 @@ class ActiveProc {
      * @param type $num
      * @return type
      */
-    public static function drawOneLottery($shenmo,$type){
-        $req = req();     
+    public static function drawOneLottery($shenmo, $type) {
+        $req = req();
         $shenmiaoInfo = $req->userInfo->game->shenmiao;
-                     
-        $itemType = self::activeRandom($shenmo->per, $shenmo); 
-        if($type == Enum_Active::OpenWish){
-            $aid =self::getActiveRandomItem($itemType, $shenmo);
+
+        $itemType = self::activeRandom($shenmo->per, $shenmo);
+        if ($type == Enum_Active::OpenWish) {
+            $aid = self::getActiveRandomItem($itemType, $shenmo);
         } else {
-            $aid =self::getActiveRandomItem_3($itemType, $shenmo,$type);//随机出的id
+            $aid = self::getActiveRandomItem_3($itemType, $shenmo, $type); //随机出的id
         }
-                           
-        if($shenmiaoInfo->activeDic->$type->num % glc()->Active_UR_Num == 0 && $itemType != Enum_ActiveItemType::Ur){
-            if($type == Enum_Active::OpenWish){
-                $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo);
+
+        if ($shenmiaoInfo->activeDic->$type->num % glc()->Active_UR_Num == 0 && $itemType != Enum_ActiveItemType::Ur) {
+            if ($type == Enum_Active::OpenWish) {
+                $aid = self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo);
             } else {
-                $aid =self::getActiveRandomItem_3(Enum_ActiveItemType::Ur, $shenmo,$type);  
-            }                     
-        } 
-        
-        return $aid;    
+                $aid = self::getActiveRandomItem_3(Enum_ActiveItemType::Ur, $shenmo, $type);
+            }
+        }
+
+        return $aid;
     }
+
     /**
      * 10连抽
      * @param type $type
      * @param type $num
      */
-    public static function drawTenLottery($shenmo,$type,$num){
-        $req = req();     
+    public static function drawTenLottery($shenmo, $type, $num) {
+        $req = req();
         $shenmiaoInfo = $req->userInfo->game->shenmiao;
-                   
+
         $tag = false;
         $n = 0;
         $list = array();
         for ($index1 = 0; $index1 < $num; $index1++) {
-            $n+=1;
-            $itemType = self::activeRandom($shenmo->per, $shenmo); 
-            if($itemType >= 2){
+            $n += 1;
+            $itemType = self::activeRandom($shenmo->per, $shenmo);
+            if ($itemType >= 2) {
                 $tag = true;
             }
-            if($n==10 && $tag == false){
-                if($type == Enum_Active::OpenWish){
-                    $list[] =self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo);//self::randSsrUr($shenmo->per)
+            if ($n == 10 && $tag == false) {
+                if ($type == Enum_Active::OpenWish) {
+                    $list[] = self::getActiveRandomItem(Enum_ActiveItemType::Ssr, $shenmo); //self::randSsrUr($shenmo->per)
                 } else {
-                    $list[] =self::getActiveRandomItem_3(Enum_ActiveItemType::Ssr, $shenmo,$type);
-                }             
+                    $list[] = self::getActiveRandomItem_3(Enum_ActiveItemType::Ssr, $shenmo, $type);
+                }
             } else {
-                if($type == Enum_Active::OpenWish){
-                    $list[] =self::getActiveRandomItem($itemType, $shenmo);
+                if ($type == Enum_Active::OpenWish) {
+                    $list[] = self::getActiveRandomItem($itemType, $shenmo);
                 } else {
-                    $list[] =self::getActiveRandomItem_3($itemType, $shenmo,$type);     
-                }                                                         
-            }  
-        }               
-        if($shenmiaoInfo->activeDic->$type->totalNum >= glc()->Active_UR_Num){//第90次必得
-            if($type == Enum_Active::OpenWish){
-                $aid =self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo); 
+                    $list[] = self::getActiveRandomItem_3($itemType, $shenmo, $type);
+                }
+            }
+        }
+        if ($shenmiaoInfo->activeDic->$type->totalNum >= glc()->Active_UR_Num) {//第90次必得
+            if ($type == Enum_Active::OpenWish) {
+                $aid = self::getActiveRandomItem(Enum_ActiveItemType::Ur, $shenmo);
             } else {
-                $aid =self::getActiveRandomItem_3(Enum_ActiveItemType::Ur, $shenmo,$type); 
-            }                     
+                $aid = self::getActiveRandomItem_3(Enum_ActiveItemType::Ur, $shenmo, $type);
+            }
             $list[0] = $aid;
             $shenmiaoInfo->activeDic->$type->totalNum = 0;
         }
-        
-        return $list;    
+
+        return $list;
     }
-    
+
     public static function prizeTypeRand($str) {
-        if(strpos($str,';')){//包含;说明里面奖品类型不同获得的概率不同
-            $sList = explode(';',$str);
-            $dic= new \stdClass();   
-            
-            $rand = rand(1,100);
-            $start = 0; 
-            $end = 0;        
+        if (strpos($str, ';')) {//包含;说明里面奖品类型不同获得的概率不同
+            $sList = explode(';', $str);
+            $dic = new \stdClass();
+
+            $rand = rand(1, 100);
+            $start = 0;
+            $end = 0;
             foreach ($sList as $val) {
-                $itemList = explode('-', $val); 
-                
+                $itemList = explode('-', $val);
+
                 $end = $itemList[1] + $start;
-                if($rand > $start && $rand <= $end){
-                    $id = self::randList(explode(',', $itemList[0]));                   
+                if ($rand > $start && $rand <= $end) {
+                    $id = self::randList(explode(',', $itemList[0]));
                     break;
-                }           
+                }
                 $start = $end;
-            }                                       
+            }
         } else {
-            $id = self::randList(explode(',',$str));
-        } 
+            $id = self::randList(explode(',', $str));
+        }
         return $id;
     }
-    
+
     /**
      * 抽奖消耗
      */
-    public static function cost($req,$shenmo,$num = 1) {
+    public static function cost($req, $shenmo, $num = 1) {
         $sList = explode(',', $shenmo->cost);
-        $costVal = $sList[1]*$num;
-        if($shenmo->discount != 0){               
-            $costVal = $sList[1]*$num*$shenmo->discount/100;                             
-        }      
-        StoreProc::removeItemFromStore($req->userInfo->game->store,$sList[0],$costVal);
+        $costVal = $sList[1] * $num;
+        if ($shenmo->discount != 0) {
+            $costVal = $sList[1] * $num * $shenmo->discount / 100;
+        }
+        StoreProc::removeItemFromStore($req->userInfo->game->store, $sList[0], $costVal);
     }
-    
+
     /**
-     * 
+     *
      * @param type $randCtx
      * @param sm_shenmiao $mo
      * @return int
      */
-    public static function activeRandom($randCtx,$mo) {
-        $rand = rand(1,10000);
-        
+    public static function activeRandom($randCtx, $mo) {
+        $rand = rand(1, 10000);
+
         $type = 1;
         $list = explode(',', $randCtx);
-        
+
         $start = 0;
         foreach ($list as $val) {
             $end = $val + $start;
-            if($rand > $start && $rand <= $end){
+            if ($rand > $start && $rand <= $end) {
                 break;
             }
             $type += 1;
             $start = $end;
         }
-        return $type;     
+        return $type;
     }
-       
+
     /**
-     * 
+     *
      * @param type $arr
      * @return type
      */
     public static function randList($arr) {
-        $rand = rand(0, count($arr)-1);    
+        $rand = rand(0, count($arr) - 1);
         return $arr[$rand];
     }
-    
+
     /**
-     * 
+     *
      * @param type $type
      * @param type $mo
      * @return type
      */
-    public static function getActiveRandomItem($type,$mo) {            
+    public static function getActiveRandomItem($type, $mo) {
         $id = 0;
         switch ($type) {
-            case Enum_ActiveItemType::Sr:     
-                $id = self::prizeTypeRand($mo->srList);               
-                //$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::prizeTypeRand($mo->ssrList);          
-                //$id = self::randList(explode(',', $mo->ssrList));                           
+                $id = self::prizeTypeRand($mo->ssrList);
+                //$id = self::randList(explode(',', $mo->ssrList));
                 break;
             case Enum_ActiveItemType::Ur:
-                $id = self::prizeTypeRand($mo->urList);         
-                //$id = self::randList(explode(',', $mo->urList));                            
+                $id = self::prizeTypeRand($mo->urList);
+                //$id = self::randList(explode(',', $mo->urList));
                 break;
             default:
                 break;
-        }   
+        }
         return $id;
     }
-    
+
     /**
-     * 
+     *
      * @param type $type
      * @param sm_shenmiao $mo
      * @return type
      */
-    public static function getActiveRandomItem_3($type,$mo,$activeType) {    
+    public static function getActiveRandomItem_3($type, $mo, $activeType) {
         $shenmiaoInfo = req()->userInfo->game->shenmiao;
-       
+
         $id = 0;
         switch ($type) {
             case Enum_ActiveItemType::Sr:
-                $id = self::prizeTypeRand($mo->srList);                       
-                //$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){
+                if ($mo->ssrUp != null) {
                     $dic = new \stdClass();
                     $ssrList = explode(';', $mo->ssrUp);
-                    
+
                     $tNum = 0;
                     foreach ($ssrList as $val) {
-                        $sList = explode(',', $val); 
+                        $sList = explode(',', $val);
                         $sid = $sList[0];
                         $dic->$sid = $sList[1];
                         $tNum += $sList[1];
-                    } 
-                    
-                    if($shenmiaoInfo->activeDic->$activeType->isUpSsr == 1){
-                        $rand = rand(1,$tNum);      
-                        $start = 0;                                                         
-                        foreach ($dic as $k=>$val) {
+                    }
+
+                    if ($shenmiaoInfo->activeDic->$activeType->isUpSsr == 1) {
+                        $rand = rand(1, $tNum);
+                        $start = 0;
+                        foreach ($dic as $k => $val) {
                             $end = $val + $start;
-                            if($rand > $start && $rand <= $end){//随机到Up得id
-                                $id = $k;                             
+                            if ($rand > $start && $rand <= $end) {//随机到Up得id
+                                $id = $k;
                                 break;
                             }
                             $start = $end;
-                        }                       
+                        }
                         $shenmiaoInfo->activeDic->$activeType->isUpSsr = 0;
                     } else {
-                        $rand = rand(1,10000);      
-                        $start = 0;  
+                        $rand = rand(1, 10000);
+                        $start = 0;
                         $sNum = 0;
                         $count = StlUtil::count($dic);
-                        foreach ($dic as $k=>$val) {
+                        foreach ($dic as $k => $val) {
                             $sNum += 1;
                             $end = $val + $start;
-                            if($rand > $start && $rand <= $end){//随机到Up得id
-                                $id = $k;                           
+                            if ($rand > $start && $rand <= $end) {//随机到Up得id
+                                $id = $k;
                                 break;
-                            }                  
-                            if($sNum >= $count){ //随机到普通的id         
+                            }
+                            if ($sNum >= $count) { //随机到普通的id
                                 $shenmiaoInfo->activeDic->$activeType->isUpSsr = 1;
-                                $id =self::prizeTypeRand($mo->ssrList);
-                                //$id = self::randList(explode(',', $mo->ssrList));                           
+                                $id = self::prizeTypeRand($mo->ssrList);
+                                //$id = self::randList(explode(',', $mo->ssrList));
                                 break;
-                            }                                                                                 
+                            }
                             $start = $end;
                         }
-                    }                                                           
+                    }
                 } else {
-                    $id =self::prizeTypeRand($mo->ssrList);                    
-                    //$id = self::randList(explode(',', $mo->ssrList));               
-                }                                                             
+                    $id = self::prizeTypeRand($mo->ssrList);
+                    //$id = self::randList(explode(',', $mo->ssrList));
+                }
                 break;
             case Enum_ActiveItemType::Ur:
-                if($mo->ssrUp != null){
+                if ($mo->ssrUp != null) {
                     $dic = new \stdClass();
                     $urList = explode(';', $mo->urUp);
                     $tNum = 0;
                     foreach ($urList as $val) {
-                        $sList = explode(',', $val); 
+                        $sList = explode(',', $val);
                         $sid = $sList[0];
                         $dic->$sid = $sList[1];
                         $tNum += $sList[1];
-                    }      
-                    
-                    if($shenmiaoInfo->activeDic->$activeType->isUpUr == 1){
-                        $rand = rand(1,$tNum);      
-                        $start = 0;                                                         
-                        foreach ($dic as $k=>$val) {
+                    }
+
+                    if ($shenmiaoInfo->activeDic->$activeType->isUpUr == 1) {
+                        $rand = rand(1, $tNum);
+                        $start = 0;
+                        foreach ($dic as $k => $val) {
                             $end = $val + $start;
-                            if($rand > $start && $rand <= $end){//随机到Up得id
-                                $id = $k;                             
+                            if ($rand > $start && $rand <= $end) {//随机到Up得id
+                                $id = $k;
                                 break;
                             }
                             $start = $end;
-                        }                       
+                        }
                         $shenmiaoInfo->activeDic->$activeType->isUpUr = 0;
                     } else {
-                        $rand = rand(1,10000);      
+                        $rand = rand(1, 10000);
                         $start = 0;
-                        
+
                         $sNum = 0;
                         $count = StlUtil::count($dic);
-                        foreach ($dic as $k=>$val) {
+                        foreach ($dic as $k => $val) {
                             $sNum += 1;
                             $end = $val + $start;
-                            if($rand > $start && $rand <= $end){
+                            if ($rand > $start && $rand <= $end) {
                                 $id = $k;
                                 break;
-                            } 
-                            if($sNum >= $count){
+                            }
+                            if ($sNum >= $count) {
                                 $shenmiaoInfo->activeDic->$activeType->isUpUr = 1;
-                                $id =self::prizeTypeRand($mo->urList);
-                                //$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::prizeTypeRand($mo->urList);
-                }                                                                     
+                    }
+                } else {
+                    //$id = self::randList(explode(',', $mo->urList));
+                    $id = self::prizeTypeRand($mo->urList);
+                }
                 break;
             default:
                 break;
-        }      
+        }
         return $id;
     }
-    
+
     /**
      * 从SSr 和  uR中得一个
      * @param type $param
      */
     public static function randSsrUr($randCtx) {
         $list = explode(',', $randCtx);
-        $list = array_splice($list,1);
-        $total =  $list[0]+$list[1];        
-       
-        $rand = rand(1,$total);      
-        $start = 0; 
+        $list = array_splice($list, 1);
+        $total = $list[0] + $list[1];
+
+        $rand = rand(1, $total);
+        $start = 0;
         //$type = Enum_ActiveItemType::Ssr;
         $type = 2;
         foreach ($list as $val) {
-            $end = $val + $start;       
-            if($rand > $start && $rand <= $end){
+            $end = $val + $start;
+            if ($rand > $start && $rand <= $end) {
                 break;
             }
-            $type += 1; 
+            $type += 1;
             $start = $end;
-        }       
+        }
         return $type;
     }
-    
+
     /**
-     * [6515] 领取 赠送体力  
+     * [6515] 领取 赠送体力
      */
     static function drawTiliGift() {
         $user = ctx();
@@ -520,7 +518,7 @@ class ActiveProc {
         $hour = date('G');
         my_Assert(!in_array($hour, $privateState->dailyDrawedTiliGift), ErrCode::active_hasgetted); # 判断是否已领取
         $arr = explode(',', glc()->activity_presentTili_times);                 # 判断是否满足领取条件
-        my_Assert(in_array($hour, $arr), ErrCode::active_illegal);              # 不满足条件 
+        my_Assert(in_array($hour, $arr), ErrCode::active_illegal);              # 不满足条件
         $base->Add_tili(glc()->activity_presentTili_number);                    # 增加体力
         $privateState->dailyDrawedTiliGift[] = $hour;
         UserProc::updateUserInfo();                                             # 回存
@@ -537,7 +535,7 @@ class ActiveProc {
 // <editor-fold defaultstate="collapsed" desc="    全服注册礼包    ">
 
     /**
-     * [6516] 查询当前全服注册人数 
+     * [6516] 查询当前全服注册人数
      */
     static function getRegNumber() {
         return Resp::ok(array(
@@ -546,7 +544,7 @@ class ActiveProc {
     }
 
     /**
-     * [6514] 领取全服注册礼包 
+     * [6514] 领取全服注册礼包
      */
     static function drawRegGift() {
         $user = new Data_UserGame(req()->userInfo->game);
@@ -581,7 +579,7 @@ class ActiveProc {
 // <editor-fold defaultstate="collapsed" desc="    在线礼包   ">
 
     /**
-     * 【6504】查询当天在线时长信息 
+     * 【6504】查询当天在线时长信息
      */
     static function getTotayOnlineInfos() {
 
@@ -592,7 +590,7 @@ class ActiveProc {
     }
 
     /**
-     * [6513] 领取连续在线礼包 
+     * [6513] 领取连续在线礼包
      */
     static function drawOnlineGift() {
         $giftid = req()->paras[0];                                               # 提取参数: 礼包的编号
@@ -607,8 +605,8 @@ class ActiveProc {
         my_Assert(!in_array($giftid, $privateState->onlineGiftIDs), #            # 判断礼包ID是否已经领取
                 ErrCode::active_hasgetted);
         $err = StoreProc::AddMultiItemInStore($giftData->rewardstr);            # 发放奖励
-        my_Assert(ErrCode::ok == $err, $err);                                   # 发放奖励失败 
-        $privateState->onlineGiftIDs[] = $giftid;                               # 记录已领礼包ID     
+        my_Assert(ErrCode::ok == $err, $err);                                   # 发放奖励失败
+        $privateState->onlineGiftIDs[] = $giftid;                               # 记录已领礼包ID
         UserProc::updateUserInfo();                                             # 回写用户数据
         return Resp::ok(array(
                     'onlineGiftts' => $privateState->onlineGiftts,
@@ -623,7 +621,7 @@ class ActiveProc {
     }
 
     /**
-     * 清理/重置 在线礼包时间戳 
+     * 清理/重置 在线礼包时间戳
      */
     static private function ClearOnlineGiftTs() {
         req()->userInfo->game->privateState->onlineGiftts = 0;
@@ -634,7 +632,7 @@ class ActiveProc {
 // <editor-fold defaultstate="collapsed" desc="    兑换码     ">
 
     /**
-     * [6512]凭兑换码领取礼包 
+     * [6512]凭兑换码领取礼包
      */
     static function drawActivePackageByCode() {
         $user = new Data_UserGame(req()->userInfo->game);
@@ -714,7 +712,7 @@ class ActiveProc {
 // </editor-fold>
 
     /**
-     * [6503] 查询当前分区开放时间戳 
+     * [6503] 查询当前分区开放时间戳
      */
     private static function GetZonePublicTS() {
         $zoneInfo = GameConfig::zonelist_getItem(req()->zoneid);
@@ -724,7 +722,7 @@ class ActiveProc {
 // <editor-fold defaultstate="collapsed" desc="  体力  ">
 
     /**
-     * [6508]  
+     * [6508]
      */
     public static function RecoveryTili() {
         $useTili = req()->paras[0];
@@ -740,7 +738,7 @@ class ActiveProc {
     }
 
     /**
-     * 清理每天的赠送体力领取记录 
+     * 清理每天的赠送体力领取记录
      */
     private static function ClearDailyTiliGift() {
         req()->userInfo->game->privateState->dailyDrawedTiliGift = ArrayInit();
@@ -748,7 +746,7 @@ class ActiveProc {
 
     /**
      * 修改玩家体力
-     * @param int $useTili $useTili>0代表增加体力,   $useTili<0代表消耗体力 
+     * @param int $useTili $useTili>0代表增加体力,   $useTili<0代表消耗体力
      */
     public static function ChangeTili($useTili) {
         $user = req()->userInfo->game;
@@ -780,12 +778,12 @@ class ActiveProc {
     }
 
 // </editor-fold>
-// 
-// 
+//
+//
 // <editor-fold defaultstate="collapsed" desc="    7日签到   ">
 
     /**
-     *  重置7日签到相关计数器 
+     *  重置7日签到相关计数器
      */
     static function DailyResetDay7Task() {
         req()->userInfo->game->gates->Times = 0;
@@ -798,14 +796,14 @@ class ActiveProc {
                     return $startDay <= $tsday;
                 }
         );
-        req()->userInfo->game->privateState->LoginDays = $newLoginDays;          # 
+        req()->userInfo->game->privateState->LoginDays = $newLoginDays;          #
         if (count(req()->userInfo->game->privateState->LoginDays) < 7) {
             req()->userInfo->game->privateState->LoginDays[] = tsDay();
         }
     }
 
     /**
-     * [6502] 领取七日签到奖励 
+     * [6502] 领取七日签到奖励
      */
     static function Day7_DrawReward() {
         // 设计7日数据结构
@@ -830,8 +828,5 @@ class ActiveProc {
     }
 
 // </editor-fold>
-//    
-    
-    
-    
+//
 }