/** * 查看订单详情 * * @author Garbin * @return void */ function view() { $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; $model_order =& m('order'); $order_info = $model_order->findAll(array('conditions' => "order_alias.order_id={$order_id} AND seller_id=" . $this->visitor->get('manage_store'), 'join' => 'has_orderextm')); $order_info = current($order_info); if (!$order_info) { $this->show_warning('no_such_order'); return; } /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('order_manage'), 'index.php?app=seller_order', LANG::get('view_order')); /* 当前用户中心菜单 */ $this->_curitem('order_manage'); $this->assign('page_title', Lang::get('member_center') . ' - ' . Lang::get('detail')); /* 调用相应的订单类型,获取整个订单详情数据 */ $order_type =& ot($order_info['extension']); $order_detail = $order_type->get_order_detail($order_id, $order_info); foreach ($order_detail['data']['goods_list'] as $key => $goods) { empty($goods['goods_image']) && ($order_detail['data']['goods_list'][$key]['goods_image'] = Conf::get('default_goods_image')); } $this->assign('order', $order_info); $this->assign($order_detail['data']); $this->display('seller_order.view.html'); }
function index() { $conditions = $this->_get_query_conditions(array(array('field' => $_GET['field_name'], 'name' => 'field_value', 'equal' => 'like'))); //更新排序 if (isset($_GET['sort']) && isset($_GET['order'])) { $sort = strtolower(trim($_GET['sort'])); $order = strtolower(trim($_GET['order'])); if (!in_array($order, array('asc', 'desc'))) { $sort = 'user_id'; $order = 'asc'; } } else { $sort = 'user_id'; $order = 'asc'; } $page = $this->_get_page(); $users = $this->_user_mod->find(array('join' => 'has_store,manage_mall', 'fields' => 'this.*,store.store_id,userpriv.store_id as priv_store_id,userpriv.privs', 'conditions' => '1=1' . $conditions, 'limit' => $page['limit'], 'order' => "{$sort} {$order}", 'count' => true)); foreach ($users as $key => $val) { if ($val['priv_store_id'] == 0 && $val['privs'] != '') { $users[$key]['if_admin'] = true; } } $this->assign('users', $users); $page['item_count'] = $this->_user_mod->getCount(); $this->_format_page($page); $this->assign('filtered', $conditions ? 1 : 0); //是否有查询条件 $this->assign('page_info', $page); /* 导入jQuery的表单验证插件 */ $this->import_resource(array('script' => 'jqtreetable.js,inline_edit.js', 'style' => 'res:style/jqtreetable.css')); $this->assign('query_fields', array('user_name' => LANG::get('user_name'), 'email' => LANG::get('email'), 'real_name' => LANG::get('real_name'))); $this->assign('sort_options', array('reg_time DESC' => LANG::get('reg_time'), 'last_login DESC' => LANG::get('last_login'), 'logins DESC' => LANG::get('logins'))); $this->display('user.index.html'); }
public static function errorHandler($resp, $code) { $resp = json_decode($resp, true); $message = isset($resp['message']) ? $resp['message'] : null; $message_to_purchaser = isset($resp['message_to_purchaser']) ? $resp['message_to_purchaser'] : null; $type = isset($resp['type']) ? $resp['type'] : null; $params = isset($resp['param']) ? $resp['param'] : null; if (isset($code) != true || $code == 0) { throw new Conekta_NoConnectionError(LANG::translate('error.requestor.connection', array('BASE' => Conekta::$apiBase), LANG::EN), LANG::translate('error.requestor.connection_purchaser', null, Conekta::$locale), $type, $code, $params); } switch ($code) { case 400: throw new Conekta_MalformedRequestError($message, $message_to_purchaser, $type, $code, $params); case 401: throw new Conekta_AuthenticationError($message, $message_to_purchaser, $type, $code, $params); case 402: throw new Conekta_ProcessingError($message, $message_to_purchaser, $type, $code, $params); case 404: throw new Conekta_ResourceNotFoundError($message, $message_to_purchaser, $type, $code, $params); case 422: throw new Conekta_ParameterValidationError($message, $message_to_purchaser, $type, $code, $params); case 500: throw new Conekta_ApiError($message, $message_to_purchaser, $type, $code, $params); default: throw new self($message, $message_to_purchaser, $type, $code, $params); } }
function index() { /* 取得列表数据 */ $conditions = $this->_get_query_conditions(array(array('field' => 'state', 'name' => 'state', 'handler' => 'groupbuy_state_translator'), array('field' => 'group_name', 'name' => 'group_name', 'equal' => 'LIKE'))); // 标识有没有过滤条件 if ($conditions) { $this->assign('filtered', 1); } $page = $this->_get_page(10); //获取分页信息 $groupbuy_list = $this->_groupbuy_mod->find(array('join' => 'be_join', 'order' => 'gb.group_id DESC', 'limit' => $page['limit'], 'count' => true, 'conditions' => 'user_id=' . $this->visitor->info['user_id'] . $conditions)); $page['item_count'] = $this->_groupbuy_mod->getCount(); //获取统计的数据 foreach ($groupbuy_list as $key => $groupbuy) { $groupbuy['ican'] = $this->_ican($groupbuy['group_id']); $groupbuy_list[$key] = $groupbuy; $groupbuy_list[$key]['spec_quantity'] = unserialize($groupbuy['spec_quantity']); $groupbuy['default_image'] || ($groupbuy_list[$key]['default_image'] = Conf::get('default_goods_image')); } //dump($groupbuy_list); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_groupbuy'), 'index.php?app=buyer_groupbuy', LANG::get('groupbuy_list')); /* 当前用户中心菜单 */ $this->_curitem('my_groupbuy'); /* 当前所处子菜单 */ $this->_curmenu('groupbuy_list'); $this->_format_page($page); $this->assign('page_info', $page); //将分页信息传递给视图,用于形成分页条 $this->assign('groupbuy_list', $groupbuy_list); $this->assign('state', array('all' => Lang::get('group_all'), 'on' => Lang::get('group_on'), 'end' => Lang::get('group_end'), 'finished' => Lang::get('group_finished'), 'canceled' => Lang::get('group_canceled'))); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_groupbuy')); $this->display('buyer_groupbuy.index.html'); }
function index() { $page = $this->_get_page(10); $this->_user_mod =& m('member'); $this->_store_mod =& m('store'); $this->_coupon_mod =& m('coupon'); $msg = $this->_user_mod->findAll(array('conditions' => 'user_id = ' . $this->visitor->get('user_id'), 'count' => true, 'limit' => $page['limit'], 'include' => array('bind_couponsn' => array()))); $page['item_count'] = $this->_user_mod->getCount(); $coupon = array(); $coupon_ids = array(); $msg = current($msg); if (!empty($msg['coupon_sn'])) { foreach ($msg['coupon_sn'] as $key => $val) { $coupon_tmp = $this->_coupon_mod->get(array('fields' => "this.*,store.store_name,store.store_id", 'conditions' => 'coupon_id = ' . $val['coupon_id'], 'join' => 'belong_to_store')); $coupon_tmp['valid'] = 0; $time = gmtime(); if ($val['remain_times'] > 0 && ($coupon_tmp['end_time'] == 0 || $coupon_tmp['end_time'] > $time)) { $coupon_tmp['valid'] = 1; } $coupon[$key] = array_merge($val, $coupon_tmp); } } $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_coupon'), 'index.php?app=my_coupon', LANG::get('coupon_list')); $this->_curitem('my_coupon'); $this->_curmenu('coupon_list'); $this->assign('page_info', $page); //将分页信息传递给视图,用于形成分页条 $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('coupon_list')); $this->_format_page($page); $this->assign('coupons', $coupon); $this->display('my_coupon.index.html'); }
function index() { $page = $this->_get_page(8); $type = isset($_GET['type']) && $_GET['type'] != '' ? trim($_GET['type']) : 'all_qa'; $conditions = '1=1 AND goods_qa.user_id = ' . $_SESSION['user_info']['user_id']; if ($type == 'reply_qa') { $conditions .= ' AND reply_content !="" '; } $my_qa_data = $this->my_qa_mod->find(array('fields' => 'ques_id,question_content,reply_content,time_post,time_reply,goods_qa.user_id,goods_qa.item_name,goods_qa.item_id,goods_qa.email,goods_qa.type,if_new,user_name', 'join' => 'belongs_to_store,belongs_to_user', 'count' => true, 'conditions' => $conditions, 'limit' => $page['limit'], 'order' => 'if_new desc,time_post desc')); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_question'), 'index.php?app=my_question', LANG::get('my_question_list')); /* 当前用户中心菜单 */ $this->_curitem('my_question'); /* 当前所处子菜单 */ $this->_curmenu('my_qa_list'); $page['item_count'] = $this->my_qa_mod->getCount(); //获取统计的数据 $this->_format_page($page); $this->assign('_curmenu', $type); $this->assign('page_info', $page); $this->assign('my_qa_data', $my_qa_data); if ($type == 'reply_qa') { $update_data = array('if_new' => '0'); $this->my_qa_mod->edit($my_qa_data['ques_id'], $update_data); } $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_question')); $this->display('my_question.index.html'); }
function login() { if ($this->visitor->has_login) { $this->show_warning('has_login'); return; } if (!IS_POST) { if (!empty($_GET['ret_url'])) { $ret_url = trim($_GET['ret_url']); } else { if (isset($_SERVER['HTTP_REFERER'])) { $ret_url = $_SERVER['HTTP_REFERER']; } else { $ret_url = SITE_URL . '/index.php'; } } /* 防止登陆成功后跳转到登陆、退出的页面 */ $ret_url = strtolower($ret_url); if (str_replace(array('act=login', 'act=logout'), '', $ret_url) != $ret_url) { $ret_url = SITE_URL . '/index.php'; } if (Conf::get('captcha_status.login')) { $this->assign('captcha', 1); } $this->import_resource(array('script' => 'jquery.plugins/jquery.validate.js')); $this->assign('ret_url', rawurlencode($ret_url)); $this->_curlocal(LANG::get('user_login')); $this->_config_seo('title', Lang::get('user_login') . ' - ' . Conf::get('site_title')); $this->display('login.html'); /* 同步退出外部系统 */ if (!empty($_GET['synlogout'])) { $ms =& ms(); echo $synlogout = $ms->user->synlogout(); } } else { if (Conf::get('captcha_status.login') && base64_decode($_SESSION['captcha']) != strtolower($_POST['captcha'])) { $this->show_warning('captcha_failed'); return; } $user_name = trim($_POST['user_name']); $password = $_POST['password']; $ms =& ms(); $user_id = $ms->user->auth($user_name, $password); if (!$user_id) { /* 未通过验证,提示错误信息 */ $this->show_warning($ms->user->get_error()); return; } else { /* 通过验证,执行登陆操作 */ $this->_do_login($user_id); /* 同步登陆外部系统 */ $synlogin = $ms->user->synlogin($user_id); } $this->show_message(Lang::get('login_successed') . $synlogin, 'back_before_login', rawurldecode($_POST['ret_url']), 'enter_member_center', 'index.php?app=member'); } }
function reply() { if (!IS_POST) { $ques_id = isset($_GET['ques_id']) && $_GET['ques_id'] != '' ? intval($_GET['ques_id']) : 0; $conditions = ' AND goods_qa.store_id = ' . $_SESSION['user_info']['user_id'] . ' AND ques_id = ' . $ques_id; $my_qa_data = $this->my_qa_mod->get(array('fields' => 'question_content,reply_content,goods_qa.user_id,goods_qa.email,time_post,user_name,goods_qa.item_id,goods_qa.item_name,goods_qa.type', 'join' => 'belongs_to_store,belongs_to_user', 'conditions' => '1=1 ' . $conditions)); if ($my_qa_data['reply_content'] != '') { echo Lang::get('already_replied'); return; } /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_qa'), 'index.php?app=my_qa', LANG::get('reply')); /* 当前用户中心菜单 */ $this->_curitem('my_qa'); /* 当前所处子菜单 */ $this->_curmenu('reply'); $this->assign('_curmenu', 'reply'); $this->assign('page_info', $page); $this->assign('my_qa_data', $my_qa_data); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('reply')); header('Content-Type:text/html;charset=' . CHARSET); $this->display('my_qa.form.html'); } else { $act = isset($_POST['act']) && $_POST['act'] != '' ? trim($_POST['act']) : ''; $ques_id = isset($_POST['ques_id']) && $_POST['ques_id'] != '' ? intval($_POST['ques_id']) : ''; $content = isset($_POST['content']) && $_POST['content'] != '' ? trim($_POST['content']) : ''; if ($act != 'reply' || $ques_id == '') { $this->pop_warning('Hacking Attempt'); return; } if ($content == '') { $this->pop_warning('content_not_null'); return; } $user_info = $this->my_qa_mod->get(array('conditions' => '1 = 1 AND ques_id = ' . $ques_id, 'fields' => 'user_id,email,item_id,item_name,type')); extract($user_info); $data = array('reply_content' => $content, 'time_reply' => gmtime(), 'if_new' => '1'); if ($this->my_qa_mod->edit($ques_id, $data)) { $url = ''; switch ($type) { case 'goods': $url = SITE_URL . "/index.php?app={$type}&act=qa&id={$item_id}&ques_id={$ques_id}&new=yes"; break; case 'groupbuy': $url = SITE_URL . "/index.php?app={$type}&id={$item_id}&ques_id={$ques_id}&new=yes"; break; } $mail = get_mail('tobuyer_question_replied', array('item_name' => $item_name, 'type' => Lang::get($type), 'url' => $url)); $this->_mailto($email, addslashes($mail['subject']), addslashes($mail['message'])); $this->pop_warning('ok', 'my_qa_reply'); } else { $this->pop_warning('reply_failed'); return; } } }
public function instanceUrl() { $id = $this->id; if (!$id) { throw new Conekta_Error(LANG::translate('error.resource.id', array('RESOURCE' => get_class()), LANG::EN), LANG::translate('error.resource.id_purchaser', null, Conekta::$locale)); } $class = get_class($this); $base = $this->classUrl($class); $extn = urlencode($id); return "{$base}/{$extn}"; }
public function instanceUrl() { $id = $this->id; if (!$id) { throw new Conekta_Error(LANG::translate('error.resource.id', array('RESOURCE' => get_class()), LANG::EN), LANG::translate('error.resource.id_purchaser', null, Conekta::$locale)); } $class = get_class($this); $base = '/subscription'; $customerUrl = $this->customer->instanceUrl(); return "{$customerUrl}{$base}"; }
/** * 列出购物车中的商品 * * @author Garbin * @return void */ function index() { $store_id = isset($_GET['store_id']) ? intval($_GET['store_id']) : 0; $carts = $this->_get_carts($store_id); $this->_curlocal(LANG::get('cart')); $this->_config_seo('title', Lang::get('confirm_goods') . ' - ' . Conf::get('site_title')); if (empty($carts)) { $this->_cart_empty(); return; } $this->assign('carts', $carts); $this->display('cart.index.html'); }
function _get_channel_curlocal($channel) { $curlocal = array(array('text' => LANG::get('all_categories'), 'url' => url('app=category'))); if (isset($channel['cate_id']) && intval($channel['cate_id']) > 0) { $parents = $this->_gcategory_mod->get_ancestor($channel['cate_id'], true); foreach ($parents as $category) { $curlocal[] = array('text' => $category['cate_name'], 'url' => url('app=search&act=store&cate_id=' . $category['cate_id'])); } } unset($curlocal[count($curlocal) - 1]); $curlocal[] = array('text' => $channel['title'], 'url' => ''); return $curlocal; }
function index() { $tmp_info = $this->_store_mod->get(array('conditions' => $this->_store_id, 'join' => 'belongs_to_sgrade', 'fields' => 'domain, functions')); $subdomain_enable = false; if (ENABLED_SUBDOMAIN && in_array('subdomain', explode(',', $tmp_info['functions']))) { $subdomain_enable = true; } if (!IS_POST) { //传给iframe参数belong, item_id $this->assign('belong', BELONG_STORE); $this->assign('id', $this->_store_id); $store = $this->_store_mod->get_info($this->_store_id); $this->assign('store', $store); $this->assign('editor_upload', $this->_build_upload(array('obj' => 'EDITOR_SWFU', 'belong' => BELONG_STORE, 'item_id' => $this->_store_id, 'button_text' => Lang::get('bat_upload'), 'button_id' => 'editor_upload_button', 'progress_id' => 'editor_upload_progress', 'upload_url' => 'index.php?app=swfupload', 'if_multirow' => 1))); $this->assign('build_editor', $this->_build_editor(array('name' => 'description'))); $msn_active_url = 'http://settings.messenger.live.com/applications/websignup.aspx?returnurl=' . SITE_URL . '/index.php' . urlencode('?app=my_store&act=update_im_msn') . '&privacyurl=' . SITE_URL . '/index.php' . urlencode('?app=article&act=system&code=msn_privacy'); $this->assign('msn_active_url', $msn_active_url); $region_mod =& m('region'); $this->assign('regions', $region_mod->get_options(0)); //$this->headtag('<script type="text/javascript" src="{lib file=mlselection.js}"></script>'); /* 属于店铺的附件 */ $files_belong_store = $this->_uploadedfile_mod->find(array('conditions' => 'store_id = ' . $this->visitor->get('manage_store') . ' AND belong = ' . BELONG_STORE . ' AND item_id =' . $this->visitor->get('manage_store'), 'fields' => 'this.file_id, this.file_name, this.file_path', 'order' => 'add_time DESC')); /* 当前页面信息 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_store')); $this->_curitem('my_store'); $this->_curmenu('my_store'); $this->import_resource('jquery.plugins/jquery.validate.js,mlselection.js'); $this->assign('files_belong_store', $files_belong_store); $this->assign('subdomain_enable', $subdomain_enable); $this->assign('domain_length', Conf::get('subdomain_length')); $this->assign('page_title', Lang::get('member_center') . ' - ' . Lang::get('my_store')); $this->display('my_store.index.html'); } else { $subdomain = $tmp_info['domain']; if ($subdomain_enable && !$tmp_info['domain']) { $subdomain = empty($_POST['domain']) ? '' : trim($_POST['domain']); if (!$this->_store_mod->check_domain($subdomain, Conf::get('subdomain_reserved'), Conf::get('subdomain_length'))) { $this->show_warning($this->_store_mod->get_error()); return; } } $data = $this->_upload_files(); if ($data === false) { return; } $data = array_merge($data, array('store_name' => $_POST['store_name'], 'region_id' => $_POST['region_id'], 'region_name' => $_POST['region_name'], 'description' => $_POST['description'], 'address' => $_POST['address'], 'tel' => $_POST['tel'], 'im_qq' => $_POST['im_qq'], 'im_ww' => $_POST['im_ww'], 'domain' => $subdomain)); $this->_store_mod->edit($this->_store_id, $data); $this->show_message('edit_ok'); } }
function index() { $conditions = empty($_GET['wait_verify']) ? "state <> '" . STORE_APPLYING . "'" : "state = '" . STORE_APPLYING . "'"; $filter = $this->_get_query_conditions(array(array('field' => 'store_name', 'equal' => 'like'), array('field' => 'sgrade'))); $store_id = $_GET['store_id']; if ($store_id) { $filter .= " AND store_id = '{$store_id}' "; } $owner_name = trim($_GET['owner_name']); if ($owner_name) { $filter .= " AND (user_name LIKE '%{$owner_name}%' OR owner_name LIKE '%{$owner_name}%') "; } //更新排序 if (isset($_GET['sort']) && isset($_GET['order'])) { $sort = strtolower(trim($_GET['sort'])); $order = strtolower(trim($_GET['order'])); if (!in_array($order, array('asc', 'desc'))) { $sort = 'sort_order'; $order = ''; } } else { $sort = 'store_id'; $order = 'desc'; } $this->assign('filter', $filter); $conditions .= $filter; $page = $this->_get_page(50); $stores = $this->_store_mod->find(array('conditions' => $conditions, 'join' => 'belongs_to_user', 'fields' => 'this.*,member.user_name', 'limit' => $page['limit'], 'count' => true, 'order' => "{$sort} {$order}")); $sgrade_mod =& m('sgrade'); $grades = $sgrade_mod->get_options(); $this->assign('sgrades', $grades); $states = array(STORE_APPLYING => LANG::get('wait_verify'), STORE_OPEN => Lang::get('open'), STORE_CLOSED => Lang::get('close')); foreach ($stores as $key => $store) { $stores[$key]['sgrade'] = $grades[$store['sgrade']]; $stores[$key]['state'] = $states[$store['state']]; $certs = empty($store['certification']) ? array() : explode(',', $store['certification']); for ($i = 0; $i < count($certs); $i++) { $certs[$i] = Lang::get($certs[$i]); } $stores[$key]['certification'] = join('<br />', $certs); } $this->assign('stores', $stores); $page['item_count'] = $this->_store_mod->getCount(); $this->import_resource(array('script' => 'inline_edit.js')); $this->_format_page($page); $this->assign('filtered', $filter ? 1 : 0); //是否有查询条件 $this->assign('page_info', $page); $this->display('store.index.html'); }
function index() { $data = $this->_get_user_comments(10); $this->assign('comments', $data['comments']); $this->assign('page_info', $data['page_info']); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_comment')); //当前用户中心菜单项 $this->_curitem('my_comment'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . "我的评价"); if (is_wap()) { $this->assign("title", "商品评价"); } $this->display('pr_comments.index.html'); }
function mall_coupon() { $page = $this->_get_page(10); $coupon = $this->_get_mall_coupon(false, $page['limit']); $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('coupon'), 'index.php?app=coupon', LANG::get('coupons_list')); $page['item_count'] = $this->_get_mall_coupon(true); $this->_format_page($page); $this->assign('page_info', $page); $this->_curitem('coupon'); $this->_curmenu('mall_coupons'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('coupon')); $this->assign('coupons', $coupon); $this->assign('type', 'mall_coupon'); $this->assign('time', gmtime()); $this->display('coupon.index.html'); }
function index() { $page = $this->_get_page(10); $coupon = $this->_coupon_mod->find(array('conditions' => 'store_id = ' . $this->_store_id, 'limit' => $page['limit'], 'count' => true)); $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('coupon'), 'index.php?app=coupon', LANG::get('coupons_list')); $page['item_count'] = $this->_coupon_mod->getCount(); $this->_format_page($page); $this->assign('page_info', $page); $this->_curitem('coupon'); $this->_curmenu('coupons_list'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('coupon')); $this->assign('coupons', $coupon); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); $this->assign('time', gmtime()); $this->display('coupon.index.html'); }
function index() { $page = $this->_get_page(8); $type = isset($_GET['type']) && $_GET['type'] != '' ? trim($_GET['type']) : 'all_qa'; $conditions = '1=1 AND goods_qa.user_id = ' . $_SESSION['user_info']['user_id']; if ($type == 'reply_qa') { $conditions .= ' AND reply_content !="" '; } $my_qa_data = $this->my_qa_mod->find(array('fields' => 'ques_id,question_content,reply_content,time_post,time_reply,goods_qa.user_id,goods_qa.item_name,goods_qa.item_id,goods_qa.email,goods_qa.type,if_new,user_name', 'join' => 'belongs_to_store,belongs_to_user', 'count' => true, 'conditions' => $conditions, 'limit' => $page['limit'], 'order' => 'if_new desc,time_post desc')); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', "我的评价", 'index.php?app=my_question', "评价列表"); /* 当前用户中心菜单 */ $this->_curitem('my_question'); /* 当前所处子菜单 */ $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_question')); $this->display('pr_comments.index.html'); }
/** * 查看订单详情 * * @author Garbin * @return void */ function view() { $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; $model_order =& m('order'); $order_info = $model_order->findAll(array('conditions' => "order_alias.order_id={$order_id} AND seller_id=" . $this->visitor->get('manage_store'), 'join' => 'has_orderextm')); $order_info = current($order_info); if (!$order_info) { $this->show_warning('no_such_order'); return; } //360cd.cn trans if ($order_info['trans_id']) { $trans_model =& m('trans'); $trans_info = $trans_model->get_trans($order_info['trans_id']); $order_info['trans_info'] = $trans_info['desc']; } //360cd.cn trans /* 团购信息 */ if ($order_info['extension'] == 'groupbuy') { $groupbuy_mod =& m('groupbuy'); $group = $groupbuy_mod->get(array('join' => 'be_join', 'conditions' => 'order_id=' . $order_id, 'fields' => 'gb.group_id')); $this->assign('group_id', $group['group_id']); } /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('order_manage'), 'index.php?app=seller_order', LANG::get('view_order')); /* 当前用户中心菜单 */ $this->_curitem('order_manage'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('detail')); /* 调用相应的订单类型,获取整个订单详情数据 */ $order_type =& ot($order_info['extension']); $order_detail = $order_type->get_order_detail($order_id, $order_info); $spec_ids = array(); foreach ($order_detail['data']['goods_list'] as $key => $goods) { empty($goods['goods_image']) && ($order_detail['data']['goods_list'][$key]['goods_image'] = Conf::get('default_goods_image')); $spec_ids[] = $goods['spec_id']; } /* 查出最新的相应的货号 */ $model_spec =& m('goodsspec'); $spec_info = $model_spec->find(array('conditions' => $spec_ids, 'fields' => 'sku')); foreach ($order_detail['data']['goods_list'] as $key => $goods) { $order_detail['data']['goods_list'][$key]['sku'] = $spec_info[$goods['spec_id']]['sku']; } $this->assign('order', $order_info); $this->assign($order_detail['data']); $this->display('seller_order.view.html'); }
function edit() { $addr_id = empty($_GET['addr_id']) ? 0 : intval($_GET['addr_id']); if (!$addr_id) { $this->pop_warning('no_such_address'); return; } if (!IS_POST) { $model_address =& m('address'); $find_data = $model_address->find("addr_id = {$addr_id} AND user_id=" . $this->visitor->get('user_id')); if (empty($find_data)) { $this->show_warning('no_such_address'); return; } $address = current($find_data); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_address'), 'index.php?app=my_address', LANG::get('edit_address')); /* 当前用户中心菜单 */ /*$this->_curitem('my_address'); /* 当前所处子菜单 */ header('Content-Type:text/html;charset=' . CHARSET); $this->_curmenu('edit_address'); $this->assign('address', $address); //$this->import_resource('mlselection.js, jquery.plugins/jquery.validate.js'); $this->assign('act', 'edit'); $this->_get_regions(); $this->display('my_address.form.html'); } else { /* 电话和手机至少填一项 */ if (!$_POST['phone_tel'] && !$_POST['phone_mob']) { $this->pop_warning('phone_required'); return; } $data = array('consignee' => $_POST['consignee'], 'region_id' => $_POST['region_id'], 'region_name' => $_POST['region_name'], 'address' => $_POST['address'], 'zipcode' => $_POST['zipcode'], 'phone_tel' => $_POST['phone_tel'], 'phone_mob' => $_POST['phone_mob']); $model_address =& m('address'); $model_address->edit("addr_id = {$addr_id} AND user_id=" . $this->visitor->get('user_id'), $data); if ($model_address->has_error()) { $this->pop_warning($model_address->get_error()); return; } $this->pop_warning('ok', APP . '_' . ACT); $this->show_message('edit_address_successed', 'back_list', 'index.php?app=my_address', 'edit_again', 'index.php?app=my_address&act=edit&addr_id=' . $addr_id); } }
/** * 编辑配送方式 * * @author Garbin * @return void */ function edit() { $shipping_id = isset($_GET['shipping_id']) ? intval($_GET['shipping_id']) : 0; if (!$shipping_id) { $this->show_warning('no_such_shipping'); return; } /* 判断是否是自己的 */ $model_shipping =& m('shipping'); $shipping = $model_shipping->get("store_id=" . $this->visitor->get('manage_store') . " AND shipping_id={$shipping_id}"); if (!$shipping) { $this->show_warning('no_such_shipping'); return; } if (!IS_POST) { /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_shipping'), 'index.php?app=my_shipping', LANG::get('edit_shipping')); /* 当前用户中心菜单 */ $this->_curitem('my_shipping'); /* 当前所处子菜单 */ $this->_curmenu('edit_shipping'); $this->_get_regions(); $cod_regions = unserialize($shipping['cod_regions']); !$cod_regions && ($cod_regions = array()); $this->assign('shipping', $shipping); $this->assign('cod_regions', $cod_regions); $this->assign('yes_or_no', array(1 => Lang::get('yes'), 0 => Lang::get('no'))); $this->import_resource('mlselection.js, jquery.plugins/jquery.validate.js'); header("Content-Type:text/html;charset=" . CHARSET); $this->display('my_shipping.form.html'); } else { $data = array('shipping_name' => $_POST['shipping_name'], 'shipping_desc' => $_POST['shipping_desc'], 'first_price' => $_POST['first_price'], 'step_price' => $_POST['step_price'], 'enabled' => $_POST['enabled'], 'sort_order' => $_POST['sort_order']); $cod_regions = empty($_POST['cod_regions']) ? array() : $_POST['cod_regions']; $data['cod_regions'] = serialize($cod_regions); $model_shipping =& m('shipping'); $model_shipping->edit($shipping_id, $data); if ($model_shipping->has_error()) { //$this->show_warning($model_shipping->get_error()); $msg = $model_shipping->get_error(); $this->pop_warning($msg['msg']); return; } $this->pop_warning('ok', 'my_shipping_edit'); $this->show_message('edit_shipping_successed', 'back_list', 'index.php?app=my_shipping', 'edit_again', 'index.php?app=my_shipping&act=edit&shipping_id=' . $shipping_id); } }
/** * 列出购物车中的商品 * * @author Garbin * @return void */ function index() { $carts = $this->_get_carts(0); //0,no limit if (empty($carts)) { //empty cart $this->_cart_empty(); return; } $this->assign('carts', $carts); $this->_curlocal(LANG::get('cart')); $this->_config_seo('title', Lang::get('confirm_goods') . ' - ' . Conf::get('site_title')); if (is_wap()) { $this->assign('title', Lang::get('confirm_goods')); } $this->display('cart.index.html'); }
/** * 支付完成后返回的URL,在此只进行提示,不对订单进行任何修改操作,这里不严格验证,不改变订单状态 * * @author Garbin * @return void */ function index() { //这里是支付宝,财付通等当订单状态改变时的通知地址 $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; //哪个订单 if (!$order_id) { /* 无效的通知请求 */ $this->show_warning('forbidden'); return; } /* 获取订单信息 */ $model_order =& m('order'); $order_info = $model_order->get($order_id); if (empty($order_info)) { /* 没有该订单 */ $this->show_warning('forbidden'); return; } $model_payment =& m('payment'); $payment_info = $model_payment->get("payment_code='{$order_info['payment_code']}' AND store_id={$order_info['seller_id']}"); if (empty($payment_info)) { /* 没有指定的支付方式 */ $this->show_warning('no_such_payment'); return; } /* 调用相应的支付方式 */ $payment = $this->_get_payment($order_info['payment_code'], $payment_info); /* 获取验证结果 */ /* 为了兼容 Asiapay, 因为他不向这个地址POST数据 */ if ($order_info['payment_code'] != 'asiapay') { $notify_result = $payment->verify_notify($order_info); if ($notify_result === false) { /* 支付失败 */ $this->show_warning($payment->get_error()); return; } } #TODO 临时在此也改变订单状态为方便调试,实际发布时应把此段去掉,订单状态的改变以notify为准 //$this->_change_order_status($order_id, $order_info['extension'], $notify_result); /* 只有支付时会使用到return_url,所以这里显示的信息是支付成功的提示信息 */ $this->_curlocal(LANG::get('pay_successed')); $this->assign('order', $order_info); $this->assign('payment', $payment_info); $this->display('paynotify.index.html'); }
protected static function readDirectory($directory) { if (!empty(self::$cache)) { return self::$cache; } $langs = array(); if ($handle = opendir($directory)) { while ($lang = readdir($handle)) { if (strpos($lang, ".php") !== false) { $langKey = str_replace('.php', '', $lang); $langs[$langKey] = (include $directory . '/' . $lang); } } closedir($handle); } self::$cache = $langs; return $langs; }
function delete() { $ques_id = empty($_GET['id']) ? 0 : trim($_GET['id']); $ids = explode(',', $ques_id); $conditions = "1 = 1 AND ques_id " . db_create_in($ids); $ms =& ms(); foreach ($ids as $key => $val) { $title = Lang::get('drop_goodsqa_notice'); $store = $this->goodsqa_mod->get(array('conditions' => 'ques_id =' . $val, 'join' => 'belongs_to_goods', 'fields' => 'goods_qa.store_id,goods_name,question_content')); $content = sprintf(Lang::get('admin_drop_your_goodsqa'), LANG::get('goods'), addslashes($store['goods_name']), Lang::get('content_is'), addslashes($store['question_content'])); $ms->pm->send(MSG_SYSTEM, $store['store_id'], $title, $content); } if (!($res = $this->goodsqa_mod->drop($conditions))) { $this->show_warning('drop_failed'); return; } else { $this->show_warning('drop_successful', 'to_qa_list', 'index.php?app=goodsqa'); return; } }
/** * 添加好友 * * @author Hyber * @return void */ function add() { if (!IS_POST) { /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('friend'), 'index.php?app=friend', LANG::get('add_friend')); header('Content-Type:text/html;charset=' . CHARSET); /* 当前所处子菜单 */ $this->_curmenu('add_friend'); /* 当前用户中心菜单 */ $this->_curitem('friend'); $this->display('friend.form.html'); } else { $user_name = str_replace(Lang::get('comma'), ',', $_POST['user_name']); //替换中文格式的逗号 if (!$user_name) { $this->pop_warning('input_username'); return; } $user_names = explode(',', $user_name); //将逗号分割的用户名转换成数组 $mod_member =& m('member'); $members = $mod_member->find("user_name " . db_create_in($user_names)); $friend_ids = array_keys($members); if (!$friend_ids) { $this->pop_warning('no_such_user'); return; } $ms =& ms(); $result = $ms->friend->add($this->visitor->get('user_id'), $friend_ids); if (!$result) { $msg = current($ms->friend->get_error()); $this->pop_warning($msg['msg']); return; } $this->pop_warning('ok', APP . '_' . ACT); /*$this->show_message('add_friend_successed', 'back_list', 'index.php?app=friend', 'continue_add', 'index.php?app=friend&act=add' );*/ } }
function index() { if (!$this->_check_express_plugin()) { $this->show_warning('no_such_express_plugin'); return; } $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; if (!$order_id) { $this->show_warning('no_such_order'); return; } // 查询的订单必须是已发货(不是货到付款)或者是已完成的交易 $order_info = $this->_order_mod->get(array('conditions' => "(status=40 OR (status=30 AND payment_code !='cod')) AND order_id={$order_id} AND (seller_id=" . $this->visitor->get('user_id') . " OR buyer_id=" . $this->visitor->get('user_id') . ")", 'fields' => 'invoice_no,express_company,buyer_id,seller_id')); if (!$order_info) { $this->show_warning('no_such_order'); return; } // 如果快递公司或者快递单号为空,则返回空 if (empty($order_info['invoice_no']) || empty($order_info['express_company'])) { $this->show_warning('invoice_or_ecompany_empty'); return; } // 从订单ID查询快递公司和快递单号 $data = $this->_hook('on_query_express', array('com' => $order_info['express_company'], 'nu' => $order_info['invoice_no'])); $this->assign('kuaidi_info', $data); // 判断来访者是当前订单的买家还是卖家,以便设置不同的当前地址和左栏菜单 if ($order_info['seller_id'] == $this->visitor->get('user_id')) { $curlocal_item = 'index.php?app=seller_order'; $curmenu_item = 'order_manage'; } else { $curlocal_item = 'index.php?app=buyer_order'; $curmenu_item = 'my_order'; } /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get($curmenu_item), $curlocal_item, LANG::get('view_delivery_track')); /* 当前用户中心菜单 */ $this->_curitem($curmenu_item); $this->_curmenu('view_delivery_track'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get($curmenu_item)); $this->display('order.express.html'); }
function index() { extract($this->_get_themes()); if (empty($themes)) { $this->show_warning('no_themes'); return; } /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('theme_list')); /* 当前用户中心菜单 */ $this->_curitem('my_theme'); $this->_curmenu('theme_config'); $this->assign('themes', $themes); $this->assign('curr_template_name', $curr_template_name); $this->assign('curr_style_name', $curr_style_name); $this->assign('manage_store', $this->visitor->get('manage_store')); $this->assign('id', $this->visitor->get('user_id')); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); $this->assign('page_title', Lang::get('member_center') . ' - ' . Lang::get('my_theme')); $this->display('my_theme.index.html'); }
function index() { /* 取得列表数据 */ $model_address =& m('address'); $addresses = $model_address->find(array('conditions' => 'user_id = ' . $this->visitor->get('user_id'))); $this->assign('addresses', $addresses); if ($_GET['ret']) { $this->assign("ret", $_SERVER['HTTP_REFERER']); } /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_address'), 'index.php?app=my_address', LANG::get('address_list')); /* 当前用户中心菜单 */ $this->_curitem('my_address'); /* 当前所处子菜单 */ $this->_curmenu('address_list'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_address')); if (is_wap()) { $this->assign("title", "地址管理"); } $this->display('my_address.index.html'); }
function index() { $user = $this->visitor->get(); $user_mod =& m('member'); $info = $user_mod->get_info($user['user_id']); $user['portrait'] = portrait($user['user_id'], $info['portrait'], 'middle'); $info['last_login'] = date("Y-m-d H:i:s", $info['last_login']); if ($info['email'] && $info['phone_mob']) { $this->assign("rank", "高"); } else { $this->assign("rank", "中"); } $this->assign('user', $user); $this->assign('info', $info); $order_mod =& m('order'); $sql1 = "SELECT COUNT(*) FROM {$order_mod->table} WHERE buyer_id = '{$user['user_id']}' AND status = '" . ORDER_PENDING . "'"; $sql2 = "SELECT COUNT(*) FROM {$order_mod->table} WHERE buyer_id = '{$user['user_id']}' AND status = '" . ORDER_SHIPPED . "'"; $sql3 = "SELECT COUNT(*) FROM {$order_mod->table} WHERE buyer_id = '{$user['user_id']}' AND status = '" . ORDER_ACCEPTED . "'"; $sql4 = "SELECT COUNT(*) FROM {$order_mod->table} WHERE buyer_id = '{$user['user_id']}' AND status = '" . ORDER_FINISHED . "'"; $buyer_stat = array('pending' => $order_mod->getOne($sql1), 'shipped' => $order_mod->getOne($sql2), 'accepted' => $order_mod->getOne($sql3), 'eva' => $order_mod->getOne($sql4)); $this->assign('buyer_stat', $buyer_stat); // $this->assign('system_notice', $this->_get_system_notice('buyer_admin')); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), url('app=member'), LANG::get('overview')); /* 当前用户中心菜单 */ //$order_weifu = $this->get_order("pending"); //$this->assign("orders_weifu", $order_weifu); $order_weishou = $this->get_order("shipped"); $this->assign("orders_weishou", $order_weishou); $collect_goods = $this->_list_collect_goods(); $this->assign('collect_goods', $collect_goods); $this->_curitem('overview'); $this->_config_seo('title', Lang::get('member_center')); if (is_wap()) { $this->assign('title', Lang::get('member_center')); } $this->display('member.index.html'); }