本文整理汇总了PHP中kernel::single方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::single方法的具体用法?PHP kernel::single怎么用?PHP kernel::single使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::single方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: command_dd
function command_dd()
{
$args = func_get_args();
$options = $this->get_options();
$dd = kernel::single('dev_docbuilder_dd');
if (empty($args)) {
$dd->export();
} else {
foreach ($args as $app_id) {
$dd->export_tables($app_id);
}
}
if ($filename = $options['result-file']) {
ob_start();
$dd->output();
$out = ob_get_contents();
ob_end_clean();
if (!is_dir(dirname($filename))) {
throw new Exception('cannot find the ' . dirname($filename) . 'directory');
} elseif (is_dir($filename)) {
throw new Exception('the result-file path is a directory.');
}
file_put_contents($options['result-file'], $out);
echo 'data dictionary doc export success.';
} else {
$dd->output();
}
}
示例2: post_install
public function post_install()
{
kernel::log('Initial ectools');
kernel::single('base_initial', 'ectools')->init();
kernel::log('Initial Regions');
kernel::single('ectools_regions_mainland')->install();
}
示例3: callback
public function callback(&$recv)
{
$objMath = kernel::single('ectools_math');
$money = $objMath->number_multiple(array($recv['orderAmount'], 0.01));
$merid = $this->getConf('mer_id', substr(__CLASS__, 0, strrpos(__CLASS__, '_')));
$mer_key = $this->getConf('mer_key', substr(__CLASS__, 0, strrpos(__CLASS__, '_')));
$sign = $recv['signature'];
$sign_method = $recv['signMethod'];
$arrs = array("version" => $recv['version'], "charset" => $recv['charset'], "transType" => $recv['transType'], "respCode" => $recv['respCode'], "respMsg" => $recv['respMsg'], "merAbbr" => $recv['merAbbr'], "merId" => $recv['merId'], "orderNumber" => $recv['orderNumber'], "traceNumber" => $recv['traceNumber'], "traceTime" => $recv['traceTime'], "qid" => $recv['qid'], "orderAmount" => $recv['orderAmount'], "orderCurrency" => $recv['orderCurrency'], "respTime" => $recv['respTime'], "settleCurrency" => $recv['settleCurrency'], "settleDate" => $recv['settleDate'], "settleAmount" => $recv['settleAmount'], "exchangeDate" => $recv['exchangeDate'], "exchangeRate" => $recv['exchangeRate'], "cupReserved" => $recv['cupReserved']);
$chkvalue = $this->sign($arrs, $sign_method, $mer_key);
$ret['payment_id'] = $arrs['orderNumber'];
$ret['account'] = $arrs['merId'];
$ret['bank'] = app::get('ectools')->_('银联');
$ret['pay_account'] = app::get('ectools')->_('付款帐号');
$ret['currency'] = 'CNY';
$ret['money'] = $money;
$ret['paycost'] = '0.000';
$ret['cur_money'] = $money;
$ret['tradeno'] = $recv['traceNumber'];
// $ret['t_payed'] = strtotime($recv['settleDate']) ? strtotime($recv['settleDate']) : time();
$ret['t_payed'] = time();
$ret['pay_app_id'] = 'unionpay';
$ret['pay_type'] = 'online';
$ret['memo'] = 'unionpay';
if ($sign == $chkvalue && $recv['respCode'] == 00) {
$ret['status'] = 'succ';
} else {
$ret['status'] = 'failed';
}
return $ret;
}
示例4: getData
/**
* 获取单笔交易数据
*
* @param array $params 接口传入参数
* @return array
*/
public function getData($params, $oauth)
{
if (isset($oauth['shop_id'])) {
$filter['shop_id'] = $oauth['shop_id'];
} else {
if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
$filter['user_id'] = $params['oauth']['account_id'];
} elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
$sellerId = $params['oauth']['account_id'];
$filter['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $this->sellerId), 'seller');
}
}
if ($params['oid']) {
$params['oid'] = explode(',', $params['oid']);
}
$tradeInfo = kernel::single('systrade_getTradeData')->getTradeInfo($params['fields'], $params['tid'], $params['oid'], $filter);
if ($tradeInfo['dlytmpl_id']) {
$dlytmpl = app::get('systrade')->rpcCall('logistics.dlytmpl.get', ['template_id' => $tradeInfo['dlytmpl_id'], 'fields' => 'corp_id,name']);
$corptmpl = app::get('systrade')->rpcCall('logistics.dlycorp.get', ['corp_id' => $dlytmpl['corp_id'], 'fields' => 'corp_code,corp_name']);
$tradeInfo['dlytmpl_name'] = $dlytmpl['name'];
$tradeInfo['corptmpl_name'] = $corptmpl['corp_name'];
$tradeInfo['corptmpl_code'] = $corptmpl['corp_code'];
}
//这里判断货到付款
//现在判断货到付款在订单里没有字段标示,所以采用两个字段相结合,就是支付为线下支付且订单状态是待支付的时候,就判断为货到付款
if ($tradeInfo['pay_type'] == "offline" && $tradeInfo['type'] == "WAIT_SELLER_SEND_GOODS") {
$tradeInfo['is_cod'] = "true";
} else {
$tradeInfo['is_cod'] = "false";
}
$tradeInfo = $this->__paramsToString($tradeInfo);
return $tradeInfo;
}
示例5: validate
public function validate($cart_objects, &$condition)
{
$all = $condition['aggregator'] === 'all';
$true = (bool) $condition['value'];
if (!isset($condition['conditions'])) {
return true;
}
if (!is_array($condition['conditions'])) {
return false;
}
foreach ($condition['conditions'] as $_cond) {
if (!is_object($this->{$_cond}['type'])) {
$this->{$_cond}['type'] = kernel::single($_cond['type']);
}
$oCond = $this->{$_cond}['type'];
$validated = $oCond->validate($cart_objects, $_cond);
// return boolean
if ($all && $validated !== $true) {
// 所有不符合 如果有一个满足返回false
return false;
} elseif (!$all && $validated === $true) {
// 任意一条符合 则返回true
return true;
}
}
return $all ? true : false;
}
示例6: _get_obj
private static function _get_obj($obj_name)
{
$_obj_name = self::$_widgets_conf[$obj_name];
$object_class = self::$_prefix . $_obj_name;
$object = kernel::single($object_class);
return $object;
}
示例7: detail_basic
function detail_basic($id)
{
$arr = $this->app->model('sales_rule_goods')->dump($id);
$render = $this->app->render();
//会员等级
if ($arr['member_lv_ids']) {
$member_lv_id = explode(',', $arr['member_lv_ids']);
$member = $this->app->model('member_lv')->getList('*', array('member_lv_id' => $member_lv_id));
if (count($member_lv_id) > count($member)) {
$member[] = array('name' => '非会员');
}
$render->pagedata['member'] = $member;
}
//过滤条件
if ($arr['conditions']) {
if ($arr['c_template']) {
$render->pagedata['conditions'] = kernel::single($arr['c_template'])->tpl_name;
}
}
//优惠方案
if ($arr['action_solution']) {
if ($arr['s_template']) {
$render->pagedata['action_solution'] = kernel::single($arr['s_template'])->name;
}
}
$render->pagedata['rules'] = $arr;
return $render->fetch('admin/sales/finder/goods.html');
}
示例8: show
function show($gid, $item = 'ask', $limit)
{
$objComment = kernel::single('b2c_message_disask');
$aComment = $objComment->good_all_disask($gid, $item, 1, null, $limit);
$memberInfo = kernel::single('b2c_frontpage')->get_current_member();
$params['member_id'] = $memberInfo['member_id'];
if (!$params['member_id']) {
$aComment['setting']['login'] = 'nologin';
}
$validate_type = $item == 'discuss' ? 'discussReply' : $item;
// 评论回复/咨询/咨询回复的权限
$aComment['setting']['power_status'] = kernel::single('b2c_message_disask')->toValidate($validate_type, $params, $message);
$aComment['setting']['power_message'] = $message;
if ($item == 'ask') {
$aComment['gask_type'] = $objComment->gask_type($gid);
} else {
$point_status = app::get('b2c')->getConf('goods.point.status') ? app::get('b2c')->getConf('goods.point.status') : 'on';
if ($point_status == 'on') {
$objPoint = $this->app->model('comment_goods_point');
$aComment['goods_point'] = $objPoint->get_single_point($gid);
$aComment['total_point_nums'] = $objPoint->get_point_nums($gid);
$aComment['_all_point'] = $objPoint->get_goods_point($gid);
}
$aComment['point_status'] = $point_status;
}
return $aComment;
}
示例9: layout
public function layout()
{
$article_id = $this->_request->get_get('article_id');
$this->pagedata['layouts'] = kernel::single('content_article_single')->get_layout_list();
$this->pagedata['article_id'] = $article_id;
$this->display('admin/article/single/layout.html');
}
示例10: theme_widget_footer_information
/**
* ShopEx licence
*
* @copyright Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
* @license http://ecos.shopex.cn/ ShopEx License
*/
function theme_widget_footer_information(&$setting,&$smarty){
$setting['order'] or $setting['order'] = 'desc';
$setting['order_type'] or $setting['order_type'] = 'pubtime';
$orderby = $setting['order_type'].' '.$setting['order'];
$func = array('asc'=>'ksort','desc'=>'krsort');
$oMAI = app::get('content')->model('article_indexs');
$filter['ifpub'] = 'true';
$filter['pubtime|lthan'] = time();
$filter['article_id'] = $setting['article_id'];
$arr = $oMAI->getList('*',$filter,0,-1,$orderby);
$tmp['indexs'] = $arr;
$tmp['__stripparenturl'] = $setting['stripparenturl'];
$nodeItem= kernel::single('content_article_node')->get_node($setting['node_id']);
$tmp['node_name'] = $nodeItem['node_name'];
if( $tmp['homepage']=='true' )
$tmp['node_url'] = app::get('site')->router()->gen_url( array('app'=>'content', 'ctl'=>'site_article', 'act'=>'i', 'arg0'=>$setting['node_id']) );
else
$tmp['node_url'] = app::get('site')->router()->gen_url( array('app'=>'content', 'ctl'=>'site_article', 'act'=>'l', 'arg0'=>$setting['node_id']) );
return $tmp;
}
示例11: post_install
function post_install()
{
kernel::log('Initial themes');
kernel::single('site_theme_base')->set_last_modify();
kernel::single('site_theme_install')->initthemes();
$themes = kernel::single('site_theme_install')->check_install();
}
示例12: _instance
/**
* 实例化存储方式类
*/
private function _instance()
{
$params = $this->storage_policy();
$obj_name = 'importexport_policy_' . $params['policy'];
$this->policy_obj = kernel::single($obj_name);
return true;
}
示例13: cancelTrade
public function cancelTrade($params)
{
if ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "member") {
$params['user_id'] = $params['oauth']['account_id'];
} elseif ($params['oauth']['account_id'] && $params['oauth']['auth_type'] == "shop") {
$sellerId = $params['oauth']['account_id'];
$params['shop_id'] = app::get('systrade')->rpcCall('shop.get.loginId', array('seller_id' => $sellerId), 'seller');
}
$postData = array('filter' => array('tid' => $params['tid']), 'data' => array('status' => 'TRADE_CLOSED_BY_SYSTEM', 'end_time' => time(), 'cancel_reason' => $params['cancel_reason']));
if ($params['user_id']) {
$postData['filter']['user_id'] = $params['user_id'];
}
if ($params['shop_id']) {
$postData['filter']['shop_id'] = $params['shop_id'];
}
if ($params['oauth']['account_id']) {
$postData['operator']['op_id'] = $params['oauth']['account_id'];
$postData['operator']['op_account'] = $params['oauth']['account_name'];
$postData['operator']['account_type'] = $params['oauth']['auth_type'];
}
try {
kernel::single('systrade_data_trade_cancel')->generate($postData);
} catch (Exception $e) {
throw $e;
}
return true;
}
示例14: _init_aggregator
protected function _init_aggregator()
{
if (is_null($this->_aAggregator)) {
$aResult = array();
/*
// 这里会产生死循环的递归操作
// 暂时使用kernel::servicelist 内部的代码进行处理
foreach(kernel::servicelist($this->aggregator_apps) as $object) {
//if(get_class($this))
$aResult = array_merge($aResult,$object->getItem());
}*/
// 多个的时候也会出现递归的问题 这个得好好想想解决方案 2010-05-17 14:27 wubin
// todo 这里只是暂时的处理 等待解决方案 2010-05-14 15:21
$apps = app::get('base')->model('app_content')->getlist('content_path,app_id', array('content_type' => 'service', 'content_name' => $this->aggregator_apps));
foreach ($apps as $row) {
if ($row['content_path']) {
if ($row['content_path'] == get_class($this)) {
$aResult = array_merge($aResult, $this->getItem());
} else {
$aResult = array_merge($aResult, kernel::single($row['content_path'], app::get($row['app_id']))->getItem());
}
}
}
$this->_aAggregator = $aResult;
}
}
示例15: detail_columns_modifier
public function detail_columns_modifier(&$detail_pages)
{
if ($this->app->getConf('site.get_policy.method') == 1 && $detail_pages['detail_point']) {
unset($detail_pages['detail_point']);
}
$objuser = kernel::single('desktop_user');
if ($objuser->is_super()) {
return;
}
$perss = $objuser->group();
$get = $_GET;
$menu_path = 'app=' . $_GET['app'] . '&' . 'ctl=' . $_GET['ctl'] . '&' . 'act=' . $_GET['act'];
$menus = app::get('desktop')->model('menus');
$filter = array('menu_type' => 'menu', 'menu_path' => $menu_path);
$row = $menus->getList('*', $filter);
$detail_action = array_keys($detail_pages);
foreach ($row as $key => $v) {
if ($v['addon']) {
$addon = unserialize($v['addon']);
if ($addon['url_params'] && $addon['url_params']['action'] == 'detail') {
if (!in_array($v['permission'], (array) $perss)) {
if ($detail_pages[$addon['url_params']['finderview']]) {
unset($detail_pages[$addon['url_params']['finderview']]);
}
}
}
}
continue;
}
}