123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace loyalsoft;
- /**
- * Description of FightProc
- *
- * @author c'y'zhao
- */
- class FightProc {
- /**
- * 逻辑分发
- * 所有的Proc中必须有这样一个方法
- * @param Req $req
- */
- public static function procMain($req) {
- switch ($req->cmd) {
- case CmdCode::cmd_fight_settle: # 6801
- return FightProc::settle();
- case CmdCode::cmd_fight_PassGateTsPrizeReceive: # 6802
- return FightProc::PassGateTsPrizeReceive();
- default:
- Err(ErrCode::cmd_err);
- }
- }
-
- public static function FightSettle() {
-
- }
-
- public static function PassGateTsPrizeReceive() {
- list($gateId,$index) = req()->paras;
-
- $gateMo = GameConfig::gate_getItem($gateId);
- my_Assert($gateMo!=null, ErrCode::err_const_no);
- $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;
-
- UserProc::updateUserInfo();
- $ret = array(
- 'gateTsPrize' => ctx()->fight()->gateTsPrizeRevicedList,
- 'store' => 'ok',
- );
- return Resp::ok($ret);
- }
-
- }
|