public function before($context) { parent::before($context); $inspectorId = $context->request->getCookie('inspector'); $inspector = DAL::get()->find('inspector', $inspectorId); $userInfo = $context->request->getCookie('userinfo'); if($inspector->isNull() || $inspector->user->id != $userInfo['id']) { $inspector = DAL::get()->find_by_userid('inspector', $userInfo['id']); $ck = new HdfCookie(); $ck->set4CurrentSession('inspector', $inspector->id); } DBC::requireTrue(false == $inspector->isNull() && $inspector->isActived(), '你没有权限访问'); $context->response->curInspector = $inspector; }
public function ajaxGetNextRecommendThread($request, $response) {/*{{{*/ header('Content-Type: application/json; charset=UTF-8'); //判断是否推送的判断变量 $isCanAutoPull = (false === empty($_COOKIE["userinfo"]["hosttype"]) && 'Doctor' == $_COOKIE["userinfo"]['hosttype']) ; $cookie = new HdfCookie(); $isSuccess = 0; if($isCanAutoPull && (false === isset($_COOKIE['firstlogintime']) || (false == empty($_COOKIE['firstlogintime']) && (XDateTime::hourDiff(XDateTime::valueOf($_COOKIE['firstlogintime']), XDateTime::now()) > 24)))) { $auto = ThreadClient::getInstance()->autoPullRecommendThreads($this->_newUser); if ($auto) { $cookie->set("firstlogintime", XDateTime::now(), 7*24*3600); SpaceExpClient::getInstance()->createSpaceExp($this->_newUser->id, XDateTime::now()); $isSuccess = 1; } } $unUnreadCaseCount = FlowClient::getInstance()->getUnReadCount($this->_newSpace->id); $callback = $request->callback; echo "\n".$callback.'('; echo Json::encode($unUnreadCaseCount); echo ');'; //方便测试 echo "\nisCanAuto:".$isCanAutoPull; echo "\nisSuccess:".$isSuccess; exit; }/*}}}*/
public function ajaxSentNotice($request, $response) {/*{{{*/ try { $hasSend = empty($_COOKIE['sdmsg']) ? false : true; if (false == $hasSend && $this->curUser instanceof User && false == $this->curUser->hasSpace()) { $title = '关于网站账户合并的意见征求'; $content = " 尊敬的用户 <br> 您好! <br> 非常感谢您使用好大夫网站提供的服务,由于在用户注册上一直没有要求手机号唯一,现在网站用户量持续增加,存在大量一手机(或邮箱)关联多账户的情况, 在网站提供服务的过程中用户不能直接使用手机号登录,造成很多不便,也给用户的帐户安全埋下隐患。为此,网站将计划在适当时候,针对一手机号对应多账户的情况进行合并, 即一个用户手机号(或邮箱)只能保留一个账户。 如果您存在多账户的情况,为了您的资料安全,可能需要您提前考虑把其他账户的资料(包含和医生的交流、积分、账户余额等)合并到一个账户里,到时网站将提供账户合并功能帮助您完成用户合并操作。 <span style='color:red;'>我们非常需要了解您的意见,请到“</span><a style='color:blue;' target=‘’_blank href='http://www.haodf.com/suggestion/suggestion'>意见建议</a><span style='color:red;'>”版块发表您的看法并提交给我们。</span> <p style='text-align:right;'>好大夫在线</p> <p style='text-align:right;'>".XDateTime::now()->toShortString()."</p> "; StationLetterClient::getInstance()->sendMsg(Message::AdminUserId, $this->curUser->id, $title, $content, array()); } $cookie = new HdfCookie(); $cookie->set("sdmsg", "1", XDateTime::ONE_DAY_SECOND*30); } catch(Exception $ex) { } header('Content-type: application/x-javascript'); echo $request->callback.'('; echo json_encode(array()); echo ');'; return parent::DIRECT_OUTPUT; }/*}}}*/
private function _afterRecharge($request, $response) {/*{{{*/ //来自流的预充值,跳 if(isset($_COOKIE['rechargeSourceFlow'])) { $ref = DAL::get()->find('DoctorPatientRef', $_COOKIE['rechargeSourceFlow']); $cookie = new HdfCookie(); $cookie->clear('rechargeSourceFlow'); if($ref instanceof DoctorPatientRef) { $response->setRedirect($response->router->urlfor('telpayment/selectchargeorder', array( 'refid' => $ref->id, ))); } } $response->cashAccount = $this->user->getCashAccount(); return 'recharge'; }/*}}}*/
public function showHealthRecordList($request, $response) { $userId = $this->user->id; $patientId = $request->getRequest('patientId', ""); $patientInfos = $this->getHealthApplyPatientList($userId); if(empty($patientId)) { $patientId = isset($_COOKIE["_patientid"])?$_COOKIE["_patientid"]:''; } if(empty($patientId)) { $patientId = $this->getCurrentUserStatus($userId); } DBC::requireFalse(empty($patientId),'该患者没有开通'); $cookie = new HdfCookie(); $cookie->set("_patientid", $patientId); $response->patientId = $patientId; $response->patientInfos = $patientInfos; $patient = DAL::get()->find("patient", $patientId); $response->patient = $patient; $nowPage = $request->getRequest('page', 1); $res = PatientFileClient::getInstance()->getUnWaitRecordListByPatientId($patient->id, $nowPage, 3); $response->pageLink = PageNav::getNavLink( PageNav::getPageNavTemplate("/myhealth/showhealthrecordlist?patientId=".$patient->id."&page="), $res['pageInfo']['nowpage'], $res['pageInfo']['pagesize'], $res['pageInfo']['total']); $response->records = $res['list']; }
/** * @brief * @author lhl * @version branches/v2.14.23 * @date 2013-07-25 */ private function modifyScore($ref) { /*{{{*/ ScoreClient::getInstance()->replyForFlow($this->user, $ref); //判断是否是患者回复,如果是患者回复则设 cookie,为了在detail页面上做判断 if ($ref->user->id == $this->user->id) { $cookie = new HdfCookie(); $cookie->set('replyCase', 1, 600); } }
private function cleanCookie() { /*{{{*/ $cookie = new HdfCookie(self::COOKIE_DOMAIN); $cookie->clear("operator"); }
private function doDetailCookie($response) {/*{{{*/ if(isset($_COOKIE['replyCase']) && $_COOKIE['replyCase'] == 1) { $response->patientReply =1; $cookie = new HdfCookie(); $cookie->clear('replyCase'); } }/*}}}*/
public function ajaxGetNextRecommendThread($request, $response) { /*{{{*/ $response->setHeader('Content-Type: application/json; charset=UTF-8'); $this->getLogger(); $canRecommend = $this->canRecommend(); $this->log->addDebug('canRecommend:' . (int) $canRecommend); if ($canRecommend) { $proposalIds = ProposalClient::getInstance()->autoPullRecommends($this->space); $this->log->addDebug('autoPullRecommends:', $proposalIds); if (false == empty($proposalIds)) { $cookie = new HdfCookie(); $cookie->set('firstlogintime', XDateTime::now(), 7 * 24 * 3600); $this->log->addDebug('firstlogintime:' . XDateTime::now() . '7*24*3600'); SpaceExpClient::getInstance()->createSpaceExp($this->user->id, XDateTime::now()); } } $unReadCount = FlowClient::getInstance()->getUnReadCount($this->space->id); echo "\n" . $request->callback . '(' . Json::encode($unReadCount) . ');'; return parent::DIRECT_OUTPUT; }
public function clearDebugContextCookie() { /*{{{*/ $cookie = new HdfCookie(); $cookie->clear('debugcontextkey'); return $this; }
private function initialize($request, $response) {/*{{{*/ $key = $this->key = $request->key; $response->urlDiseaseKey = $request->key; $this->nowPage = $request->getRequest('p', 1); if (empty($key)) { $this->_exit404(); } $this->province = $request->province; $allArea = Area::provInfo(); unset($allArea['q']);//不要“其它”省份 $this->provinceList = $allArea; if (isset($this->provinceList[$this->province])){ $this->provinceName = $this->provinceList[$this->province]['Province']; } $this->disease = DiseaseClient::getInstance()->getByDiseaseKey($key); if($this->disease == null || $this->disease->isNull()){ $this->_exit404(); } $this->diseaseParent = new NullEntity(); if(empty($this->disease->parentKey) == false){ $this->diseaseParent = DiseaseClient::getInstance()->getByDiseaseKey($this->disease->parentKey); } $this->modules = $this->getModule($key); $diseasePage = DiseasePage::getByDiseaseId($this->disease->id); $res = $diseasePage->getPaperAndZhuantiList4ZhuantiPage($page=0, $pageSize=10, $options=array('queryType' => self::ZHUANTI_QUERYTYPE_LABLE, 'diseaseId' => $this->disease->id)); $response->id2Types = $res['id2Types']; $response->key = $this->key; $response->province = $this->province; $response->provinceList = $this->provinceList; $response->modules = $this->modules; $response->disease = $this->disease; $response->diseaseName = $this->disease->name; $response->isecho = HdfCookie::echoChangeCity(); }/*}}}*/
private function clearCookieForReply() { /*{{{*/ //当患者回复时弹出积分图片,由于图片只弹出一次所以得把cookie清掉 $cookieReply = isset($_COOKIE['replyCase']) ? $_COOKIE['replyCase'] : ''; if ($cookieReply && $cookieReply == 1) { $cookie = new HdfCookie(); $cookie->clear('replyCase'); } }
public function checkGuestId() { if (!isset($_COOKIE["g"]) || !$_COOKIE["g"]) { $GuestId = $this->generateGuestId(); $cookie = new HdfCookie(); $cookie->set("g", $GuestId, 630720000); //20 years $_COOKIE['g'] = $GuestId; } $this->GuestId = $_COOKIE['g']; return true; }