Selaa lähdekoodia

展示宠物接口修改

cyzhao 1 kuukausi sitten
vanhempi
commit
0c2a7a2b54
1 muutettua tiedostoa jossa 13 lisäystä ja 11 poistoa
  1. 13 11
      Gameserver/App/process/PetProc.php

+ 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());
     }