/** * 用户添加关注,同时推送条新鲜事 * * @param $uid 用户 * @param $friendid 关注的对象 * @param $limit 新鲜事数量 */ function addFollow($uid, $friendid, $limit = 20, $from = '') { //fixed global $timestamp; if (!$uid || !$friendid) { return false; } if ($this->isFollow($uid, $friendid)) { return 'user_attention_exists'; } $attentionDB = $this->_getAttentionDB(); $attentionDB->insert(array('uid' => $uid, 'friendid' => $friendid, 'joindate' => $this->_timestamp)); $userServer = L::loadClass('UserService', 'user'); $userServer->updateByIncrement($uid, array(), array('follows' => 1)); $userServer->updateByIncrement($friendid, array(), array('fans' => 1, 'newfans' => 1)); $medalservice = L::loadClass('medalservice', 'medal'); $medalservice->runAutoMedal($friendid, 'fans', 'fans', 1); $friendService = L::loadClass('Friend', 'friend'); if (!$friendService->isFriend($uid, $friendid) || $from == 'addFriend') { $this->addUserWeiboRelationsByFriendid($friendid, $uid, $limit); } /*更新粉丝排行记录*/ L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate('fans'); $elementupdate->setCacheNum(100); $elementupdate->totalFansUpdate($friendid); $elementupdate->updateSQL(); $elementupdate->setCacheNum(20); $elementupdate->todayFansUpdate($friendid); $elementupdate->updateSQL(); return true; }
function afterpost() { global $db_ifpwcache, $timestamp; if ($this->data['ifcheck'] == 1) { if ($this->forum->foruminfo['allowhtm'] && !$this->forum->foruminfo['cms']) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } $lastpost = array('subject' => substrs($this->data['title'], 26), 'author' => $this->data['lastposter'], 'lastpost' => $timestamp, 'tid' => $this->tid, 't_date' => $timestamp); $this->forum->lastinfo('topic', '+', $lastpost); if ($this->forum->isOpen() && !$this->data['anonymous']) { require_once R_P . 'require/functions.php'; if (!$this->extraBehavior) { $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weiboContent = substrs(stripWindCode($weiboService->escapeStr(strip_tags($this->data['content']))), 125); $weiboExtra = array('title' => stripslashes($this->data['title']), 'fid' => $this->forum->fid, 'fname' => $this->forum->name, 'atusers' => $this->data['atusers']); $weiboService->send($this->post->uid, $weiboContent, 'article', $this->tid, $weiboExtra); $threadService = L::loadClass('threads', 'forum'); $threadService->setAtUsers($this->tid, 0, $this->data['atusers']); } //会员资讯缓存 $userCache = L::loadClass('Usercache', 'user'); $userCache->delete($this->data['authorid'], array('article', 'cardtopic')); /* $usercachedata = array(); $usercachedata['subject'] = substrs(stripWindCode($this->data['title']), 100, N); $usercachedata['content'] = substrs(stripWindCode($this->data['content']), 100, N); $usercachedata['postdate'] = $timestamp; if ($this->att) { $usercachedata['attimages'] = $this->att->getImages(4); } $userCache->update($this->data['authorid'], 'topic', $this->tid, $usercachedata); */ } //Start elementupdate require_once D_P . 'data/bbscache/o_config.php'; if ($db_ifpwcache & 128 || $o_browseopen || $db_ifpwcache & 512 && $this->att && $this->att->elementpic) { L::loadClass('elementupdate', '', false); $elementupdate = new ElementUpdate($this->forum->fid); if ($db_ifpwcache & 128) { $elementupdate->newSubjectUpdate($this->tid, $this->forum->fid, $timestamp, $this->data['special']); } if ($db_ifpwcache & 512 && $this->att && $this->att->elementpic && $this->_checkIfHidden()) { $elementupdate->newPicUpdate($this->att->elementpic['aid'], $this->forum->fid, $this->tid, $this->att->elementpic['attachurl'], $this->att->elementpic['ifthumb'], $this->data['content']); } if ($o_browseopen) { $elementupdate->setCacheNum(100); /*设置缓存100个*/ $elementupdate->lastPostUpdate($this->data['authorid'], $this->tid, $timestamp); } $elementupdate->updateSQL(); } require_once R_P . 'require/functions.php'; updateDatanalyse($this->data['authorid'], 'memberThread', 1); //End elementupdate } if ($this->postdata->filter->filter_weight > 1) { $this->postdata->filter->insert($this->tid, 0, implode(',', $this->postdata->filter->filter_word), $this->postdata->filter->filter_weight); } if ($this->data['topped'] > 0) { require_once R_P . 'require/updateforum.php'; setForumsTopped($this->tid, $this->data['fid'], $this->data['topped']); updatetop(); } }