/**
  * @desc 调用云端代码更新联赛射手榜数据
  */
 public function actionUpdateShooterData()
 {
     $leagueId = Yii::app()->request->getPost('leagueid');
     $cloudCodeModel = new BmobCloudCode('userGoalAssist');
     $res = $cloudCodeModel->get(array('leagueId' => "{$leagueId}"));
     if (empty($res)) {
         CommonFunction::ajaxResult(State::$SHOOTER_RANGE_ERROR_CODE, State::$SHOOTER_RANGE_ERROR_MSG);
     } else {
         //更新射手榜发送推送
         $baiduPushModel = new BaiduPushModel();
         $baiduPushModel->sendMessageForAllLeague(4, 21, $leagueId, "更新了射手榜");
         CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG, array('response' => $res));
     }
 }
 /**
  * @desc 编辑赛事信息
  */
 public function actionEditGameSchedule()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         throw new CHttpException(500, '此方法只允许ajax调用');
     }
     $masterId = CommonFunction::getUserId();
     $gameDate = Yii::app()->request->getPost('game_date');
     $gameTime = Yii::app()->request->getPost('game_time');
     $gameAddress = Yii::app()->request->getPost('game_address');
     $gameId = Yii::app()->request->getPost('gameid');
     if (empty($gameId) || empty($gameDate) || empty($gameTime) || empty($gameAddress)) {
         CommonFunction::ajaxResult(State::$SYS_PARAM_ERROR_CODE, State::$SYS_PARAM_ERROR_MSG);
     }
     $leagueModel = new LeagueModel();
     $res = $leagueModel->findByMaster($masterId, 1);
     if (empty($res)) {
         throw new CHttpException(500, '该用户无权限管理联赛');
     }
     $leagueId = $res[0]->objectId;
     $leagueName = $res[0]->name;
     $gameModel = new TournamentModel();
     $leagueTeam = $gameModel->findLeagueTeam($gameId, $leagueId);
     if (empty($leagueTeam)) {
         CommonFunction::ajaxResult(State::$SYS_PERMISSION_ERROR_CODE, State::$SYS_PERMISSION_ERROR_MSG);
     }
     //var_dump($leagueTeam);exit;
     //		$date = array(
     //			'event_date' => $gameDate.' 00:00:00',
     //			'start_time' => '0000-00-00 '.$gameTime,
     //			'site' => $gameAddress
     //		);
     //		$gameDate = date ( "Y-m-d" );
     //		$gameTime = date ( "H:i:s" );
     //$date = $gameDate.' 00:00:00';
     $gameDateTime = $gameDate . ' ' . $gameTime . ':00';
     $res = '';
     try {
         $res = $gameModel->updateSchedule($gameId, $gameDateTime, $gameDateTime, $gameAddress);
     } catch (Exception $e) {
         //echo $e;
     }
     //更新赛程发送推送
     $baiduPushModel = new BaiduPushModel();
     $baiduPushModel->sendMessageForAllLeague(4, 20, $leagueId, "更新了赛程");
     if (isset($res->updatedAt)) {
         $response = 'success';
     } else {
         $response = 'fail';
     }
     CommonFunction::ajaxResult(State::$SUSSION_CODE, State::$SUSSION_MSG, array('response' => $response));
 }