/** * @desc 删除球队 */ public function actionDeleteTeam() { $masterId = CommonFunction::getUserId(); $leagueId = Yii::app()->request->getPost('leagueId'); $teamId = Yii::app()->request->getPost('teamId'); if (empty($leagueId) || empty($teamId)) { CommonFunction::ajaxResult(State::$SYS_PARAM_ERROR_CODE, State::$SYS_PARAM_ERROR_MSG); } $leagueModel = new LeagueModel(); $groupModel = new GroupModel(); $Groups = $groupModel->findByLeagueId($leagueId); if (empty($Groups)) { $res = $leagueModel->removeRelation('teams', 'Team', $leagueId, $teamId); if (isset($res->updatedAt)) { $resM = $leagueModel->findByMaster($masterId, 1); $teamModel = new TeamModel(); $leagueTeams = $teamModel->findRowsByRelation("teams", "League", $resM[0]->objectId); $deleteTeam = $teamModel->findTeamByObjectId($teamId); if (isset($deleteTeam[0]->captain->username)) { $uid = $deleteTeam[0]->captain->username; $pushMsg = '你的球队:' . $deleteTeam[0]->name . ',已被联赛【' . $resM[0]->name . '】移除出联赛'; CommonFunction::pushAppMsg($uid, $pushMsg); // $device = new InstallationModel(); // $msg = $device->findByUid($uid); // if(isset($msg[0]) && !empty($msg[0])){ // $deviceMsg = $msg[0]; // $push = new PushMsgModel(); // $pushMsg = '你的球队:'.$deleteTeam[0]->name.',已被联赛【'.$resM[0]->name.'】移除出联赛'; // if(isset($deviceMsg->deviceToken) && isset($deviceMsg->deviceType) && $deviceMsg->deviceType == 'ios'){ // $push->createIosPush($deviceMsg->deviceToken,$pushMsg); // }elseif(isset($deviceMsg->installationId) && isset($deviceMsg->deviceType) && $deviceMsg->deviceType == 'android'){ // $push->createAndroidPush($deviceMsg->installationId,$pushMsg); // } // } } } CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG, array('leagueTeams' => $leagueTeams)); } else { CommonFunction::ajaxResult(State::$TEAM_DELETE_ERROR_CODE, State::$TEAM_DELETE_ERROR_MSG); } }
/** * @desc 球队阵容 */ public function actionGameLineup() { $teamId = Yii::app()->request->getQuery('team', ''); $LineupModel = new LineupModel(); $lineupData = $LineupModel->findLineupByTeamId($teamId); $teamModel = new TeamModel(); $team = $teamModel->findTeamByObjectId($teamId); if ($team) { $team = $team[0]; } $backPlayers = array(); $strikerPlayers = array(); $forwardPlayers = array(); $goalkeeperPlayers = array(); if (isset($lineupData[0])) { $lineupId = $lineupData[0]->objectId; $userModel = new UserModel(); $backPlayers = $userModel->findRowsByRelation("back", "Lineup", $lineupId); $strikerPlayers = $userModel->findRowsByRelation("striker", "Lineup", $lineupId); $forwardPlayers = $userModel->findRowsByRelation("forward", "Lineup", $lineupId); $goalkeeperPlayers = $lineupData[0]->goalkeeper; } // print_r($team);exit("dafasfda"); $this->render('gameLineup', array('team' => $team, 'backPlayers' => $backPlayers, 'strikerPlayers' => $strikerPlayers, 'forwardPlayers' => $forwardPlayers, 'goalkeeperPlayers' => $goalkeeperPlayers)); }