public function __construct($forum) { $this->forum = $forum; $this->specialSortTids = array_keys(Wekit::loadDao('native.dao.PwNativeSpecialSortDao')->getSpecialSortByTopId($forum->fid, 1)); // var_dump($this->specialSortTids);exit; $this->count = count($this->specialSortTids); }
/** * 获取当前dao类的基础DAO类 * * 获取当前dao类的基础DAO类,当baseInstance没有设置时,调用defaultBaseInstance * @throws Exception * @return PwBaseDao */ public function getBaseInstance() { if (!$this->_baseInstance) { if (empty($this->_defaultBaseInstance)) { throw new Exception('This dao is error'); } $this->_baseInstance = Wekit::loadDao($this->_defaultBaseInstance); } return $this->_baseInstance; }
/** * 查看未读系统通知列表,并将已查看的未读消息设为已读 * @access public * @return string <pre> /index.php?m=native&c=notice&type=(reply|system)&page=1&_json=1 type:10 未读通知;0 所有系统消息 response: html </pre> */ public function run() { list($type, $page) = $this->getInput(array('type', 'page')); // $type = 3; if ($type == 'reply') { $typeids = array(10); //回复提醒 $exclude = false; } else { $typeids = array(1, 10); //排除私信提醒、回复提醒 $exclude = true; } $page = intval($page); $page < 1 && ($page = 1); $perpage = 20; list($start, $limit) = Pw::page2limit($page, $perpage); $notice_list = Wekit::loadDao('native.dao.PwNativeMessageNoticesDao')->getNoticesByTypeIds($this->uid, $typeids, $start, $limit, $exclude); $notice_list = $this->_getNoticeService()->formatNoticeList($notice_list); // $noticeList = $this->_getNoticeDs()->getNotices($this->loginUser->uid,$type,$start, $limit); // $noticeList = $this->_getNoticeService()->formatNoticeList($noticeList); // var_dump($noticeList);exit; $typeCounts = $this->_getNoticeService()->countNoticesByType($this->uid); //获取用户通知总数 //类型 $typeid = intval($type); //获取所有NOTICE未读通知数 $unreadCount = $this->_getNoticeDs()->getUnreadNoticeCount($this->uid); // $unread_notice_cnt = Wekit::loadDao('native.dao.PwNativeMessageNoticesDao')->getUnreadCountByTypeIds($this->loginUser->uid,$typeids,$exclude); // $this->_readNoticeList($unreadCount,$noticeList);//将消息设置为已读 $this->_readNoticeList($unreadCount, $notice_list); //将消息设置为已读 var_dump($notice_list, $unreadCount); exit; //count $count = intval($typeCounts[$typeid]['count']); $this->setOutput($page, 'page'); $this->setOutput($perpage, 'perpage'); $this->setOutput($count, 'count'); $this->setOutput(ceil($count / $perpage), 'totalpage'); $this->setOutput(array('type' => $typeid), 'args'); $this->setOutput($typeid, 'typeid'); $this->setOutput($typeCounts, 'typeCounts'); $this->setOutput($noticeList, 'noticeList'); // seo设置 Wind::import('SRV:seo.bo.PwSeoBo'); $seoBo = PwSeoBo::getInstance(); $lang = Wind::getComponent('i18n'); $seoBo->setCustomSeo($lang->getMessage('SEO:mess.notice.run.title'), '', ''); Wekit::setV('seo', $seoBo); }
/** * Enter description here ... * @return PwSpecialSortDao */ protected function _getDao() { return Wekit::loadDao('forum.dao.PwSpecialSortDao'); }
/** * @return WindidUserBlackDao */ protected function _getBlacklistDao() { return Wekit::loadDao('WSRV:user.dao.WindidUserBlackDao'); }
/** * @return App_Account_InfoDao */ private function _loadDao() { return Wekit::loadDao('EXT:account.service.dao.App_Account_TaobaoUserInfoDao'); }
/** * 获得用户禁止DAO * * @return PwUserBanDao */ private function _getDao() { return Wekit::loadDao('user.dao.PwUserBanDao'); }
private function _getDao() { return Wekit::loadDao('native.dao.PwBannerDao'); }
public function weightCron() { $threadsWeightDao = Wekit::loadDao('native.dao.PwThreadsWeightDao'); //执行权重计算逻辑 $current_time = time(); $stop_time = $current_time - 604800; //获取7天前的数据进行计算 $threadsWeightDao->deleteAutoData(); //删除自动生成热帖数据 $threadsWeightDao->deleteUserData($stop_time); //删除推荐的过期热帖数据 // $stop_time = $current_time-1604800;//获取更早前的数据 // echo $stop_time;exit; $nativeThreadsDao = Wekit::loadDao('native.dao.PwNativeThreadsDao'); //从论坛帖子列表获取指定时间内的帖子条数 $res = $nativeThreadsDao->getCountByTime($stop_time); $threads_count = intval($res['count']); $threads_count = $threads_count > 1000 ? 1000 : $threads_count; //权重计算默认只取1000条 $num = 50; //一次处理的记录数 $pages = ceil($threads_count / $num); //计算热帖的自然权重值,并将结果插入权重表 for ($i = 1; $i <= $pages; $i++) { // $starttime_test = time(); $page = $i; $start = ($page - 1) * $num; //开始位置偏移 $res = $nativeThreadsDao->fetchThreadsData($stop_time, $start, $num); $weight_values = array(); if ($res) { foreach ($res as $k => $v) { $weight = $v['like_count'] * 2 + $v['replies'] * 4 + $v['reply_like_count'] + floor(($current_time - $v['lastpost_time']) / 86400) * -4 + floor(($current_time - $v['created_time']) / 86400) * -20; // $res[$k]['weight'] = $weight; $weight_values[] = "({$v['tid']},{$weight},{$current_time},1)"; } $weight_values = implode(',', $weight_values); //将权重计算结果插入权重表,表中已有数据不再重复插入 $threadsWeightDao->insertValues($weight_values); } } //获取权重表中管理员设置的热帖数量 $threads_count = $threadsWeightDao->getUserDataCount(); $threads_count = isset($threads_count['count']) ? intval($threads_count['count']) : 0; $pages = ceil($threads_count / $num); //将管理员设置的热帖进行自然权重计算并更新数据 for ($i = 1; $i <= $pages; $i++) { // $starttime_test = time(); $page = $i; $start = ($page - 1) * $num; //开始位置偏移 $res = $threadsWeightDao->fetchUserThreadsData($start, $num); //获取管理员设置的热帖数据计算权重 $weight_values = array(); if ($res) { foreach ($res as $k => $v) { $weight = $v['like_count'] * 2 + $v['replies'] * 4 + $v['reply_like_count'] + floor(($current_time - $v['lastpost_time']) / 86400) * -4 + floor(($current_time - $v['create_time']) / 86400) * -20; $weight_values[] = "({$v['tid']},{$weight},{$v['create_time']},{$v['create_userid']},'{$v['create_username']}',{$v['isenable']})"; } $weight_values = implode(',', $weight_values); //将权重计算结果覆盖插入权重表,表中已有数据将被覆盖 $threadsWeightDao->replaceValues($weight_values); } } //对推荐不到2小时的数据继续置顶 $max_weight = $threadsWeightDao->getMaxWeight(); $max_weight = isset($max_weight['weight']) ? intval($max_weight['weight']) + 1 : 1; $threadsWeightDao->batchUpdateUserWeight($current_time - 7200, $max_weight); //只保留100条非用户推荐的自然计算数据 $res = $threadsWeightDao->getWeightByPos(99); if ($res) { $weight = $res['weight']; $threadsWeightDao->deleteByWeight($weight); } // echo "SCRIPT EXCUTE FINISHED"; }
/** * @return PwPatchDao */ private function _dao() { return Wekit::loadDao('patch.dao.PwPatchDao'); }
/** * @return PwRemindDao */ protected function _getRemindDao() { return Wekit::loadDao('remind.dao.PwRemindDao'); }
protected function _getDao() { return Wekit::loadDao('forum.dao.PwPostsReplyDao'); }
/** * @return App_Image_Dao */ private function loadDao() { return Wekit::loadDao('EXT:4tschool.service.searches.dao.App_Search_Dao'); }
private function _getLikeRelationsDao() { return Wekit::loadDao('like.dao.PwLikeRelationsDao'); }
private function getApp_NANATools_AdminRole() { return Wekit::loadDao('EXT:nanatools.service.dao.App_NANATools_AdminRoleDao'); }
/** * 获取精华相关DAO对象 * * @return PwThreadsDigestIndexDao */ private function _getDao() { return Wekit::loadDao('SRV:forum.dao.PwThreadsDigestIndexDao'); }
/** * * @return PwThreadAttachDao */ protected function _getDao() { return Wekit::loadDao('attach.dao.PwThreadAttachDao'); }
<?php defined('WEKIT_VERSION') || exit('Forbidden'); Wekit::loadDao('attention.dao.PwAttentionDao'); class PwNativeAttentionDao extends PwAttentionDao { /* 根据uid获取关注的用户数 */ public function getAttentionCount($uid) { if (!$uid) { return 0; } $sql = $this->_bindTable("SELECT count(*) cnt FROM %s WHERE `uid`={$uid}"); $smt = $this->getConnection()->query($sql); $res = $smt->fetch(); return isset($res['cnt']) ? intval($res['cnt']) : 0; } /* 根据uid获取用户的关注列表 */ public function fetchAttentionByUid($uid, $pos = 0, $num = 20) { if (!$uid) { return array(); } $sql = $this->_bindTable("SELECT touid FROM %s WHERE `uid`={$uid} LIMIT {$pos},{$num}"); $smt = $this->getConnection()->query($sql); $res = $smt->fetchAll(); $uids = array(); foreach ($res as $v) { $uids[] = $v['touid']; } return $uids;
private function _getDao() { return Wekit::loadDao('space.dao.PwSpaceDao'); }
/** * Enter description here ... * @return PwMessageNoticesDao */ protected function _getDao() { return Wekit::loadDao('message.dao.PwMessageNoticesDao'); }
private function _getPostPlaceDao() { return Wekit::loadDao('place.dao.PwPostPlaceDao'); }
private function _getDao() { return Wekit::loadDao('design.dao.PwDesignModuleDao'); }
/** * @return App_Verify_Check_Dao */ protected function _getDao() { return Wekit::loadDao('EXT:verify.service.dao.App_Verify_Check_Dao'); }
private function _getDao() { return Wekit::loadDao('design.dao.PwDesignSegmentDao'); }
protected function _getDao() { return Wekit::loadDao('pay.dao.PwOrderDao'); }
/** * * Enter description here ... * @return PwMessageConfigDao */ private function _getMessageConfigDao() { return Wekit::loadDao('message.dao.PwMessageConfigDao'); }
protected function _getDao() { return Wekit::loadDao('site.dao.PwBbsinfoDao'); }
protected function _getThreadHitsDao() { return Wekit::loadDao('forum.dao.PwThreadsHitsDao'); }
protected function _getThreadDao() { return Wekit::loadDao('native.dao.PwNativeThreadExpandDao'); }
private function getWindidUserDao() { // return Wekit::loadDao('WSRV:user.dao.WindidUserDao'); return Wekit::loadDao('EXT:nanatools.service.dao.WindidUserDao'); }