Пример #1
0
 public function weixinSetRedirect($request, $response)
 {/*{{{*/
     UserClient::clearSeed();
     $openid = $request->openid;
     $weixUser = DAL::get()->find_by_openid_and_weixintype("WeixUser", $openid, WeixUser::WEIXINTYPE_PATIENT, true);
     $spaceId = $request->spaceId;
     $userId = $weixUser->userId;
     setcookie("WeixUserId", $weixUser->id, time()+3600*24*365*20, "/", "haodf.com");
     if($userId != 0)
     {
         UserClient::getInstance()->login4Weix($weixUser->userId);
         setcookie("WeixUserId", $weixUser->id, time()+3600*24*365*20, "/", "haodf.com");
         $patientSignin = DAL::get()->find_by_ForWeiXinSignin('PatientSignin', $spaceId, 0, $userId);
     }
     else
     {
         $patientSignin = new NullEntity();
     }
     if($patientSignin->isNull())
     {
         if($weixUser->userId != 0)
         {
             $url = $response->router->urlfor('weixin/checkpatient',  array('userid'=>$weixUser->userId, 'spaceid'=>$spaceId, 'patientName'=>$request->patientName, 'disease'=>$request->disease));
         }
         else
         {
             $url = $response->router->urlfor('weixin/reportinfo',  array('wxUserId'=>$weixUser->id, 'spaceid'=>$spaceId));
         }
     }
     else
     {
         $patientId = $patientSignin->patient->id;
         $attachmentIds = $patientSignin->attachmentIds;
         $hasPatientSigninContent = (false == empty($attachmentIds)) || ('' != trim($patientSignin->treatment));
         if($hasPatientSigninContent)
         {
             $url = $response->router->urlfor('weixin/wxflowdetail',  array('patientid'=>$patientId, 'spaceid'=>$spaceId));
         }
         else
         {
             $url = $response->router->urlfor('attach/weixinconfirmattach',  array('patientId'=>$patientId, 'spaceId'=>$spaceId));
         }
     }
     $response->setRedirect($url);
 }/*}}}*/
Пример #2
0
 public function auth($request, $response)
 {/*{{{*/
     UserClient::clearSeed();
     $code = $request->code;
     $openid = WeixApi::getOpenIdByCode($code, WeixUser::WEIXINTYPE_PATIENT);
     $weixUser = DAL::get()->find_by_openid_and_weixintype('WeixUser', $openid, WeixUser::WEIXINTYPE_PATIENT);
     setcookie("WeixUserId", $weixUser->id, time()+3600*24*365*20, "/", "haodf.com");
     $type = $request->type;
     if($weixUser->userId != 0)
     {
         $user = UserClient::getInstance()->login4Weix($weixUser->userId);
     }
     if($type == 1)
     {
         $response->setRedirect("http://" . URL_PREFIX . "m.haodf.com/touch/weixin/beforesignin?openid=$openid");
     }
     else
     {
         $response->setRedirect("http://" . URL_PREFIX . "m.haodf.com/touch/weixin/mydoctor?userid=$weixUser->userId&openid=$openid");
     }
 }/*}}}*/