本文整理汇总了PHP中kernel::url_prefix方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::url_prefix方法的具体用法?PHP kernel::url_prefix怎么用?PHP kernel::url_prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel
的用法示例。
在下文中一共展示了kernel::url_prefix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$mobileshop_url = $this->app->getConf('mobileshop.url');
$mobileshop_token = $this->app->getConf('mobileshop.token');
if (!empty($mobileshop_url)) {
$wlshop = app::get('b2c')->model('shop');
$node_ids = $wlshop->getList('node_id', array('node_type' => 'shopex_wmall', 'status' => 'bind'));
foreach ($node_ids as $value) {
if (!empty($value['node_id'])) {
$node_id = $value['node_id'];
}
}
$callinfo['node_id'] = $node_id;
$callinfo['shop_url'] = kernel::base_url(1) . kernel::url_prefix() . "/";
$callinfo['shop_license'] = base_certificate::get('certificate_id');
$callinfo['shop_node'] = base_shopnode::node_id('b2c');
$callinfo['shop_name'] = app::get('site')->getConf('site.name');
$callinfo['type'] = '1';
$callinfo['sign'] = $this->get_sign($callinfo, $mobileshop_token);
$this->pagedata['ifseturl'] = 1;
$this->pagedata['node_id'] = $callinfo['node_id'];
$this->pagedata['type'] = $callinfo['type'];
$this->pagedata['shop_license'] = $callinfo['shop_license'];
$this->pagedata['shop_node'] = $callinfo['shop_node'];
$this->pagedata['shop_url'] = $callinfo['shop_url'];
$this->pagedata['shop_name'] = $callinfo['shop_name'];
$this->pagedata['sign'] = $callinfo['sign'];
$this->pagedata['mobileshop_url'] = $mobileshop_url;
} else {
$this->pagedata['ifseturl'] = 0;
}
$this->page('admin/index.html');
}
示例2: column_editbutton
public function column_editbutton($row)
{
$callback_url = urlencode(kernel::openapi_url('openapi.b2c.callback.shoprelation', 'callback', array('shop_id' => $row['shop_id'])));
$api_url = kernel::base_url(1) . kernel::url_prefix() . '/api';
$obj_user = kernel::single('desktop_user');
$user_id = $obj_user->user_data['user_id'];
$user_name = $obj_user->user_data['name'];
$api_v = $this->app->getConf("api.local.version");
$str_operation = "";
if ($row['status'] == 'unbind') {
$str_operation = '<a href="index.php?app=b2c&ctl=admin_shoprelation&act=showEdit&p[0]=' . $row['shop_id'] . '" target="_blank">' . app::get('b2c')->_('编辑') . '</a>';
if ($str_operation) {
$str_operation .= ' <a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('申请绑定') . '</a>';
} else {
$str_operation .= '<a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('申请绑定') . '</a>';
}
} else {
$str_operation = '';
if ($str_operation) {
$str_operation .= ' <a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('解除绑定') . '</a>';
} else {
$str_operation .= '<a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('解除绑定') . '</a>';
}
}
return $str_operation;
}
示例3: send_to_center
static function send_to_center($app_id, $data = null, $method = 'node.reg')
{
$app_info = app::get($app_id)->define();
$obj_app = app::get($app_id);
// 生成参数...
$api_data = array('certi_app' => $method, 'certificate_id' => base_certificate::certi_id(), 'node_type' => 'ecos.' . $app_id, 'url' => kernel::base_url(true), 'version' => $app_info['version'], 'channel_ver' => $app_info['api_ver'], 'api_ver' => '1.2', 'format' => 'json', 'api_url' => kernel::base_url(1) . kernel::url_prefix() . '/api');
//更新时,多带个参数
if ($method == 'node.update') {
$api_data['node_id'] = base_shopnode::node_id($app_id);
}
ksort($api_data);
foreach ($api_data as $key => $value) {
$str .= $value;
}
$api_data['certi_ac'] = strtoupper(md5($str . base_certificate::token()));
$http = kernel::single('base_httpclient');
$http->set_timeout(6);
$result = $http->post(LICENSE_CENTER_V, $api_data);
$result = json_decode($result, true);
if ($result['res'] == 'succ') {
return self::set_node_id($result['info'], $app_id);
} else {
return false;
}
}
示例4: index
function index()
{
$callback_url = '';
$api_url = kernel::base_url(1) . kernel::url_prefix() . '/api';
$ceti_id = base_certificate::get('certificate_id');
$node_id = base_shopnode::node_id($this->app->app_id);
$obj_user = kernel::single('desktop_user');
$user_id = $obj_user->user_data['user_id'];
$user_name = $obj_user->user_data['name'];
$api_v = $this->app->getConf("api.local.version");
$this->finder('b2c_mdl_shop', array('title' => app::get('b2c')->_('数据互联') . app::get('b2c')->_('证书:') . $ceti_id . ', ' . app::get('b2c')->_('节点:') . $node_id, 'actions' => array(array('label' => app::get('b2c')->_('新建绑定关系'), 'icon' => 'add.gif', 'href' => 'index.php?app=b2c&ctl=admin_shoprelation&act=addnew', 'target' => '_blank'), array('label' => app::get('b2c')->_('查看绑定情况'), 'icon' => 'add.gif', 'onclick' => 'new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get()'))));
}
示例5: column_editbutton
public function column_editbutton($row)
{
$callback_url = urlencode(kernel::api_url('api.b2c.callback.shoprelation', 'callback', array('shop_id' => $row['shop_id'])));
$api_url = kernel::base_url(1) . kernel::url_prefix() . '/api';
$str_operation = "";
if ($row['status'] == 'unbind') {
$str_operation = '<a href="index.php?app=b2c&ctl=admin_shoprelation&act=showEdit&p[0]=' . $row['shop_id'] . '" target="_blank">编辑</a>';
if ($str_operation) {
$str_operation .= ' <a href="index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '">申请绑定</a>';
} else {
$str_operation .= '<a href="index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '">申请绑定</a>';
}
} else {
$str_operation = '';
if ($str_operation) {
$str_operation .= ' <a href="index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '">解除绑定</a>';
} else {
$str_operation .= '<a href="index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '">解除绑定</a>';
}
}
return $str_operation;
}
示例6: save_matrix
function save_matrix()
{
$this->begin();
$get_matrixtype = app::get('system')->getConf('system.matrix.set');
$matrix = app::get('system')->model('matrixset');
$shop = app::get('b2c')->model('shop');
$post = $_POST;
$matrixtype = $post['matrixtype'];
unset($post['matrixtype']);
//查看是否存在绑定关系,如果存在提示解除
$shoplist = $shop->getList('*', array('status' => 'bind'));
if ($get_matrixtype != $matrixtype && count($shoplist) > 0) {
//$this->begin('index.php?app=b2c&ctl=admin_shoprelation&act=index');
$this->end(false, app::get('system')->_("如果需要切换通道,请先解除现有的绑定关系"));
}
//基础数据
$post['node_id'] = base_shopnode::node_id('b2c');
$post['node_type'] = "ecos.b2c";
$post['matrixset_id'] = intval($post['matrixset_id']);
$api_url = kernel::base_url(1) . kernel::url_prefix() . '/api';
//查看私有矩阵是否已经开通过
$list_matrix = $matrix->getList('*', array('node_id' => $post['node_id'], 'status' => 'active'));
if ($matrixtype == "private") {
$params = array('node_type' => $post['node_type'], 'node_name' => $post['shopname'], 'api_url' => $api_url, 'token' => $post['token']);
$request = kernel::single('system_request');
$request_result = $request->register($post['api_url'], $params);
}
if ($matrixtype == "private" && $request_result) {
app::get('system')->setConf('system.matrix.set', 'private');
$post['status'] = 'active';
$result = $matrix->save($post);
} else {
app::get('system')->setConf('system.matrix.set', 'public');
$data['status'] = 'dead';
$result = $matrix->update($data, array('status' => 'active', 'node_id' => $post['node_id']));
}
$this->end($result);
}
示例7: index
function index()
{
$furl = kernel::base_url(1) . kernel::url_prefix() . '/shopadmin';
$content = '[InternetShortcut]
URL=' . $furl . '
IDList=[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
';
header("Content-type: charset=utf-8");
header("Content-type: application/octet-stream");
/** ¼æÈݸ÷¸öä¯ÀÀÆ÷ **/
$filename = app::get('desktop')->getConf('background.title') . ".url";
$encoded_filename = urlencode($filename);
$encoded_filename = str_replace("+", "%20", $encoded_filename);
if (preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) {
header('Content-Disposition: attachment; filename="' . $encoded_filename . '"');
} elseif (preg_match("/Firefox/", $_SERVER['HTTP_USER_AGENT'])) {
header('Content-Disposition: attachment; filename*="utf8' . $filename . '"');
} else {
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
/** end **/
echo $content;
}
示例8: edit
//.........这里部分代码省略.........
$order_items[$k]['numtype'] = $type['floatstore'];
}
//----------end
}
} else {
if ($v['obj_type'] == 'gift') {
$str_service_goods_type_obj = $arr_service_goods_type_obj['gift'];
foreach ($v['order_items'] as $gift_key => $gift_item) {
if (!$gift_item['products']) {
$o = $this->app->model('order_items');
$tmp = $o->getList('*', array('item_id' => $gift_item['item_id']));
$gift_item['products']['product_id'] = $tmp[0]['product_id'];
}
if (isset($gift_items[$gift_item['goods_id']]) && $gift_items[$gift_item['goods_id']]) {
$gift_items[$gift_item['goods_id']]['nums'] = $this->objMath->number_plus(array($gift_items[$gift_item['goods_id']]['nums'], $item['quantity']));
} else {
$str_service_goods_type_obj->get_order_object(array('goods_id' => $gift_item['goods_id'], 'product_id' => $gift_item['products']['product_id']), $arrGoods, 'admin_order_edit');
$gift_name = $gift_item['name'];
if ($gift_item['addon']) {
$arr_addon = unserialize($gift_item['addon']);
if ($arr_addon['product_attr']) {
$gift_name .= '(';
foreach ($arr_addon['product_attr'] as $arr_product_attr) {
$gift_name .= $arr_product_attr['label'] . $this->app->_(":") . $arr_product_attr['value'] . $this->app->_(" ");
}
if (strpos($gift_name, $this->app->_(" ")) !== false) {
$gift_name = substr($gift_name, 0, strrpos($gift_name, $this->app->_(" ")));
}
$gift_name .= ')';
}
}
$gift_items[$gift_item['products']['product_id']] = array('goods_id' => $gift_item['goods_id'], 'product_id' => $gift_item['products']['product_id'], 'bn' => $gift_item['bn'], 'nums' => $gift_item['quantity'], 'name' => $gift_name, 'item_type' => $arrGoods['category']['cat_name'], 'price' => $gift_item['price'], 'quantity' => $gift_item['quantity'], 'sendnum' => $gift_item['sendnum'], 'small_pic' => $arrGoods['image_default_id'], 'is_type' => $v['obj_type'], 'link_url' => $arrGoods['link_url'], 'item_id' => $gift_item['item_id']);
}
}
} else {
// 赠品以外的其他区块的解析.
if ($arr_service_goods_type_obj[$v['obj_type']]) {
$str_service_goods_type_obj = $arr_service_goods_type_obj[$v['obj_type']];
$extends_items[] = $str_service_goods_type_obj->get_order_object($v, $arrGoods, 'admin_order_edit');
}
}
}
}
$aOrder['items'] = $order_items;
$aOrder['gifts'] = $gift_items;
$aOrder['extends_items'] = $extends_items;
if ($aOrder['member_id'] > 0) {
$objMember = $this->app->model('members');
$aOrder['member'] = $objMember->dump($aOrder['member_id'], '*', array('pam_account' => array('*')));
foreach ($aOrder['member']['pam_account'] as $row) {
$aOrder['member'][$row['login_type']] = $row['login_account'];
}
$aOrder['ship_email'] = $aOrder['pam_account']['email']['login_account'];
} else {
$aOrder['member'] = array();
}
$objDelivery = $this->app->model('dlytype');
$aArea = app::get('ectools')->model('regions')->getList('*', null, 0, -1);
foreach ($aArea as $v) {
$aTmp[$v['name']] = $v['name'];
}
$aOrder['deliveryArea'] = $aTmp;
$aRet = $objDelivery->getList('*', null, 0, -1);
foreach ($aRet as $v) {
$aShipping[$v['dt_id']] = $v['dt_name'];
}
$aOrder['selectDelivery'] = $aShipping;
$objPayment = app::get('ectools')->model('payment_cfgs');
$aRet = $objPayment->getList('*', array('status' => 'true', 'platform' => array('iscommon', 'ispc'), 'is_frontend' => true));
if (!$aORet['member_id']) {
if ($aRet) {
foreach ($aRet as $key => $arr_payments) {
if (trim($arr_payments['app_id']) == 'deposit') {
unset($aRet[$key]);
}
}
}
}
$aPayment[-1] = app::get('b2c')->_('货到付款');
foreach ($aRet as $v) {
$aPayment[$v['app_id']] = $v['app_name'];
}
$aOrder['selectPayment'] = $aPayment;
$objCurrency = app::get('ectools')->model("currency");
$aRet = $objCurrency->curAll();
foreach ($aRet as $v) {
$aCurrency[$v['cur_code']] = $v['cur_name'];
}
$site_trigger_tax = $this->app->getConf('site.trigger_tax');
$this->pagedata['site_trigger_tax'] = $site_trigger_tax;
$aOrder['curList'] = $aCurrency;
$aOrder['cur_name'] = $aCurrency[$aOrder['currency']];
$this->pagedata['order'] = $aOrder;
$this->pagedata['finder_id'] = $_GET['finder_id'];
$this->pagedata['base_url'] = kernel::base_url(1) . kernel::url_prefix() . '/openapi/b2c.iframe.order.edit';
$this->pagedata['res_url'] = app::get('desktop')->res_url;
$this->pagedata['secret_key'] = $new_secret_key;
$this->pagedata['notify_url'] = $notify_url;
$this->page('admin/order/order_edit_iframe.html');
}
示例9: create
//.........这里部分代码省略.........
}
}
// 订单成功后清除购物车的的信息
$this->cart_model = $this->app->model('cart_objects');
$this->cart_model->remove_object('', null, $mag, $is_fastbuy);
// 生成cookie有效性的验证信息
setcookie('ST_ShopEx-Order-Buy', md5($this->app->getConf('certificate.token') . $order_id));
setcookie("purchase[addr][usable]", "", time() - 3600, kernel::base_url() . '/');
setcookie("purchase[shipping]", "", time() - 3600, kernel::base_url() . '/');
setcookie("purchase[payment]", "", time() - 3600, kernel::base_url() . '/');
setcookie("checkout_b2c_goods_buy_info", "", time() - 3600, kernel::base_url() . '/');
// 得到物流公司名称
if ($order_data['order_objects']) {
$itemNum = 0;
$good_id = "";
$goods_name = "";
foreach ($order_data['order_objects'] as $arr_objects) {
if ($arr_objects['order_items']) {
if ($arr_objects['obj_type'] == 'goods') {
$obj_goods = $this->app->model('goods');
$good_id = $arr_objects['order_items'][0]['goods_id'];
$obj_goods->updateRank($good_id, 'buy_count', $arr_objects['order_items'][0]['quantity']);
$arr_goods = $obj_goods->parent_getList('image_default_id', array('goods_id' => $good_id));
$arr_goods = $arr_goods[0];
}
foreach ($arr_objects['order_items'] as $arr_items) {
$itemNum = $this->objMath->number_plus(array($itemNum, $arr_items['quantity']));
if ($arr_objects['obj_type'] == 'goods') {
if ($arr_items['item_type'] == 'product') {
$goods_name .= $arr_items['name'] . ($arr_items['products']['spec_info'] ? '(' . $arr_items['products']['spec_info'] . ')' : '') . '(' . $arr_items['quantity'] . ')';
}
}
}
}
}
$arr_dlytype = $obj_dlytype->dump($order_data['shipping']['shipping_id'], 'dt_name');
$arr_updates = array('order_id' => $order_id, 'total_amount' => $order_data['total_amount'], 'shipping_id' => $arr_dlytype['dt_name'], 'ship_mobile' => $order_data['consignee']['mobile'], 'ship_tel' => $order_data['consignee']['telephone'], 'ship_addr' => $order_data['consignee']['addr'], 'ship_email' => $order_data['consignee']['email'] ? $order_data['consignee']['email'] : '', 'ship_zip' => $order_data['consignee']['zip'], 'ship_name' => $order_data['consignee']['name'], 'member_id' => $order_data['member_id'] ? $order_data['member_id'] : 0, 'uname' => !$order_data['member_id'] ? app::get('b2c')->_('顾客') : $arrPams['pam_account']['login_name'], 'itemnum' => count($order_data['order_objects']), 'goods_id' => $good_id, 'goods_url' => kernel::base_url(1) . kernel::url_prefix(), 'thumbnail_pic' => base_storager::image_path($arr_goods['image_default_id']), 'goods_name' => $goods_name, 'ship_status' => '', 'pay_status' => 'Nopay', 'is_frontend' => true);
$order->fireEvent('create', $arr_updates, $order_data['member_id']);
}
$db->commit($transaction_status);
/** 订单创建结束后执行的方法 **/
$odr_create_service = kernel::servicelist('b2c_order.create');
$arr_order_create_after = array();
if ($odr_create_service) {
foreach ($odr_create_service as $odr_ser) {
if (!is_object($odr_ser)) {
continue;
}
if (method_exists($odr_ser, 'get_order')) {
$index = $odr_ser->get_order();
} else {
$index = 10;
}
while (true) {
if (!isset($arr_order_create_after[$index])) {
break;
}
$index++;
}
$arr_order_create_after[$index] = $odr_ser;
}
}
ksort($arr_order_create_after);
if ($arr_order_create_after) {
foreach ($arr_order_create_after as $obj) {
$obj->generate($order_data);
}
}
/** end **/
} else {
$db->rollback();
}
if ($result) {
$order_num = $order->count(array('member_id' => $order_data['member_id']));
$obj_mem = $this->app->model('members');
$obj_mem->update(array('order_num' => $order_num), array('member_id' => $order_data['member_id']));
/** 订单金额为0 **/
if ($order_data['cur_amount'] == '0') {
// 模拟支付流程
$objPay = kernel::single("ectools_pay");
$sdf = array('payment_id' => $objPay->get_payment_id($order_data['order_id']), 'order_id' => $order_data['order_id'], 'rel_id' => $order_data['order_id'], 'op_id' => $order_data['member_id'], 'pay_app_id' => $order_data['payinfo']['pay_app_id'], 'currency' => $order_data['currency'], 'payinfo' => array('cost_payment' => $order_data['payinfo']['cost_payment']), 'pay_object' => 'order', 'member_id' => $order_data['member_id'], 'op_name' => $this->user->user_data['account']['login_name'], 'status' => 'ready', 'cur_money' => $order_data['cur_amount'], 'money' => $order_data['total_amount']);
$is_payed = $objPay->gopay($sdf, $msg);
if (!$is_payed) {
$msg = app::get('b2c')->_('订单自动支付失败!');
// $this->end(false, $msg, $this->gen_url(array('app'=>'b2c','ctl'=>'site_cart','act'=>'checkout')));
kernel::single('base_rpc_service')->send_user_error('order_error', $msg);
}
$obj_pay_lists = kernel::servicelist("order.pay_finish");
$is_payed = false;
foreach ($obj_pay_lists as $order_pay_service_object) {
$is_payed = $order_pay_service_object->order_pay_finish($sdf, 'succ', 'font', $msg);
}
}
return $order_data;
// $this->end(true, $this->app->_("订单生成成功!"), $this->gen_url(array('app'=>'b2c','ctl'=>'site_paycenter','act'=>'index','arg0'=>$order_id,'arg1'=>'true')),'',true);
} else {
// $this->end(false, $msg, $this->gen_url(array('app'=>'b2c','ctl'=>'site_cart','act'=>'checkout')),true,true);
kernel::single('base_rpc_service')->send_user_error('order_error', $msg);
}
}
示例10: openapi_url
static function openapi_url($openapi_service_name, $method = 'access', $params = null)
{
if (substr($openapi_service_name, 0, 8) != 'openapi.') {
trigger_error('$openapi_service_name must start with: openapi.');
return false;
}
$arg = array();
foreach ((array) $params as $k => $v) {
$arg[] = urlencode($k);
$arg[] = urlencode(str_replace('/', '%2F', $v));
}
return kernel::base_url(1) . kernel::url_prefix() . '/openapi/' . substr($openapi_service_name, 8) . '/' . $method . '/' . implode('/', $arg);
}
示例11: create
//.........这里部分代码省略.........
$this->cart_model->remove_object('', null, $mag, $is_fastbuy);
$this->app->model('cart')->unset_data();
// 生成cookie有效性的验证信息
setcookie('ST_ShopEx-Order-Buy', md5($this->app->getConf('certificate.token') . $order_id));
setcookie("purchase[addr][usable]", "", time() - 3600, kernel::base_url() . '/');
setcookie("purchase[shipping]", "", time() - 3600, kernel::base_url() . '/');
setcookie("purchase[payment]", "", time() - 3600, kernel::base_url() . '/');
setcookie("checkout_b2c_goods_buy_info", "", time() - 3600, kernel::base_url() . '/');
// 得到物流公司名称
if ($order_data['order_objects']) {
$itemNum = 0;
$good_id = "";
$goods_name = "";
foreach ($order_data['order_objects'] as $arr_objects) {
if ($arr_objects['order_items']) {
if ($arr_objects['obj_type'] == 'goods') {
$obj_goods = $this->app->model('goods');
$good_id = $arr_objects['order_items'][0]['goods_id'];
$obj_goods->updateRank($good_id, 'buy_count', $arr_objects['order_items'][0]['quantity']);
$arr_goods = $obj_goods->parent_getList('image_default_id', array('goods_id' => $good_id));
$arr_goods = $arr_goods[0];
}
foreach ($arr_objects['order_items'] as $arr_items) {
$itemNum = $this->objMath->number_plus(array($itemNum, $arr_items['quantity']));
if ($arr_objects['obj_type'] == 'goods') {
if ($arr_items['item_type'] == 'product') {
$goods_name .= $arr_items['name'] . ($arr_items['products']['spec_info'] ? '(' . $arr_items['products']['spec_info'] . ')' : '') . '(' . $arr_items['quantity'] . ')';
}
}
}
}
}
$arr_dlytype = $obj_dlytype->dump($order_data['shipping']['shipping_id'], 'dt_name');
$arr_updates = array('order_id' => $order_id, 'total_amount' => $order_data['total_amount'], 'shipping_id' => $arr_dlytype['dt_name'], 'ship_mobile' => $order_data['consignee']['mobile'], 'ship_tel' => $order_data['consignee']['telephone'], 'ship_addr' => $order_data['consignee']['addr'], 'ship_email' => $order_data['consignee']['email'] ? $order_data['consignee']['email'] : '', 'ship_zip' => $order_data['consignee']['zip'], 'ship_name' => $order_data['consignee']['name'], 'member_id' => $order_data['member_id'] ? $order_data['member_id'] : 0, 'uname' => !$order_data['member_id'] ? app::get('b2c')->_('顾客') : $arrPams['pam_account']['login_name'], 'itemnum' => count($order_data['order_objects']), 'goods_id' => $good_id, 'goods_url' => kernel::base_url(1) . kernel::url_prefix() . $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_product', 'act' => 'index', 'arg0' => $good_id)), 'thumbnail_pic' => base_storager::image_path($arr_goods['image_default_id']), 'goods_name' => $goods_name, 'ship_status' => '', 'pay_status' => 'Nopay', 'is_frontend' => true);
$order->fireEvent('create', $arr_updates, $order_data['member_id']);
}
$c_result = $db->commit($transaction_status);
//门店充值卡充值
if ($_POST['is_store_cz'] == 2) {
$orders_czkcz = $this->app->model('orders');
$save_data['czkcz_is'] = 2;
$orders_czkcz->update($save_data, array('order_id' => $order_id));
$member_id = $order_data['member_id'];
$msg = '门店充值卡充值';
$objAdvances = $this->app->model("member_advance");
$objAdvances->add($member_id, $order_data['total_amount'], app::get('b2c')->_('门店充值卡充值'), $msg);
}
/** 订单创建结束后执行的方法 **/
$odr_create_service = kernel::servicelist('b2c_order.create');
$arr_order_create_after = array();
if ($odr_create_service) {
foreach ($odr_create_service as $odr_ser) {
if (!is_object($odr_ser)) {
continue;
}
if (method_exists($odr_ser, 'get_order')) {
$index = $odr_ser->get_order();
} else {
$index = 10;
}
while (true) {
if (!isset($arr_order_create_after[$index])) {
break;
}
$index++;
}
示例12: docreate
//.........这里部分代码省略.........
$obj_mCart = $this->app->model('cart');
if (!$_POST['member_id']) {
$member_indent = md5(kernel::single('base_session')->sess_id());
$data = $obj_mCart->get_cookie_cart_arr($member_indent);
} else {
$member_indent = md5($_POST['member_id'] . kernel::single('base_session')->sess_id());
$data = $obj_mCart->get_cookie_cart_arr($member_indent, $_POST['member_id']);
}
$objCarts = $obj_mCart->get_cart_object($data);
$is_empty = $obj_mCart->is_empty($objCarts);
if ($is_empty) {
$this->end(false, app::get('b2c')->_('购物车为空,操作失败!'));
}
$order =& $this->app->model('orders');
$_POST['order_id'] = $order_id = $order->gen_id();
$order_data = array();
$obj_order_create = kernel::single("b2c_order_create");
$order_data = $obj_order_create->generate($_POST, $member_indent, $msg, $objCarts);
if (!$order_data) {
$this->end(false, $msg, "index.php?app=b2c&ctl=admin_order&act=index");
}
$result = $obj_order_create->save($order_data, $msg);
// 与中心交互
/*$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($order_data,'create');
}
else
{
$obj_order_create->rpc_caller_request($order_data);
}*/
//新的版本控制api
$obj_apiv = kernel::single('b2c_apiv_exchanges_request');
$obj_apiv->rpc_caller_request($order_data, 'ordercreate');
// 取到日志模块
$log_text = "";
if ($result) {
$log_text = app::get('b2c')->_("订单创建成功!");
#↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓记录管理员操作日志@lujy↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
if ($obj_operatorlogs = kernel::service('operatorlog')) {
if (method_exists($obj_operatorlogs, 'inlogs')) {
$memo = '新订单被添加,订单号为 "' . $order_data['order_id'] . '"';
$obj_operatorlogs->inlogs($memo, $order_data['order_id'], 'orders');
}
}
#↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑记录管理员操作日志@lujy↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
} else {
$log_text = app::get('b2c')->_("订单创建失败!");
}
$orderLog = $this->app->model("order_log");
$sdf_order_log = array('rel_id' => $order_id, 'op_id' => $this->user->user_id, 'op_name' => $this->user->user_data['account']['login_name'], 'alttime' => time(), 'bill_type' => 'order', 'behavior' => 'creates', 'result' => $result ? 'SUCCESS' : 'FAILURE', 'log_text' => $log_text);
$log_id = $orderLog->save($sdf_order_log);
if ($result) {
// 订单成功后清除购物车的的信息
$cart_model = $this->app->model('cart');
$cart_model->del_cookie_cart_arr($member_indent);
// 得到物流公司名称
if ($order_data['order_objects']) {
$itemNum = 0;
$good_id = "";
$goods_name = "";
foreach ($order_data['order_objects'] as $arr_objects) {
if ($arr_objects['order_items']) {
if ($arr_objects['obj_type'] == 'goods') {
$obj_goods = $this->app->model('goods');
$good_id = $arr_objects['order_items'][0]['goods_id'];
$arr_goods = $obj_goods->dump($good_id);
}
foreach ($arr_objects['order_items'] as $arr_items) {
$itemNum = $this->objMath->number_plus(array($itemNum, $arr_items['quantity']));
if ($arr_objects['obj_type'] == 'goods') {
if ($arr_items['item_type'] == 'product') {
$goods_name .= $arr_items['name'] . ($arr_items['products']['spec_info'] ? '(' . $arr_items['products']['spec_info'] . ')' : '') . '(' . $arr_items['quantity'] . ')';
}
}
}
}
}
$obj_dlytype = $this->app->model('dlytype');
$arr_dlytype = $obj_dlytype->dump($order_data['shipping']['shipping_id'], 'dt_name');
if ($order_data['member_id']) {
$obj_members = $this->app->model('members');
$arrPams = $obj_members->dump($order_data['member_id'], '*', array(':account@pam' => array('*')));
}
$arr_updates = array('order_id' => $order_id, 'total_amount' => $order_data['total_amount'], 'shipping_id' => $arr_dlytype['dt_name'], 'ship_mobile' => $order_data['consignee']['mobile'], 'ship_tel' => $order_data['consignee']['telephone'], 'ship_addr' => $order_data['consignee']['addr'], 'ship_email' => $order_data['consignee']['email'] ? $order_data['consignee']['email'] : '', 'ship_zip' => $order_data['consignee']['zip'], 'ship_name' => $order_data['consignee']['name'], 'member_id' => $order_data['member_id'] ? $order_data['member_id'] : 0, 'uname' => !$order_data['member_id'] ? app::get('b2c')->_('顾客') : $arrPams['pam_account']['login_name'], 'itemnum' => count($order_data['order_objects']), 'goods_id' => $good_id, 'goods_url' => kernel::base_url(1) . kernel::url_prefix() . app::get('site')->router()->gen_url(array('app' => 'b2c', 'ctl' => 'site_product', 'act' => 'index', 'arg0' => $good_id)), 'thumbnail_pic' => base_storager::image_path($arr_goods['image_default_id']), 'goods_name' => $goods_name, 'ship_status' => '', 'pay_status' => 'Nopay', 'is_frontend' => false);
$order->fireEvent('create', $arr_updates, $order_data['member_id']);
}
}
if ($result) {
$order_num = $order->count(array('member_id' => $order_data['member_id']));
$obj_mem = $this->app->model('members');
$obj_mem->update(array('order_num' => $order_num), array('member_id' => $order_data['member_id']));
$this->end(true, app::get('b2c')->_('订单创建成功'), "index.php?app=b2c&ctl=admin_order&act=index");
} else {
$this->end(false, $msg, "index.php?app=b2c&ctl=admin_order&act=index");
}
}
示例13: base_url
public function base_url($full = false)
{
$c = $full ? 'full' : 'part';
if (!$this->base_url[$c]) {
$app_url_map = array_flip(kernel::$url_app_map);
$this->base_url[$c] = kernel::base_url($full) . kernel::url_prefix() . $app_url_map[$this->app_id] . ($app_url_map[$this->app_id] == '/' ? '' : '/');
}
return $this->base_url[$c];
}
示例14: base_url
public function base_url($full = false)
{
$c = $full ? 'full' : 'part';
if (!$this->base_url[$c]) {
$part = kernel::$app_url_map[$this->app_id];
$this->base_url[$c] = kernel::base_url($full) . kernel::url_prefix() . $part . ($part == '/' ? '' : '/');
}
return $this->base_url[$c];
}
示例15: create
//.........这里部分代码省略.........
// 添加收货地址
if ($arrMember['member_id'] && isset($_POST['delivery']['is_save']) && $_POST['delivery']['is_save'] && !$_POST['delivery']['addr_id']) {
if ($_POST['delivery']['ship_name'] && $_POST['delivery']['ship_mobile'] && $_POST['delivery']['ship_area'] && $_POST['delivery']['ship_addr']) {
$obj_member_addr = $this->app->model('member_addrs');
$count = $obj_member_addr->count(array('member_id' => $arrMember['member_id']));
if ($count < 5) {
$obj_members = $this->app->model('members');
$arrMemberAddr = array('name' => $_POST['delivery']['ship_name'], 'phone' => array('mobile' => $_POST['delivery']['ship_mobile'], 'telephone' => $_POST['delivery']['ship_tel'] ? $_POST['delivery']['ship_tel'] : ''), 'area' => $_POST['delivery']['ship_area'], 'addr' => $_POST['delivery']['ship_addr'], 'zipcode' => $_POST['delivery']['ship_zip'] ? $_POST['delivery']['ship_zip'] : '');
$obj_members->insertRec($arrMemberAddr, $arrMember['member_id'], $message);
}
}
}
$obj_dlytype = $this->app->model('dlytype');
if ($_POST['payment']['pay_app_id'] == '-1') {
$arr_dlytype = $obj_dlytype->dump($_POST['delivery']['shipping_id'], '*');
if ($arr_dlytype['has_cod'] == 'false') {
$this->end(false, $this->app->_("ship_method_consistent_error"));
}
}
$obj_filter = kernel::single('b2c_site_filter');
$_POST = $obj_filter->check_input($_POST);
//$obj_api_order = kernel::service("api.b2c.order");
$order =& $this->app->model('orders');
$_POST['order_id'] = $order_id = $order->gen_id();
$_POST['member_id'] = $arrMember['member_id'] ? $arrMember['member_id'] : 0;
$order_data = array();
$obj_order_create = kernel::single("b2c_order_create");
$order_data = $obj_order_create->generate($_POST);
$result = $obj_order_create->save($order_data, $msg);
//$result = true;
// 取到日志模块
if ($arrMember['member_id']) {
$obj_members = $this->app->model('members');
$arrPams = $obj_members->dump($arrMember['member_id'], '*', array(':account@pam' => array('*')));
}
// remark create
$obj_order_create = kernel::single("b2c_order_remark");
$arr_remark = array('order_bn' => $order_id, 'mark_text' => $_POST['memo'], 'op_name' => !$arrMember['member_id'] ? '顾客' : $arrPams['pam_account']['login_name'], 'mark_type' => 'b0');
$log_text = "";
if ($result) {
$log_text = "订单创建成功!";
} else {
$log_text = "订单创建失败!";
}
$orderLog = $this->app->model("order_log");
$sdf_order_log = array('rel_id' => $order_id, 'op_id' => $arrMember['member_id'], 'op_name' => !$arrMember['member_id'] ? '顾客' : $arrPams['pam_account']['login_name'], 'alttime' => time(), 'bill_type' => 'order', 'behavior' => 'creates', 'result' => 'SUCCESS', 'log_text' => $log_text);
$log_id = $orderLog->save($sdf_order_log);
if ($result) {
foreach (kernel::servicelist('b2c_save_post_om') as $object) {
$object->set_arr($order_id, 'order');
}
// 设定优惠券不可以使用
$objCarts = $this->app->model('cart')->get_objects(true);
if (isset($objCarts['object']['coupon']) && $objCarts['object']['coupon']) {
$obj_coupon = kernel::single("b2c_coupon_mem");
foreach ($objCarts['object']['coupon'] as $coupons) {
if ($coupons['used']) {
$obj_coupon->use_c($coupons['coupon'], $arrMember['member_id']);
}
}
}
// 订单成功后清除购物车的的信息
$this->cart_model =& $this->app->model('cart_objects');
$this->cart_model->remove_object();
// 生成cookie有效性的验证信息
setcookie('ST_ShopEx-Order-Buy', md5($this->app->getConf('certificate.token') . $order_id));
setcookie("S[ST_ShopEx-Anonymity-Buy]", "false", time() - 3600);
// 得到物流公司名称
if ($order_data['order_objects']) {
$itemNum = 0;
$good_id = "";
$goods_name = "";
foreach ($order_data['order_objects'] as $arr_objects) {
if ($arr_objects['order_items']) {
if ($arr_objects['obj_type'] == 'goods') {
$obj_goods = $this->app->model('goods');
$good_id = $arr_objects['order_items'][0]['goods_id'];
$arr_goods = $obj_goods->dump($good_id);
}
foreach ($arr_objects['order_items'] as $arr_items) {
$itemNum = $this->objMath->number_plus(array($itemNum, $arr_items['quantity']));
if ($arr_objects['obj_type'] == 'goods') {
if ($arr_items['item_type'] == 'product') {
$goods_name .= $arr_items['name'] . ($arr_items['products']['spec_info'] ? '(' . $arr_items['products']['spec_info'] . ')' : '') . '(' . $arr_items['quantity'] . ')';
}
}
}
}
}
$arr_dlytype = $obj_dlytype->dump($order_data['shipping']['shipping_id'], 'dt_name');
$arr_updates = array('order_id' => $order_id, 'total_amount' => $order_data['total_amount'], 'shipping_id' => $arr_dlytype['dt_name'], 'ship_mobile' => $order_data['consignee']['mobile'], 'ship_tel' => $order_data['consignee']['telephone'], 'ship_addr' => $order_data['consignee']['addr'], 'ship_email' => $order_data['consignee']['email'] ? $order_data['consignee']['email'] : '', 'ship_zip' => $order_data['consignee']['zip'], 'ship_name' => $order_data['consignee']['name'], 'member_id' => $order_data['member_id'] ? $order_data['member_id'] : 0, 'uname' => !$order_data['member_id'] ? '顾客' : $arrPams['pam_account']['login_name'], 'itemnum' => count($order_data['order_objects']), 'goods_id' => $good_id, 'goods_url' => kernel::base_url(1) . kernel::url_prefix() . $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_product', 'act' => 'index', 'arg0' => $good_id)), 'thumbnail_pic' => base_storager::image_path($arr_goods['image_default_id']), 'goods_name' => $goods_name, 'ship_status' => '', 'pay_status' => 'Nopay', 'is_frontend' => true);
$order->fireEvent('create', $arr_updates, $order_data['member_id']);
}
}
if ($result) {
$this->end(true, $this->app->_("订单生成成功!"), $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_order', 'act' => 'index', 'arg0' => $order_id)));
} else {
$this->end(false, $msg, $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_cart', 'act' => 'checkout')));
}
}