コード例 #1
0
ファイル: PwWeibo.php プロジェクト: fanqimeng/4tweb
 /**
  * 更新一条微博
  *
  * @param object $dm PwWeiboDm
  * @return bool|PwError
  */
 public function updateWeibo(PwWeiboDm $dm)
 {
     if (($result = $dm->beforeUpdate()) !== true) {
         return $result;
     }
     return $this->_getDao()->updateWeibo($dm->weibo_id, $dm->getData(), $dm->getIncreaseData());
 }
コード例 #2
0
ファイル: PwSendWeibo.php プロジェクト: chendong0444/phpwind
 /**
  * 发布一条微博
  *
  * @param object $dm PwWeiboDm
  * @return bool|PwError
  */
 public function send(PwWeiboDm $dm)
 {
     if (($result = $this->check()) instanceof PwError) {
         return $result;
     }
     $dm->setCreatedUser($this->user->uid, $this->user->username);
     $dm->setCreatedTime(Pw::getTime());
     $weibo_id = $this->_getDs()->addWeibo($dm);
     $this->_getFresh()->send($this->user->uid, PwFresh::TYPE_WEIBO, $weibo_id);
     return $weibo_id;
 }
コード例 #3
0
 /**
  * 添加一条微博评论
  *
  * @param object $dm PwWeiboCommnetDm
  * @return bool|PwError
  */
 public function addComment(PwWeiboCommnetDm $dm, PwUserBo $user)
 {
     if (($result = $this->_getDs()->addComment($dm)) instanceof PwError) {
         return $result;
     }
     Wind::import('SRV:weibo.dm.PwWeiboDm');
     $weibo_id = $dm->getField('weibo_id');
     $dm1 = new PwWeiboDm($weibo_id);
     $dm1->addComments(1);
     $this->_getDs()->updateWeibo($dm1);
     PwSimpleHook::getInstance('weibo_addComment')->runDo($result, $dm, $user);
     return $result;
 }
コード例 #4
0
 public function addPost($pid, $tid)
 {
     $url = WindUrlHelper::createUrl('bbs/read/run', array('tid' => $this->info['tid'], 'fid' => $this->info['fid']));
     $lang = Wind::getComponent('i18n');
     $content = $lang->getMessage("BBS:like.like.flesh") . '[url=' . $url . ']' . $this->content . '[/url]';
     Wind::import('SRV:weibo.dm.PwWeiboDm');
     Wind::import('SRV:weibo.srv.PwSendWeibo');
     Wind::import('SRV:weibo.PwWeibo');
     $dm = new PwWeiboDm();
     $dm->setContent($content)->setType(PwWeibo::TYPE_LIKE);
     $sendweibo = new PwSendWeibo($this->userBo);
     $sendweibo->send($dm);
     return true;
 }
コード例 #5
0
 public function execute()
 {
     $this->dm->setCreatedUser($this->user->uid, $this->user->username);
     $this->dm->setCreatedTime(Pw::getTime());
     if (($result = $this->_getHook()->runWithVerified('check', $this->dm)) instanceof PwError) {
         return $result;
     }
     $result = Wekit::load('weibo.srv.PwWeiboService')->addComment($this->dm, $this->user);
     if ($result instanceof PwError) {
         return $result;
     }
     if ($this->isTransmit) {
         Wind::import('SRV:weibo.srv.PwSendWeibo');
         $dm2 = new PwWeiboDm();
         $dm2->setContent($this->dm->getField('content'));
         $dm2->setSrcId($this->dm->getField('weibo_id'));
         $sendweibo = new PwSendWeibo($this->user);
         $this->newId = $sendweibo->send($dm2);
     }
     if (($result = $this->_getHook()->runDo('addWeibo', $this->dm)) instanceof PwError) {
         return $result;
     }
     return true;
 }
コード例 #6
0
 public function sendFreshStat($uid, $content, $type)
 {
     Wind::import('SRV:user.bo.PwUserBo');
     $userBo = new PwUserBo($uid);
     Wind::import('SRV:weibo.dm.PwWeiboDm');
     $dm = new PwWeiboDm();
     $dm->setContent($content);
     Wind::import('SRV:weibo.srv.PwSendWeibo');
     $weiboService = new PwSendWeibo($userBo);
     $result = $weiboService->send($dm);
     if ($result) {
         return $this->buildResponse(0);
     }
     return $this->buildResponse(-1);
 }
コード例 #7
0
ファイル: IndexController.php プロジェクト: fanqimeng/4tweb
 /**
  * 领取勋章
  * 
  */
 public function doAwardAction()
 {
     $logId = (int) $this->getInput('logid', 'post');
     $isfresh = (int) $this->getInput('isfresh', 'post');
     $content = $this->getInput('content', 'post');
     if ($logId < 1) {
         $this->showError('MEDAL:fail');
     }
     $resource = $this->_getMedalService()->awardMedal($logId, $this->loginUser->uid);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     if ($isfresh) {
         Wind::import('SRV:weibo.dm.PwWeiboDm');
         Wind::import('SRV:weibo.srv.PwSendWeibo');
         Wind::import('SRV:weibo.PwWeibo');
         $dm = new PwWeiboDm();
         $dm->setContent($content)->setType(PwWeibo::TYPE_MEDAL);
         $sendweibo = new PwSendWeibo($this->loginUser);
         $sendweibo->send($dm);
     }
     $this->showMessage("MEDAL:award.success");
 }
コード例 #8
0
 private function _updateLikeCount($typeid, $fromid, $count)
 {
     switch ($typeid) {
         case PwLikeContent::THREAD:
             Wind::import('SRV:forum.dm.PwTopicDm');
             $dm = new PwTopicDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('forum.PwThread')->updateThread($dm, PwThread::FETCH_MAIN);
         case PwLikeContent::POST:
             Wind::import('SRV:forum.dm.PwReplyDm');
             $dm = new PwReplyDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('forum.PwThread')->updatePost($dm);
         case PwLikeContent::WEIBO:
             Wind::import('SRV:weibo.dm.PwWeiboDm');
             $dm = new PwWeiboDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('weibo.PwWeibo')->updateWeibo($dm);
         case PwLikeContent::APP:
             Wind::import('SRV:like.dm.PwLikeSourceDm');
             $dm = new PwLikeSourceDm($fromid);
             $dm->setLikeCount($count);
             return Wekit::load('like.PwLikeSource')->updateSource($dm);
     }
 }