Quellcode durchsuchen

金币商城正式版

cyzhao vor 1 Jahr
Ursprung
Commit
7679e99a89

+ 1 - 1
Gameserver/App/model/Const/GameConfig.php

@@ -3,7 +3,7 @@
  // 由CodeGenerator创建。
  // Copyright (C) gwang (wanggangzero@qq.com), Loyalsoft@sjz Inc
  // author: gwang 
- // 日期: 2024-04-19 15:46:08
+ // 日期: 2024-04-22 15:50:47
 ////////////////////
 
 /**

+ 15 - 0
Gameserver/App/model/Const/sm_shop_gold.php

@@ -53,5 +53,20 @@ class sm_shop_gold
     */
     public $freeNum;
 
+    /**
+    * @var Int32 折扣 default(0) 
+    */
+    public $discount;
+
+    /**
+    * @var Int32 广告次数 default(0) 
+    */
+    public $guanggaoNum;
+
+    /**
+    * @var Int32 冷却时间 default(0) 
+    */
+    public $downTs;
+
 }
 

+ 19 - 0
Gameserver/App/model/User/Info_PrivateState.php

@@ -146,6 +146,25 @@ class Info_PrivateState extends Object_ext {
      */
     public $buyNum_ShopBoxBright = 0;
     
+    /**
+     * 金币商城第一个冷却时间记录
+     * @var type
+     */
+    public $goldShop_GuangGaoTs_1 = 0;
+
+    public $goldShop_GuangGaoNum = 0;
+
+    /**
+     * 金币商城第二个冷却时间记录
+     * @var type
+     */
+    public $goldShop_GuangGaoTs_2 = 0;
+    /**
+     * 金币商城第三个冷却时间记录
+     * @var type
+     */
+    public $goldShop_GuangGaoTs_3 = 0;
+    
     
     public function initialize() {
         $this->junbeiShopNumRecord = new \stdClass();

+ 219 - 186
Gameserver/App/process/ShopProc.php

@@ -14,6 +14,7 @@ namespace loyalsoft;
  * @author c'y'zhao
  */
 class ShopProc {
+
     /**
      * 逻辑分发
      * 所有的Proc中必须有这样一个方法
@@ -22,18 +23,18 @@ class ShopProc {
     public static function procMain($req) {
         switch ($req->cmd) {
             case CmdCode::cmd_shop_BuyGift:                                     # 6501 商城购买东西
-                return ShopProc::ShopBuyGift();             
+                return ShopProc::ShopBuyGift();
             default:
                 Err(ErrCode::cmd_err);
         }
     }
-    
+
     /**
      * 商城购买东西
      * @return type
      */
     public static function ShopBuyGift() {
-        list($type,$typeId,$buyNum) = req()->paras;
+        list($type, $typeId, $buyNum) = req()->paras;
         $user = ctx();
 
         $resultArr = array();
@@ -42,316 +43,347 @@ class ShopProc {
         $gateGift = array();
         switch ($type) {
             case EnumShopGift::GateGift_Shop://章节礼包
-                my_Assert(!in_array($typeId, ctx()->privateState->gateGiftReceived), ErrCode::user_shop_NotRepeatBuy);       
-                
+                my_Assert(!in_array($typeId, ctx()->privateState->gateGiftReceived), ErrCode::user_shop_NotRepeatBuy);
+
                 $mo = GameConfig::shop_gategift_getItem($typeId);
-                my_Assert($mo != null, ErrCode::err_const_no);       
-                
+                my_Assert($mo != null, ErrCode::err_const_no);
+
                 $price = explode(';', $mo->reward);
                 foreach ($price as $value) {
                     $item = explode(',', $value);
-                    if(GameConfig::item_getItem($item[0])->itemType == EnumItemType::tuzhiBox){
+                    if (GameConfig::item_getItem($item[0])->itemType == EnumItemType::tuzhiBox) {
                         $dic = GameConfig::item();
                         $list = array();
                         foreach ($dic as $id => $val) {
-                            if($val->itemType == EnumItemType::tuzhi){
+                            if ($val->itemType == EnumItemType::tuzhi) {
                                 $list[] = $val->typeId;
                             }
                         }
-                        
-                        $randNum = rand(0, count($list)-1);
+
+                        $randNum = rand(0, count($list) - 1);
                         $tuzhiId = $list[$randNum];
-                        $gateGift[] = $tuzhiId.',1';
-                        
+                        $gateGift[] = $tuzhiId . ',1';
                     } else {
                         $gateGift[] = $value;
-                    }                                       
+                    }
                 }
-                
+
                 foreach ($gateGift as $str) {
                     StoreProc::AddMultiItemInStore($str);
                 }
-                                                               
+
                 ctx()->privateState->gateGiftReceived[] = $typeId;
-                
+
                 ctx()->baseInfo->charge_amt += $mo->curPrice;
                 break;
             case EnumShopGift::Daily_Shop://每日商店                             
                 $mo = GameConfig::shop_daily_getItem($typeId);
-                my_Assert($mo != null, ErrCode::err_const_no);   
-                              
+                my_Assert($mo != null, ErrCode::err_const_no);
+
                 my_Assert(in_array($typeId, $user->privateState->dailyShopRandItems), ErrCode::err_const_no);
-                if($typeId == 10001){
+                if ($typeId == 10001) {
                     $getNum = 0;
                     foreach ($user->privateState->dailyShopReceived as $id) {
-                        if($id == $typeId){
-                            $getNum+=1;
+                        if ($id == $typeId) {
+                            $getNum += 1;
                         }
                     }
-                    
-                    if($getNum >= $mo->freeNum){
-                        my_Assert($user->privateState->dailyShop_GuangGaoNum < $mo->num, ErrCode::user_shop_FreeNumLimit);   
-                        if($user->privateState->dailyShop_GuangGaoNum >= 1){                                                    
-                            my_Assert(now() - $user->privateState->dailyShop_GuangGaoTs >= $mo->downTs, ErrCode::user_shop_FreeNumLimit);      
-                        }                                                              
+
+                    if ($getNum >= $mo->freeNum) {
+                        my_Assert($user->privateState->dailyShop_GuangGaoNum < $mo->num, ErrCode::user_shop_FreeNumLimit);
+                        if ($user->privateState->dailyShop_GuangGaoNum >= 1) {
+                            my_Assert(now() - $user->privateState->dailyShop_GuangGaoTs >= $mo->downTs, ErrCode::user_shop_FreeNumLimit);
+                        }
                         $user->privateState->dailyShop_GuangGaoNum += 1;
                         $user->privateState->dailyShop_GuangGaoTs = now();
-                    }                                                   
-                } else {                                                               
-                    my_Assert(!in_array($typeId, $user->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);   
+                    }
+                } else {
+                    my_Assert(!in_array($typeId, $user->privateState->dailyShopReceived), ErrCode::user_shop_NotRepeatBuy);
 
-                    switch ($mo->costType) {                    
+                    switch ($mo->costType) {
                         case EnumShopCost::Gold:
-                            my_Assert($user->baseInfo->gold>= $mo->costNum, ErrCode::notenough_gold_msg); 
+                            my_Assert($user->baseInfo->gold >= $mo->costNum, ErrCode::notenough_gold_msg);
                             ctx()->baseInfo->Consume_Gold($mo->costNum);
                             break;
                         case EnumShopCost::Cash:
-                            my_Assert($user->baseInfo->cash>= $mo->costNum, ErrCode::notenough_cash_msg); 
+                            my_Assert($user->baseInfo->cash >= $mo->costNum, ErrCode::notenough_cash_msg);
                             ctx()->baseInfo->Consume_Cash($mo->costNum);
                             break;
                         default:
                             break;
-                    }                                      
+                    }
                 }
-                                            
-                $str = explode(',',$mo->reward); 
-                if($str[0] == 501){//暂时还没有
-                    
-                    
+
+                $str = explode(',', $mo->reward);
+                if ($str[0] == 501) {//暂时还没有
                 }
                 //$dailyArr
-                
+
                 StoreProc::AddMultiItemInStore($mo->reward);
                 ctx()->privateState->dailyShopReceived[] = $typeId;
-                
+
                 break;
-                
+
             case EnumShopGift::GemBox_Shop ://宝石宝箱
                 $mo = GameConfig::shop_box_getItem($typeId);
-                my_Assert($mo != null, ErrCode::err_const_no); 
-                              
-                if($buyNum > 0){
+                my_Assert($mo != null, ErrCode::err_const_no);
+
+                if ($buyNum > 0) {
                     $cost = $mo->cost_ten;
-                    if($buyNum == 1){
-                        $cost = $mo->cost_one;    
+                    if ($buyNum == 1) {
+                        $cost = $mo->cost_one;
                     }
-                    my_Assert( $user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);    
-                    $user->baseInfo->Consume_Cash($cost);        
+                    my_Assert($user->baseInfo->cash >= $cost, ErrCode::notenough_cash_msg);
+                    $user->baseInfo->Consume_Cash($cost);
                 }
-                               
-                if($mo->type == 1){
-                    if($buyNum == 0){
+
+                if ($mo->type == 1) {
+                    if ($buyNum == 0) {
                         $buyNum = 1;
-                        my_Assert(now()-$user->privateState->lastFreeGetTs_ShopBoxCommon >= $mo->freeDownTs*24*60*60, ErrCode::user_shop_FreeNumLimit);
+                        my_Assert(now() - $user->privateState->lastFreeGetTs_ShopBoxCommon >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
                         $user->privateState->lastFreeGetTs_ShopBoxCommon = now();
-                    }                    
-                } else if($mo->type == 2){
-                    if($buyNum == 0){
+                    }
+                } else if ($mo->type == 2) {
+                    if ($buyNum == 0) {
                         $buyNum = 1;
-                        my_Assert(now()-$user->privateState->lastFreeGetTs_ShopBoxBright >= $mo->freeDownTs*24*60*60, ErrCode::user_shop_FreeNumLimit);
+                        my_Assert(now() - $user->privateState->lastFreeGetTs_ShopBoxBright >= $mo->freeDownTs * 24 * 60 * 60, ErrCode::user_shop_FreeNumLimit);
                         $user->privateState->lastFreeGetTs_ShopBoxBright = now();
                     }
                 }
-                
+
                 $arr = array();
                 $arr[] = 1;
                 $arr[] = 10;
-                if(!in_array($buyNum, $arr)){
+                if (!in_array($buyNum, $arr)) {
                     $buyNum = 1;
                 }
-                
-                $perList = explode(';',$mo->percent);                
+
+                $perList = explode(';', $mo->percent);
                 $allNum = 0;
                 foreach ($perList as $key => $value) {
                     $str = explode(',', $value);
                     $allNum += $str[1];
                 }
-                
-                $allNum *= 10;                    
-                for ($i = 0; $i < $buyNum; $i++) {                   
+
+                $allNum *= 10;
+                for ($i = 0; $i < $buyNum; $i++) {
                     $buyCount = 0;
-                    if($mo->type == 1){
-                        $user->privateState->buyNum_ShopBoxCommon += 1;       
+                    if ($mo->type == 1) {
+                        $user->privateState->buyNum_ShopBoxCommon += 1;
                         $buyCount = $user->privateState->buyNum_ShopBoxCommon;
                     } else {
-                        $user->privateState->buyNum_ShopBoxBright += 1;        
+                        $user->privateState->buyNum_ShopBoxBright += 1;
                         $buyCount = $user->privateState->buyNum_ShopBoxBright;
                     }
-                    
-                    $bichu1 = explode(',',$mo->bichu1); 
+
+                    $bichu1 = explode(',', $mo->bichu1);
                     $qual = 0;
-                    if($buyCount % $bichu1[0] == 0){
+                    if ($buyCount % $bichu1[0] == 0) {
                         $qual = $bichu1[1];
                     }
-                    if($mo->bichu2 != null){
-                        $bichu2 = explode(',',$mo->bichu2); 
-                        if($buyCount % $bichu2[0] == 0){
+                    if ($mo->bichu2 != null) {
+                        $bichu2 = explode(',', $mo->bichu2);
+                        if ($buyCount % $bichu2[0] == 0) {
                             $qual = $bichu2[1];
                         }
                     }
-                    
-                    if($qual == 0){
+
+                    if ($qual == 0) {
                         $start = 0;
-                        $end = 0;                   
-                        $randNum = rand (1,$allNum);                       
+                        $end = 0;
+                        $randNum = rand(1, $allNum);
                         foreach ($perList as $k => $val) {
                             $str = explode(',', $val);
-                            $end += $str[1]*10;
-                            if($randNum > $start && $randNum <= $end){
+                            $end += $str[1] * 10;
+                            if ($randNum > $start && $randNum <= $end) {
                                 $qual = $str[0];
                                 break;
                             }
                             $start = $end;
                         }
                     }
-                                                              
-                    if($qual >0){
-                            $gemDic = GameConfig::gem();
-                            $gemList = array();
-                            foreach ($gemDic as $key => $value) {
-                                if($value->qual == $qual){
-                                    $gemList[] = $value;
-                                }
+
+                    if ($qual > 0) {
+                        $gemDic = GameConfig::gem();
+                        $gemList = array();
+                        foreach ($gemDic as $key => $value) {
+                            if ($value->qual == $qual) {
+                                $gemList[] = $value;
                             }
-                            
-                            $n = rand(0, count($gemList)-1);                  
-                            $gem = StoreProc::initGem($gemList[$n]->typeId);
-                            $resultArr[] = $gem->uid;
-                            StoreProc::PutGemInStore2($gem);
-                    }                                                                                       
+                        }
+
+                        $n = rand(0, count($gemList) - 1);
+                        $gem = StoreProc::initGem($gemList[$n]->typeId);
+                        $resultArr[] = $gem->uid;
+                        StoreProc::PutGemInStore2($gem);
+                    }
                 }
-                
-                
+
+
                 break;
             case EnumShopGift::BujiBox_Shop://补给箱
                 $mo = GameConfig::shop_supply_getItem($typeId);
-                my_Assert($mo != null, ErrCode::err_const_no); 
-                
+                my_Assert($mo != null, ErrCode::err_const_no);
+
                 $list = explode(',', $mo->cost);
-                my_Assert(StlUtil::dictHasProperty($user->store->items, $list[0]), ErrCode::notenough_item); 
-                
+                my_Assert(StlUtil::dictHasProperty($user->store->items, $list[0]), ErrCode::notenough_item);
+
                 $user->store->removeItem($list[0], $list[1]);
-                $user->baseInfo->Add_Gold($mo->gold);             
-                if(!StlUtil::dictHasProperty($user->privateState->junbeiShopNumRecord, $typeId)){                   
+                $user->baseInfo->Add_Gold($mo->gold);
+                if (!StlUtil::dictHasProperty($user->privateState->junbeiShopNumRecord, $typeId)) {
                     $user->privateState->junbeiShopNumRecord->$typeId = 0;
-                }                
+                }
                 $num = $user->privateState->junbeiShopNumRecord->$typeId += 1;
-                
-                if(!StlUtil::dictHasProperty($user->privateState->supplyBichuDic, $typeId)){                   
+
+                if (!StlUtil::dictHasProperty($user->privateState->supplyBichuDic, $typeId)) {
                     $user->privateState->supplyBichuDic->$typeId = 0;
-                } 
+                }
                 $user->privateState->supplyBichuDic->$typeId += 1;
-                
-                my_Assert($num <= $mo->limitNum, ErrCode::user_shop_LimitNum); 
+
+                my_Assert($num <= $mo->limitNum, ErrCode::user_shop_LimitNum);
                 $list = explode(';', $mo->percent);
-                $randNum = rand(0,10000);
+                $randNum = rand(0, 10000);
                 $start = 0;
-                $end = 0;   
-                $qual = null;               
+                $end = 0;
+                $qual = null;
                 foreach ($list as $item) {
-                    $arr = explode(',', $item); 
+                    $arr = explode(',', $item);
 
-                    $per = $arr[2]*100;
+                    $per = $arr[2] * 100;
                     $end += $per;
-                    if($randNum >= $start && $randNum <$end){
-                        $qual = $arr[0].','.$arr[1];//品阶,稀有度
+                    if ($randNum >= $start && $randNum < $end) {
+                        $qual = $arr[0] . ',' . $arr[1]; //品阶,稀有度
                         break;
                     }
                     $start = $end;
-                }                         
+                }
                 //必出
                 $bichu = explode(',', $mo->bichu);
                 $qArr = explode(',', $qual);
-                if($qArr[0]==$bichu[1] && $qArr[1] == $bichu[2]){//得到必出,重置数量记录
-                    $user->privateState->supplyBichuDic->$typeId = 0;     
-                    $qual = $bichu[1].','.$bichu[2];
+                if ($qArr[0] == $bichu[1] && $qArr[1] == $bichu[2]) {//得到必出,重置数量记录
+                    $user->privateState->supplyBichuDic->$typeId = 0;
+                    $qual = $bichu[1] . ',' . $bichu[2];
                 } else {
-                    if($user->privateState->supplyBichuDic->$typeId == $bichu[0]){
-                        $qual = $bichu[1].','.$bichu[2];
+                    if ($user->privateState->supplyBichuDic->$typeId == $bichu[0]) {
+                        $qual = $bichu[1] . ',' . $bichu[2];
                         $user->privateState->supplyBichuDic->$typeId = 0;
-                    }                                     
+                    }
                 }
-                                         
-                if($qual != null){
+
+                if ($qual != null) {
                     $str = explode(',', $qual);
-                    
+
                     $equipList = array();
                     $dic = GameConfig::equip();
                     foreach ($dic as $tid => $item) {
-                        if($item->qual == $str[0] && $item->rarity == $str[1]){
+                        if ($item->qual == $str[0] && $item->rarity == $str[1]) {
                             $equipList[] = $item->typeId;
                         }
                     }
-                    
-                    $rNum = rand(0, count($equipList)-1);
+
+                    $rNum = rand(0, count($equipList) - 1);
                     $equipId = $equipList[$rNum];
                     StoreProc::PutEquipInStore($equipId, 1);
                     $equip[] = $equipId;
                 }
-                               
+
                 break;
             case EnumShopGift::Cash_Shop://商城-钻石
-                $mo = GameConfig::shop_cash_getItem($typeId);                            
-                my_Assert($mo != null, ErrCode::err_const_no); 
-                
+                $mo = GameConfig::shop_cash_getItem($typeId);
+                my_Assert($mo != null, ErrCode::err_const_no);
+
                 $tag = false;
-                if(in_array($typeId,$user->privateState->cashShopReceived)){
-                    $tag = true;            
+                if (in_array($typeId, $user->privateState->cashShopReceived)) {
+                    $tag = true;
                 }
-                
-                $reward = $mo->reward;                
-                if(!$tag){
-                    $reward = $mo->reward.';'.$mo->reward;
+
+                $reward = $mo->reward;
+                if (!$tag) {
+                    $reward = $mo->reward . ';' . $mo->reward;
                 }
-                
+
                 StoreProc::AddMultiItemInStore($reward);
                 $user->baseInfo->charge_amt += $mo->price;
                 $user->privateState->cashShopReceived[] = $typeId;
-                
-                break;           
+
+                break;
             case EnumShopGift::Gold_Shop://商城-金币--可以多次购买
                 $mo = GameConfig::shop_gold_getItem($typeId);
-                my_Assert($mo != null, ErrCode::err_const_no); 
-                            
+                my_Assert($mo != null, ErrCode::err_const_no);
+
                 $tempNum = 0;
                 foreach ($user->privateState->goldShopReceived as $key) {
-                    if($key == $typeId){
+                    if ($key == $typeId) {
                         $tempNum += 1;
                     }
                 }
-               
-                if($tempNum >= $mo->freeNum){
-                    my_Assert($user->baseInfo->cash>= $mo->costNum, ErrCode::notenough_cash_msg); 
-                    ctx()->baseInfo->Consume_Cash($mo->price);                    
+
+                if ($tempNum >= $mo->freeNum) {
+                    if ($typeId == 1 && $user->privateState->goldShop_GuangGaoNum < $mo->guanggaoNum) {
+                        //广告
+                        //$user->privateState->goldShopReceived[] = $typeId;
+                        $user->privateState->goldShop_GuangGaoNum += 1;
+                    } else {
+                        $ts = 0;
+                        switch ($typeId) {
+                            case 1:
+                                $ts = $user->privateState->goldShop_GuangGaoTs_1;
+                                break;
+                            case 2:
+                                $ts = $user->privateState->goldShop_GuangGaoTs_2;
+                                break;
+                            case 3:
+                                $ts = $user->privateState->goldShop_GuangGaoTs_3;
+                                break;
+                        }
+
+                        if ($ts == 0) {
+                            //收费买
+                            my_Assert($user->baseInfo->cash >= $mo->price, ErrCode::notenough_cash_msg);
+                            ctx()->baseInfo->Consume_Cash($mo->price);
+                            //$user->privateState->goldShopReceived[] = $typeId;
+                        } else {
+                            my_Assert(now() - $ts >= $mo->downTs, ErrCode::user_shop_FreeNumLimit);
+                            switch ($typeId) {
+                                case 1:
+                                    $user->privateState->goldShop_GuangGaoTs_1 = now();
+                                    break;
+                                case 2:
+                                    $user->privateState->goldShop_GuangGaoTs_2 = now();
+                                    break;
+                                case 3:
+                                    $user->privateState->goldShop_GuangGaoTs_3 = now();
+                                    break;
+                            }
+                        }
+                    }
                 }
-                
+
                 $user->privateState->goldShopReceived[] = $typeId;
-                
                 StoreProc::AddMultiItemInStore($mo->reward);
-                            
-                break;           
+
+                break;
             default:
                 break;
         }
-             
-        if(ctx()->baseInfo->charge_amt > 0 && ctx()->baseInfo->fRechargePriceReceived == 0){
+
+        if (ctx()->baseInfo->charge_amt > 0 && ctx()->baseInfo->fRechargePriceReceived == 0) {
             StoreProc::AddMultiItemInStore(GameConfig::globalsettings()->FirstRechargePrice);
             ctx()->baseInfo->fRechargePriceReceived = 1;
         }
-            
-        
+
+
         ctx($user);
         UserProc::updateUserInfo();
-        return Resp::ok(array(         
+        return Resp::ok(array(
                     'gemBox' => $resultArr,
-                    'gateGift'=>$gateGift,                 
-                    'cash'=>$user->baseInfo->cash,
-                    'gold'=>$user->baseInfo->gold,
-                    'privateState' => $user->privateState,                   
+                    'gateGift' => $gateGift,
+                    'cash' => $user->baseInfo->cash,
+                    'gold' => $user->baseInfo->gold,
+                    'privateState' => $user->privateState,
                     'store' => $user->store,));
-        
     }
-    
+
     /**
      * 商城每日重置
      */
@@ -359,26 +391,26 @@ class ShopProc {
         ctx()->privateState->dailyShopReceived = array();
         ctx()->privateState->goldShopReceived = array();
         ctx()->privateState->junbeiShopNumRecord = new \stdClass();
-        
+
         ctx()->privateState->dailyShop_GuangGaoNum = 0;
         ctx()->privateState->dailyShop_GuangGaoTs = 0;
     }
-    
+
     /**
      * 每日商城随机6个道具
      * @return type
      */
     public static function DailyShopItemRand() {
         $dataDic = new \stdClass();
-        
+
         $dic = GameConfig::shop_daily();
-        if($dic == null){
+        if ($dic == null) {
             return;
         }
-              
+
         foreach ($dic as $typeId => $mo) {
             $type = $mo->type;
-            if(StlUtil::dictHasProperty($dataDic,$type) ){
+            if (StlUtil::dictHasProperty($dataDic, $type)) {
                 $list = $dataDic->$type;
                 $list[] = $typeId;
                 $dataDic->$type = $list;
@@ -388,43 +420,44 @@ class ShopProc {
                 $dataDic->$type = $list;
             }
         }
-        $result = array();             
-        $arrType = array(1,2,3,2,4,3);
-        foreach ($arrType as $k) {                          
-            if(StlUtil::dictHasProperty($dataDic,$k) && count($dataDic->$k) > 0){
-                $arr2 = $dataDic->$k;   
-                if($k == 1){
+        $result = array();
+        $arrType = array(1, 2, 3, 2, 4, 3);
+        foreach ($arrType as $k) {
+            if (StlUtil::dictHasProperty($dataDic, $k) && count($dataDic->$k) > 0) {
+                $arr2 = $dataDic->$k;
+                if ($k == 1) {
                     $result[] = $arr2[0];
                     continue;
                 }
-                
+
                 $allNum = 0;
                 foreach ($arr2 as $giftTypeId) {
-                    $allNum += GameConfig::shop_daily_getItem($giftTypeId)->per;                   
+                    $allNum += GameConfig::shop_daily_getItem($giftTypeId)->per;
                 }
-                
-                $randNum = rand(1,$allNum);
+
+                $randNum = rand(1, $allNum);
                 $start = 0;
                 $end = 0;
                 $index = 0;
                 foreach ($arr2 as $itemId) {
                     $per = GameConfig::shop_daily_getItem($itemId)->per;
                     $end += $per;
-                    if($randNum >= $start && $randNum < $end){
+                    if ($randNum >= $start && $randNum < $end) {
                         $result[] = $itemId;
                         break;
                     }
                     $start = $end;
                     $index += 1;
-                }                            
+                }
                 unset($arr2[$index]);
-                
-                $dataDic->$k = array_values($arr2);             
+
+                $dataDic->$k = array_values($arr2);
             }
         }
-        
-        
-        ctx()->privateState->dailyShopRandItems = $result;        
+
+
+        ctx()->privateState->dailyShopRandItems = $result;
         UserProc::updateUserInfo();
     }
+
 }