/**
  * 发送回复
  * @param int $tid
  * @param int $uid
  * @param string $title
  * @param string $content
  * return bool
  */
 public function sendPost($tid, $uid, $title, $content)
 {
     list($uid, $tid, $title, $content) = array(intval($uid), intval($tid), trim($title), trim($content));
     if ($uid < 1 || $tid < 1 || !$content) {
         return $this->buildResponse(THREAD_INVALID_PARAMS, "参数错误");
     }
     if ($this->_getOnline()->isOnline($uid) !== true) {
         $this->buildResponse(USER_NOT_LOGIN, "用户没有登录");
     }
     Wind::import('SRV:forum.srv.PwPost');
     Wind::import('SRV:forum.srv.post.PwReplyPost');
     $postAction = new PwReplyPost($tid);
     $pwPost = new PwPost($postAction);
     $info = $pwPost->getInfo();
     $title == 'Re:' . $info['subject'] && ($title = '');
     $postDm = $pwPost->getDm();
     $postDm->setTitle($title)->setContent($content)->setAuthor($uid, $user->username, $user->ip);
     if (($result = $pwPost->execute($postDm)) !== true) {
         $this->buildResponse(-1, $result->getError());
     }
     $postId = $pwPost->getNewId();
     return $this->buildResponse(0, array('pid' => $postId));
 }
Ejemplo n.º 2
0
 /**
  * 发送回复
  * @param int $tid
  * @param int $uid
  * @param string $title
  * @param string $content
  * return bool
  */
 public function sendPost($tid, $uid, $title, $content)
 {
     $userBo = new PwUserBo($uid);
     if (!$userBo->isExists()) {
         return $this->buildResponse(THREAD_USER_NOT_EXIST);
     }
     Wind::import('SRV:forum.srv.PwPost');
     Wind::import('SRV:forum.srv.post.PwReplyPost');
     $postAction = new PwReplyPost($tid);
     $pwPost = new PwPost($postAction);
     $info = $pwPost->getInfo();
     $title == 'Re:' . $info['subject'] && ($title = '');
     $postDm = $pwPost->getDm();
     $postDm->setTitle($title)->setContent($content)->setAuthor($uid, $userBo->username, $userBo->ip);
     if (($result = $pwPost->execute($postDm)) !== true) {
         $this->buildResponse(-1, $result->getError());
     }
     return $this->buildResponse(0, $result);
 }