public function detailsAction($data)
 {
     $d['topics'] = TopicDao::getByIdCat($data);
     $d['categorie'] = CategorieDao::getByIdCat($data);
     $this->set($d);
     $this->render('details');
 }
Пример #2
0
 public function detailsAction($data)
 {
     $d['topic'] = TopicDao::getByIdTop($data);
     $this->set($d);
     $this->render('details');
 }
<?php

require '../dao/TopicDao.php';
require '../dao/GetDao.php';
require '../dao/MessageDao.php';
$topicName = $_REQUEST['topicName'];
$userId = $_REQUEST['userId'];
//是否精确查询,否则采取模糊匹配
$isExact = (bool) $_REQUEST['isExact'];
$topicDao = new TopicDao();
$getDao = new GetDao();
$messageDao = new MessageDao();
$topicDao = new TopicDao();
$topic = (object) array();
$topic->postTopic = json_decode($topicDao->searchPostTopic($userId, $topicName, $isExact))->resultArray;
$topic->achieveTopic = json_decode($topicDao->searchAchieveTopic($userId, $topicName, $isExact))->resultArray;
foreach ($topic->achieveTopic as $index => $achieve) {
    $achieveId = $achieve->achieveId;
    $achieve->getCount = (int) $getDao->achieveGetCount($achieveId);
    $achieve->mesgCount = (int) $messageDao->achieveMessageCount($achieveId);
}
echo json_encode($topic);
<?php

require '../dao/TopicDao.php';
require '../dao/GetDao.php';
require '../dao/MessageDao.php';
$userId = $_REQUEST['userId'];
$topicDao = new TopicDao();
$topic = (object) array();
$topic->postTopic = json_decode($topicDao->postHotTopic())->resultArray;
$topic->achieveTopic = json_decode($topicDao->achieveSelfTopic($userId))->resultArray;
echo json_encode($topic);