本文整理汇总了PHP中logger::error方法的典型用法代码示例。如果您正苦于以下问题:PHP logger::error方法的具体用法?PHP logger::error怎么用?PHP logger::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logger
的用法示例。
在下文中一共展示了logger::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* 订单完成\归档.
*
* @param $sdf array 订单ID\操作者ID\操作者名称
*
* @return bool - 成功与否
*/
public function generate($sdf, &$msg = '')
{
$mdl_order = app::get('b2c')->model('orders');
$order_sdf = $mdl_order->dump($sdf['order_id']);
//订单作废前验证
foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
if (!$service->exec($order_sdf, $msg)) {
return false;
}
}
$order_sdf['status'] = 'finish';
// 更新退款日志结果
if ($mdl_order->save($order_sdf)) {
//订单日志记录
vmc::singleton('b2c_order_log')->set_operator(array('ident' => $sdf['op_id'] ? $sdf['op_id'] : $order_sdf['member_id'], 'model' => $sdf['op_id'] ? 'shopadmin' : 'members', 'name' => $sdf['op_name'] ? $sdf['op_name'] : '会员'))->set_order_id($order_sdf['order_id'])->success('finish', '订单已完成归档!', $order_sdf);
} else {
$msg = '完成\\归档失败!';
return false;
}
//订单作废时同步扩展服务
foreach (vmc::servicelist('b2c.order.end.finish') as $service) {
if (!$service->exec($order_sdf, $msg)) {
//记录日志,不中断
logger::error($sdf['order_id'] . '完成归档时出错!' . $msg);
}
}
return true;
}
示例2: dologin
public function dologin()
{
$enc_str = $_GET['enc_str'];
$enc_str = app::get('mobile')->router()->decode_args($enc_str);
$member_id = $_GET['mid'];
$decode_enc = utils::decrypt($enc_str);
$session_id = $decode_enc['session_id'];
if ($session_id) {
$session_arr = explode('|', $session_id);
$session_id = $session_arr[0];
$time = $session_arr[1];
if (time() - (int) $time > 3600) {
//超时
logger::error('微信登录失败!超时.' . var_export($_GET, 1) . var_export($decode_enc, 1));
$this->display('mobile/wxloginerror.html');
exit;
}
vmc::singleton('base_session')->set_sess_id($session_id);
vmc::singleton('base_session')->start();
vmc::singleton('b2c_user_object')->set_member_session($member_id);
$member_id = vmc::singleton('b2c_user_object')->get_member_session();
$member = app::get('b2c')->model('members')->dump($member_id);
if ($member) {
$this->pagedata['member'] = $member;
$this->display('mobile/wxloginsuccess.html');
} else {
logger::error('微信登录失败!未知会员数据.' . var_export($_GET, 1) . var_export($decode_enc['session_id'], 1));
$this->display('mobile/wxloginerror.html');
}
} else {
logger::error('微信登录失败!未知SESSION_ID.' . var_export($_GET, 1) . var_export($decode_enc['session_id'], 1));
$this->display('mobile/wxloginerror.html');
}
}
示例3: is_return_vaild
public function is_return_vaild($form, $key, $secu_id)
{
$_key = $key;
$sign_type = $secu_id;
$get = $this->para_filter($form);
//对所有GET反馈回来的数据去空
$sort_get = $this->arg_sort($get);
//对所有GET反馈回来的数据排序
$mysign = $this->build_mysign($sort_get, $_key, $sign_type);
//生成签名结果
$mysign = strtoupper($mysign);
if ($mysign == $form['sign']) {
return true;
}
#记录返回失败的情况
logger::error(app::get('ectools')->_('支付单号:') . $form['out_trade_no'] . app::get('ectools')->_('签名验证不通过,请确认!') . "\n");
logger::error(app::get('ectools')->_('本地产生的加密串:') . $mysign);
logger::error(app::get('ectools')->_('手机财付通传递打过来的签名串:') . $form['sign']);
$str_xml .= "<tenpayform>";
foreach ($form as $key => $value) {
$str_xml .= "<{$key}>" . $value . "</{$key}>";
}
$str_xml .= "</tenpayform>";
return false;
}
示例4: send
public function send($target, $title, $content, $config)
{
$tmpl_data = $config['tmpl_data'];
$action_name = $config['action_name'];
$action_name_alias = $config['action_name_alias'];
$new_msg = array('member_id' => $target['member_id'], 'target' => $target['mobile'], 'subject' => $title, 'content' => $content . $this->platform_config['sms_sign'], 'createtime' => time(), 'msg_type' => 'sms', 'status' => 'sent');
app::get('b2c')->model('member_msg')->save($new_msg);
if (!$target['mobile']) {
return false;
}
if (empty($this->platform_config['url']) || empty($this->platform_config['params_tmpl'])) {
return false;
}
$args = array('target' => $target['mobile'], 'content' => $content . $this->platform_config['sms_sign'], 'tmpl_data' => json_encode($tmpl_data), 'time' => date('Y-m-d H:i:s'), 'action' => $action_name, 'action_alias' => $action_name_alias);
//需要获得access_token
if (!empty($this->platform_config['access_token_action'])) {
if (!($args['access_token'] = $this->get_access_token($this->platform_config['access_token_action']))) {
logger::error($this->platform_config['name'] . 'access_token获得失败,无法调用短信发送API');
return false;
}
}
$params = $this->gen_params($this->platform_config['params_tmpl'], $args);
$result = $this->net->post($this->platform_config['url'], $params);
logger::debug(__CLASS__ . $this->platform_config['url']);
logger::debug(var_export($params, 1));
logger::debug(var_export($result, 1));
return true;
}
示例5: __call
public function __call($method, $params)
{
//api 版本历史
$apiv_history = array('2.0', '1.0');
$api_info = base_rpc_service::$api_info;
$api_obj = NULL;
$flag = false;
foreach ($apiv_history as $v) {
if ($this->apiv == $v) {
$flag = true;
}
if ($flag) {
$service = 'apiv_' . $v . '_' . $api_info['api_name'];
$api_obj = kernel::service($service);
if (method_exists($api_obj, $method)) {
break;
} else {
logger::error('apiv service:' . $service . ', method:' . $method . ' not found!');
}
}
}
if (!$api_obj || !method_exists($api_obj, $method)) {
trigger_error('server reject!', E_USER_ERROR);
}
//return call_user_func_array(array( &$api_obj, $method ), $params);
return $api_obj->{$method}($params[0], $params[1]);
}
示例6: call
public function call($method, $params, $appId)
{
$prismHost = config::get('prism.prismHostUrl');
$prismSocketFile = config::get('prism.prismSocketFile');
//获取应用对应的key和secret
$keySecret = apiUtil::getPrismKey($appId);
$key = $keySecret['key'];
$secret = $keySecret['secret'];
//获取path
$path = apiUtil::genApiPath($method);
//params加入系统数据
$systemParams = $this->__genSystemParams($method);
$params = array_merge($params, $systemParams);
$params['method'] = $method;
//实例化请求工具
$client = new base_prism_client($prismHost, $key, $secret, $prismSocketFile);
//$path = "/api/bbc?method=bbc.test";
$result = $client->post($path, $params);
//日志记录
//之前request和response分开记录的,发现不容易找,只好放一起了
logger::info('call API : ' . $method . "\n" . 'wiht host : ' . $prismHost . "\n" . 'wiht key : ' . $key . "\n" . 'wiht secret : ' . $secret . "\n" . 'with params :' . var_export($params, 1) . "\n" . 'api result : ' . $result . "\n");
//这里是返回数据
$result = json_decode($result, 1);
if ($result['error'] == null) {
return $result['result'];
} else {
//根据返回的数据是否错误,如果有错误,尽量以原有异常抛出
$exception = $result['error']['exception'] ? $result['error']['exception'] : 'Exception';
logger::error(var_export($result, 1));
$e = new $exception($result['error']['message']);
throw $e;
}
}
示例7: exec
/**
* 订单创建完成时
* @params array - 订单完整数据,含ITEMS
* @return boolean - 执行成功与否
*/
public function exec($sdf, &$msg = '')
{
logger::debug($sdf['order_id'] . 'createfinish exec');
if ($sdf['is_cod'] == 'Y') {
$freeze_data = array();
foreach ($sdf['items'] as $key => $item) {
//购买数量计数
vmc::singleton('b2c_openapi_goods', false)->counter(array('goods_id' => $item['goods_id'], 'buy_count' => $item['nums'], 'buy_count_sign' => md5($item['goods_id'] . 'buy_count' . $item['nums'] * 1024)));
//组织库存冻结数据
$freeze_data[] = array('sku' => $item['bn'], 'quantity' => $item['nums']);
}
//库存冻结
if (!vmc::singleton('b2c_goods_stock')->freeze($freeze_data, $msg)) {
logger::error('库存冻结异常!ORDER_ID:' . $sdf['order_id'] . ',' . $msg);
}
}
/* 订单金额为0 **/
$order_sdf = $sdf;
if ($order_sdf['order_total'] == '0') {
// 生成支付账单
$obj_bill = vmc::singleton('ectools_bill');
$bill_sdf = array('bill_type' => 'payment', 'pay_object' => 'order', 'pay_mode' => in_array($order_sdf['pay_app'], array('-1', 'cod', 'offline')) ? 'offline' : 'online', 'order_id' => $order_sdf['order_id'], 'pay_app_id' => $order_sdf['pay_app'], 'pay_fee' => $order_sdf['cost_payment'], 'member_id' => $order_sdf['member_id'], 'status' => 'succ', 'money' => $order_sdf['order_total'], 'memo' => '订单0元时自动生成');
if (!$obj_bill->generate($bill_sdf, $msg)) {
//TODO 自动支付失败,
logger::error('订单0元时自动支付失败!' . $msg);
return;
}
}
return true;
}
示例8: __construct
function __construct($app)
{
$this->app = $app;
$this->sitemap = app::get('wap')->getConf('sitemaps');
// print_r($this->sitemap);exit;
if (!is_array($this->sitemap)) {
$sitemap_config = kernel::single('wap_module_base')->assemble_config();
if (is_array($sitemap_config)) {
$this->sitemap = $sitemap_config;
//todo:兼容kvstroe出错的情况下
if (!kernel::single('wap_module_base')->write_config($sitemap_config)) {
logger::error('Error: sitemap can\'t save to kvstore');
//todo:如果写入失败,记录于系统日志中,前台不报错,保证网站运行正常
}
} else {
//if false
trigger_error('sitemap is lost!', E_USER_ERROR);
//todo:无sitemap时报错
}
}
foreach ($this->sitemap as $part => $controller) {
$urlmap[$controller[0] . ':' . $controller[1]] = $part;
if ($controller[3]) {
$extmap[$part] = '.' . $controller[3];
}
}
$this->urlmap = $urlmap;
$this->extmap = $extmap;
$this->_request = kernel::single('base_component_request');
$this->_response = kernel::single('base_component_response');
}
示例9: check
/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
* @return bool
*/
public static function check($value, $hashedValue, base_hashing_hasher_interface $hasher = null)
{
if (!$hasher) {
$hasher = kernel::single('base_hashing_hasher_bcrypt');
}
logger::error(var_export(array($value, $hashedValue), 1));
return $hasher->check($value, $hashedValue);
}
示例10: exec
/**
* 订单发货操作完成时.
*
* @delivery_sdf array - 发货单据SDF
* @msg 异常消息
*
* @return bool - 执行成功与否
*/
public function exec($delivery_sdf, &$msg = '')
{
$order_id = $delivery_sdf['order_id'];
if (!$order_id) {
$msg = '未知订单id';
return false;
}
$all_send = true;
$order_items = app::get('b2c')->model('order_items')->getList('*', array('order_id' => $order_id));
$order_items = utils::array_change_key($order_items, 'item_id');
foreach ($delivery_sdf['delivery_items'] as $item) {
$order_items[$item['order_item_id']]['sendnum'] += $item['sendnum'];
if ($order_items[$item['order_item_id']]['sendnum'] > $order_items[$item['order_item_id']]['nums']) {
$msg = '发货异常,超出应发数量';
return false;
}
if ($order_items[$item['order_item_id']]['sendnum'] < $order_items[$item['order_item_id']]['nums']) {
$all_send = false;
//部分发货
}
}
$order_sdf = array('order_id' => $order_id, 'items' => $order_items, 'ship_status' => $all_send ? '1' : '2');
if (!app::get('b2c')->model('orders')->save($order_sdf)) {
$msg = '订单状态修改失败!';
return false;
}
//库存冻结释放,真实扣除库存
$stock_data = array();
foreach ($delivery_sdf['delivery_items'] as $key => $value) {
$stock_data[] = array('sku' => $value['bn'], 'quantity' => $value['sendnum']);
}
if (!vmc::singleton('b2c_goods_stock')->unfreeze($stock_data, $msg)) {
logger::error('库存冻结释放异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
}
if (!vmc::singleton('b2c_goods_stock')->delivery($stock_data, $msg)) {
logger::error('库存扣减异常!ORDER_ID:' . $order_sdf['order_id'] . ',' . $msg);
}
//订单日志记录
vmc::singleton('b2c_order_log')->set_operator(array('ident' => $delivery_sdf['op_id'], 'model' => 'shopadmin', 'name' => '操作员'))->set_order_id($order_sdf['order_id'])->success('shipment', '订单' . (!$all_send ? '部分' : '') . '发货成功!', $delivery_sdf);
/*
* 消息通知
* @args1 事件名称
* @args2 消息模板数据填充
* @args3 消息目标
*/
$pam_data = vmc::singleton('b2c_user_object')->get_pam_data('*', $delivery_sdf['member_id']);
logger::debug('pam_data' . var_export($pam_data, 1));
$dlycorp = app::get('b2c')->model('dlycorp')->dump($delivery_sdf['dlycorp_id']);
$consignee_area = $delivery_sdf['consignee']['area'];
$consignee_area = explode(':', $consignee_area);
$consignee_area = $consignee_area[1];
//消息模板参数
$env_list = array('order_id' => $delivery_sdf['order_id'], 'consignee_name' => $delivery_sdf['consignee']['name'], 'consignee_area' => $consignee_area, 'consignee_addr' => $delivery_sdf['consignee']['addr'], 'consignee_tel' => $delivery_sdf['consignee']['tel'], 'consignee_mobile' => $delivery_sdf['consignee']['mobile'], 'dlycorp_name' => $dlycorp['name'], 'dlycorp_code' => $dlycorp['corp_code'], 'dlycorp_website' => $dlycorp['website'], 'logistics_no' => $delivery_sdf['logistics_no'], 'timestr' => date('Y-m-d H:i:s', $delivery_sdf['last_modify']));
vmc::singleton('b2c_messenger_stage')->trigger('orders-shipping', $env_list, array('mobile' => $pam_data['mobile'] ? $pam_data['mobile']['login_account'] : $order_sdf['consignee']['mobile'], 'email' => $pam_data['email'] ? $pam_data['email']['login_account'] : $order_sdf['consignee']['email'], 'member_id' => $delivery_sdf['member_id']));
return true;
}
示例11: error_handler
function error_handler($code, $msg, $file, $line)
{
if ($code == ($code & (E_ERROR ^ E_USER_ERROR ^ E_USER_WARNING))) {
logger::error(sprintf('ERROR:%d @ %s @ file:%s @ line:%d', $code, $msg, $file, $line));
if ($code == ($code & (E_ERROR ^ E_USER_ERROR))) {
exit;
}
}
return true;
}
示例12: loadModule
public function loadModule($moduleName)
{
$moduleName .= "Action";
$class_file = $this->getLocation($moduleName);
try {
require_once $class_file;
} catch (Exception $ex) {
logger::error("can not load module" . $class_file, $ex, "ModuleLoader");
}
$mod_obj = new $moduleName();
return $mod_obj;
}
示例13: call
public function call($conn, $path, $params, $method_type = 'get')
{
$caller = new PrismClient($conn['host'], $conn['key'], $conn['secret']);
if (in_array($method_type, array('get', 'post', 'delete', 'put'))) {
$result = call_user_func_array(array($caller, $method_type), array($path, $params));
}
$result = json_decode($result, true);
if ($result['error'] != null) {
logger::error(var_export(['conn' => $conn, 'path' => $path, 'params' => $params, 'method' => $method_type, 'result' => $result], 1));
throw new RuntimeException($result['error']['code'] . ':' . $result['error']['message'], $result['error']['code']);
}
return $result['result'];
}
示例14: register
static function register($data = null)
{
$sys_params = base_setup_config::deploy_info();
$code = md5(microtime());
base_kvstore::instance('ecos')->store('net.handshake', $code);
$app_exclusion = app::get('base')->getConf('system.main_app');
/** 得到框架的总版本号 **/
$obj_apps = app::get('base')->model('apps');
$tmp = $obj_apps->getList('*', array('app_id' => 'base'));
$app_xml = $tmp[0];
$app_xml['version'] = $app_xml['local_ver'];
if (defined('CERTIFICATE_SAS') && constant('CERTIFICATE_SAS')) {
$data = array('certi_app' => 'open.reg', 'app_id' => 'ecos.' . $app_exclusion['app_id'], 'url' => $data ? $data : kernel::base_url(1), 'result' => $code, 'version' => $app_xml['version']);
} else {
$conf = base_setup_config::deploy_info();
$data = array('certi_app' => 'open.reg', 'identifier' => base_enterprise::ent_id(), 'password' => base_enterprise::ent_ac(), 'product_key' => $conf['product_key'], 'url' => $data ? $data : kernel::base_url(1), 'result' => $code, 'version' => $app_xml['version'], 'api_ver' => '1.3');
}
$http = kernel::single('base_httpclient');
$http->set_timeout(6);
$result = $http->post(LICENSE_CENTER, $data);
//todo: 声称获取一个唯一iD,发给飞飞
$result = json_decode($result, 1);
if ($result['res'] == 'succ') {
if ($result['info']) {
/*
if ($result['info']['node_id'])
{
$arr_shop_node_id = array(
'node_id' => $result['info']['node_id'],
);
base_shopnode::set_node_id($arr_shop_node_id,$app_exclusion['app_id']);
unset($result['info']['node_id']);
}
*/
//1.3接口不再返回node_id信息
base_shopnode::register($app_exclusion['app_id']);
$certificate = $result['info'];
$flag = self::set_certificate($certificate);
if ($flag) {
app::get('base')->setConf('certificate_code_url', $data['url']);
return true;
} else {
return false;
}
}
} else {
//throw new Exception(LICENSE_CENTER." return ".$result['res']."error is-- ".$result['code'].",".$result['msg']);
logger::error('create certificate_id faile, reason:' . LICENSE_CENTER . " return " . $result['res'] . "error is " . $result['code'] . "," . $result['msg'], false, LOG_ERR);
return false;
}
}
示例15: command_create
function command_create($project_name)
{
$options = $this->get_options();
$options['template'] = $options['template'] ? $options['template'] : 'dev_app';
list($template, $template_args) = explode(':', $options['template']);
$project_prototype = kernel::single($template);
$project_path = $project_prototype->init($project_name, $template_args);
if ($project_path) {
$project = array('name' => $project_name, 'path' => $project_path, 'createtime' => time(), 'type' => $options['template']);
dev_project::save($project);
logger::info('Write project info... ok.');
} else {
logger::error('error.');
}
}