public function soapServer($request, $response)
 {/*{{{*/
     $postdata = file_get_contents("php://input");
     $function = 'soapServer';
     $this->ioLogRecorder->addLog(XDateTime::now()->toString()." service [{$function}] ".$this->ioLogRecorder->format2SimpleLog($postdata));
     $configs = ProviderConfigFactory::getProviderAppConfigs(PhoneConference::SPTYPE_HUAWEI, TeleConfProvider::APPTYPE_CONF);
     $callbackUrl = $configs['callbackUrl'];
     $server = new SoapServer(null, array('uri' => 'HuaweiConfCallback','location'=>$callbackUrl));
     $server->setClass('HuaweiTeleConfApi');
     try
     {
         $lockName = $this->getLockerName($postdata);
         $cacher= DAL::get()->getCache(Cacher::CACHETYPE_LOCKER);
         $locker  = LockUtil::factory(LockUtil::LOCK_TYPE_MEMCACHE, array('memcache' => $cacher));
         $locker->getLock($lockName);
         $server->handle();
         $locker->releaseLock($lockName);
     }
     catch(Exception $ex)
     {
         $locker->releaseLock($lockName);
     }
     header("HTTP/1.1 202 Accepted");
     header("Content-Type: text/xml;charset=UTF-8");
     return parent::DIRECT_OUTPUT;
 }/*}}}*/
Ejemplo n.º 2
0
 private function setAmbiente($tipo = '')
 {
     $registrador = new DAL();
     $idTipo = $registrador->getTipoDato($tipo, 'id', 'id');
     if (!$idTipo) {
         return false;
     }
     $idTipo = $idTipo;
     $nombreTipo = $registrador->getTipoDato($tipo, 'id', 'nombre');
     $aliasTipo = $registrador->getTipoDato($tipo, 'id', 'alias');
     unset($registrador);
     return array("id" => $idTipo, "nombre" => $nombreTipo, "alias" => $aliasTipo);
 }
function query1($disorder)
{
    echo "jaz sem funkcija";
    $dal = new DAL();
    $age_min = 18;
    $age_max = 36;
    $unitarray = array(75, 77, 78);
    $disorderarray = array(1, 2, 3, 4, 5);
    $cat = $dal->get_count_dissorder_age_persons_by_unit($unit_in, 0, 11, $age_min, $age_max, $disorder);
    $cat = $cat[0];
    $table = str_replace("##DISORDER{$disorder}##", $cat->sestevek, $table);
    echo $table;
    return $table;
}
 private function getUserIdByPatientAttachment($context)
 {/*{{{*/
     $encodeId = $context->request->id;
     $patientAttachmentId = Codec::getInstance()->decodeId($encodeId);
     $patientAttachment = DAL::get()->find('patientattachment',$patientAttachmentId);
     return $patientAttachment->user->id;
 }/*}}}*/
Ejemplo n.º 5
0
 public static function getDtoInfos(array $tasks)
 {
     /*{{{*/
     $dtoList = array();
     foreach ($tasks as $task) {
         $patient = $task->patient;
         //$ticket = DAL::get()->find_by_source('ticket', $task, true);
         $ticket = DAL::get()->find_waiting_ticket('ticket', $task);
         if ($ticket->isNull()) {
             continue;
         }
         if (false == isset($dtoList[$patient->user->id])) {
             $dtoList[$patient->user->id] = array();
         }
         $dto = new self();
         $dto->id = $ticket->source->id;
         $dto->ticketId = $ticket->id;
         $dto->ctime = $ticket->ctime;
         $dto->inspectorName = $task->inspector->isNull() ? '╬┤ио┼С' : $task->inspector->getRealName();
         $dto->patient = $patient;
         $dto->level = $task->level;
         $dto->source = $task;
         $dto->inspectorId = $ticket->inspectorId;
         $dto->status = $task->getStatusDesc();
         $dto->src = $task->getSrcDesc();
         $dto->comment = $task->comment;
         $dto->proposal = $task->proposal;
         $dtoList[$patient->user->id][] = $dto;
     }
     return $dtoList;
 }
Ejemplo n.º 6
0
 public function showAdd($request, $response)
 {
     /*{{{*/
     $response->id = $request->getRequest('id', 0);
     $response->msg = $request->msg;
     $response->noteBook = DAL::get()->find('NoteBook', $response->id);
 }
Ejemplo n.º 7
0
 public function show($request, $response)
 {
     /*{{{*/
     $response->cates = $this->threadCateClient->getTopLevelList();
     $response->auditor = DAL::get()->find('auditor', $request->id);
     $res = $this->auditorClient->getByRoles(array(Auditor::ROLE_LEADER));
     $response->leaders = isset($res[Auditor::ROLE_LEADER]) ? $res[Auditor::ROLE_LEADER] : array();
     $response->groups = DAL::get()->find_all_by_condition('auditorgroup', '1=1');
     $response->id = $request->id;
     $response->showContent = true;
     $response->viewer = $this->auditor;
     if (null == $response->id) {
         $isGroupLeader = false;
         if ($this->auditor->isLeader()) {
             foreach ($response->groups as $group) {
                 if ($group->leader->id == $this->auditor->id) {
                     $isGroupLeader = true;
                 }
             }
             if (false == $isGroupLeader) {
                 throw new BizException('你还不是任何组的组长,请联系管理员设置');
             }
         }
     }
 }
	private function searchBySphinx($request, $response, $kw, $p)
	{/*{{{*/
        $doctorSearchd = SphinxSearchdBase::createSearchdByType('Doctor');
        $utf8Kw = mb_convert_encoding($kw, 'utf-8', 'gbk');
		$res = $doctorSearchd->query($utf8Kw, ($p - 1) * 15, 15);
        $searchResult = SearchResult::sphinxResult2searchResult($res, 'doctor', ($p - 1) * 15, 15);
        $response->totalPage = ceil($searchResult->total_found/$searchResult->pageSize);
		
		$results = array();
		foreach($searchResult->items as $item)
		{/*{{{*/
			$doctor = DAL::get()->find('doctor',$item->id);
			
            if($doctor->isNull() || $doctor->deleted > 0 )
            {
				continue;
			}
			
			$result = array();
			$result['id'] = $doctor->id;
			$result['name'] = $doctor->name;
			$result['title'] = $doctor->title;
			$result['hospital'] = $doctor->hospitalfaculty->hospital->name;
			$result['userid'] = $doctor->getUserId();
			$result['hospitalfacultyname'] = $doctor->hospitalfaculty->name ;
			$results[] = (object)$result;
		}/*}}}*/
		return $results;
	}/*}}}*/
 public function service($request, $response)
 {/*{{{*/
     ob_start();
     $result = "";
     $function = $request->service;
     if(method_exists($this, $function))
     {
         try
         {
             $lockName = $this->getLockerName($request);
             $cacher= DAL::get()->getCache(Cacher::CACHETYPE_LOCKER);
             $locker  = LockUtil::factory(LockUtil::LOCK_TYPE_MEMCACHE, array('memcache' => $cacher));
             $locker->getLock($lockName);
             $result = $this->$function($request,$response);
             $locker->releaseLock($lockName);
         }
         catch(LockException $ex)
         {
             $this->ioLogRecorder->addLog(XDateTime::now()->toString()."并发锁错误 $lockName\n");
         }
         catch(Exception $ex)
         {
             $locker->releaseLock($lockName);
         }
     }
     echo $result;
     header('Content-Length: ' . ob_get_length());
     return parent::DIRECT_OUTPUT;
 }/*}}}*/
 /**
  * checkNotice  接收来自第三方的电话咨询订单验证消息
  * 
  * @access public
  * @return void
  */
 public function checkNotice()
 {/*{{{*/
     $data = file_get_contents("php://input");
     if(empty($data))
     {
         echo json_encode(array('errno' => 2, 'detail' => iconv("GBK", "UTF-8", '数据为空')));
         exit;
     }
     $arrData = json_decode($data, true);
     $type = $arrData['type'];
     $postData = $arrData['postdata'];
     $partnerTelOrder = DAL::get()->find_by_tradeid('partnertelorder', $postData['trade_id']);
     if(false == $partnerTelOrder->isNull())
     {
         $telOrder = DAL::get()->find('telorder', $partnerTelOrder->orderId); 
         if(false == $telOrder->isNull())
         {
             if(($type == '2' && $telOrder->isRefund()) || ($type == '1' && $telOrder->isFinished()))
             {
                 echo json_encode(array('errno'=>'0')); 
                 ScoreClient::getInstance()->createIntegralLog(User::ADMIN_USERID, $partnerTelOrder->tradeId, IntegralLog::BAIDUZHIDAO_PHONE_DRAWBACK_SUCCESS);
                 exit;
             }
         }
     }
     echo json_encode(array('errno'=>'1')); 
     ScoreClient::getInstance()->createIntegralLog(User::ADMIN_USERID, $partnerTelOrder->tradeId, IntegralLog::BAIDUZHIDAO_PHONE_DRAWBACK_FAIL);
     exit;
 }/*}}}*/
 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);
 }
 function modify($request, $response)
 {
     /*{{{*/
     $this->myProjectOperator->checkAdminAuthOrQuit('update');
     $projectOrgId = $request->projectOrgId;
     $response->projectOrg = DAL::get()->find('projectOrg', $projectOrgId);
 }
Ejemplo n.º 13
0
 public function detail($request, $response)
 {/*{{{*/
     $threadId = (int)$request->case_id;
     $criticalNum = 100*100*1000;
     $correctNum = 100*100*100;
     $threadId = $threadId > $criticalNum ? $threadId : $threadId-$correctNum;
     
     $proposal = DAL::get()->find('proposal', $threadId);
     if(false == $proposal->isNull())
     {
         $response->setRedirect($proposal->getTouchUrl());
         return 0;
     }
     else
     {
         $intention = DAL::get()->find('intention', $threadId);
         if(false == $intention->isNull())
         {
             $response->setRedirect($intention->getTouchUrl());
             return 0;
         }
         else
         {
             DBC::requireTrue(false, 'Êý¾ÝÎÊÌâ');
         }
     }
 }/*}}}*/
Ejemplo n.º 14
0
	public function postTopic($request, $response)
	{
		$groupIds = $request->groupIds;
		if(!$groupIds)
		{
			$response->message = '没有选择话题所在的组!';
			MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
			return false;
		}
		$title = $request->title;
		$content = preg_replace("/<\/?a[^>]*>/i", "", $request->content);
		if(XString::cntrim($title) == '' || XString::cntrim($content) == '')
		{
			$response->message = '话题标题和内容都不能为空!';
			MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
			return false;
		}
		$groups = DAL::get()->find('regroup', $groupIds);
		foreach($groups as $group)
		{
			if($group->reboard->isNull() == false)
			{
				$member = ForumClient::getInstance()->getMemberByUserIdAndGroupId($this->user->id, $group->id);
				if($member->isNull() == false && $member->isForbiddened())
				{
					$response->message = '您的发言没有成功,可能是已被禁止发言!服务电话:'.HdfPhoneNumber::PHONE_FENZHEN;
					MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
					return false;
				}
				ResidentEvilClient::getInstance()->createTopic($group->space, $group->reboard, $this->user, $title, $content);
			}
		}
		$response->message = '话题发表成功!';
		MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
	}
 private function buildData($facultyList) 
 {/*{{{*/
     $res = array();
     $facultyData = array();
     if(false == empty($facultyList))
     {
         $facultys = DAL::get()->find('Faculty', $facultyList['ids']);
         foreach($facultys as $faculty)
         {
             $hospitalFacultyGroup = $this->getHospitalFacultyGroupByFacultyId($faculty->id);
             if(count($hospitalFacultyGroup) == 5)
             {
                 $formData = $this->buildFormData($hospitalFacultyGroup, $faculty->id);
                 $facultyNames = $this->getAllNames($faculty);
                 if (count($facultyNames)>1)
                 {
                     foreach ($facultyNames as $facultyName)
                     {
                         $res[] = $this->getRealData($faculty, $formData, $facultyName);
                         unset($facultyName);
                     }
                 }
                 else
                 {
                     $res[] = $this->getRealData($faculty, $formData);
                 }
             }
             BeanFinder::get('LocalCache')->removeAll(); 
             unset($faculty);
         }
         BeanFinder::get('LocalCache')->removeAll(); 
     }
     return $res;
 }/*}}}*/
Ejemplo n.º 16
0
    protected function getDataForDiseaseDoctors($diseaseDoctors)
    {/*{{{*/
        $res = array();
        if (empty($diseaseDoctors)) return $res;
        foreach ($diseaseDoctors as $diseaseDoctor)
        {
            BeanFinder::get('LocalCache')->removeAll(); 
            $hospital = $diseaseDoctor->doctor->hospitalfaculty->hospital;
            if($hospital->isNull() || $hospital->isTestHospital()) 
            {
                continue;
            }
            
            $diseaseDoctorInfo = $this->wrapDiseaseDocInfo($diseaseDoctor, $diseaseDoctor->disease);

            $res[] = array(
                'item' => $diseaseDoctorInfo,
            );
            unset($diseaseDoctorInfo);
            
            // 二级疾病
            $childredDiseases = DAL::get()->find_all_childrenDiseases('Disease', $diseaseDoctor->disease->id);   // TODO
            foreach ($childredDiseases as $childDisease)
            {
                $childrenDiseaseDocInfo = $this->wrapDiseaseDocInfo($diseaseDoctor, $childDisease);
                $res[] = array(
                    'item' => $childrenDiseaseDocInfo,
                );
                unset($childrenDiseaseDocInfo);
            }
        }
        return $res;
    }/*}}}*/
    public function before($context) 
    {/*{{{*/
        parent::before($context);
        $group = DAL::get()->find_parent('FinanceInspectGroup');

        DBC::requireTrue($group->among($context->response->curInspector), '你没有权限访问');
    }/*}}}*/
 public function listOfSource($request, $response)
 {
     /*{{{*/
     $sourcetype = $request->sourcetype;
     $sourceid = $request->sourceid;
     $response->projectLogs = DAL::get()->find_by_sourcetype_and_sourceid('projectlog', $sourcetype, $sourceid);
 }
 public function before($context)
 {
     $doctorId = Codec::getInstance()->decodeId($context->request->id);
     $action = $context->action;
     if($context->controller == 'doctor' && $context->action == 'showreply')
     {
         $comment = DoctorCommentClient::getInstance()->getDoctorCommentSubClass($context->request->commentid);
         $doctorId = $comment->doctor->id;
     }
     if($context->controller == 'doctor' && $context->action == 'addcomment')
     {
         $doctorId = $context->request->doctor_id;
     }
     if($context->controller == 'paper' && $context->action == 'showcmstagtypelist')
     {
         $doctorId = $context->request->searchParam;
     }
     $redirectActionArray = array(
         'showdetail'
         ,'commentlist'
         ,'addcomment'
         ,'showcmstagtypelist'
         ,'showreply'
         );
     $doctorIds = DAL::get()->find_id_by_hospitalfacultyid('doctor', 0);
     $isInRedirectActionArray = in_array($action, $redirectActionArray);
     $isInDoctorList = in_array($doctorId, $doctorIds);
     if($isInRedirectActionArray && $isInDoctorList)
     {
         $context->response->setRedirect('http://www.'.URL_PREFIX.'haodf.com/info/dissociatedoctornotice.php');
     }
 }
Ejemplo n.º 20
0
 public static function getDAL()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 21
0
 public function listOfSubunitTpl($request, $response)
 {
     $subunitTplId = $request->subunitTplId;
     $subunitTpl = DAL::get()->find('SubunitTpl', $subunitTplId, true);
     $response->chipTpls = $subunitTpl->getChipTpls();
     $response->subunitTpl = $subunitTpl;
 }
Ejemplo n.º 22
0
    public function createSitemap()
    {/*{{{*/
        $content = '';
        $header = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'."\n";
		$footer = '</urlset>';
        $hospitalUrlList = DAL::get()->queryAllHospitalUrl4Sitemap('hospital'); 
        $content = $this->getData4Sitemap($hospitalUrlList);
        $diseaseUrlList = DAL::get()->queryAllDiseaseUrl4Sitemap('disease');
        $content .= $this->getData4Sitemap($diseaseUrlList);
        $facultyUrlList = DAL::get()->queryAllFacultyUrl4Sitemap('faculty');
        $content .= $this->getData4Sitemap($facultyUrlList);
        $zixunUrlList = $this->getZixunUrl();
        $content .= $this->getData4Sitemap($zixunUrlList);
        $bookingHospitalUrlList = SpaceClient::getInstance()->getBookingHospitalUrl4Sitemap('plussignchannel');
        $content .= $this->getData4Sitemap($bookingHospitalUrlList);
        $data = $header.$content.$footer;
        $filePath = dirname(__FILE__).'/../root/sitemap/';
        $fileName = 'wwwfront.xml';
        $file = $filePath.$fileName;
        $fp = fopen($file,'w');
        fwrite($fp, $data);
        fclose($fp);
    }/*}}}*/
 public function delete($request, $response)
 {
     /*{{{*/
     $ticket = DAL::get()->find('ticket', $request->ticketid);
     if ($ticket->isNull()) {
         echo 'ticket does not exist';
         exit;
     }
     $passContent = $this->getPassContent($request);
     $deleteDto = new DoctorCommentPostInspectResultDto($ticket->getSource(), Inspectable::STATUS_VALID, $request->content, $request->adminComment);
     $res = InspectClient::getInstance()->delete($ticket->id, $this->inspector, $deleteDto);
     if (false == $res) {
         echo '审核失败';
         exit;
     } else {
         //dodo::psq
         S3LogClient::getInstance()->add($this->inspector, $ticket->source->getLogable()->action(DoctorCommentPostLog::ACTION_POST_DELETE, $passContent));
         $nextTicket = InspectClient::getInstance()->pickTicket($this->inspector, $ticket->inspectGroup);
         if ($nextTicket->isNull()) {
             // 没有下一条工单了
             echo "没有工单了,审核结束";
             exit;
         } else {
             // 还有下一条
             $post = $nextTicket->source;
             $response->setRedirect('/commentpost/edit?id=' . $post->id . '&ticketid=' . $nextTicket->id);
         }
     }
 }
Ejemplo n.º 24
0
 public function before($context)
 {
     /*{{{*/
     $curOperator = DAL::get()->find("TeleOperator", $context->request->getCookie('operator'));
     /**
      * 如果没有登录,调到登录页面 
      */
     if ($curOperator->isNull()) {
         header('Location:http://' . URL_PREFIX . 'callcenter.haodf.com/operator/login');
         exit;
     }
     $bk = $context->request->getCookie('bk');
     $ip = RequestDelegate::getIp();
     $session = SessionDefault::singleton();
     /**
      * 网站用户已登录,而且允许在外网访问管理后台
      * 或者
      * 是超级管理员
      * 可以在外放访问呼叫中心
      */
     if (false == RequestDelegate::isOfficeIp()) {
         if ($bk && isset($session->UserId) && BackYardAuth::authVerificationCode($bk, $session->UserId, $ip) || $curOperator->isSupperAdmin()) {
         } else {
             echo "本系统只允许在办公室内使用!";
             exit;
         }
     }
 }
Ejemplo n.º 25
0
    public function setUp($currentSystemCode, $useRemoteCache = self::REMOTE_CACHE_USED) {
        if ($this->isSetup() == false)
        {
            DBC::requireNotEmptyString($currentSystemCode);
            $this->currentSystemCode = $currentSystemCode;
            BeanFinder::register('currentSystemCode', $this->currentSystemCode);
            $this->useRemoteCache = $useRemoteCache;

            include(dirname(__FILE__).'/dalsetting.php');
            $this->orgDbConfigs['dbwrite'] = $dbwrite;
            $this->orgDbConfigs['dbread'] = $dbread;
            DAL::get()->registerDb($dbConfigs);
            DAL::get()->registerMsDb($msDbConfigs);
            DAL::get()->registerRemoteCache($caches);
            DAL::get()->registerGearman($gearmanConfigs); 
            DAL::get()->initSession($sessionSavePaths); 
            DAL::get()->registerRedis($redisConfigs); 
            if (isset($this->dbConfigs[$currentSystemCode]))
            {
                BeanFinder::register('dbexecuter', $this->getDbExecuter());
            }
            $this->isSetup = true;
        }

        return $this;
    }
Ejemplo n.º 26
0
 public static function deletePost($post_id)
 {
     //delete img
     //first get the post
     $post = self::getPost($post_id);
     //post->getImg
     $img = $post->getImagesPost();
     //foreach img delete img in the DB
     if ($img != NULL) {
         foreach ($img as $image) {
             DAL::deleteImg($image->getImg_id());
         }
         //then in the files (somthing like rmdir /images/posts/$postid -R) !!!this section might rise errors...
         $dir = 'images/posts/' . $post->getPost_id();
         $files = array_diff(scandir($dir), array('.', '..'));
         foreach ($files as $file) {
             is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
         }
         rmdir($dir);
     }
     //then get votes
     $votes = $post->getVote_post();
     //foreach vote, unset it
     if ($votes != NULL) {
         foreach ($votes as $vote) {
             DAL::unsetVote_post($vote->getPost_id(), $vote->getUser()->getUsername());
         }
     }
     DAL::deletePost($post_id);
 }
Ejemplo n.º 27
0
 public function __construct($request, $response)
 {
     /*{{{*/
     parent::__construct($request, $response);
     $clients = array('auditorClient', 'threadCateClient', 'userClient', 'spaceClient', 'doctorClient', 'hospitalClient', 'hospitalFacultyClient', 'PatientClient', 'DoctorPatientPostClient', 'inspectClient');
     foreach ($clients as $client) {
         $this->{$client} = new ClientProxy($client);
     }
     $userId = UserClient::getInstance()->getCheckedSeed('id');
     if ($userId) {
         $this->curUser = DAL::get()->find('user', $userId);
     } else {
         $this->curUser = new NullEntity();
     }
     $response->curUser = $this->curUser;
     $response->staticUrl = 'http://i1.hdfimg.com/in/case';
     $response->leftWidth = '40%';
     //$response->leftWidth = '43%';
     $response->controller = $request->controller;
     $response->action = $request->action;
     $response->showContent = $request->showContent;
     $this->user = $response->user;
     $this->curInspector = $response->curInspector;
     $this->auditor = $response->auditor;
     if (false == $this->auditor instanceof Auditor) {
         $auditor = $this->curInspector->getAuditorEntity4auditfront();
         $this->auditor = $auditor;
     }
     $response->args = array();
     $response->isAjax = $request->ajax_status;
 }
 public function modify($request, $response)
 {
     /*{{{*/
     $this->myProjectOperator->checkAdminAuthOrQuit('update');
     $response->projectOrgs = DAL::get()->find_all('ProjectOrg');
     $response->projectOperator = DAL::get()->find('ProjectOperator', $request->projectOperatorId);
 }
 public function service($request, $response)
 {/*{{{*/
     ob_start();
     $result = $this->callCenterApi->returnSuccess();
     $function = $request->service;
     if(method_exists($this, $function))
     {
         try
         {
             $lockName = $this->getLockerName($request);
             $cacher= DAL::get()->getCache(Cacher::CACHETYPE_LOCKER);
             $locker  = LockUtil::factory(LockUtil::LOCK_TYPE_MEMCACHE, array('memcache' => $cacher));
             $locker->getLock($lockName);
             $result = $this->$function($request,$response);
             $locker->releaseLock($lockName);
         }
         catch(LockException $ex)
         {
             error_log(XDateTime::now()->toString()."并发锁错误 $lockName\n", 3 , $this->logFileName);
         }
         catch(Exception $ex)
         {
             error_log(XDateTime::now()->toString()."释放锁 $lockName\n", 3 , $this->logFileName);
             $locker->releaseLock($lockName);
         }
     }
     echo $result;
     $this->logTxt .= XDateTime::now()->toString().'--->'.print_r($result, true)."\n";
     header('Content-Length: ' . ob_get_length());
     return parent::DIRECT_OUTPUT;
 }/*}}}*/
Ejemplo n.º 30
0
 public function addFlowChargeOrder($request, $response)
 {
     /*{{{*/
     $refId = $request->getRequest('refid', true);
     $ref = DAL::get()->find('DoctorPatientRef', $refId);
     $isdpRef = $ref instanceof DoctorPatientRef;
     $isUserSelf = $ref->user->id == $this->user->id;
     $isOpenCharge = $ref->space->isChargeOpened();
     DBC::requireTrue($isdpRef && $isUserSelf && $isOpenCharge, '对不起,您不能预充值');
     if ($this->checkCanCharge($ref)) {
         $this->message("抱歉!现在不能购买。您已经提前购买了{$ref->space->name}医生的3次指导机会,为避免资源浪费,请在使用后再次够买。", $response, array('text' => '点击这里继续', 'url' => $ref->getUrl()));
     } else {
         $product = ProductClient::getInstance()->getDoctorChargeFlowProduct($ref->space);
         $charge = $product->salePrice;
         $cashAccount = $this->user->getCashAccount();
         if ($cashAccount->amount >= $charge) {
             $serviceOrder = ServiceOrderClient::getInstance()->create($ref, $product, $this->user);
             if (false == $serviceOrder->isNull()) {
                 ServiceOrderClient::getInstance()->pay($serviceOrder, $this->user);
                 $serviceOrder = DAL::get()->find('serviceOrder', $serviceOrder->id, true);
             }
             if ($serviceOrder->isPaid()) {
                 $response->setRedirect($serviceOrder->successUrl());
                 return parent::DIRECT_OUTPUT;
             }
         }
         $url = 'http://' . URL_PREFIX . 'passport.haodf.com/telpayment/showtelaccount';
         $this->message('您的余额不足,不能购买,请充值后重新购买', $response, array('text' => '去充值', 'url' => $url));
     }
 }