本文整理汇总了PHP中APF::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP APF::get_instance方法的具体用法?PHP APF::get_instance怎么用?PHP APF::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APF
的用法示例。
在下文中一共展示了APF::get_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_view
public function get_view()
{
$req = APF::get_instance()->get_request();
$data = $req->get_attributes();
$this->assign_data("data", $data);
return "Header";
}
示例2: convert_imageurl
public static function convert_imageurl($desc)
{
preg_match_all('/<img[alt\\s\\=\\"]*src="data:image\\/([^>\\"]*)"[alt\\s\\=\\"]*[\\/]?>/i', $desc, $matches);
//preg_match_all('/<img ([^>]*)" />/i', $desc, $matches);
if (empty($matches)) {
return $desc;
}
foreach ($matches[1] as $key => $str) {
$img_str = substr($str, strpos($str, ",") + 1);
$bin = base64_decode($img_str);
$upload_dir = APF::get_instance()->get_config('file_tmp_path');
$filename = md5($bin);
$path = $upload_dir . $filename;
file_put_contents($path, $bin);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$file_type = finfo_file($finfo, $path);
$post_params = array("file" => "@" . $path . ";type=" . $file_type);
$request_url = APF::get_instance()->get_config('file_upload_url');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
$info = curl_getinfo($ch);
$ret_value = json_decode($ret);
if (!$ret_value->error) {
$fetch_hash = $ret_value->saved_file[0]->hash;
}
$simple_url = Bll_AttachmentBiz::get_instance()->get_file_link_by_hash($fetch_hash);
$tag = '<img src="' . $simple_url . '" />';
$desc = str_replace($matches[0][$key], $tag, $desc);
}
return $desc;
}
示例3: initEnv
private function initEnv()
{
$this->objAPF = $objAPF = APF::get_instance();
$this->request = $this->objAPF->get_request();
$this->params = $this->request->get_parameters();
$this->debug = isset($_GET['debug']) ? true : false;
}
示例4: handle_request_internal
public function handle_request_internal()
{
$request = APF::get_instance()->get_request();
$brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
$cityId = self::$BrokerInfo['BaseInfo']['CITYID'];
try {
$starBll = new Bll_Broker_StarIntermediary($cityId);
$starIsOpen = $starBll->checkCityIfOpen();
if ($starIsOpen) {
$starInfo = $starBll->getBrokerNewestInfo($brokerId);
$brokerScore = $starInfo['broker']['brokerScore'] ?: 0;
$maxScore = $starInfo['city']['cityScore'] ?: 0;
$leftScore = $maxScore - $brokerScore > 0 ? $maxScore - $brokerScore : 0;
$clickScoreRate = sprintf("%.1f", $starInfo['city']['vppvBeishu'] ?: 0);
$isStar = $starInfo['broker']['isMingxing'] ?: 0;
$request->set_attribute('brokerScore', $brokerScore);
$request->set_attribute('maxScore', $maxScore);
$request->set_attribute('leftScore', $leftScore);
$request->set_attribute('clickScoreRate', $clickScoreRate);
$request->set_attribute('isStar', $isStar);
} else {
//todo 产品没有定义错误页面,工期太赶,没有时间处理
return;
}
} catch (Exception $e) {
//todo 不做任何处理
return;
}
return "Broker_StarIntermediary";
}
示例5: get_userinfo_from_ldap
public function get_userinfo_from_ldap($username, $password)
{
$config = @APF::get_instance()->get_config('ldap', 'ldap');
$url = $config['url'];
if ($config['host'] && $config['port']) {
$ldaphost = $config['host'];
$ldapport = $config['port'];
$data = array('u' => $username, 'p' => $password, 'f' => 'getinfo', 'host' => $ldaphost, 'port' => $ldapport);
} else {
$data = array('u' => $username, 'p' => $password, 'f' => 'getinfo');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
$login = json_decode(curl_exec($ch), true);
curl_close($ch);
$ldap_info = false;
if ($login['result']) {
$info = $login['result'];
for ($i = 0; $i < $info['count']; $i++) {
$ldap_info = new stdClass();
$ldap_info->chinese_name = $info[$i]['displayname'][0];
$ldap_info->english_name = $info[$i]['samaccountname'][0];
$ldap_info->email = $info[$i]['mail'][0];
}
}
return $ldap_info;
}
示例6: change_status
public function change_status($status, $input_arr)
{
$new_reporter = APF::get_instance()->get_request()->get_username();
$new_ticket = array('priority' => $this->ticket->priority, 'reporter' => $new_reporter, 'owner' => $this->ticket->owner, 'assigned_qa' => $this->ticket->assigned_qa, 'status' => 'opened', 'summary' => $this->ticket->summary, 'pmt_id' => $this->ticket->pmt_id, 'environment' => $this->ticket->environment, 'department' => $this->ticket->department, 'component' => $this->ticket->component, 'version' => $this->ticket->version, 'is_regression' => $this->ticket->is_regression, 'description' => $this->ticket->description, 'resolution' => '', 'reason' => '', 'reason_detail' => '');
$new_ticket_id = Bll_TicketBiz::get_instance()->ticket_add($new_ticket);
if ($input_arr['comments']) {
$current_time = date("Y-m-d H:i:s");
$log_id_comment = Bll_TicketLogBiz::get_instance()->comment_add($new_ticket_id, $input_arr['comments'], $new_reporter, $current_time);
}
$parent_ticket_id = $this->ticket->id;
$relation = Bll_TicketRelationBiz::get_instance()->find_root_by_parent($parent_ticket_id);
if ($relation) {
$root_ticket_id = $relation->root_ticket_id;
} else {
$root_ticket_id = $parent_ticket_id;
}
$new_relation = array();
$new_relation['ticket_id'] = $new_ticket_id;
$new_relation['parent_ticket_id'] = $parent_ticket_id;
$new_relation['root_ticket_id'] = $root_ticket_id;
$success = Bll_TicketRelationBiz::get_instance()->relation_add($new_relation);
//return $success;
if ($success) {
//reopen log add
$current_time = date("Y-m-d H:i:s");
$input_arr_log = array('ticket_id' => $new_ticket_id, 'created_by' => $new_reporter, 'field' => 'ticket', 'oldvalue' => 'null', 'newvalue' => $new_ticket['description'], 'created_at' => $current_time);
$log_id = Bll_TicketLogBiz::get_instance()->log_add($input_arr_log);
$location = Ticket_DetailController::build_uri() . "?ticket_id=" . $new_ticket_id;
APF::get_instance()->get_response()->redirect($location);
}
}
示例7: insertLoginLog
/**
* 插入经纪人登录日志
*
* @param int $splitSuffix
* @return array
*/
public static function insertLoginLog($userid, $usertype = 1)
{
//变量定义
$timestamp = time();
$date = date('Ymd');
$sql = sprintf("select LogId from `%s` where UserId=" . $userid . " and LoginDate='" . $date . "' and LoginFlag=1 limit 1", self::TABLE_NAME);
$oModel = Model_Log_BrokerLogin::data_access();
try {
$logInfo = $oModel->native_sql($sql, array());
} catch (Exception $e) {
$logInfo = array();
}
if (is_arrya($logInfo) && count($logInfo)) {
$logFlag = 0;
} else {
$logFlag = 1;
}
$ip = APF::get_instance()->get_request()->get_client_ip();
$remote_port = intval($_SERVER['REMOTE_PORT']);
$sqlInsert = sprintf("insert into `%s` (LogId,UserId,UserType,LoginTime,LoginDate,LoginFlag)) values('','{$userid}','{$usertype}','{$timestamp}','{$date}','{$logflag}')", static::getTableName($splitSuffix));
try {
$rowCount = $oModel->native_sql($sqlInsert, array(), false);
return 1 == $rowCount;
} catch (Exception $e) {
return false;
}
}
示例8: handle_request_internal
public function handle_request_internal()
{
$this->apf = APF::get_instance();
$this->request = $this->apf->get_request();
$this->response = $this->apf->get_response();
$this->params = $this->request->get_parameters();
$act = trim($this->params['act']);
$brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
$cityId = self::$BrokerInfo['BaseInfo']['CITYID'];
/*
if($cityId == 11){
APF::get_instance()->get_response()->redirect('/ajkbroker/commissions/mysale');
return false;
}
*/
switch ($act) {
case 'checkConsume':
$this->checkConsume($brokerId, $cityId);
break;
default:
echo json_encode("非法请求");
exit;
break;
}
}
示例9: handle_request_internal
public function handle_request_internal()
{
if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) {
$this->outData(array(), 0);
exit;
}
$this->apf = APF::get_instance();
$this->request = $this->apf->get_request();
$this->response = $this->apf->get_response();
$params = $this->request->get_parameters();
//经纪人ID
$this->brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
// TODO 替换为其他的方式
//经纪人城市ID
$this->cityId = self::$BrokerInfo['BaseInfo']['CITYID'];
$type = $params['type'];
switch ($type) {
case 'esf':
//二手房房源数据获取
$this->getBrokerEsfPro();
break;
case 'zf':
//租房房源数据获取
$this->getBrokerZfPro();
break;
default:
$this->outData(array(), 0);
break;
}
}
示例10: _checkSave
private function _checkSave()
{
// 验证ip是否合法
$clientIp = APF::get_instance()->get_request()->get_client_ip();
$configIp = APF::get_instance()->get_config('active_coupon_ip', 'customer');
return $clientIp == $configIp ? true : false;
}
示例11: handle_request_internal
public function handle_request_internal()
{
if (!isset($this->_params['cityId'])) {
return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
}
// 房屋类型 junyang
$protype = APF::get_instance()->get_config('housetype', 'zu_house');
$protype = isset($protype[$this->_params['cityId']]) ? $protype[$this->_params['cityId']] : $protype[0];
// 装修类型
$fitments = APF::get_instance()->get_config('ajk_fitment_unify', 'zu_house');
$fitment = $fitments[$this->_params['cityId']];
// 选择朝向
$toward = APF::get_instance()->get_config('toward', 'zu_house');
// 房屋配置
$deployment = APF::get_instance()->get_config('b_deployment', 'zu_house');
// 付款类型
$paytype = APF::get_instance()->get_config('paytype', 'zu_house');
// 合租类型
$sharetype = APF::get_instance()->get_config('sharetype', 'zu_house');
// 合租性别
$sharesex = APF::get_instance()->get_config('sharesex', 'zu_house');
//是否播种城市
$isseed = 0;
$cityTop = Bll_HzFixPlan::get_citytop($this->_params['cityId']);
if (!empty($cityTop)) {
$isseed = 1;
}
$return = array();
$return["status"] = "ok";
$return["data"] = array("protype" => $protype, "fitment" => $fitment, "toward" => $toward, "deployment" => $deployment, "paytype" => $paytype, "sharetype" => $sharetype, "sharesex" => $sharesex, 'isseed' => $isseed);
return $return;
}
示例12: execute
public function execute($input_parameters = NULL)
{
if (APF::get_instance()->is_debug_enabled()) {
APF::get_instance()->debug(__CLASS__ . '[' . $this->pdo->config['dsn'] . '|' . $this->pdo->get_name() . ']' . "->execute: " . $this->queryString);
}
$logger = APF::get_instance()->get_logger();
$logger->debug(__CLASS__, '[' . $this->pdo->get_name() . ']->execute: ', $this->queryString);
APF::get_instance()->pf_benchmark_inc_begin('dbtime');
$start = microtime(true);
$ret = parent::execute($input_parameters);
$end = microtime(true);
APF::get_instance()->pf_benchmark_inc_end('dbtime');
//add by hexin for record SQL execute time
APF::get_instance()->pf_benchmark("sql_time", array($this->i => $end - $start));
// 按照惯用格式记录sql执行时间和占用内存
// added by htlv
$tmp_time = $end - $start;
$tmp_mem = memory_get_usage();
apf_require_class('APF_Performance');
APF::get_instance()->pf_benchmark("sql_time_af", array($this->i => array('sql' => $this->_sql, APF_Performance::MESSAGE_TIME => $tmp_time, APF_Performance::MESSAGE_MEMORY => $tmp_mem)));
if (!$ret) {
$error_info = parent::errorInfo();
/**
* remove duplicated error log
$logger->error(__CLASS__, '['. $this->pdo->get_name() .']->execute: ', $this->queryString);
$_error_info = preg_replace("#[\r\n \t]+#",' ',print_r($error_info,true));
$logger->error(__CLASS__, '['. $this->pdo->get_name() .']->execute: ', $_error_info);
*/
if (parent::errorCode() !== '00000') {
throw new APF_Exception_SqlException($this->pdo->get_name() . ' | ' . $this->pdo->config['dsn'] . ' | ' . $this->queryString . ' | ' . join(' | ', $error_info), parent::errorCode());
}
}
return $ret;
}
示例13: handle_request
public function handle_request()
{
$apf = APF::get_instance();
$request = $apf->get_request();
$params = $request->get_parameters();
$baseDomain = $apf->get_config('base_domain', 'common');
$baseUri = defined('BASE_URI') ? BASE_URI : '';
$showUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/show";
$win = Model_Goodbroker_Baseinfo::data_access()->filter('is_deem', 1)->filter('top_ten', 1)->limit(10)->find_all();
$gbdao = new Bll_Goodbroker();
$vcrres = $gbdao->getResourceDAO();
$winids = '';
foreach ($win as $row) {
$winids .= $row->broker_id . ',';
}
$winids = substr($winids, 0, -1);
$vcrarr = $vcrres->getVcr($winids);
$varr = array();
foreach ($vcrarr as $row) {
$varr[$row['broker_id']] = $row['resource_url'];
}
$request->set_attribute('win', $win);
$request->set_attribute('varr', $varr);
$request->set_attribute('showUrl', $showUrl);
return 'Goodbroker_Win';
}
示例14: handle_request_internal
public function handle_request_internal()
{
// @params proids :房源id 多个id以逗号间隔如22,33,44【必填】
// @params brokerId :经纪人id【必填】
// @params token :token【必填】
// @params from :请求来源【必填】
$paramsApi['from'] = APF::get_instance()->get_config('java_api_from');
$paramsApi['proids'] = $this->_params['propIds'];
$paramsApi['token'] = $this->_params['token'];
$paramsApi['brokerId'] = $this->_params['brokerId'];
$brokerId = $this->_params['brokerId'];
//判断经纪人为ppc经纪人 & 套餐经纪人
//根据不同类型判断调用不同的java接口
if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
$paramsApi['isComboBroker'] = true;
$api_url = 'sale/properties/deletes?json';
} else {
$paramsApi['isComboBroker'] = false;
$api_url = 'ppc/properties/deletes?json';
}
$data = Util_CallAPI::callJavaInternalApi($api_url, $paramsApi, false);
if ($data['data']['status'] === 'ok') {
$ret = array('status' => 'ok', 'data' => array());
} else {
$errcode = $data['data']['code'];
$translate_errcode = $this->my_err_code($errcode);
return Util_MobileAPI::error($translate_errcode);
}
return $ret;
}
示例15: handle_request_internal
public function handle_request_internal()
{
$request = APF::get_instance()->get_request();
$managerCookie = $request->get_cookie('manager_id');
if (!empty($managerCookie)) {
echo json_encode(array('status' => 'error', 'data' => '没有操作权限。'));
return;
}
$houseIds = $request->get_parameter('houseIds');
$planId = $request->get_parameter('planId');
if (is_null($houseIds)) {
echo json_encode(array('status' => 'error', 'data' => '请输入房源ID'));
return;
}
$houseIds = explode(',', $houseIds);
$houseBaseInfoList = Bll_House_EsfHouse::getHouseInfoByHouseIdEx(static::$intBrokerID, $houseIds, static::$intBrokerCityID, array('proId'));
if (empty($houseBaseInfoList)) {
echo json_encode(array('status' => 'error', 'data' => '获取房源信息失败'));
return;
}
$houseIdList = array();
foreach ($houseBaseInfoList as $houseBaseInfo) {
$houseIdList[] = $houseBaseInfo['proId'];
}
$result = Bll_Ppc_ServiceAPI::fixPlanAddHouse(static::$intBrokerID, $houseIdList, $planId, 21181);
if ($result && strcasecmp('ok', $result['status']) == 0) {
echo json_encode(array('status' => 'ok', 'data' => '推广成功'));
} elseif ($result && strcasecmp('error', $result['status']) == 0) {
echo json_encode(array('status' => 'error', 'data' => $result['info']));
} else {
echo json_encode(array('status' => 'ok', 'data' => '推广成功', 'msg' => '调用API超时'));
}
}