Example #1
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;
 }
 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;
 }
 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);
 }
Example #4
0
 /**
  * 领取勋章
  * 
  */
 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");
 }