示例#1
0
文件: service.php 项目: vazahat/dudex
 public function __construct()
 {
     $this->questionDao = EQUESTIONS_BOL_QuestionDao::getInstance();
     $this->answerDao = EQUESTIONS_BOL_AnswerDao::getInstance();
     $this->optionDao = EQUESTIONS_BOL_OptionDao::getInstance();
     $this->followDao = EQUESTIONS_BOL_FollowDao::getInstance();
 }
示例#2
0
文件: upgrade.php 项目: vazahat/dudex
 private function copyData()
 {
     $tables = array(array(QUESTIONS_BOL_QuestionDao::getInstance()->getTableName(), EQUESTIONS_BOL_QuestionDao::getInstance()->getTableName(), array('id', 'userId', 'text', 'settings', 'timeStamp')), array(QUESTIONS_BOL_OptionDao::getInstance()->getTableName(), EQUESTIONS_BOL_OptionDao::getInstance()->getTableName(), array('id', 'userId', 'questionId', 'text', 'timeStamp')), array(QUESTIONS_BOL_AnswerDao::getInstance()->getTableName(), EQUESTIONS_BOL_AnswerDao::getInstance()->getTableName(), array('id', 'userId', 'optionId', 'timeStamp')), array(QUESTIONS_BOL_FollowDao::getInstance()->getTableName(), EQUESTIONS_BOL_FollowDao::getInstance()->getTableName(), array('id', 'userId', 'questionId', 'timeStamp')), array(QUESTIONS_BOL_ActivityDao::getInstance()->getTableName(), EQUESTIONS_BOL_ActivityDao::getInstance()->getTableName(), array('id', 'questionId', 'activityType', 'activityId', 'userId', 'timeStamp', 'privacy', 'data')));
     foreach ($tables as $t) {
         OW::getDbo()->query('REPLACE INTO ' . $t[1] . ' (`' . implode('` ,`', $t[2]) . '`) SELECT `' . implode('` ,`', $t[2]) . '` FROM ' . $t[0]);
     }
 }
示例#3
0
 public function findMyFeedCount($startStamp, $userId)
 {
     $activityDao = EQUESTIONS_BOL_ActivityDao::getInstance();
     $followDao = EQUESTIONS_BOL_FollowDao::getInstance();
     $query = "SELECT COUNT(DISTINCT q.id) FROM " . $this->getTableName() . " q\n            INNER JOIN " . $activityDao->getTableName() . " a ON q.id=a.questionId\n            LEFT JOIN " . $followDao->getTableName() . " f ON q.id=f.questionId\n            WHERE a.privacy!=:pn AND a.timeStamp <= :ss\n                AND f.userId=:u\n                OR a.userId=:u";
     return $this->dbo->queryForColumn($query, array('ss' => $startStamp, 'u' => $userId, 'pn' => EQUESTIONS_BOL_FeedService::PRIVACY_NOBODY));
 }