本文整理汇总了PHP中Codec类的典型用法代码示例。如果您正苦于以下问题:PHP Codec类的具体用法?PHP Codec怎么用?PHP Codec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Codec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trans
public static function trans($link) {
$codec = new Codec();
if ($link{0} == "/") return self::enclosehref();
$url = "";
$data = explode(":", $link, 2);
if (count($data) < 2) return "";
switch ($data[0]) {
case 0: //link
$url = $data[1];
break;
case 1: //hospital
$url = "http://www.haodf.com/hospital/".$codec->encodeId($data[1]).".htm";
break;
case 2: //faculty
$url = "http://www.haodf.com/keshi/".$codec->encodeId($data[1]).".htm";
break;
case 3: //hospitalfaculty
$url = "http://www.haodf.com/faculty/".$codec->encodeId($data[1]).".htm";
break;
case 7: //hospitalfacultydoctor
$url = "http://www.haodf.com/doctor/".$codec->encodeId($data[1]).".htm";
break;
case 8: //disease
$url = "http://www.haodf.com/jibing/$data[1].htm";
break;
case 9: //jiahao
$url = "http://jiahao.haodf.com";
break;
}
if (!$url) return "";
return self::href($url);
}
示例2: delete
public function delete( $request,$response )
{/*{{{*/
$subId = (int)Codec::getInstance()->decodeId($request->subid);
SubscriptionClient::getInstance()->deleteSubscriptDisease( $subId );
$response->setRedirect( $response->router->urlfor( "subscriptdisease/showindex" ) );
}/*}}}*/
示例3: loadMoreCase
public function loadMoreCase($request, $response)
{/*{{{*/
if (is_numeric($request->doctorid))
{
$this->_exit404();
}
$doctorId = (int)Codec::getInstance()->decodeId($request->doctorid);
if((int)$doctorId <= 0)
{
$this->_exit404();
}
$doctor = DAL::get()->find('Doctor', $doctorId);
if($doctor->isNull() || !$doctor->hasSpace())
{
$this->_exit404();
}
$space = $doctor->space;
$response->doctor = $doctor;
$response->space = $space;
$response->doctorSpaceIsOpened = $doctor->hasSpace() && $space->isOpened();
$nowPage = $request->getRequest('p', 1);
$res = FlowClient::getInstance()->getFlowList($response->space->id, $nowPage, self::PAGESIZE);
$response->flowList = $res['list'];
$response->nowPage = $nowPage;
$response->pages = $res['pageInfo']['pages'];
$response->loadUrl = $response->touchUrl.'/case/loadmorecase?doctorid='.$request->doctorid.'&p=';
$response->title = $doctor->name."大夫患者咨询_好大夫在线";
$response->topTitle = "咨询列表";
}/*}}}*/
示例4: getData
protected function getData($nowPage, $pageSize)
{/*{{{*/
$dataList = $this->prepareData($nowPage, $pageSize);
$res = array();
foreach ($dataList as $data)
{
$tempData = array();
$tempData['item']['key'] = $data['dname'].'医院';
$tempData['item']['url'] = 'http://haoping.haodf.com/jibing/'.$data['dkey'].'/yiyuan.htm';
$tempData['item']['showUrl'] = XString::truncate('haoping.haodf.com/jibing/'.$data['dkey'].'/yiyuan.htm', 38, '...');
$tempData['item']['title'] = $data['dname']."推荐医院_好大夫在线";
$tempData['item']['pageSize'] = rand(58, 62).'K';
$tempData['item']['date'] = date('Y-m-d', time());
$tempData['item']['content'] = "各地".$data['dname']."医院就医指南";
foreach ($data['formdata'] as $key => $form)
{
$data['formdata'][$key]['form']['diseaseHospitalUrl'] = 'http://haoping.haodf.com/hospital/'.Codec::getInstance()->encodeId($form['form']['hid']).'/'.$data['dkey'].'.htm';
unset($form);
}
$tempData['item'] = $tempData['item'] + $data['formdata'];
$res[] = $tempData;
unset($data);
}
return $res;
}/*}}}*/
示例5: __construct
public function __construct($request, $response) {
parent::__construct($request, $response);
$facultyId = Codec::getInstance()->decodeId($request->id);
if ( (int)$facultyId <= 0) {
$this->_exit404();
}
$this->_faculty = DAL::get()->find('faculty', $facultyId);
if ($this->_faculty->isNull()) {
$this->_exit404();
}
$this->_facultyIdFrom = $this->_faculty->id;
$this->_facultyIdTo = $this->_faculty->id + $this->_faculty->mask;
$area = new Area();
$this->_provInfo = $area->provInfo();
$this->_prov = $request->prov;
if (empty($this->_prov))
$this->_prov = $request->province;
$this->_otherProv = explode(',', $this->_provInfo['q']['Province']);
$this->_areaName = empty($this->_provInfo[$this->_prov]['Name']) ? '' : $this->_provInfo[$this->_prov]['Name'];
$this->_provinceStr = str_replace(',', "','", $this->_areaName);
$this->_p = $request->getRequest('p', 1);
$response->faculty = $this->_faculty;
$response->areaName = $this->_areaName;
$response->provInfo = $this->_provInfo;
$response->prov = $this->_prov;
$response->isShowPhone = in_array($this->_faculty->name, self::$askLinks);
}
示例6: index
public function index($request, $response)
{
$doctorId = $this->_newSpace->host->id;
$doctorUserId = $this->_newSpace->user->id;
$doctor = DAL::get()->find( 'User', $doctorUserId );
$encodeId = Codec::getInstance()->encodeId($doctorId);
$hezuoList = array(
$doctor->realName.'个人网站'=>'http://'."$doctor->name".'.haodf.com',
'好大夫在线'.$doctor->realName.'信息中心页' =>'http://www.haodf.com/doctor/'.$encodeId.'.htm#schedule',
'搜狐'.$doctor->realName.'信息中心页' =>'http://haodf.health.sohu.com'.'/doctor/'.$encodeId.'.htm',
'新浪'.$doctor->realName.'信息中心页' =>'http://hospitalize.news.sina.com'.'/doctor/'.$encodeId.'.htm',
'腾讯'.$doctor->realName.'信息中心页' =>'http://health.qq.haodf.com'.'/doctor/'.$encodeId.'.htm',
'新华网'.$doctor->realName.'信息中心页' =>'http://xinhua.haodf.org'.'/doctor/'.$encodeId.'.htm',
'人民网 '.$doctor->realName.'信息中心页' =>'http://haodf.people.com.cn'.'/doctor/'.$encodeId.'.htm',
'新浪亲子'.$doctor->realName.'信息中心页' => 'http://qiuyi.baby.sina.com.cn'.'/doctor/'.$encodeId.'.htm',
'摇篮网'.$doctor->realName.'信息中心页' =>'http://haodf.yaolan.com'.'/doctor/'.$encodeId.'.htm',
'太平洋亲子'.$doctor->realName.'信息中心页' =>'http://haodf.pckids.com.cn'.'/doctor/'.$encodeId.'.htm',
'太平洋女性网'.$doctor->realName.'信息中心页' =>'http://haodf.pclady.com.cn'.'/doctor/'.$encodeId.'.htm',
'大众网健康'.$doctor->realName.'信息中心页' =>'http://haodf.health.dzwww.com'.'/doctor/'.$encodeId.'.htm',
'人民健康保险'.$doctor->realName.'信息中心页'=>'http://haodf.picchealth.com'.'/doctor/'.$encodeId.'.htm',
'凤凰网'.$doctor->realName.'信息中心页' =>'http://haodf.health.ifeng.com'.'/doctor/'.$encodeId.'.htm',
'msn'.$doctor->realName.'信息中心页' =>'http://wenda.health.msn.com.cn'.'/doctor/'.$encodeId.'.htm',
);
$sinaUser = DAL::get()->find_sinauser_by_spaceid('weibouser', $doctorUserId);
$tencentUser = DAL::get()->find_tencentuser_by_spaceid('weibouser', $doctorUserId);
$response->sinaUser = $sinaUser;
$response->tencentUser = $tencentUser;
$response->hezuoList = $hezuoList;
}
示例7: getUserIdByPatientAttachment
private function getUserIdByPatientAttachment($context)
{/*{{{*/
$encodeId = $context->request->id;
$patientAttachmentId = Codec::getInstance()->decodeId($encodeId);
$patientAttachment = DAL::get()->find('patientattachment',$patientAttachmentId);
return $patientAttachment->user->id;
}/*}}}*/
示例8: before
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');
}
}
示例9: getRealData
private function getRealData($facultyObj)
{/*{{{*/
$res = array();
$res['name'] = $facultyObj->name;
$res['id'] = Codec::getInstance()->encodeId($facultyObj->id);
$res['intro'] = strip_tags($facultyObj->intro);
unset($facultyObj);
return $res;
}/*}}}*/
示例10: getCodec
public static function getCodec($id)
{
foreach (Codec::getAllCodecs() as $codec) {
if ($codec->getID() === $id) {
return $codec;
}
}
throw new Exception($id . " is not a known codec ID.");
}
示例11: put
public function put($topic, $msg, $async)
{
if (strlen($msg) > Codec::MAX_MSG_LENGTH) {
throw new \Exception('Can not put message which length > ' . Codec::MAX_MSG_LENGTH);
}
list($host, $port, $part) = $this->selectPart($topic);
if (!isset($this->sockets[$host . ':' . $port])) {
$this->sockets[$host . ':' . $port] = new Socket($host, $port);
try {
$this->sockets[$host . ':' . $port]->connect();
} catch (\Exception $e) {
echo $e->getMessage();
}
if (!$this->sockets[$host . ':' . $port]->active) {
$this->inactive = $host . '-' . $port;
$this->removeInactive($topic);
if (sizeof($this->writeList[$topic]) > 0) {
$this->put($topic, $msg);
} else {
throw new \Exception('all brokers seems down');
}
}
}
$socket = $this->sockets[$host . ':' . $port];
$data = Codec::putEncode($topic, $part, $msg);
$reTry = 0;
$success = false;
while (1) {
$writeSuccess = $socket->write($data);
if ($writeSuccess && $async) {
$success = true;
$result = array('id' => -1, 'code' => 0, 'offset' => -1);
break;
}
$buf = $socket->read0();
list($success, $result, $errorMsg) = Codec::putResultDecode($buf);
if ($errorMsg) {
throw new MetaQ_Exception($errorMsg);
}
if ($success || $reTry >= self::RETRY) {
break;
}
usleep(500);
$reTry++;
}
if (!$success) {
throw new MetaQ_Exception('put command not succeed to ' . $host . ':' . $port);
$this->inactive = $host . '-' . $port;
$this->removeInactive($topic);
if (sizeof($this->writeList) > 0) {
$this->put($topic, $msg);
} else {
throw new \Exception('all brokers seems down');
}
}
return $result;
}
示例12: validTesterDoctor
private function validTesterDoctor($request)
{
$doctorId = (int)Codec::getInstance()->decodeId($request->id);
$doctor = DAL::get()->find('Doctor', $doctorId);
if($doctor->isNull() == false && $doctor->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp())
{
header('Location: http://www.haodf.com');
exit;
}
}
示例13: buildData
private function buildData($hospitalFacultys, $doctors)
{/*{{{*/
$resArray = array();
foreach ($hospitalFacultys as $hospitalFaculty)
{
$hospital = $hospitalFaculty->hospital;
$faculty = $hospitalFaculty->faculty;
$isPlus = PlussignChannelClient::getInstance()->isHospitalFacultyBookDoctor($hospital->name, $faculty->name);
$keyWord = $hospital->commonName.$hospitalFaculty->name;
if($isPlus)
{
$content1 = "提供".$doctors[$hospitalFaculty->id]."等".
$hospitalFaculty->doctorCount."位大夫的擅长、门诊时间查询,".
$keyWord.$hospitalFaculty->spaceCount."位大夫提供免费网上咨询,另外有"
.count($isPlus)."位大夫提供预约加号服务。";
$hospitalEncode = Codec::getInstance()->encodeId($hospital->name);
$facultyEncode = Codec::getInstance()->encodeId($faculty->name);
$url3 = "http://www.".URL_PREFIX."haodf.com/jiahao/search.htm?district=".$isPlus[0].
"&hospitalName=".$hospitalEncode."&facultyName=".$facultyEncode;
}
else
{
$content1 = '提供'.$doctors[$hospitalFaculty->id].
'等'.$hospitalFaculty->doctorCount.'位大夫的擅长、门诊时间查询,'.
$keyWord.$hospitalFaculty->spaceCount.'位大夫提供免费网上咨询。';
$hasArticle = ArticleClient::getInstance()->hasArticleInHospitalFaculty($hospitalFaculty->id);
$url3 = '';
if(false == empty($hasArticle))
{
$url3 = $hospitalFaculty->getWenZhangUrl();
}
BeanFinder::get('LocalCache')->removeAll();
}
$url4 = $hospital->getReMapUrl();
$resArray[$hospitalFaculty->id]['item'] = array(
'keyword'=>$keyWord,
'url'=>$hospitalFaculty->getUrl(),
'creator'=>'haodf.com',
'title'=>$hospital->commonName.$hospitalFaculty->name." 好大夫在线",
'publishdate'=>date('Y-m-d', time()),
'content1'=>$content1,
'url1'=>$hospitalFaculty->getScheduleUrl(),
'url2'=>$hospitalFaculty->getDoctorUrl(),
'url3'=>$url3,
'url4'=>$url4,
);
unset($hospitalFaculty);
BeanFinder::get('LocalCache')->removeAll();
}
unset($hospitalFacultys, $doctors);
return $resArray;
}/*}}}*/
示例14: before
public function before($context)
{
$doctorId = Codec::getInstance()->decodeId($context->request->doctor_id);
$action = $context->action;
$redirectActionArray = array(
'step1account'
,'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');
}
}
示例15: index
public function index($request, $response)
{
/*{{{*/
$phoneNumber = '';
if (is_numeric($request->phonenumber)) {
$phoneNumber = $request->phonenumber;
} else {
$phoneNumber = Codec::getInstance()->decodeId($request->phonenumber);
}
if ($this->curOperator->isOffWork()) {
//$this->cleanCookie();
$response->setRedirect('/operator/login');
}
$response->showPhoneNumber = XString::hiddenTelNumber($phoneNumber);
$response->userName = $request->username;
$response->phoneNumber = $phoneNumber;
}