public function posts3()
 {
     $m = new PostModel();
     $data = $m->relation('author')->find();
     print_r($data);
 }
Ejemplo n.º 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();
 }