function main() { $oIo = kernel::servicelist('desktop_io'); foreach ($oIo as $aIo) { if ($aIo->io_type_name == substr($_FILES['import_file']['name'], -3)) { $oImportType = $aIo; break; } } unset($oIo); $handle = fopen($_FILES['import_file']['tmp_name'], "r"); $line = 0; $saveData = array(); $appId = $this->app->app_id; $mdl = substr($this->object_name, strlen($this->app->app_id . '_mdl_')); $oImportType->prepared_import($appId, $mdl); while ($contents = $oImportType->fgethandle($handle)) { $return = $oImportType->import($contents, $appId, $mdl); if ($return['0'] == 'failure') { header("content-type:text/html; charset=utf-8"); echo "<script>alert(\"上传失败\\n失败原因:" . $return[1]['error'] . "\")</script>"; exit; } $line++; } $oImportType->finish_import(); fclose($handle); echo "<script>alert(\"上传成功 已加入队列 系统会自动跑完队列" . ($return[1]['warning'] ? "但是存在如下问题 \\n" . implode("\\n", array_keys($return[1]['warning'])) : '') . "\")</script>"; }
function result() { $this->set_no_store(); $oSearch =& $this->app->model('search'); $emu_static = $this->app->getConf('system.seo.emuStatic'); foreach (kernel::servicelist("search.prepare") as $obj) { $obj->parse($_POST); } $cat_id = $_POST['cat_id']; unset($_POST['cat_id']); foreach ($_POST as $k => $v) { if ($k == "name" && $_POST[$k][0]) { $_POST[$k][0] = str_replace('_', '%xia%', $_POST[$k][0]); $_POST[$k][0] = strip_tags($_POST[$k][0]); } if ($k == "price" && $_POST[$k][1]) { $_POST[$k][0] = floatval($_POST[$k][0]); $_POST[$k][1] = floatval($_POST[$k][1]); } } if (isset($_POST['filter']) && ($filter = $oSearch->decode($_POST['filter'], $path))) { $filter = array_merge($filter, $_POST); } else { $filter = $_POST; } unset($_POST['filter']); $filter = $oSearch->encode($filter); if (empty($cat_id) && empty($filter)) { $args = null; } else { $args = array($cat_id, $filter); } $this->sredirect(array('app' => 'b2c', 'ctl' => 'site_gallery', 'act' => 'index', 'args' => $args)); }
public function exec($params = null) { // 与中心交互 $is_need_rpc = false; $obj_rpc_obj_rpc_request_service = kernel::servicelist('b2c.rpc_notify_request'); foreach ($obj_rpc_obj_rpc_request_service as $obj) { if ($obj && method_exists($obj, 'rpc_judge_send')) { if ($obj instanceof b2c_api_rpc_notify_interface) { $is_need_rpc = $obj->rpc_judge_send($params); } } if ($is_need_rpc) { break; } } if ($is_need_rpc) { /*$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($params,'create'); } else { $obj_order_create = kernel::single('b2c_order_rpc_recaller'); $obj_order_create->rpc_caller_request($params); }*/ //新的版本控制api $obj_apiv = kernel::single('b2c_apiv_exchanges_request'); $obj_apiv->rpc_caller_request($params, 'ordercreate'); } }
function trigger() { set_time_limit(0); ignore_user_abort(1); //检查计划任务有没有增减 $status = $this->status(); $service = (array) kernel::servicelist('autotask'); $servicelist = array_values($service['iterator']->getArrayCopy()); $exists_class = array_keys($status); $diff_class = array_diff($servicelist, $exists_class); $add = $delete = array(); foreach ($diff_class as $class_name) { if (in_array($class_name, $exists_class)) { //app::get('base')->model('task')->delete('task'=>$class_name); } else { $class = new $class_name(); if ($class instanceof base_interface_task) { $data = array('task' => $class_name, 'description' => $class->description(), 'rule' => $class->rule(), 'last' => time()); app::get('base')->model('task')->insert($data); } } } //根据规则执行计划任务 $status = $this->status(); $now = time(); foreach ($status as $cron) { if ($cron['enabled'] && $now >= base_crontabparser::parse($cron['rule'], $cron['last'])) { $cron_class = new $cron['task'](); $cron_class->exec(); app::get('base')->model('task')->update(array('last' => $now), array('task' => $cron['task'])); kernel::log('crontab ' . $cron['task'] . ' run at ' . date('Y-m-d H:m:i', $now)); } } }
private function _cart_process($aData, &$aResult, $aConfig) { foreach (kernel::servicelist('b2c_cart_object_apps') as $object) { if (!is_object($object)) { continue; } if (method_exists($object, 'get_order')) { $index = $object->get_order(); } else { $index = 10; } while (true) { if (!isset($tmp[$index])) { break; } $index++; } $tmp[$index] = $object; } krsort($tmp); foreach ($tmp as $object) { if (method_exists($object, 'get_type')) { $type_name = $object->get_type(); } else { $type_name = array_pop(explode('_', get_class($object))); } // 购物车项类型 $aResult['object'][$type_name] = $object->getAll(true); } }
/** * 获取所有开启(激活)的支付方式 * @param mixed 过滤条件 * @return array 支付方式数组 */ public function get_all($sdf) { $arr_payments = array(); $obj_payments_service_all = kernel::servicelist('ectools_payment.ectools_mdl_payment_cfgs'); foreach ($obj_payments_service_all as $obj) { switch ($obj->app_key) { case 'offline': $payout_type = 'offline'; break; case 'offlinemeitong': $payout_type = 'offline'; break; case 'offlinecard': $payout_type = 'offline'; break; case 'deposit': $payout_type = 'deposit'; break; default: $payout_type = 'online'; break; } $strPayment = $this->app->getConf(get_class($obj)); $arrPaymnet = unserialize($strPayment); if (isset($arrPaymnet['status']) && $arrPaymnet['status'] == 'true') { $arr_payments[$obj->app_key] = array('payout_type' => $payout_type, 'payment_name' => isset($arrPaymnet['setting']['pay_name']) && $arrPaymnet['setting']['pay_name'] ? $arrPaymnet['setting']['pay_name'] : $obj->display_name, 'payment_id' => isset($obj->app_rpc_key) && $obj->app_rpc_key ? $obj->app_rpc_key : $obj->app_key); } } return $arr_payments; }
function input_goodsfilter($params) { $render = new base_render(app::get('b2c')); $obj_type = app::get('b2c')->model('goods_type'); $input_name = $params['name']; parse_str($params['value'], $value); $params = array('gtype' => $obj_type->getList('*', null, 0, -1), 'view' => 'admin/goods/finder_filter.html', 'params' => $params['params'], 'json' => json_encode($data), 'data' => $value, 'from' => $params['value'], 'domid' => substr(md5(rand(0, time())), 0, 6), 'name' => $input_name); $type_id = '_ANY_'; $params['value'] = $value; if ($params['value']['type_id']) { $type_id = $params['value']['type_id']; } $render->pagedata['params'] = $params; $goods_filter = kernel::single('b2c_goods_goodsfilter'); $return = $goods_filter->goods_goodsfilter($type_id, app::get('b2c')); $render->pagedata['filter'] = $return; $render->pagedata['type_id'] = $type_id; $render->pagedata['filter_items'] = array(); foreach (kernel::servicelist('goods_filter_item') as $key => $object) { if (is_object($object) && method_exists($object, 'get_item_html')) { $render->pagedata['filter_items'][] = $object->get_item_html(); } } return $render->fetch('admin/goods/goods_filter.html'); }
/** * 创建退款单 * @params array - 订单数据 * @params obj - 应用对象 * @params string - 支付单生成的记录 * @return boolean - 创建成功与否 */ public function generate(&$sdf, &$controller = null, &$msg = '') { // 异常处理 if (!isset($sdf) || !$sdf || !is_array($sdf)) { trigger_error(app::get('ectools')->_("退款单信息不能为空!"), E_USER_ERROR); exit; } $is_save = false; // 保存的接口方法 $obj_refund_create = kernel::single("ectools_refund_create"); $is_save = $obj_refund_create->generate($sdf); if (!$is_save) { $msg = app::get('ectools')->_('退款单生成失败!'); return false; } $obj_refund_special = kernel::servicelist('ectools_refund.ectools_mdl_special_refund'); foreach ($obj_refund_special as $obj_app) { $is_save = $obj_app->dorefund($sdf); } if ($is_save) { $obj_api_refund = kernel::single("ectools_refund_update"); $sdf['status'] = 'succ'; $is_save = $obj_api_refund->generate($sdf); if (!$is_save) { $msg = app::get('ectools')->_('退款单编辑失败!'); return false; } } return $is_save; }
function detail_basic($member_id) { $app = app::get('b2c'); $userObject = kernel::single('b2c_user_object'); $member_model = $this->app->model('members'); $a_mem = $member_model->dump($member_id); $accountData = $userObject->get_members_data(array('account' => 'login_account'), $member_id); $a_mem['contact']['name'] = $accountData['account']['local']; $a_mem['contact']['email'] = $accountData['account']['email']; $a_mem['contact']['phone']['mobile'] = $accountData['account']['mobile']; $obj_extend_point = kernel::service('b2c.member_extend_point_info'); if ($obj_extend_point) { // 当前会员拥有的积分 $obj_extend_point->get_real_point($member_id, $a_mem['score']['total']); // 当前会员实际可以使用的积分 $obj_extend_point->get_usage_point($member_id, $a_mem['score']['usage']); } $userPassport = kernel::single('b2c_user_passport'); $render = $app->render(); $render->pagedata['attr'] = $userPassport->get_signup_attr($member_id); $render->pagedata['mem'] = $a_mem; $render->pagedata['member_id'] = $member_id; // 判断是否使用了推广服务 $is_bklinks = 'false'; $obj_input_helpers = kernel::servicelist("html_input"); if (isset($obj_input_helpers) && $obj_input_helpers) { foreach ($obj_input_helpers as $obj_bdlink_input_helper) { if (get_class($obj_bdlink_input_helper) == 'bdlink_input_helper') { $is_bklinks = 'true'; } } } $render->pagedata['is_bklinks'] = $is_bklinks; return $render->fetch('admin/member/detail.html'); }
public function exec($params = null) { // 与中心交互 $is_need_rpc = false; $obj_rpc_obj_rpc_request_service = kernel::servicelist('b2c.rpc_notify_request'); foreach ($obj_rpc_obj_rpc_request_service as $obj) { if ($obj && method_exists($obj, 'rpc_judge_send')) { if ($obj instanceof b2c_api_rpc_notify_interface) { $is_need_rpc = $obj->rpc_judge_send($sdf_order); } } if ($is_need_rpc) { break; } } //取消订单支付是否实时同步在后台的设置 //if (app::get('b2c')->getConf('site.order.send_type') == 'false' && $is_need_rpc) if ($is_need_rpc) { /*$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($params,'pay'); } else { $obj_order_create = kernel::single('b2c_order_rpc_pay'); $obj_order_create->rpc_caller_request($params); }*/ //新的版本控制api $obj_apiv = kernel::single('b2c_apiv_exchanges_request'); $obj_apiv->rpc_caller_request($params, 'orderpay'); } }
/** * 初始化扩展列和detail * * @return void */ protected function initExtendsColumnAndDetail() { $service_list = array(); foreach (kernel::servicelist('desktop_finder.' . $this->object_name) as $name => $object) { $service_list[$name] = $object; } foreach (kernel::servicelist('desktop_finder.' . $this->object_name . '.' . $this->finder_aliasname) as $name => $object) { $service_list[$name] = $object; } foreach ($service_list as $name => $object) { foreach (get_class_methods($object) as $method) { switch (substr($method, 0, 7)) { case 'column_': $this->addon_columns[] = array($object, $method); break; case 'detail_': if (!$this->alertpage_finder) { //如果是弹出页finder, 则去掉详细查看按钮 $this->detail_pages[$method] = array($object, $method); } break; } } $this->service_object[] = $object; } }
function recover() { kernel::single('base_session')->close(); set_time_limit(0); $filename = $_GET['file']; $fileid = intval($_GET['fileid']) ? intval($_GET['fileid']) : 1; $vols = $_GET['vols'] ? $_GET['vols'] : 1; $oDSB = kernel::single("desktop_system_backup"); $app = $_GET['appid']; //备份中的app //$objB2c = app::get('b2c'); //$objB2c->setConf('member.attr',''); // $attr_model = $objB2c->model('member_attr')->init(); $oDSB->recover($filename, $vols, $fileid, $app); //exit; if ($vols <= $fileid) { ob_start(); kernel::single('base_shell_loader')->exec_command('kvrecovery'); //还原kvstore ob_end_clean(); foreach (kernel::servicelist('restore_firevent') as $k => $firevent) { if (is_object($firevent)) { $firevent->restoreEvent(); } } echo '{success:"' . app::get('desktop')->_('恢复完成') . '"}'; } else { echo '{message:"' . $oDSB->show_message . app::get('desktop')->_('正在恢复第') . ($fileid + 1) . app::get('desktop')->_('卷 共') . $vols . '' . app::get('desktop')->_('卷') . '", nexturl:"index.php?app=desktop&ctl=comeback&act=recover&file=' . $filename . '&vols=' . $vols . '&fileid=' . ($fileid + 1) . '&appid=' . $app . '"}'; } }
public function do_payment($payment, &$msg) { $obj_pay_lists = kernel::servicelist("order.pay_finish"); //$obj_pay = kernel::single("ectools_pay"); $is_payed = 'succ'; foreach ($obj_pay_lists as $order_pay_service_object) { $class_name = get_class($order_pay_service_object); if (strpos($class_name, $this->app->app_id . '_') !== false) { $objAdvance = $this->app->model('member_advance'); if ($payment['op_id']) { if (!$objAdvance->check_account($payment['op_id'], $msg, $payment['cur_money'])) { $is_payed = 'failed'; return false; } } else { $is_payed = 'failed'; return false; } //$obj_api_payment = kernel::service("api.ectools.payment"); $obj_payment_update = kernel::single('ectools_payment_update'); $payment['status'] = 'succ'; $obj_payment_update->generate($payment, $msg); //$obj_pay->pay_finish($payment, $is_payed); $is_payed = $order_pay_service_object->order_pay_finish($payment, 'succ', 'font'); return $is_payed; } } return false; }
function login($params) { $auth = pam_auth::instance($params['type']); if ($params['module']) { if ($passport_module = kernel::single($params['module'])) { if ($passport_module instanceof pam_interface_passport) { $module_uid = $passport_module->login($auth, $auth_data); if ($module_uid) { $auth->account()->update($params['module'], $module_uid, $auth_data); } $log = array('event_time' => time(), 'event_type' => $auth->type, 'event_data' => $auth_data['log_data']); app::get('pam')->model('log')->insert($log); $_SESSION['last_error'] = $auth_data['log_data']; $_SESSION['type'] = $auth->type; $_SESSION['login_time'] = time(); $url = ''; if ($params['mini']) { $url = '?mini=1'; } /** * appעļ */ $params['member_id'] = $module_uid; $params['uname'] = $_POST['uname']; foreach (kernel::servicelist('pam_login_listener') as $service) { $service->listener_login($params); } header('Location:' . base64_decode(urldecode($params['redirect'])) . $url); } } else { } } }
public function filter(&$aResult, $aConfig) { // 没有商品数据 if (empty($aResult['object']['goods'])) { return false; } if (!isset($aConfig['promotion']['goods'])) { //购物车的时候 $aGoodsId = array(); foreach ($aResult['object']['goods'] as $row) { if (empty($row['obj_items']['products']['0']['goods_id'])) { continue; } $gid = $row['obj_items']['products']['0']['goods_id']; //验证是否参与促销 false:不参与 foreach (kernel::servicelist("b2c_promotion_use_check") as $object) { if (!$object->check_use_promotion($gid)) { continue 2; } } $aGoodsId[] = $gid; } $aConfig = $this->_init_rule(array_unique($aGoodsId), array('current_time' => time())); } else { $aConfig = $aConfig['promotion']['goods']; } $this->_filter($aResult, $aConfig); }
public function point_detail($nPage = 1) { $this->path[] = array('title' => app::get('pointprofessional')->_('会员中心'), 'link' => $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_member', 'act' => 'index', 'full' => 1))); $this->path[] = array('title' => app::get('pointprofessional')->_('我的积分'), 'link' => '#'); $GLOBALS['runtime']['path'] = $this->path; $member = $this->app_current->model('members'); $member_point = $this->app_current->model('member_point'); $obj_gift_link = kernel::service('b2c.exchange_gift'); if ($obj_gift_link) { $this->pagedata['exchange_gift_link'] = $obj_gift_link->gen_exchange_link(); } $data = $member->dump($this->app->member_id, '*', array('score/event' => array('*'))); $count = $member_point->count(array('member_id' => $this->app->member_id)); // 扩展的积分信息 $obj_extend_point = kernel::servicelist('b2c.member_extend_point_info'); if ($obj_extend_point) { foreach ($obj_extend_point as $obj) { $this->pagedata['extend_point_html'] = $obj->gen_extend_detail_point($data); } } $aPage = $this->get_start($nPage, $count); $params['data'] = $member_point->get_all_list('*', array('member_id' => $this->member['member_id'], 'change_point|than' => '0'), $aPage['start'], $this->pagesize); $params['page'] = $aPage['maxPage']; $this->pagination($nPage, $params['page'], 'point_detail', '', 'pointprofessional', 'site_point'); $this->pagedata['total'] = $data['score']['total']; $this->pagedata['historys'] = $params['data']; $this->output('pointprofessional'); }
public function filter(&$aData, &$aResult, $aConfig = array()) { $this->use_rules = $this->pass_rules = $this->all_rules = $this->_rules = null; // 取出符合当前购物车条件的规则(已经使用了conditions过滤) $this->_filter_rules($aResult, $aConfig); // 只是对goods进行处理待解决 其它类型购物车项待扩展 if (!isset($aResult['object']['goods']) || !is_array($aResult['object']['goods'])) { return false; } if ($aResult['object']['goods']) { foreach ($aResult['object']['goods'] as &$object) { $this->_apply_to_item($object, $aResult); } } else { //原促销只针对于商品。但订单中包含礼包等信息时。应用于整个购物的促销无法应用。 故追加如下 2011-2-28 16:08 $num = 0; foreach (kernel::servicelist('b2c_cart_object_apps') as $o) { if ($o->intopromotion) { //标识该类型“商品” 是否计入订单促销范围 if (method_exists($o, 'get_type')) { $tmp[] = $o->get_type(); } } } if ($tmp) { foreach ($aResult['object'] as $_key => &$row) { if (in_array($_key, $tmp) && $row) { foreach ($row as &$object) { $this->_apply_to_item($object, $aResult); } } } } //End } #print_r($aResult);exit; if (isset($aResult['object']['coupon']) && !empty($aResult['object']['coupon'])) { foreach ($aResult['object']['coupon'] as &$val) { if (isset($this->all_rules[$val['rule_id']])) { $val['name'] = $this->all_rules[$val['rule_id']]['cpns_name']; $val["description"] = $aResult['promotion']['coupon'][$val['rule_id']]['desc']; //$this->all_rules[$val['rule_id']]['description']; if (!$this->use_rules || !is_array($this->use_rules)) { continue; } if (isset($this->use_rules[$val['rule_id']])) { if (!$this->use_rules[$val['rule_id']]['show']) { $val['used'] = true; } $this->use_rules[$val['rule_id']]['show'] = true; } } else { $val['name'] = $val['coupon']; $val["description"] = '<font color="red">' . app::get('b2c')->_('该优惠券可能已过期或未启用!') . '~</font>'; } } } $this->dehistory(); }
/** * 获取模板列表信息 * */ public function getTemplateList() { $aResult = array(); foreach (kernel::servicelist('b2c_promotion_tpl_order_apps') as $object) { $aResult[get_class($object)] = array('name' => $object->tpl_name, 'type' => $object->type); } return $aResult; }
function work($full_object_name) { $this->url = 'index.php?'; ecos_desktop_finder_make_get($this->name); $query = utils::http_build_query($_GET); $this->url = $this->url . $query; $this->object_name = $full_object_name; list($object_app, $object_name) = ecos_desktop_finder_split_model($full_object_name); $service_list = array(); foreach (kernel::servicelist('desktop_finder.' . $this->object_name) as $name => $object) { $service_list[$name] = $object; } foreach (kernel::servicelist('desktop_finder.' . $this->object_name . '.' . $this->finder_aliasname) as $name => $object) { $service_list[$name] = $object; } foreach ($service_list as $name => $object) { $tmpobj = $object; foreach (get_class_methods($tmpobj) as $method) { switch (substr($method, 0, 7)) { case 'column_': $this->addon_columns[] = array(&$tmpobj, $method); break; case 'detail_': if (!$this->alertpage_finder) { //如果是弹出页finder,则去详细查看按钮 $this->detail_pages[$method] = array(&$tmpobj, $method); } break; } } $this->service_object[] =& $tmpobj; if (method_exists($tmpobj, 'row_style')) { $this->row_style_func[] =& $tmpobj; } unset($tmpobj); $i++; } /** * 对额外添加的column和detail的修改 */ $obj_addon_cols = kernel::servicelist('desktop_finder_column_modifier.' . $this->object_name . '.' . $this->finder_aliasname); if ($obj_addon_cols) { foreach ($obj_addon_cols as $obj) { $obj->columns_modifier($this->addon_columns); } } $obj_addon_detail_cols = kernel::servicelist('desktop_finder_detail_modifier.' . $this->object_name . '.' . $this->finder_aliasname); if ($obj_addon_detail_cols) { foreach ($obj_addon_detail_cols as $obj) { $obj->detail_columns_modifier($this->detail_pages); } } /** end **/ $this->object = app::get($object_app)->model($object_name); $this->has_tag = $this->object->has_tag; $this->dbschema = $this->object->schema; $this->main(); }
/** * ShopEx licence * * @copyright Copyright (c) 2005-2013 ShopEx Technologies Inc. (http://www.shopex.cn) * @license http://ecos.shopex.cn/ ShopEx License */ function theme_widget_index_tab_goods(&$setting,&$render){ $_return = false; switch ($setting['selector']) { case 'filter': parse_str($setting['goods_filter'],$goodsFilter); $goodsFilter['goodsOrderBy'] = $setting['goods_order_by']; $goodsFilter['goodsNum'] = $setting['limit']; $_return = b2c_widgets::load('Goods')->getGoodsList($goodsFilter,'wap'); //$_return = array_values($_return['goodsRows']); break; case 'select': $goodsFilter['goods_id'] = explode(",", $setting["goods_select"]); $goodsFilter['goodsNum'] = $setting['limit']; $_return = b2c_widgets::load('Goods')->getGoodsList($goodsFilter,'wap'); foreach (json_decode($setting['goods_select_linkobj'],1) as $obj) { if(trim($obj['pic'])!=""){ $_return['goodsRows'][$obj['id']]['goodsPicL'] = $_return['goodsRows'][$obj['id']]['goodsPicM'] = $_return['goodsRows'][$obj['id']]['goodsPicS'] = $obj['pic']; } if(trim($obj['nice'])!=""){ $_return['goodsRows'][$obj['id']]['goodsName'] = $obj['nice']; } } break; } $gids = array_keys($_return['goodsRows']); //商品标签 if(is_array($_return['goodsRows'])){ foreach($_return['goodsRows'] as $apk=>$apv){ $_return['goodsRows'][$apk]['goods_id'] = $apv['goodsId']; } } foreach( kernel::servicelist('tags_special.add') as $services ) { if ( is_object($services)) { if ( method_exists( $services, 'add') ) { $services->add( $gids, $_return['goodsRows'] ); } } } if(!$gids||count($gids)<1)return $_return; $mdl_product = app::get('b2c')->model('products'); $products = $mdl_product ->getList('product_id, spec_info, price, freez, store, marketable, goods_id',array('goods_id'=>$gids,'marketable'=>'true')); foreach ($products as $product) { $_return['goodsRows'][$product['goods_id']]['products'][] = $product; } return $_return; }
private function clear() { foreach (kernel::servicelist("desktop_debug_clean_data") as $object) { if (method_exists($object, 'clean')) { $object->clean(); } } $this->error_splash(true, '数据清理成功!'); }
function index() { if ($_GET['action'] == 'export') { $this->_end_message = '导出商品'; } if ($this->has_permission('batcheditmarketable')) { $group[] = array('label' => app::get('b2c')->_('商品上架'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=enable', 'target' => 'refresh'); $group[] = array('label' => app::get('b2c')->_('商品下架'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=disable', 'target' => 'refresh'); $group[] = array('label' => '_SPLIT_'); } if ($this->has_permission('batcheditprice')) { $group[] = array('label' => app::get('b2c')->_('统一调价'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=uniformPrice', 'target' => 'dialog'); $group[] = array('label' => app::get('b2c')->_('分别调价'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=differencePrice', 'target' => 'dialog'); } if ($this->has_permission('batcheditstore')) { $group[] = array('label' => app::get('b2c')->_('统一调库存'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=uniformStore', 'target' => 'dialog'); $group[] = array('label' => app::get('b2c')->_('分别调库存'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=differenceStore', 'target' => 'dialog'); $group[] = array('label' => '_SPLIT_'); } $group[] = array('label' => app::get('b2c')->_('商品名称'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=name', 'target' => 'dialog'); $group[] = array('label' => app::get('b2c')->_('商品简介'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=brief', 'target' => 'dialog'); if ($this->has_permission('brandgoods')) { $group[] = array('label' => app::get('b2c')->_('商品品牌'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=brand', 'target' => 'dialog'); } $group[] = array('label' => app::get('b2c')->_('商品排序'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=dorder', 'target' => 'dialog'); $group[] = array('label' => app::get('b2c')->_('商品重量'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=weight', 'target' => 'dialog'); if ($this->has_permission('catgoods')) { $group[] = array('label' => app::get('b2c')->_('分类转换'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=singleBatchEdit&p[0]=cat', 'target' => 'dialog'); $group[] = array('label' => '_SPLIT_'); } $group[] = array('label' => app::get('b2c')->_('重新生成图片'), 'icon' => 'download.gif', 'submit' => 'index.php?app=b2c&ctl=admin_goods&act=batchImage', 'target' => 'dialog'); foreach (kernel::servicelist('b2c.goods_finder_edit_group') as $object) { if (is_object($object) && method_exists($object, 'get_extends_group')) { $object->get_extends_group($group); } } if ($this->has_permission('addgoods')) { $custom_actions[] = array('label' => app::get('b2c')->_('添加商品'), 'icon' => 'add.gif', 'href' => 'index.php?app=b2c&ctl=admin_goods_editor&act=add', 'target' => '_blank'); } $custom_actions[] = array('label' => app::get('b2c')->_('批量操作'), 'icon' => 'batch.gif', 'group' => $group); $actions_base['title'] = app::get('b2c')->_('商品列表'); $actions_base['actions'] = $custom_actions; $actions_base['use_buildin_set_tag'] = true; $actions_base['use_buildin_filter'] = true; if ($this->has_permission('exportgoods')) { $actions_base['use_buildin_export'] = true; } if ($this->has_permission('importgoods')) { $actions_base['use_buildin_import'] = true; } if (!$this->has_permission('deletegoods')) { $actions_base['use_buildin_recycle'] = false; } $actions_base['allow_detail_popup'] = true; $actions_base['use_view_tab'] = true; $this->finder('b2c_mdl_goods', $actions_base); }
public function __construct() { foreach (kernel::servicelist('view_compile_helper') as $helper) { $this->loadCompileHelper($helper); } foreach (kernel::servicelist('view_helper') as $helper_path => $helper) { $this->loadViewHelper($helper); } }
public function login($params = null) { if (!$params) { return false; } foreach (kernel::servicelist('api_login') as $k => $passport) { return $passport->login($params); } }
/** * 创建支付单 * @params array - 订单数据 * @params obj - 应用对象 * @params string - 支付单生成的记录 * @return boolean - 创建成功与否 */ public function generate(&$sdf, &$controller = null, &$msg = '') { // 异常处理 if (!isset($sdf) || !$sdf || !is_array($sdf)) { trigger_error("支付单信息不能为空!", E_USER_ERROR); exit; } $is_save = false; //$obj_api_payment = kernel::service("api.ectools.payment"); $obj_payment_create = kernel::single('ectools_payment_create'); $is_save = $obj_payment_create->generate($sdf, $msg); if (!$is_save) { $msg = '支付单生成失败!'; return false; } // 支付方式的处理 $str_app = ""; $pay_app_id = $sdf['pay_app_id'] ? $sdf['pay_app_id'] : $sdf['pay_type']; $obj_app_plugins = kernel::servicelist("ectools_payment.ectools_mdl_payment_cfgs"); foreach ($obj_app_plugins as $obj_app) { $app_class_name = get_class($obj_app); $arr_class_name = explode('_', $app_class_name); if (isset($arr_class_name[count($arr_class_name) - 1]) && $arr_class_name[count($arr_class_name) - 1]) { if ($arr_class_name[count($arr_class_name) - 1] == $pay_app_id) { $pay_app_ins = $obj_app; $str_app = $app_class_name; } } else { if ($app_class_name == $pay_app_id) { $pay_app_ins = $obj_app; $str_app = $app_class_name; } } } //$str_app = "ectools_payment_plugin_" . (($sdf['pay_app_id']) ? $sdf['pay_app_id'] : $sdf['pay_type']); $pay_app_ins = new $str_app($controller->app); if ($sdf['pay_type'] == 'online') { // 线上支付,如alipay,paypal,99bill,tenpay等等 if ($pay_app_id != 'deposit') { $is_payed = $pay_app_ins->dopay($sdf); } else { $is_payed = $pay_app_ins->do_payment($sdf, $msg); } return $is_payed; } else { // 线下支付 $paymentsArr['trade_no'] = $paymentsArr['pay_app_id'] . ' trade no. ' . time(); $paymentsArr['t_payed'] = time(); //$obj_api_payment = kernel::service("api.ectools.payment"); $obj_payment_update = kernel::single('ectools_payment_update'); $sdf['status'] = 'succ'; $obj_payment_update->generate($sdf, $msg); // 调用orders对接接口 todo. } return true; }
/** * 支付返回后的同意支付处理 * @params array - 页面参数 * @return null */ public function parse($params = '') { // 取到内部系统参数 $pathInfo = substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], "parse/") + 6); $objShopApp = $this->getAppName($pathInfo); $innerArgs = explode('/', $pathInfo); $class_name = array_shift($innerArgs); $class_name = array_shift($innerArgs); $method = array_shift($innerArgs); $arrStr = array(); $arrSplits = array(); $arrQueryStrs = array(); // QUERY_STRING if (isset($innerArgs) && $innerArgs) { $querystring = array_shift($innerArgs); if ($querystring) { $querystring = substr($querystring, 1); $arrStr = explode("&", $querystring); foreach ($arrStr as $str) { $arrSplits = explode("=", $str); $arrQueryStrs[urldecode($arrSplits[0])] = urldecode($arrSplits[1]); } } } $payments_bill = new $class_name($objShopApp); $ret = $payments_bill->{$method}($arrQueryStrs); // 支付结束,回调服务. if ($ret['status'] != 'failed') { $obj_payments = app::get('ectools')->model('payments'); $sdf = $obj_payments->dump($ret['payment_id'], '*', '*'); $sdf['account'] = $ret['account']; $sdf['bank'] = $ret['bank']; $sdf['pay_account'] = $ret['pay_account']; $sdf['currency'] = $ret['currency']; //$sdf['money'] = $ret['money']; //$sdf['paycost'] = $ret['paycost']; //$sdf['cur_money'] = $ret['cur_money']; $sdf['trade_no'] = $ret['trade_no']; $sdf['t_payed'] = $ret['t_payed']; $sdf['pay_app_id'] = $ret['pay_app_id']; $sdf['pay_type'] = $ret['pay_type']; $sdf['memo'] = $ret['memo']; //$obj_api_payment = kernel::service("api.ectools.payment"); $obj_payment_update = kernel::single('ectools_payment_update'); $obj_payment_update->generate($ret, $msg); $obj_pay_lists = kernel::servicelist("order.pay_finish"); foreach ($obj_pay_lists as $order_pay_service_object) { $class_name = get_class($order_pay_service_object); if (strpos($class_name, $objShopApp->app_id . '_') !== false) { $order_pay_service_object->order_pay_finish($sdf, $ret['status'], 'font'); } } /*$objOrders = $this->app->model('orders'); $objOrders->order_pay_finish($ret, $ret['status']);*/ } }
public function process($aData, &$aResult = array(), $aConfig = array()) { foreach (kernel::servicelist('b2c_cart_postfilter_apps') as $object) { if (!is_object($object)) { continue; } $object->filter($aData, $aResult, $aConfig); } $this->app->model('cart')->count_objects($aResult); }
function create() { $types = array(); foreach (kernel::servicelist('dev.project_type') as $class => $type) { $types[] = array('name' => $type->get_name(), 'templates' => $type->get_templates(), 'class' => $class); } $this->nav[] = array(app::get('dev')->_('创建新项目')); $this->pagedata['types'] = $types; $this->page('project/create.html'); }
function to_setting() { $this->begin(); $member_comments = kernel::single('b2c_message_disask'); $aOut = $member_comments->to_setting('ask', $_POST); foreach (kernel::servicelist('ask_list') as $service) { $service->save_setting($_POST); } $this->end('success', app::get('b2c')->_('设置成功')); }
/** * loginlimit-登录受限检测 * * @param none * @return void */ function loginlimit($mid, &$redirect) { $services = kernel::servicelist('loginlimit.check'); if ($services) { foreach ($services as $service) { $redirect = $service->checklogin($mid); } } return $redirect ? true : false; }