public function actionActivityView()
 {
     $id = Yii::$app->request->get('activity_id');
     if (empty($id)) {
         throw new ServerErrorHttpException('查看课程信息失败,原因:参数错误!');
     }
     $activityModel = Activity::findOne($id);
     //录取人数
     $enrollCount = ActivityUsers::getEnrollCountByActivityId($id);
     //通过人数
     $passCount = ActivityUsers::getPassCountByActivityId($id);
     $activityUsersModel = ActivityUsers::getAllInfoById($id);
     if (!empty($activityUsersModel)) {
         foreach ($activityUsersModel as $key => $val) {
             $activityUsersModel[$key]['age'] = date('Y', time()) - date('Y', strtotime($val['birthday']));
         }
     }
     $levelName = Level::getOneLevelNameById(\Yii::$app->user->identity->level_id);
     $photo = UsersInfo::getPhotoByUserId(\Yii::$app->user->id);
     $messageCount = MessagesUsers::getCountByUserIdAndType(\Yii::$app->user->id);
     $currentTrain = TrainUsers::getTrainByUserId(\Yii::$app->user->id);
     //培训信息
     if (empty($activityModel)) {
         throw new ServerErrorHttpException('查看活动信息失败,原因:不存在的活动!');
     }
     $data = ['levelName' => $levelName, 'currentTrain' => $currentTrain, 'activityModel' => $activityModel, 'enrollCount' => $enrollCount, 'passCount' => $passCount, 'activityUsersModel' => $activityUsersModel, 'photo' => $photo, 'messageCount' => $messageCount];
     return $this->render('activity-view', ['data' => $data]);
 }