cyzhao 1 сар өмнө
parent
commit
0c2a7a2b54

+ 13 - 11
Gameserver/App/process/PetProc.php

@@ -810,22 +810,24 @@ class PetProc {
      * @return Resp
      */
     public static function Pet_SelectShowPet(){
-        list($uid) = req()->paras;
+        list($uids) = req()->paras;
         
         $petDic = ctx()->store->pet;
-        my_Assert(StlUtil::dictHasProperty($petDic, $uid), ErrCode::user_store_NotExistPet);
-        
-        my_Assert(count(ctx()->store()->mainShowPetList)< GameConfig::glc2()->Pet_MainShowPetList , ErrCode::user_store_ShowPetNumLimit);
-        
-        my_Assert(ctx()->store->petUid_fight_position != $uid, ErrCode::user_store_NotSelectPet_fight);
-        my_Assert(!in_array($uid, ctx()->store->petUids_supportFight_position), ErrCode::user_store_NotSelectPet_supportfight);
         
-        if(in_array($uid,ctx()->store()->mainShowPetList)){
-            StlUtil::arrayRemove(ctx()->store()->mainShowPetList, $uid);
+        if(count($uids) == 0){
+            ctx()->store()->mainShowPetList = $uids;
         } else {
-            ctx()->store()->mainShowPetList[] = $uid;
+            my_Assert(count($uids)< GameConfig::glc2()->Pet_MainShowPetList , ErrCode::user_store_ShowPetNumLimit);
+            
+            foreach ($uids as $uid) {
+                my_Assert(StlUtil::dictHasProperty($petDic, $uid), ErrCode::user_store_NotExistPet);
+                my_Assert(ctx()->store->petUid_fight_position != $uid, ErrCode::user_store_NotSelectPet_fight);
+                my_Assert(!in_array($uid, ctx()->store->petUids_supportFight_position), ErrCode::user_store_NotSelectPet_supportfight);              
+            }
+            
+            ctx()->store()->mainShowPetList = $uids;
         }
-        
+             
         UserProc::updateUserInfo();
         return Resp::ok(array());
     }