public function understandSubsidyPolicy($request, $response)
 {
     /*{{{*/
     $response->spaceId = $this->space->id;
     $space = $this->space;
     $doc_scene = DAL::get()->find_by_spaceid("weixdoctorqrcodescene", $space->id);
     if (false == $doc_scene->isNull()) {
         $sceneId = $doc_scene->sceneId;
     } else {
         $sceneId = WeixClient::getInstance()->queryMaxSceneId();
         WeixClient::getInstance()->createDoctorScene($sceneId, $space->id);
     }
     $response->crCodeMsg = "";
     $ticket = WeixApi::getTicket($sceneId, WeixUser::WEIXINTYPE_SPACE);
     if (false == empty($ticket)) {
         $url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . urlencode($ticket);
         $response->crCodeMsg = "<p>{$space->name}大夫,扫描如下二维码可以立即关注“好大夫在线医生服务号”并快速绑定</p>\n                <p><img src='{$url}' width='200px' heigh  t='200px'/></p>";
     }
 }
    public function getWeixQrCodeUrl($userId)
    {/*{{{*/
        $space = DAL::get()->find('space', $userId);
        if($space->isNull())
        {
            $this->setErrorCode(144);
            return 0;
        }
        $doc_scene = DAL::get()->find_by_spaceid("weixdoctorqrcodescene", $space->id);
        if(false == $doc_scene->isNull())
        {
            $sceneId = $doc_scene->sceneId;
        }
        else
        {
            $sceneId = WeixClient::getInstance()->queryMaxSceneId(); 
            WeixClient::getInstance()->createDoctorScene($sceneId, $space->id);
        }
        $wenxUrl = '';
        for($count = 0; $count < 3; $count++)
        {
            $wenxUrl =  WeixApi::getQrcodeUrl($sceneId, WeixUser::WEIXINTYPE_PATIENT);
            if ($wenxUrl != '') break;
        }
        $this->content = array('spaceQrCodeUrl' => $wenxUrl);

    }/*}}}*/
 private function noticeWeix($weixMsgDto, $type)
 {/*{{{*/
     if('PatientSignin' == $type)
     {
         WeixClient::getInstance()->processPatientSigninContextEvent($weixMsgDto, $_SERVER);
     }
     else
     {
         WeixClient::getInstance()->processFlowContextEvent($weixMsgDto);
     }
 }/*}}}*/
    public static function getQRCode4PhoneClient($curUser, $nowSpaceUser = '')
    {/*{{{*/
        if(empty($nowSpaceUser))
        {
            $nowSpaceUser = new NullEntity;
        }
        //患者和未登录用户
        if(false == $curUser->hasSpace())
        {
            echo '<script type="text/javascript"  src="http://i1.hdfimg.com/space/js/twodimension.js?20131118"></script>';
        }

        //医生登录
        if($curUser->hasSpace() && false == $nowSpaceUser->isNull() && $curUser->id == $nowSpaceUser->id && false == $curUser->space->hasLoginMobileTerminal() && $curUser->space->isConfirmed())
        {
           //echo '<script type="text/javascript"  src="http://i1.hdfimg.com/space/js/twodimension_doc.js?20131118"></script>';
        }
        //微信医生服务号二维码
        if($curUser->hasSpace() && false == $nowSpaceUser->isNull() && $curUser->id == $nowSpaceUser->id && $curUser->space->isConfirmed())
        {
            $doc_scene = DAL::get()->find_by_spaceid("weixdoctorqrcodescene", $nowSpaceUser->id);
            if(false == $doc_scene->isNull())
            {
                $sceneId = $doc_scene->sceneId;
            }
            else
            {
                $sceneId = WeixClient::getInstance()->queryMaxSceneId(); 
                WeixClient::getInstance()->createDoctorScene($sceneId, $nowSpaceUser->id);
            }
            $ticket = WeixApi::getTicket($sceneId, WeixUser::WEIXINTYPE_SPACE);
            if(false == empty($ticket))
            {
                $codeUrl = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . urlencode($ticket);
                echo '<script type="text/javascript"  src="http://i1.hdfimg.com/space/js/twodimension_wxdoc.js?20141105"></script>';
                echo "<script>loadTwoDimension('{$codeUrl}'); scrollx({id: 'two_dimen'}) </script>";
            }
        }

    }/*}}}*/
Example #5
0
 private function submitReplay($weixUser, $weixDealingProposal, $weixMsgIds)
 {/*{{{*/
     $proposalId = $weixDealingProposal->proposalId; 
     WeixClient::getInstance()->finishDealingProposal($weixUser->id, $proposalId);
     WeixClient::getInstance()->replyFirstProposalAsync($proposalId, $weixUser->id, $weixMsgIds);
 }/*}}}*/
				<li>预约下次复诊时间</li>
				<li>没来及找我看的检查结果,传上来帮你评估,不用再跑门诊</li>
				<li>病情不明白、不理解地方可以告诉我,直接与我沟通</li>
			</ul>
			<h3 class="list_title">报到方法:</h3>
			<div class="clearfix">
				<div class="left_ewm">
					<b>方法一:微信扫描二维码</b>
					<div class="ewm_box">
                    <?php 
$doc_scene = DAL::get()->find_by_spaceid("weixdoctorqrcodescene", $space->id);
if (false == $doc_scene->isNull()) {
    $sceneId = $doc_scene->sceneId;
} else {
    $sceneId = WeixClient::getInstance()->queryMaxSceneId();
    WeixClient::getInstance()->createDoctorScene($sceneId, $space->id);
}
$ticket = WeixApi::getTicket($sceneId, WeixUser::WEIXINTYPE_PATIENT);
?>
                        <img src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=<?php 
echo urlencode($ticket);
?>
" alt="" width="174" height="174">
					</div>
					扫描<?php 
echo $space->name;
?>
医生二维码<br>
					完成“报到”
				</div>
				<div class="right_src">
 public function domobileBindUser($request, $response)
 {/*{{{*/
     if (Captcha::verify($request->key, XIpLocation::getIp(), 'password', $request->mobile, $request->token))
     {
         $newToken = Captcha::generate('password', $request->mobile, ContentFactory::TYPE_NUM, 4, XIpLocation::getIp(), 10);
         $cacher = Cacher::get()->getCache(Cacher::CACHETYPE_CAPTCHA);
         $captchaInfos = $cacher->get($newToken);
         $newKey = strtolower($captchaInfos['question']);
         $bindRes = WeixClient::getInstance()->bindUser($this->weixSpaceUser->id,$request->spaceId, WeixUser::WEIXINTYPE_SPACE); 
         if($bindRes == true )
         {
             $user = UserClient::getInstance()->login4Weix($request->spaceId);
             $res = "success";
             $forward = (empty($forward)) ? $response->router->urlfor('weixindoctor/bindsuccess') : $forward;
         }
         else
         {
             $res = "hasbind";  //该用户已绑定
         }
         $results = array('res' => $res, 'msg' => '');
     }
     else
     {
         $results = array('res' => 'failure', 'msg' => mb_convert_encoding('验证码输入有误', 'UTF-8', 'GBK'), 'next' => '');
     }
     echo json_encode($results);
     return self::DIRECT_OUTPUT;
 }/*}}}*/
 public function createWeixinQrcode4Space($request, $response)
 {
     /*{{{*/
     if ($request->username == '') {
         return;
     }
     $response->username = $request->username;
     $space = DAL::get()->find_by_fld_spaceusername('space', $request->username);
     if ($space->isNull()) {
         $response->msg = "无效的医生用户名!";
         return;
     }
     $doc_scene = DAL::get()->find_by_spaceid("weixdoctorqrcodescene", $space->id);
     if (false == $doc_scene->isNull()) {
         $sceneId = $doc_scene->sceneId;
     } else {
         $sceneId = WeixClient::getInstance()->queryMaxSceneId();
         WeixClient::getInstance()->createDoctorScene($sceneId, $space->id);
     }
     $ticket = WeixApi::getTicket($sceneId, WeixUser::WEIXINTYPE_SPACE);
     $url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . urlencode($ticket);
     $response->msg = "<p>医生姓名:{$space->name}</p>\n            <p>所在医院科室:{$space->host->hospitalfaculty->hospital->name}{$space->host->hospitalfaculty->name}</p>\n            <p>二维码连接:" . $url . "</p>\n            <p><img src='{$url}' /></p>";
 }
    public function successPatientSignin($request, $response)
    {/*{{{*/
        if('patientsigninaftervisit' == $request->from)
        {
            $response->signinType = "复诊报道";
        }
        else
        {
            $response->signinType = "门诊/住院患者报到";
        }

        //二维码
        $response->space = DAL::get()->find('space', $request->spaceId);
        $doc_scene = DAL::get()->find_by_spaceid("weixdoctorqrcodescene", $response->space->id);
        if(false == $doc_scene->isNull())                                           
        {                                                                           
            $sceneId = $doc_scene->sceneId;                                         
        }                                                                           
        else                                                                        
        {                                                                           
            $sceneId = WeixClient::getInstance()->queryMaxSceneId();                
            WeixClient::getInstance()->createDoctorScene($sceneId, $space->id);       
        }                                                                           
        $ticket = WeixApi::getTicket($sceneId, WeixUser::WEIXINTYPE_PATIENT);
        $url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=' . urlencode($ticket);
        $response->url = $response->space->getUrl();
        $response->weixUrl = $url;       
    }/*}}}*/