/** * @desc 添加球队 */ public function actionAddTeam() { $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->createRelation('teams', 'Team', $leagueId, $teamId); if (isset($res->updatedAt)) { $resM = $leagueModel->findByMaster($masterId, 1); $teamModel = new TeamModel(); $leagueTeams = $teamModel->findRowsByRelation("teams", "League", $resM[0]->objectId); $addTeam = $teamModel->findTeamByObjectId($teamId); if (isset($addTeam[0]->captain->username)) { $uid = $addTeam[0]->captain->username; $pushMsg = '你的球队:' . $addTeam[0]->name . ',已被添加进联赛:' . $resM[0]->name; //给队长发送联赛邀请 $baiduPushModel = new BaiduPushModel(); $baiduPushModel->sendInviteMessageForTeamCaptain($leagueId, $teamId, $addTeam[0]->captain); // 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 = '你的球队:'.$addTeam[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_ADD_ERROR_CODE, State::$TEAM_ADD_ERROR_MSG); } }
public function actionTest() { // $cloudCode = new BmobCloudCode('resulttest'); // $res = $cloudCode->get(array("name"=>111222)); // var_dump(json_decode($res,true));exit; // $test=new UserModel(); // $res=$test->getUserByTeam("093dc7adf2","11ccef1103"); // $teamModel = new TeamModel(); // $leagueTeams = $teamModel->findMembers("f5967d0626"); //// // $baiduPushModel=new BaiduPushModel(); // $baiduPushModel->push($leagueTeams,"更新赛事","更新赛事啊啊啊111", 4, 21, array("leagueId"=>"f5967d0626")); // //更新赛程发送推送 // $baiduPushModel=new BaiduPushModel(); // $baiduPushModel->sendMessageForAllLeague( 4, 21, "3171e5c832","aaaa"); $leagueModel = new LeagueModel(); $res = $leagueModel->createRelation('teams', 'Team', "c341dfb5a3", "202de4d820"); }