本文整理汇总了PHP中kernel::service方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::service方法的具体用法?PHP kernel::service怎么用?PHP kernel::service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::service方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tmpl_file, $app_id = null)
{
array_unshift($this->_files, $tmpl_file);
$this->_vars = $this->pagedata;
if ($p = strpos($tmpl_file, ':')) {
$object = kernel::service('tpl_source.' . substr($tmpl_file, 0, $p));
if ($object) {
$tmpl_file_path = substr($tmpl_file, $p + 1);
$last_modified = $object->last_modified($tmpl_file_path);
}
} else {
$tmpl_file = realpath(APP_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file);
$last_modified = filemtime($tmpl_file);
}
if (!$last_modified) {
//无文件
}
$compile_id = $this->compile_id($tmpl_file);
if ($object) {
$compile_code = $this->_compiler()->compile($object->get_file_contents($tmpl_file_path));
} else {
$compile_code = $this->_compiler()->compile_file($tmpl_file);
}
eval('?>' . $compile_code);
array_shift($this->_files);
}
示例2: check
public function check()
{
$this->begin();
$server_id = intval($_POST['server_id'][0]);
$server_setting = $this->app->model('serverlist')->dump($server_id, '*', array('database' => '*', 'http' => '*', 'ftp' => '*'));
$htdocs = $server_setting['http']['htdocs'];
$obj_dir = dir($htdocs);
$server = kernel::service('svhost_server', array('content_path' => 'svhost_server'));
$model_vhostlist = $this->app->model('vhostlist');
while (($domain = $obj_dir->read()) !== false) {
if (substr($domain, 0, 1) == '.') {
continue;
}
$site_root = "{$htdocs}/{$domain}";
if (is_file($site_root)) {
continue;
}
if (!strstr($domain, '.')) {
continue;
}
if ($server->is_exists($domain)) {
continue;
}
$domain_strip_dot = str_replace('.', '', $domain);
$sdf = array('domain' => $domain, 'server_id' => $server_id, 'ip' => $server_setting['server']['ip'], 'db' => array('host' => $server_setting['database']['host'], 'port' => $server_setting['database']['port'], 'name' => $domain_strip_dot, 'user' => $domain_strip_dot, 'password' => ''), 'ftp' => array('user' => $domain_strip_dot, 'password' => ''));
$model_vhostlist->save($sdf);
}
$this->end(true, __('检查完成!'));
}
示例3: dorecycle
function dorecycle($mdl_name, $filter = null)
{
$oRecycle = app::get('desktop')->model('recycle');
list($app_id, $table) = explode('_mdl_', $mdl_name);
$o = app::get($app_id)->model($table);
$recycle_item = array();
$recycle_item['drop_time'] = time();
$recycle_item['item_type'] = $o->table_name();
$dbschema = $o->get_schema();
$textColumn = $dbschema['textColumn'];
$pkey = $dbschema['idColumn'];
foreach ($dbschema['columns'] as $k => $col) {
if ($col['is_title'] && $col['sdfpath']) {
$textColumn = $col['sdfpath'];
break;
}
}
$rows = $o->getList('*', $filter, 0, -1);
if (method_exists($o, 'pre_recycle')) {
if (!$o->pre_recycle($rows)) {
return false;
}
}
$menus = app::get('desktop')->model('menus');
$permission_id = $menus->permissionId($_GET);
foreach ($rows as $k => $v) {
$pkey_value = $v[$pkey];
$v = $o->dump($v[$pkey], '*', 'delete');
$recycle_item['item_sdf'] = $v;
$recycle_item['app_key'] = $app_id;
$recycle_item['item_title'] = $v[$textColumn];
if (method_exists($o, 'title_recycle')) {
$recycle_item['item_title'] = $o->title_recycle($v);
}
$tmp = $recycle_item;
$tmp['permission'] = $permission_id;
$return = $oRecycle->save($tmp);
unset($tmp[$pkey]);
$o->delete(array($pkey => $pkey_value));
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog.system')) {
if (method_exists($obj_operatorlogs, 'dorecycle')) {
$obj_operatorlogs->dorecycle($v);
}
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
}
if (method_exists($o, 'suf_recycle')) {
if (!$o->suf_recycle($_POST)) {
return false;
}
}
$services = kernel::serviceList('desktop_finder_callback.' . get_class($o));
foreach ($services as $service) {
if (method_exists($service, 'recycle')) {
$service->recycle($_POST);
}
}
return true;
}
示例4: re_request
/**
* 重新发起数据同步的请求
* @param string id - 序号
* @param int call-time 发起时间
*/
public function re_request($order_no, $call_time)
{
$this->begin();
if (!$order_no || !$call_time) {
$this->end(false, app::get('b2c')->_('发起请求参数不全!'));
}
$obj_base_rpcpoll = app::get('base')->model('rpcpoll');
$tmp = $obj_base_rpcpoll->getList('*', array('id' => $order_no, 'calltime' => $call_time));
if ($tmp) {
$arr_rpcpoll = $tmp[0];
$arr_callback = explode(':', $arr_rpcpoll['callback']);
$callback = array('class' => $arr_callback[0], 'method' => $arr_callback[1]);
$rpc_poll_key = $arr_rpcpoll['id'] . '-' . $arr_rpcpoll['calltime'];
// 与中心交互
$obj_rpc_request_service = kernel::service('b2c.rpc.send.request');
if ($obj_rpc_request_service && method_exists($obj_rpc_request_service, 'rpc_recaller_request')) {
if ($obj_rpc_request_service instanceof b2c_api_rpc_request_interface) {
$obj_rpc_request_service->rpc_recaller_request($arr_rpcpoll['method'], $arr_rpcpoll['params'], $callback, $arr_rpcpoll['method'], 1, $rpc_poll_key);
}
} else {
$obj_rpc_request = kernel::single('b2c_order_data_relation');
$obj_rpc_request->form_request($arr_rpcpoll['method'], $arr_rpcpoll['params'], $callback, $arr_rpcpoll['method'], 1, $rpc_poll_key);
}
$this->end(true, app::get('b2c')->_('重新发送成功!'));
} else {
$this->end(false, app::get('b2c')->_('发起的请求不存在!'));
}
}
示例5: save
function save()
{
$this->begin('index.php?app=b2c&ctl=admin_brand&act=index');
$objBrand = $this->app->model('brand');
$brandname = $objBrand->dump(array('brand_name' => $_POST['brand_name'], 'brand_id'));
if (empty($_POST['brand_id']) && is_array($brandname)) {
$this->end(false, app::get('b2c')->_('品牌名重复'));
}
$_POST['ordernum'] = intval($_POST['ordernum']);
$data = $this->_preparegtype($_POST);
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog.goods')) {
$olddata = app::get('b2c')->model('brand')->dump($_POST['brand_id']);
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
if ($objBrand->save($data)) {
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog.goods')) {
if (method_exists($obj_operatorlogs, 'brand_log')) {
$obj_operatorlogs->brand_log($_POST, $olddata);
}
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
$this->end(true, app::get('b2c')->_('品牌保存成功'));
} else {
$this->end(false, app::get('b2c')->_('品牌保存失败'));
}
}
示例6: update
/**
* 订单备注添加
* @param array sdf
* @param string message
* @return boolean success or failure
*/
public function update(&$sdf, &$msg = '')
{
// 备注订单是和中心的交互
$order = $this->app->model('orders');
$arr_order = $order->getList('*', array('order_id' => $sdf['orderid']));
if ($arr_order[0]) {
if ($arr_order[0]['mark_text']) {
$arr_order[0]['mark_text'] = unserialize($arr_order[0]['mark_text']);
}
$arr_order[0]['mark_text'][] = array('mark_text' => str_replace("\n", ' ', $sdf['mark_text']), 'add_time' => time(), 'op_name' => $sdf['op_name']);
$arr_order[0]['mark_text'] = serialize($arr_order[0]['mark_text']);
}
$data['order_id'] = $sdf['orderid'];
$data['mark_text'] = $arr_order[0]['mark_text'] ? $arr_order[0]['mark_text'] : $sdf['mark_text'];
$data['mark_type'] = $sdf['mark_type'];
$is_success = $order->save($data);
if ($is_success) {
//$this->request($sdf, 'store.trade.memo.update');
//ajx 订单备注走2.0新接口
if ($order_object = kernel::service('b2c_order_rpc_async')) {
$order_object->modifyActive($sdf['orderid']);
}
return true;
} else {
$msg = app::get('b2c')->_("订单备注保存失败!");
return false;
}
}
示例7: rpc_notify
public function rpc_notify($order_id, $sdf = array())
{
if (!$order_id) {
return;
}
// 普通一般订单不做处理,只是实现这个接口。
$obj_order = $this->app->model('orders');
$subsdf = array('order_objects' => array('*', array('order_items' => array('*', array(':products' => '*')))), 'order_pmt' => array('*'));
$objOrder = $obj_order->dump($order_id, '*', $subsdf);
$obj_order_create = kernel::single("b2c_order_create");
// 首先发送订单。
$obj_rpc_request_service = kernel::service('b2c.rpc.send.request');
if ($obj_rpc_request_service && method_exists($obj_rpc_request_service, 'rpc_caller_request')) {
if ($obj_rpc_request_service instanceof b2c_api_rpc_request_interface) {
$obj_rpc_request_service->rpc_caller_request($objOrder, 'create');
}
} else {
$obj_order_create->rpc_caller_request($objOrder);
}
// 判断是否需要其他的请求 - 暂时只有支付后的业务
$app_ectools = app::get('ectools');
$objModelPay = $app_ectools->model('payments');
$obj_order_bills = $app_ectools->model('order_bills');
$sql = 'SELECT * FROM ' . $objModelPay->table_name(1) . ' AS payments' . ' LEFT JOIN ' . $obj_order_bills->table_name(1) . ' AS bill ON bill.bill_id=payments.payment_id' . ' WHERE bill.bill_type="payments" AND bill.rel_id=\'' . $obj_order_bills->db->quote($order_id) . '\' AND (status=\'succ\' OR status=\'progress\')';
if ($row = $obj_order_bills->db->select($sql)) {
$arr_data = array();
$arr_data = $row[0];
$arr_data['order_id'] = $arr_data['rel_id'];
unset($arr_data['rel_id']);
$obj_order_pay = kernel::single('b2c_order_pay');
$obj_order_pay->request($arr_data);
}
}
示例8: to_reply
function to_reply()
{
$this->begin("javascript:finderGroup[" . "'" . $_GET["finder_id"] . "'" . "].refresh()");
$comment_id = $_POST['comment_id'];
$comment = $_POST['reply_content'];
if ($comment_id && $comment) {
$member_comments = kernel::single('b2c_message_msg');
if ($member_comments->to_reply($_POST)) {
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog.members')) {
if (method_exists($obj_operatorlogs, 'reply_comment')) {
$sdf['comment'] = $comment_id;
$sdf['title'] = $comment;
$sdf['object_type'] = 'msg';
$obj_operatorlogs->reply_comment($sdf);
}
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
$this->end(true, app::get('b2c')->_('回复成功'));
} else {
$this->end(false, app::get('b2c')->_('回复失败'));
}
} else {
$this->end(false, app::get('b2c')->_('内容不能为空'));
}
}
示例9: input_region
function input_region($params)
{
if ($params['required'] == 'true') {
$params['vtype'] = 'area';
}
$package = kernel::service('ectools_regions.ectools_mdl_regions');
$params['package'] = $package->key;
if (!$params['callback']) {
unset($params['callback']);
}
$render = app::get('ectools')->render();
$render->pagedata['params'] = $params;
$area_depth = app::get('ectools')->getConf('system.area_depth');
$aDepth = array();
for ($i = 0; $i < $area_depth; $i++) {
$aDepth[] = $i;
}
$render->pagedata['area_depth'] = $aDepth;
if (ECAE_MODE) {
$render->pagedata['region_data'] = app::get('ectools')->getConf('system.region_data');
}
if ($params['platform'] == 'iswap') {
$views = 'wap/common/region.html';
} else {
$views = 'common/region.html';
}
return $render->fetch($views);
}
示例10: __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 {
kernel::log('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]);
}
示例11: save
function save()
{
$this->begin();
$mem_wit = $this->app->model('member_withdrawal');
$mem_adv = $this->app->model('member_advance');
$row = $mem_wit->dump($_POST['id']);
if (!$row || $row['has_op'] == 'true') {
$this->end(false, app::get('b2c')->_('该数据已经处理!'));
}
$data['modify_advance'] = -$row['amount'];
$data['modify_memo'] = $_POST['remark'];
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog.members')) {
$olddata = app::get('b2c')->model('members')->dump($data['member_id']);
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
if (!$mem_adv->adj_amount($row['member_id'], $data, $msg, false)) {
$this->end(false, app::get('b2c')->_($msg));
}
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog.members')) {
if (method_exists($obj_operatorlogs, 'detail_advance_log')) {
$newdata = app::get('b2c')->model('members')->dump($data['member_id']);
$obj_operatorlogs->detail_advance_log($newdata, $olddata);
}
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
$_POST['has_op'] = 'true';
if ($mem_wit->save($_POST)) {
$this->end(true, app::get('b2c')->_('保存成功'));
} else {
$this->end(false, app::get('b2c')->_('保存失败'));
}
}
示例12: __construct
function __construct()
{
$obj = kernel::service('base_charset');
if ($obj instanceof base_charset_interface) {
$this->set_instance($obj);
}
}
示例13: __construct
function __construct()
{
if (!setlocale(LC_ALL, 'zh_CN.gbk')) {
setlocale(LC_ALL, "chs");
}
$this->charset = kernel::service('ectools_charset');
}
示例14: _send
function _send($sendMethod, $tmpl_name, $target, $data, $type, $title = null)
{
$sender =& $this->_load($sendMethod);
$this->_ready($sender);
if (!$this->_systmpl) {
$this->_systmpl =& $this->app->model('member_systmpl');
}
$content = $this->_systmpl->fetch($tmpl_name, $data);
$tile = $this->loadTitle($type, $sendMethod, '', $data);
$service = kernel::service("b2c.messenger.fireEvent_content");
if (is_object($service)) {
if (method_exists($service, 'get_content')) {
$content = $service->get_content($content);
}
$tile = $service->get_content($tile);
}
if ($tile == '') {
$tile = app::get('site')->getConf('site.name');
}
$sender->config['shopname'] = app::get('site')->getConf('site.name');
// Andrew 20120929
// 接管消息系统
// $sender->send($target,$tile,$content,$sender->config);
$services = kernel::servicelist("custom.message.send");
foreach ($services as $service) {
$service->send($sendMethod, $target, $tile, $content, $sender->config);
}
return $ret || !is_bool($ret);
}
示例15: check_order
function check_order($orders)
{
$cancel_mdl = app::get('starbuy')->model('cancelorder');
$obj_checkorder = kernel::service('b2c_order_apps', array('content_path' => 'b2c_order_checkorder'));
foreach ($orders as $key => $val) {
$oid = $val['order_id'];
if ($obj_checkorder->check_order_cancel($oid)) {
$sdf['order_id'] = $oid;
$sdf['op_id'] = 1;
// $this->user->user_id;
$sdf['opname'] = "admin";
//$this->user->user_data['account']['login_name'];
$sdf['account_type'] = "shopadmin";
//$this->user->account_type;
$sdf['op_id'] = $this->user->user_id;
$sdf['opname'] = $this->user->user_data['account']['login_name'];
$sdf['account_type'] = $this->user->account_type;
$b2c_order_cancel = kernel::single("b2c_order_cancel");
if ($b2c_order_cancel->generate($sdf, $null, $message)) {
if ($order_object = kernel::service('b2c_order_rpc_async')) {
$order_object->modifyActive($sdf['order_id']);
}
$cancel_mdl->delete(array('order_id' => $oid));
}
}
}
}