예제 #1
0
	public function addDoctorCommentPost($request, $response)
	{/*{{{*/
		$dcId = $request->commentid;
		$dcpContent = $request->dcpContent;
        $doctorComment = DoctorCommentClient::getInstance()->getDoctorComment($dcId);
		if(mb_strlen($dcpContent, 'gbk') > 500)
		{
			MsgHtml::msg('你发表的内容超过500字限制', $doctorComment->getUrl(), array('delay' => '10', 'button' => 'back'));
		}

        Crumb::ensure(DoctorCommentClient::getInstance()->genCommentCrumbKey(), $request->crumb, self::TTL);
        $user = $this->curUser;
        if ($user->isNull())
        {
            $user = DoctorComment::getGuestUser();
        }

        $gid = UserClient::getInstance()->checkGuest();

        try
        {

            $res = DoctorCommentPostClient::getInstance()->addDoctorCommentPost($doctorComment, $user, $dcpContent, XIpLocation::getIp(), $gid);
        }
        catch(BizException $ex)
        {
            MsgHtml::msg($ex->getMessage(), $doctorComment->doctor->getUrl(), array('delay' => '10', 'button' => 'close'));
        }
        $this->cleanUrlCache($doctorComment->getUrl());
        $this->cleanUrlCache($doctorComment->doctor->getUrl());
    	$response->setRedirect($doctorComment->getUrl()."?from=1"); 
	}/*}}}*/
 public function setRecover($request, $response)
 {
     /*{{{*/
     $ids = $request->ids;
     $postIds = $request->indexs;
     $post = new TrashDoctorCommentPost(reset($postIds));
     $postId = DoctorCommentPostClient::getInstance()->recoverDoctorCommentPost(reset($postIds), $this->inspector);
     S3LogClient::getInstance()->add($this->inspector, $post->getLogable()->action(DoctorCommentPostLog::ACTION_POST_RECOVER));
     $result = $postId;
     $response->id = implode(' ', $ids);
     $response->result = $result;
     $response->actionDesc = "更新/设置点评回帖";
     $response->_my_template = '/default/processmsg';
 }
예제 #3
0
 public function findList()
 {
     if ('' != $this->request->username) {
         $user = DAL::get()->find_by_name('user', $this->request->username);
         if (false == $user->isNull()) {
             $this->request->setRequest('userid', $user->id);
         }
     }
     if ($this->dto->deleted) {
         $this->res = DoctorCommentPostClient::getInstance()->getTrashDoctorCommentPostList($this->request->getRequest('p', 1), 50, $this->getOptions());
     } else {
         $this->res = DoctorCommentPostClient::getInstance()->getDoctorCommentPostList($this->request->getRequest('p', 1), 50, $this->getOptions());
     }
     return $this;
 }