public function newPost($request, $response) { /*{{{*/ $verifyOk = Captcha::verify($request->verifyStr, XIpLocation::getIp(), 'article', $request->article_id, $request->token); DBC::requireTrue($verifyOk, "您输入的验证码有误!"); //禁用词检查 $title = $request->title; $result = DoctorClient::getInstance()->getProfanityCheck($title); DBC::requireFalse($result['CODE'] < 0, "文章 评论添加失败"); DBC::requireFalse($result['CODE'] == 2, "文章 评论添加成功"); $title = $result['CONTENT']; $content = htmlspecialchars($request->getRequest('content'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1'); $result = DoctorClient::getInstance()->getProfanityCheck($content); DBC::requireFalse($result['CODE'] < 0, "文章 评论添加失败"); DBC::requireFalse($result['CODE'] == 2, "文章 评论添加成功"); $content = $result['CONTENT']; $article = DAL::get()->find('article', $request->article_id); $feilds = array(); $feilds['ip'] = XIpLocation::getIp(); $feilds['ipLocation'] = XIpLocation::getLocationArea(); $userId = $this->user->isNull() == false ? $this->user->id : ''; $comment = ArticleClient::getInstance()->addComment($article, $userId, $title, $content, $feilds); squid::clean($article->getUrl(), true); $this->message('您发表的评论已经提交,待网站审核通过后即可展示。', $response); }
public function newArticleComment($articleId, $content, $userId) {/*{{{*/ $article = DAL::get()->find('article', $articleId); if ($article->isDelete() || $article->isNull()) { $this->setErrorCode(308); return 0; } if(1 > strlen(trim($content))) { $this->setErrorCode(310); return 0; } $userId = 0 == $userId ? '' : $userId; $title = ''; $feilds = array(); $feilds['ip'] = XIpLocation::getIp(); $feilds['ipLocation'] = XIpLocation::getLocationArea(); $comment = ArticleClient::getInstance()->addComment($article, $userId, $title, $content, $feilds); $info['successContent'] = ''; squid::clean($article->getUrl(), true); if(false == empty($comment)) { $info['successContent'] = '评论已提交,待审核通过后即可展示'; } $this->content = $info; }/*}}}*/
public static function getLocation($ip=null) { if (!self::$iplocation) { $filename = realpath(dirname(__FILE__)) . "/ip/wry.dat"; self::$iplocation = new qqwry($filename); } if ($ip === null) $ip = self::getIp(); $result = array(); list($result['country'], $result['area'])=self::$iplocation->q($ip); return ($result) ? $result : array('country'=>'δ֪µØÇø', 'area'=>''); }
public function newPost($request, $response){ $verifyStr = $request->verifystr; $verifyOk = Captcha::verify($verifyStr, XIpLocation::getIp(), 'article', $request->article_id, $request->token); if($verifyOk == false) { $this->message('您输入的验证码有误!', $response); return false; } //禁用词检查 $title = $request->title; $result = DoctorClient::getInstance()->getProfanityCheck($request->title); if ($result['CODE'] < 0) { $this->message('文章 评论添加失败', $response); return false; } if ($result['CODE'] == 2) { //提示发表成功,但是数据没有入库 $this->message('文章 评论添加成功', $response); return true; } $title = $result['CONTENT']; $content = htmlspecialchars($request->getRequest('content'), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1'); $result = DoctorClient::getInstance()->getProfanityCheck($content); if ($result['CODE'] < 0) { $this->message('文章 评论添加失败', $response); return false; } if ($result['CODE'] == 2) { //提示发表成功,但是数据没有入库 $this->message('文章 评论添加成功', $response); return true; } $content = $result['CONTENT']; $article = DAL::get()->find('article', $request->article_id); $feilds = array(); $feilds['ip'] = XIpLocation::getIp(); $feilds['ipLocation'] = XIpLocation::getLocationArea(); $userId = ($this->_newUser->isNull() == false) ? $this->_newUser->id : ''; $comment = ArticleClient::getInstance()->addComment($article, $userId, $title, $content, $feilds); squid::clean($article->getUrl(), true); $this->message('您发表的评论已经提交,待网站审核通过后即可展示。', $response); }
public function ajaxCheckSum($request, $response) {/*{{{*/ $verifyOk = Captcha::verify($request->door, XIpLocation::getIp(), 'suggestion', $request->userid, $request->token); echo $verifyOk ? 0 : 1; exit; }/*}}}*/
public function checkSourceIPValid() { /*{{{*/ $qpayServIPS = array('61.152.114.140', '61.152.114.141', '61.152.114.142'); $remoteIP = XIpLocation::getIp(); //todo in_array if (XIpLocation::isIpAddress($remoteIP) && array_search($remoteIP, $qpayServIPS) !== false) { return true; } return false; }
public function createIndexSearchLogs($request, $response) { /*{{{*/ $gcookie = $_COOKIE["g"]; $entrance = $request->entrance; $hospitalName = $request->hospitalName; $diseaseName = $request->diseaseName; $doctorName = $request->doctorName; $province = $request->province; $area = Area::provInfoAll(); $province = $area[$province]['Province']; if ($hospitalName == '-输入医院名称-') { $hospitalName = ''; } if ($province == '-请选择医院省份-') { $province = ''; } $location = XIpLocation::getLocation(); $ipInfo = XIpLocation::getIp() . ' ' . $location['area'] . ' ' . $location['country']; PaymentClient::getInstance()->createIndexLog($hospitalName, $diseaseName, $doctorName, $province, $ipInfo, $gcookie, $entrance); return parent::DIRECT_OUTPUT; }
/** 患友会投诉**/ public function ajaxComplaint($request, $response) { /*{{{*/ if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') || strpos($_SERVER['HTTP_USER_AGENT'], 'Baiduspider')) { return false; } $topicUrl = $request->topicUrl; $messageId = $request->messageId; $floor = $request->floor; $isAjax = $request->isAjax; $adviceContent = trim($request->adviceContent); $complaintType = trim($request->complaintType); if ($isAjax) { $complaintType = mb_convert_encoding($complaintType, 'gbk', 'utf-8'); $adviceContent = mb_convert_encoding($adviceContent, 'gbk', 'utf-8'); } $content = ""; $content .= "来自 " . XIpLocation::getLocationArea() . '[' . XIpLocation::getIp() . "] 的用户发送了一条患友会投诉, 内容如下:\n"; $content .= "类型:" . $complaintType . "\n"; $content .= "投诉内容:" . $adviceContent . "\n"; $content .= "所提交的话题:<a href='" . $topicUrl . "' target='_blank'>点击查看</a>\n"; $content .= "所提交的回复ID:" . $messageId . "\n"; $content .= "所在楼:" . $floor . "楼\n"; $content .= "所提交的空间: <a href=\"http://" . URL_PREFIX . $this->space->userName . ".haodf.com\" target=\"_blank\">" . $this->space->host->name . "</a>\n"; $content .= "----------------------------------------------------------------------------\n"; $content .= "提交人:" . $this->user->name . "(" . $this->user->id . ")\n"; $content .= "发送时间: " . date("Y-m-d H:i") . "\n"; $content .= "----------------------------------------------------------------------------\n"; $content .= "用户端信息: \n" . $_SERVER['HTTP_USER_AGENT']; UserClient::getInstance()->addUserAdvice('评论投诉', $content, $this->user->id); return parent::DIRECT_OUTPUT; }
private function getQpayForm4FollowupOrder(FollowupOrder $order, $bankid) { //dodo::zhb 创建充值单 $depositeOrder = OrderClient::getInstance()->createDepositeOrder($this->user, $order->price, DepositeOrder::RECHARGE_TYPE_QPAY, array($order)); //设置订单信息提交给快钱 $orders = array(); $orders['orderId'] = $depositeOrder->id; $orders['productName'] = strip_tags($order->product->title); if($bankid == '00') { $orders['bankId'] = ''; $orders['bankType'] = '00'; }else{ $orders['bankId'] = $bankid; $orders['payType'] = 10; } $orders['orderTimestamp'] = Qpay::getInstance()->getQpayOrderTimestamp(); $orders['payerIP'] = XIpLocation::getIp(); //dodo::zhb 快钱回调url $orders['bgUrl'] = BeanFinder::get('configs')->qpay_callback_url;//$this->getQpayAccessUrl().'/400/pay/followupqpayreceive'; $orders['pageUrl'] = BeanFinder::get('configs')->qpay_callback_returnurl; $orders['orderAmount'] = $order->price; $qpay = new Qpay(); $qpay->setOrderInfo($orders, Pay::TYPE_FOLLOWUPORDER); $form = $qpay->getSubmitForm(); return $form; }
/** * @brief 举报 ajax提交 * @author lhl * @version branches/v2.14.23 * @date 2013-07-25 */ public function ajaxComplaint($request, $response) { /*{{{*/ if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') || strpos($_SERVER['HTTP_USER_AGENT'], 'Baiduspider')) { return false; } $flowId = $request->flowId; $refId = $request->refId; $ref = DAL::get()->find('DoctorPatientRef', $refId); $refUrl = $ref->getUrl(); $isAjax = $request->isAjax; if ($isAjax) { $complaintType = mb_convert_encoding(trim($request->complaintType), 'gbk', 'utf-8'); $adviceContent = mb_convert_encoding(trim($request->adviceContent), 'gbk', 'utf-8'); } else { $adviceContent = trim($request->adviceContent); $complaintType = trim($request->complaintType); } $content = ""; $content .= "来自 " . XIpLocation::getLocationArea() . '[' . XIpLocation::getIp() . "] 的用户发送了一条流页面<font color='red'>" . ($this->user->id == $this->space->id ? "医生" : "患者") . "投诉</font>, 内容如下:\n"; $content .= "类型:" . $complaintType . "\n"; $content .= "投诉内容:" . $adviceContent . "\n"; $content .= "所提交的流:<a href='" . $refUrl . "' target='_blank'>点击查看</a>\n"; $content .= "所提交的post ID:" . $flowId . "\n"; $content .= "所提交的空间: <a href=\"http://" . URL_PREFIX . $this->space->userName . ".haodf.com\" target=\"_blank\">" . $this->space->host->name . "</a>\n"; $content .= "----------------------------------------------------------------------------\n"; $content .= "提交人:" . $this->user->name . "(" . $this->user->id . ")\n"; $content .= "发送时间: " . date("Y-m-d H:i") . "\n"; $content .= "----------------------------------------------------------------------------\n"; $content .= "用户端信息: \n" . $_SERVER['HTTP_USER_AGENT']; $userAdviceId = UserClient::getInstance()->addUserAdvice('评论投诉', $content, $this->user->id); if ($userAdviceId) { die("true"); } die("false"); }
/** * ajaxChangeCaptcha 更换验证码 * * @param mixed $request * @param mixed $response * @access public * @return void */ public function ajaxChangeCaptcha($request,$response) {/*{{{*/ $tokenInfo = Captcha::generateByDefaultKey('resetpwd', ContentFactory::TYPE_CHAR, 4, XIpLocation::getIp(), 3); echo json_encode($tokenInfo); return Parent::DIRECT_OUTPUT; }/*}}}*/
public function showDetail($request, $response) {/*{{{*/ $id = $request->id; $id = (int)Codec::getInstance()->decodeId($id); if(empty($id)) { throw new BizException('医生信息不存在.'); exit(); } $doctor = DAL::get()->find('doctor', $id); if($doctor == null || $doctor->isNull() || $doctor->hospitalfaculty instanceof NullEntity) { throw new BizException('医生信息不存在.'); exit(); } $this->skipHospitals($doctor->hospitalfaculty->hospital->id, $response); $this->skipDoctors($doctor->id, $response); $response->doctor = $doctor; $scheduleTable = array(); $scheduleTables1 = DoctorClient::getInstance()->getFormatScheduleList($doctor->id); if($doctor->id != $doctor->primaryId) { $scheduleTables = DoctorClient::getInstance()->getFormatScheduleList($doctor->primaryId); $tmpInfos1 = $scheduleTables1[$doctor->id]; $tmpInfos2 = $scheduleTables[$doctor->primaryId]; foreach($tmpInfos1 as $i=>$infos) { if(empty($infos) || false==is_array($infos)) continue; $items = array(); foreach($infos as $j=>$info) { $items[$j] = (false == empty($tmpInfos1[$i][$j])) ? $tmpInfos1[$i][$j] : ""; } $scheduleTable[$i] = $items; } } else { $scheduleTable = $scheduleTables1[$doctor->id]; } $options['doctor'] = $doctor->primaryId; $pageInfo['pageSize'] = 10; $commentList = DoctorCommentClient::getInstance()->getCommentList($options, $pageInfo); $commentList = $commentList['commentList']; $diseaseAry = DiseaseClient::getInstance()->getDiseaseDoctorList(array($doctor->primaryId), 50); $diseaseIds = array(); foreach ($diseaseAry as $diseaseDorctor) { $diseaseIds[$diseaseDorctor->fld_diseaseid]['id'] = $diseaseDorctor->fld_diseaseid; $diseaseIds[$diseaseDorctor->fld_diseaseid]['name'] = $diseaseDorctor->disease->name; $diseaseIds[$diseaseDorctor->fld_diseaseid]['key'] = $diseaseDorctor->disease->key; } $sameDiseaseDoctorList = array(); if(empty($diseaseIds) == false) { $sameDiseaseDoctorList = DoctorClient::getInstance()->getSameProfessionalDoctors($doctor->primaryId, array_keys($diseaseIds), $limit=4); } $articleList = array(); $spaceCaseList = array(); if($doctor->hasSpace() && $doctor->space->isOpened()) { $articleList = ArticleClient::getInstance()->getTitleListBySpace($doctor->space->id, 3); $spaceCaseList = DAL::get()->find_all_lastpost_by_space('doctorpatientref', $doctor->space, 10); } $response->articleList = $articleList; $response->spaceCaseList = $spaceCaseList; $response->hospitalfaculty = $doctor->hospitalfaculty; $response->hospital = $doctor->hospitalfaculty->hospital; $response->faculty = $doctor->hospitalfaculty->faculty; $response->scheduleTable = $scheduleTable ; $response->commentList = $commentList ; $response->diseaseAry = $diseaseAry; $response->diseaseIds = $diseaseIds; $response->VOTE_DISPLAY_LIMIT = 4; $response->sameDiseaseDoctorList = $sameDiseaseDoctorList; if($doctor->space->isNull()) { $spaceAskedThreadsCount = $spaceAskedFlowsCount = $spaceRepliedThreadsCount = $spaceRepliedFlowsCount; } else { $spaceAskedThreadsCount = SpaceClient::getInstance()->getCountOfAskedThreadsCount($doctor->space->id, $this->_newUser->id); $spaceAskedFlowsCount = SpaceClient::getInstance()->getCountOfAskedFlowsCount($doctor->space->id, $this->_newUser->id); $spaceRepliedThreadsCount = SpaceClient::getInstance()->getCountOfRepliedThreadsCount($doctor->space->id, $this->_newUser->id); $spaceRepliedFlowsCount = SpaceClient::getInstance()->getCountOfRepliedFlowsCount($doctor->space->id, $this->_newUser->id); } $response->spaceAskedCount = $spaceAskedThreadsCount + $spaceAskedFlowsCount; $response->spaceRepliedCount = $spaceRepliedThreadsCount + $spaceRepliedFlowsCount; $response->crumb = Crumb::create(DoctorCommentClient::getInstance()->genCommentCrumbKey(), self::TTL); $space = $doctor->space; $response->space = $space; $commonCaseNote = $doctor->getCommonCaseNote4Display(); $response->commonCaseNote = $commonCaseNote; $response->successOrderCount = count(DAL::get()->find_id_finishStatus_and_maybeSuccessCallBackStatus('BookingOrder', $space)); $bookingCondition = $space->getSpaceBusinessRequirement4Booking()->disease; $response->bookingCondition = empty($bookingCondition) ? '不限' : $bookingCondition; $response->token = Captcha::generate('comment', $doctor->id, ContentFactory::TYPE_ARITHMATIC, 4, XIpLocation::getIp(), 3); }/*}}}*/
<?php require_once dirname(__FILE__).'/../init.php'; $request = new Request(); $hospitalFacultyId = Codec::getInstance()->decodeId($request->getRequest('id')); $hospitalFaculty = DAL::get()->find('HospitalFaculty', $hospitalFacultyId); $user = UserClient::getInstance()->getCurrentUser(); $token = Captcha::generate('dcapply', $user->id, ContentFactory::TYPE_CHAR, 4, XIpLocation::getIp(), 3); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>添加医生信息基本信息</title> <link href="http://i1.hdfimg.com/css/css.css?1303386395" rel="stylesheet" type="text/css" /> <link href="http://i1.hdfimg.com/css/frame.css?20131224" rel="stylesheet" type="text/css" /> <link href="http://i1.hdfimg.com/css/inside.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="http://i1.hdfimg.com/space/js/calendar.css" /> <script type="text/javascript" language="javascript" src="http://i1.hdfimg.com/space/js/tools.js?1366769791"></script> <script type="text/javascript" src="http://i1.hdfimg.com/space/js/calendar.js"></script> <script type="text/javascript" src="http://i1.hdfimg.com/space/js/calendar-zh.js"></script> <script type="text/javascript" src="http://i1.hdfimg.com/space/js/calendar-setup.js"></script> <style type="text/css"> .table_green { border-collapse: collapse; } .table_green td { padding: 5px; border: 1px #B6E4A7 solid; } </style> <link href="http://i1.hdfimg.com/nav/nav.css?1303460346" rel="stylesheet" type="text/css"/>
public function sendDocotrAppDownSMS($request, $response) {/*{{{*/ $mobile = $request->mobile; if(false == XString::isMobileNew($mobile)) { $result = '{"code":"error_mobile"}'; } else if(Captcha::verify($request->door, XIpLocation::getIp(), $request->kind, 0, $request->token) == false) { $result = '{"code":"error_door"}'; } else { $content = "全新的医生专用版客户端下载地址:http://m.haodf.com/sd ,建议在Wi-Fi环境下下载。如您在使用过程中遇到问题,请与医生助理联系010-56707226"; SMSClient::getInstance()->sendSMSNoSignature(array($mobile) , $content); $result = '{"code":"success"}'; } $callback = $request->callback; if ($callback) { $result = $callback.'('.$result.');'; header('Content-Type: text/javascript;'); } else { header('Content-Type: application/json;'); } header("Content-Type: text/html; charset=GBK"); echo $result; return parent::DIRECT_OUTPUT; }/*}}}*/
private function _getCommentParams($userId, $doctorId, $tag, $effect, $attitude, $comment, $type, $name, $phone, $treatment, $os, $deviceId, $deviceType) {/*{{{*/ $params = array(); $params['skill'] = $effect; $params['attitude'] = $attitude; $params['tag'] = $tag; $params['content'] = $comment; $params['type'] = $type; //点评类型 0=投票,1=感谢信 3=就医经验 $params['ip'] = XIpLocation::getIp(); $params['gid'] = md5($deviceId); //设备号唯一识别发点评设备 但是部分机型设备号包含特殊字符,对所有设备号做md5处理 $params['userRealName'] = $name; $params['userMobile'] = $phone; $params['remedy'] = $treatment; return $params; }/*}}}*/
public function pay($request, $response) {/*{{{*/ $this->validLogin(); $user = $this->_newUser; $onlinePayType = $request->onlinePayType; $order = DAL::get()->find('TelOrder', $request->sId); if (false == $order->isNull() && $order->isPayed()) { $response->setRedirect($response->router->urlfor('payment/paymessage', array('orderId'=>$order->id))); return ; } DBC::requireTrue($user->id == $order->getUser()->id, '请患者重新登陆,或者重新下单!'); $ownerDoctor = $order->getExecuterBySpace()->host; $hospitalfaculty = $ownerDoctor->hospitalfaculty; $hospital = $hospitalfaculty->hospital; $description = $hospital->name.$hospitalfaculty->name.$ownerDoctor->name; $buyerCashAccount = $order->owner->relatedObject->getCashAccount(); $balance = 0; if($buyerCashAccount != null && $buyerCashAccount->isNull() == false) { $balance = $order->owner->relatedObject->getCashAccount()->amount; } $amount = number_format($order->getAmount()-$balance, 2, '.', ''); TelOrderClient::getInstance()->updatePayType($order->id, $onlinePayType); //dodo::zhb 创建充值单 $depositeOrder = OrderClient::getInstance()->createDepositeOrder($user, $user->getCashAccount(), $amount, $onlinePayType == 'alipay'?DepositeOrder::RECHARGE_TYPE_ALIPAY:DepositeOrder::RECHARGE_TYPE_QPAY, $order->id, get_class($order)); if($onlinePayType == 'alipay') { //创建支付url $callBackUrl = BeanFinder::get('configs')->alipay_callback_url; $frontUrl = BeanFinder::get('configs')->alipay_callback_returnurl; $payUrl = Alipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $amount, $callBackUrl, TelService::$serviceType[TelService::APPOINTMENT_SERVICE], $description, $frontUrl); header("Location: $payUrl"); exit(); } else { $orders = array(); $orders['orderId'] = $depositeOrder->id; $orders['productName'] = TelService::$serviceType[TelService::APPOINTMENT_SERVICE]; if($onlinePayType == '00') { $orders['bankId'] = ''; $orders['bankType'] = '00'; }else{ $orders['bankId'] = $onlinePayType; $orders['payType'] = 10; } $orders['orderTimestamp'] = Qpay::getInstance()->getQpayOrderTimestamp(); $orders['payerIP'] = XIpLocation::getIp(); $orders['bgUrl'] = BeanFinder::get('configs')->qpay_callback_url; $orders['orderAmount'] = $amount; $qpay = new Qpay(); $qpay->setOrderInfo($orders, Pay::TYPE_PAY); $form = $qpay->getSubmitForm(); $response->form = $form; } }/*}}}*/
private function doRegister($request, $response) {/*{{{*/ $result = array('err' => array(), 'user' => new NullEntity()); $name = mb_strtolower($request->username, 'GB2312'); $pass1 = $request->password; $pass2 = $request->password2; $phone = $request->phone; $mobile = $request->mobile; $email = $request->email; $city = $request->city; $question = $request->pwdQ; $answer = $request->pwdA; $isDoctor = $request->is_doctor; $patientCardNO = $request->patientCardNO; $verifyOk = Captcha::verify($request->verifyStr, XIpLocation::getIp(), 'login', $request->captchaId, $request->token); //username $utf8name = mb_convert_encoding($name, 'utf8', 'gbk'); $result['err'] = $this->checkUsername(self::ERROR_RESULT_ARRAY, $name, $utf8name); //verifycode if($verifyOk == false) { $result['err'][] = "验证码错误"; } //password if (!preg_match("/^[0-9a-zA-Z]{4,16}$/", $pass1)) $result['err'][] = "密码格式错误, 只能为4-16位数字或字母"; if ($pass1 != $pass2) $result['err'][] = "密码校验错误"; //others if ($phone && false == XString::isPhone($phone)) { $result['err'][] = "电话格式错误"; } if ($mobile && false == XString::isMobile($mobile)) { $result['err'][] = "您填写的手机号码不合要求,请修改后重新提交";} if ($email && false == XString::isEmail($email)) { $result['err'][] = "邮件格式错误"; } //patient card if(empty($patientCardNO) == false && $this->checkPatientCardNO($patientCardNO) == false) { $result['err'][] = "您输入的随访码不正确,请核对医生发放的随访码"; } if (false == empty($result['err'])) { return $result; } $data = array( 'realName' => '', 'sex' => 1, 'phone' => $phone, 'mobile' => $mobile, 'email' => $email, 'birthday' => '0', 'idcard' => '', 'province' => '', 'city' => $city, 'district' => '', 'question' => $question, 'answer' => $answer, 'ip' => UserClient::getInstance()->getIp(), ); if (!$data['email']) unset($data['email']); if (!$data['mobile']) unset($data['mobile']); $user = UserClient::getInstance()->register($name, $pass1, $data); if ($user->isNull()) { $result['err'][] = "请稍后重新注册"; } else { $result['user'] = $user; } return $result; }/*}}}*/
public static function getIpArea($ip = null) { $location = XIpLocation::getLocation($ip); return self::getProvinceByCountry($location['country']); }
public function ajaxUploadFailed($request, $response) {/*{{{*/ $failedFiles = $request->files; $location = $request->location; $postUrl = urldecode($request->posturl); $userId = UserClient::getInstance()->getSeed('id'); $userName = UserClient::getInstance()->getSeed('name'); $title = "\n------------------------------------------------------\n".XDateTime::now()." $userId $userName $location $postUrl"; $title .= "\n ".$_SERVER['HTTP_USER_AGENT']." ".XIpLocation::getLocationArea()."[".XIpLocation::getIp()."]"; error_log(print_r($title,true), 3, '/tmp/uploadfailed.log'); foreach($failedFiles as $n => $file) { $fileName = XString::convertToGbk($file['name']); $line = "\n\t$n\t{$fileName}\t{$file['status']}\t{$file['size']}\t{$file['loaded']}\t{$file['percent']}%\t{$file['responseStatus']}"; $line .= "\nresponse={$file['response']}\n"; error_log(print_r($line,true), 3, '/tmp/uploadfailed.log'); } exit; }/*}}}*/
protected function _log($datas) {/*{{{*/ if($datas['app'] == 'doctor') { $user = self::getUser($datas); if($user->hasConfirmedSpace() && $user->space->isDoctor()) { if ($user->space->activated == 0) return; $configs = BeanFinder::get('configs'); $logdir = $configs->logDir; //记录医生登录时间,IP及GUESTID(ADMIN账户代替操作时不记录时间) //$this->_newUser在admin登录情况下,取得是当前space的用户信息 //要判断是否医生本人登录,只能从登录信息中去取 //问题:现在的管理员仅指admin一个用户,而不是具有管理员角色的人 if (false == $user->isAdmin()) { // $session = SessionDefault::singleton(); // var_dump($logdir.'/login/'.XIpLocation::getIp().'|'.$session->GuestId.'|'.$user->id.'.log');exit; // @file_put_contents($logdir.'/login/'.XIpLocation::getIp().'|'.$session->GuestId.'|'.$user->id.'.log', '+', FILE_APPEND); @file_put_contents($logdir.'/login/'.XIpLocation::getIp().'|HDF.40.4f681ce58761d|'.$user->id.'.log', '+', FILE_APPEND); } } } }/*}}}*/
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"); }/*}}}*/
/** * ��ǰip�������� * @return string */ public static function getIpCity($ip = null) { $location = XIpLocation::getLocation($ip); return self::getCityStdName($location['country'] . $location['area']); }
public function sosPost($request, $response) { $tel = $request->tel; $time = $request->time; $isAjax = $request->isAjax; $confirm = $request->confirm; if($isAjax) { $adviceContent = mb_convert_encoding(trim($request->adviceContent),'gbk','utf-8'); $clientInfo = mb_convert_encoding($request->clientInfo, 'gbk', 'utf-8'); } else { $adviceContent = trim($request->adviceContent); $clientInfo = $request->clientInfo; } $msg = null; if( empty($adviceContent) ) { $msg = '您还没有简要描述您使用好大夫在线所遇到的困难或需要的帮助,请填写后再点击提交'; if(false == $isAjax) { MsgHtml::msg($msg, '', array('button' => 'back' )); exit; } } else { $title = "空间求助 (" . date ( "y-m-d H:i" ) . ")"; $content = ""; $content .= "来自 " . XIpLocation::getLocationArea() . '[' . XIpLocation::getIp() . "] 的用户发送了一条空间求助, 内容如下:\n"; $content .= $adviceContent ."\n"; if (! $this->_newSpace->isConfirmed()) { $content .= "<font color=red>注意: 该用户未认证(" . date ( 'y-m-d H:i:s', time() ) . "之前)!!!</font>\n"; } $content .= "所提交的空间: <a href=\"http://" . $this->_newSpace->userName . ".haodf.com\" target=\"_blank\">" . $this->_newSpace->host->name . "</a>\n"; if($request->id) { if($request->type == DoctorPatientRef::DOCTORPATIENTREF_TYPE) { $sourceUrl = DoctorPatientRef::getStaticUrl($this->_newSpace->userName, $request->id); $content .= "<a href= '{$sourceUrl}' target='_blank' > 来源链接 </a>\n"; } else if($request->type == DoctorPatientRef::THREAD_TYPE) { $sourceUrl = Thread::getStaticUrl($this->_newSpace->userName, $request->id); $content .= "<a href= '{$sourceUrl}' target='_blank' > 来源链接 </a>\n"; } } $content .= "----------------------------------------------------------------------------\n"; $content .= "联系电话: " . $tel . "\n"; if ($time) { $content .= "方便联系的时间: " . $time . "\n"; } $content .= "----------------------------------------------------------------------------\n"; $content .= "发送时间: " . date("Y-m-d H:i"); $content .= "----------------------------------------------------------------------------\n"; $content .= "用户端信息: \n" . $clientInfo; UserClient::getInstance()->addUserAdvice('空间求助', $content, $this->_newSpace->user->id); $msg = '信息发送成功,感谢对好大夫在线的支持,管理员稍后为您处理遇到的问题,处理后我们会发送站内信通知您,请继续浏览网站信息'; if(false == $isAjax) { MsgHtml::msg($msg, $this->_newSpace->getUrl()); } } $response->msg = $msg; }
private function doAddComment($commentType, $request) {/*{{{*/ $doctorId = $request->doctorId; $doctor = DAL::get()->find('Doctor', $doctorId); $params = array(); $params['type'] = $commentType; $params['skill'] = (int)$request->getRequest('skill', -2); $params['attitude'] = (int)$request->getRequest('attitude', -2); $params['tag'] = iconv("utf8", "gbk", $request->getRequest('disease', '')); $params['content'] = iconv("utf8", "gbk", trim($request->getRequest('content', ''))); $params['ip'] = XIpLocation::getIp(); $params['gid'] = UserClient::getInstance()->checkGuest(); $remedy = iconv("utf8", "gbk", $request->getRequest('remedy', '')); $params['remedy'] = ($remedy == '如:药品名、手术名') ? '' : $remedy; $params['userMobile'] = $request->userMobile; $params['userRealName'] = iconv("utf8", "gbk", $request->userRealName == $request->defaultUserName ? '': $request->userRealName); $msg = $this->getConfirmMsg($params, $commentType, $doctor); if ($msg) { echo '{"res":"failure", "msg":"'.$msg.'"}'; return self::DIRECT_OUTPUT; } $userId = $this->user->isNull() ? 0 : $this->user->id; $patientId = 0; $user = DAL::get()->find('user', $userId); try { $doctorCommentId = DoctorCommentClient::getInstance()->addComment($doctor->primaryId, $user, $patientId, $params); echo '{"res":"success"}'; } catch(BizException $ex) { echo '{"res":"failure", "msg":"'.$ex->getMessage().'"}'; } }/*}}}*/
protected function _log() { if ($this->_newSpace->activated == 0) return; $configs = BeanFinder::get('configs'); $logdir = $configs->logDir; //记录医生登录时间,IP及GUESTID(ADMIN账户代替操作时不记录时间) //$this->_newUser在admin登录情况下,取得是当前space的用户信息 //要判断是否医生本人登录,只能从登录信息中去取 //问题:现在的管理员仅指admin一个用户,而不是具有管理员角色的人 if ($this->_spaceIsLogin && false == $this->_adminIsLogin) { $session = SessionDefault::singleton(); @file_put_contents($logdir.'/login/'.XIpLocation::getIp().'|'.$session->GuestId.'|'.$this->_newSpace->user->id.'.log', '+', FILE_APPEND); } //此为记录仅供医生没有更新时查询日志使用 //记这么复杂就是为了寻找上面日志没有生成的原因 if ($this->_spaceIsLogin) { @file_put_contents('/tmp/spaceactioncronlogin_all_'.XDateTime::today()->getDate().'.log', $this->_newSpace->user->id."\n", FILE_APPEND); @file_put_contents('/tmp/spaceactioncronlogin_all_'.XDateTime::today()->getDate().'.log', XIpLocation::getIp().'|'.$session->GuestId.'|'.$this->_newSpace->user->id."\n", FILE_APPEND); } }
if (isset($showtype) && $showtype) { $doctorComment = InspectorDoctorCommentListHelper::getDoctorComment($item); } } else { $doctorComment = $item; } if ($doctorComment->isNull()) { continue; } if (isset($spaceList[$doctorComment->userId]) && !$spaceList[$doctorComment->userId]->isNull()) { $space = $spaceList[$doctorComment->userId]; } else { $space = new NullEntity(); } $ip = $doctorComment->ip; $templ = XIpLocation::getLocation($ip); $ipLocation = "{$templ['country']} {$templ['area']}"; $ipTrashCnt = 0; $ipGoodCnt = 0; if (isset($ipCommentStatInfos['ip'][$ip])) { $ipTrashCnt = $ipCommentStatInfos['ip'][$ip]['trashcnt']; $ipGoodCnt = $ipCommentStatInfos['ip'][$ip]['goodcnt']; } $ipSegment = preg_match('/^(\\d+\\.\\d+\\.\\d+)\\.\\d+$/', $ip, $matches) ? $matches[1] : ""; $ipSegmentGoodCnt = 0; $ipSegmentTrashCnt = 0; if (isset($ipCommentStatInfos['ipsegment'][$ipSegment])) { $ipSegmentGoodCnt = $ipCommentStatInfos['ipsegment'][$ipSegment]['goodcnt']; $ipSegmentTrashCnt = $ipCommentStatInfos['ipsegment'][$ipSegment]['trashcnt']; } $isTel = false;
public function pay($request, $response) { /*{{{*/ $this->validLogin($response); $source = $this->getSource($request); if ($source->isNull()) { $response->setRedirect($this->space->getPhoneServiceUrl4Order()); return parent::DIRECT_OUTPUT; } $this->checkIsMySource($source); if ($source->isPaid()) { $response->setRedirect($source->successUrl()); return parent::DIRECT_OUTPUT; } $account = $source->user->getCashAccount(); if ($account->amount >= $source->getSalePrice()) { $response->setRedirect($response->router->urlfor('payment/showpaytype', array('sourceId' => $source->id, 'sourceType' => $request->sourceType))); return parent::DIRECT_OUTPUT; } $amount = XString::calculateBalancePrice($source->getSalePrice(), $account->amount); $doctor = $this->space->host; $hospitalfaculty = $doctor->hospitalfaculty; $hospital = $hospitalfaculty->hospital; $description = $hospital->name . $hospitalfaculty->name . $doctor->name; $onlinePayType = $request->onlinePayType; $depositeOrder = OrderClient::getInstance()->createDepositeOrder($this->user, $amount, $onlinePayType == 'alipay' ? DepositeOrder::RECHARGE_TYPE_ALIPAY : DepositeOrder::RECHARGE_TYPE_QPAY, array($source)); if ($onlinePayType == 'alipay') { //创建支付url $callBackUrl = BeanFinder::get('configs')->alipay_callback_url; $frontUrl = BeanFinder::get('configs')->alipay_callback_returnurl; $payUrl = Alipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $depositeOrder->amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description, $frontUrl); $response->exitJump($payUrl); } else { if ($onlinePayType == '00') { $orders = array(); $orders['orderId'] = $depositeOrder->id; $orders['productName'] = ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text; $orders['bankId'] = ''; $orders['bankType'] = '00'; $orders['orderTimestamp'] = Qpay::getInstance()->getQpayOrderTimestamp(); $orders['payerIP'] = XIpLocation::getIp(); $orders['bgUrl'] = BeanFinder::get('configs')->qpay_callback_url; $orders['orderAmount'] = $amount; $qpay = new Qpay(); $qpay->setOrderInfo($orders, Pay::TYPE_PAY); $form = $qpay->getSubmitForm(); $response->form = $form; } else { //创建支付url $callBackUrl = BeanFinder::get('configs')->alipay_gateway_callback_url; $frontUrl = BeanFinder::get('configs')->alipay_gateway_callback_returnurl; $payUrl = GatewayAlipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description, $frontUrl, $onlinePayType); $response->form = $payUrl; } } }
private function recordLoginInfo($space) {/*{{{*/ $session = SessionDefault::singleton(); $configs = BeanFinder::get('configs'); $logdir = $configs->logDir; @file_put_contents($logdir.'/login/'.XIpLocation::getIp().'|'.$session->GuestId.'|'.$space->user->id.'.log', '+', FILE_APPEND); }/*}}}*/
public function getInfoOfCase($spaceId) {/*{{{*/ $space = DAL::get()->find('space', $spaceId); if($space->isNull()) { $this->setErrorCode(328); return 0; } $configs = BeanFinder::get('configs'); $logdir = $configs->logDir; @file_put_contents($logdir.'/login/'.XIpLocation::getIp().'|'.$spaceId.'|'.$spaceId.'.log', '+', FILE_APPEND); $infos = array(); $infos = $this->getCntOfCase($spaceId); $this->content = $infos; }/*}}}*/
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; }/*}}}*/