Пример #1
0
 /**
  * 个人中心
  */
 public function personalSpace()
 {
     $user = D('Member')->getUserByUid(session('uid'));
     $aids = D('ActivityMember')->getAidsByUid(session('uid'));
     $activities = D('Activity')->getActivitiesByAids($aids);
     $activityMemberD = new ActivityMemberModel();
     foreach ($activities as &$activity) {
         if (time() > $activity['starttime'] && time() < $activity['endtime'] && $activity['status'] >= 0) {
             //活动进行中
             $activity['status'] = 10;
         } elseif (time() > $activity['endtime'] && $activity['status'] >= 0) {
             //已经结束
             $activity['status'] = -2;
         }
         $activity['status_info'] = A('Activity')->getStatusInfo($activity['status']);
         $activity['members_num'] = $activityMemberD->getMemberNumByAid($activity['aid']);
         $activity['isfounder'] = $activity['uid'] == session('uid') ? true : false;
     }
     $this->assign("activities", $activities);
     $this->assign('user', $user);
     $this->display();
 }
Пример #2
0
 /**
  * 过期的活动
  * @author JunhaoHo
  */
 public function activityExpired()
 {
     $activities = D('Activity')->getActivitesExpired();
     $postD = new PostModel();
     $activityMemberD = new ActivityMemberModel();
     foreach ($activities as &$activity) {
         $cover = $postD->getRandomPicByAid($activity['aid']);
         $activity['cover'] = $cover ?: '';
         $activity['Y'] = date('Y', $activity['starttime']);
         $activity['M'] = date('M', $activity['starttime']);
         $activity['j'] = date('j', $activity['starttime']);
         $activity['Y_display'] = date('Y') == $activity['Y'] ? 'none' : 'block';
         $activity['j_display'] = $activity['Y_display'] == 'none' ? 'block' : 'none';
         $activity['member_num'] = $activityMemberD->getMemberNumByAid($activity['aid']);
     }
     $this->assign('activities', $activities);
     $this->display();
 }