Przeglądaj źródła

后端接口补充

cyzhao 1 rok temu
rodzic
commit
7421ce52ef

+ 7 - 0
Gameserver/App/base/ErrCode.php

@@ -330,6 +330,13 @@ class ErrCode {
 
 // </editor-fold>
 //
+
+//   // <editor-fold defaultstate="collapsed" desc="    关卡     ">    
+
+    const user_Gate_NoUserGateInfo = 3201;
+// </editor-fold>
+//
+
 // <editor-fold defaultstate="collapsed" desc="    反射方法    ">
 
     /**

+ 1 - 1
Gameserver/App/model/User/Info_Gates.php

@@ -25,7 +25,7 @@ class Info_Gates extends Object_ext {
     public $UnlockedGatesMaxId = 0; 
     /**
      * 章节列表
-     * @var type
+     * @var Ins_GateInfo
      */
     public $GateList = null;
     

+ 44 - 15
Gameserver/App/process/FightProc.php

@@ -34,31 +34,60 @@ class FightProc {
         
     }
     
+    /**
+     * 章节宝箱的领取
+     * @return type
+     */
     public static function PassGateTsPrizeReceive() {
         list($gateId,$index) = req()->paras;                                      
         
         $gateMo = GameConfig::gate_getItem($gateId);
         my_Assert($gateMo!=null, ErrCode::err_const_no);
         
+        my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::user_Gate_NoUserGateInfo);
+        $gateInfo = ctx()->gates->GateList->$gateId;
         
+        $tag = false;
+        $prize = "";
+        $mask =0;
+        switch ($index) {
+            case 1:
+                $ts = $gateMo->first_ts1 *60;
+                if($ts >= $gateInfo->MaxSeconds){
+                    $tag = true;
+                }
+                $mask=1;
+                $prize = $gateMo->first_reward1;
+                break;
+            case 2:
+                $ts = $gateMo->first_ts2*60;
+                if($ts >= $gateInfo->MaxSeconds){
+                    $tag = true;
+                }
+                $mask = 2;
+                $prize = $gateMo->first_reward2;
+                break;
+            case 3:
+                if($gateInfo->pass > 0){
+                    $tag = true;
+                }                   
+                $mask =3;
+                $prize = $gateMo->first_reward3;
+                break;
+            default:
+                break;
+        }
         
-//        $prizelist = ctx()->fight()->gateTsPrizeRevicedList;
-//        $recordlist = ctx()->fight()->gateTsRecord;
-//        for($i = $index -1 ; $i >0; $i--){//校验是否满足条件
-//            $str = $gateId.'-'.$i;
-//            my_Assert(in_array($str, $recordlist) && in_array($str, $prizelist), ErrCode::err_const_no);          
-//        }
-//        
-//        my_Assert(in_array($str, $recordlist) && !in_array($str, $prizelist), ErrCode::err_const_no);       
-//        
-//        $key = 'first_reward'.$index;
-//        StoreProc::AddMultiItemInStore($gateMo->$key); 
-//        ctx()->fight()->gateTsPrizeRevicedList[] = $gateId.'-'.$index;    
-        
+        if($tag){
+            StoreProc::AddMultiItemInStore($prize); 
+            $gateInfo->FirstReward = $mask;    
+        }
+        ctx()->gates->GateList->$gateId=$gateInfo;
+
         UserProc::updateUserInfo();
         $ret = array(          
-            'gateTsPrize' => ctx()->fight()->gateTsPrizeRevicedList, 
-            'store' => 'ok',
+            'gate' => $gateInfo, 
+            'store' => ctx()->store,
             );
         return Resp::ok($ret);
     }