public static function getInstance()
 {
     if (empty(self::$_instance) || !self::$_instance instanceof MessageQueueClient) {
         $client = new MessageQueueClient();
         if ($client->connect(self::QUEUE_IP, self::QUEUE_PORT)) {
             self::$_instance = $client;
         } else {
             echo 'connect  server error' . "\r\r";
             exit;
         }
     }
     return self::$_instance;
 }
 private function bindPartnerTelOrder($tradeId, $orderId)
 {/*{{{*/
     if(false == empty($tradeId))
     { 
         if(is_numeric($tradeId))
         {
             $partnerTelOrder = DAL::get()->find_by_tradeid("partnertelorder", $tradeId);
             if(false == $partnerTelOrder->isNull())
             {
                 $order = DAL::get()->find('telorder', $orderId, true);
                 PartnerClient::getInstance()->bindPartnerTelOrder($tradeId, $orderId);
                 MessageQueueClient::getInstance()->regEvent(new UploadAttachement($order->patient->id, $tradeId, $orderId), MessageQueueItem::LEVEL2, PartnerTelOrderNotice::MAXTRY);
             }else {
 	          DBC::requireTrue(false, '百度知道订单不存在');
             }
         }else {
 	        DBC::requireTrue(false, '百度知道订单格式不对');
         }
     }
 }/*}}}*/
Example #3
0
	public static function input($type, $id)
	{
		MessageQueueClient::getInstance()->regEvent(new seoInput($type, $id));
	}
Example #4
0
 private function dealSearchIndex()
 {
     if (false == empty($this->searchRelatedList)) {
         //RealTimeSearchClient::getInstance()->batchDealSearchIndexFromUnitOfWork($this->searchRelatedList);
         MessageQueueClient::getInstance()->regEvent4Net(new RealTimeSearchEvent($this->searchRelatedList));
     }
 }
 private function cleanUrlCache($url)
 {/*{{{*/
     MessageQueueClient::getInstance()->regEvent(new Squid($url), MessageQueueItem::LEVEL2);
 }/*}}}*/
 public function ajaxForRecoverAllComment($request, $response)
 {
     /*{{{*/
     DBC::requireTrue($this->inspector->hasAllRightOfComment(), "权限不足");
     $doctor = DAL::get()->find('doctor', $request->doctorId);
     MessageQueueClient::getInstance()->regEvent(new RecoverAll4Doctor($doctor, $this->inspector, "恢复医生所有点评"), MessageQueueItem::LEVEL2, MessageQueueItem::DEFAULT_MAX_RETRY_TIME);
     echo "success";
     return parent::DIRECT_OUTPUT;
 }
    /**
     * upload  
     * 
     * @param mixed $userId 
     * @param mixed $files 
     * @static
     * @access public
     * @return void
     */
    public static function upload($userId, $files)
    {/*{{{*/
        set_time_limit(60);
        $user = DAL::get()->find('user', $userId);
        if($user->isNull())
        {
            $this->setErrorCode(107);
            return 0;
        }
        if (isset($files['content']))
        {
			$file = $files['content'];
            if ($file['error']==0)
            {
                $filePath = TuClient::getInstance()->uploadAttach($file);
                $attachType = self::getType4Attachment($file);
				$attach = AttachClient::getInstance()->addAttach($userId, $file['name'], $filePath, $file['type'], $file['size'], $attachType, '', '');
                if (!$attach || $attach->isNull())
                {
                    return 165;
                }
                //语音amr转mp3
                if(Attachment::isSound($files['content']['type']))
                {
                    MessageQueueClient::getInstance()->regEvent(new VoliceConvertToMp3($attach->id));
                }
                $content['userId'] = $userId;
                $content['attachmentId'] = $attach->id;
                return $content;
            }
            else
            {
                return 165;
            }
        }
        else
        {
            return 164;
        }
    }/*}}}*/