public function indexEn() { if (is_wap()) { $this->theme("bootstrap"); } $this->display(); }
function edit() { $model_address =& m('address'); if (!IS_POST) { $addr_id = intval($_GET['addr_id']); if (!$addr_id) { $this->show_no(); } $find_data = $model_address->find("addr_id = {$addr_id} AND user_id=" . $this->visitor->get('user_id')); $address = current($find_data); $address['city'] = $this->get_parent($address['region_id']); $address['province'] = $this->get_parent($address['city']); $this->assign("province_list", $this->get_regions(0)); //取出所有的省 $this->assign("city_list", $this->get_regions($address['province'])); //取出所有的城市 $this->assign("dis_list", $this->get_regions($address['city'])); //取出所有的区域 $this->assign('address', $address); if (is_wap()) { $this->assign("title", "编辑地址"); } $this->display('my_address.edit.html'); } else { $data = array('consignee' => str_cut(trim($_POST['consignee']), 0, 10), 'region_id' => $_POST['region_id'], 'region_name' => $_POST['region_name'], 'address' => trim($_POST['address']), 'zipcode' => trim($_POST['zipcode']), 'phone_tel' => trim($_POST['phone_tel']), 'phone_mob' => trim($_POST['phone_mob'])); $addr_id = intval($_POST['addr_id']); if (!$addr_id) { $this->show_no(); } $where = "addr_id={$addr_id}"; $model_address->edit($where, $data); header("location:/index.php?app=my_address"); } }
public function termsService() { if (is_wap()) { $this->theme("bootstrap"); } $this->display(); }
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 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'); }
public function index() { if (isset($this->in['path']) && $this->in['path'] != '') { $dir = _DIR_CLEAR($_GET['path']); } else { if (isset($_SESSION['this_path'])) { $dir = _DIR_CLEAR($_SESSION['this_path']); } else { $dir = '/'; //For the first time into the system, with no arguments if ($GLOBALS['is_root']) { $dir = WEB_ROOT; } } } $dir = rtrim($dir, '/') . '/'; $this->assign('dir', $dir); if (is_wap()) { $this->display('index_wap.php'); } else { $this->display('index.php'); } }
public function index() { if (isset($this->in['path']) && $this->in['path'] != '') { $dir = _DIR_CLEAR($_GET['path']); } else { if (isset($_SESSION['this_path'])) { $dir = _DIR_CLEAR($_SESSION['this_path']); } else { $dir = '/'; //首次进入系统,不带参数 if ($GLOBALS['is_root']) { $dir = WEB_ROOT; } } } $dir = rtrim($dir, '/') . '/'; $this->assign('dir', $dir); if (is_wap()) { $this->display('index_wap.php'); } else { $this->display('index.php'); } }
function buy_now() { if (!$this->visitor->has_login && is_wap()) { header('Location:index.php?app=member&act=mlogin&ret_url=' . rawurlencode($_SERVER['HTTP_REFERER'])); return; } $spec_id = isset($_POST['spec_id']) ? intval($_POST['spec_id']) : 0; $quantity = isset($_POST['quantity']) ? intval($_POST['quantity']) : 0; if (!$spec_id || !$quantity) { return; } /* 是否有商品 */ $spec_model =& m('goodsspec'); $spec_info = $spec_model->get(array('fields' => 'g.store_id, g.goods_id, g.goods_name, g.spec_name_1, g.spec_name_2, g.default_image, gs.spec_1, gs.spec_2, gs.stock, gs.price', 'conditions' => $spec_id, 'join' => 'belongs_to_goods')); if (!$spec_info) { $this->show_message('no_such_goods'); /* 商品不存在 */ return; } /* 如果是自己店铺的商品,则不能购买 */ if ($this->visitor->get('manage_store')) { if ($spec_info['store_id'] == $this->visitor->get('manage_store')) { $this->show_message('can_not_buy_yourself'); return; } } $spec_1 = $spec_info['spec_name_1'] ? $spec_info['spec_name_1'] . ':' . $spec_info['spec_1'] : $spec_info['spec_1']; $spec_2 = $spec_info['spec_name_2'] ? $spec_info['spec_name_2'] . ':' . $spec_info['spec_2'] : $spec_info['spec_2']; $specification = $spec_1 . ' ' . $spec_2; /* 将商品加入购物车 */ $cart_item = array('user_id' => $this->visitor->get('user_id'), 'session_id' => SESS_ID, 'store_id' => $spec_info['store_id'], 'spec_id' => $spec_id, 'goods_id' => $spec_info['goods_id'], 'goods_name' => addslashes($spec_info['goods_name']), 'specification' => addslashes(trim($specification)), 'price' => $spec_info['price'], 'quantity' => $quantity, 'goods_image' => addslashes($spec_info['default_image']), 'is_cart' => 1); /* 添加并返回购物车统计即可 */ $cart_model =& m('cart'); $rec_id = $cart_model->add($cart_item); header('Location: /index.php?app=order&good=cart&rid=' . $rec_id . "&n=1"); }
function _get_carts_info() { if (is_wap()) { //is_wap if ($_GET['rid'] > 0) { //手机的立即购 $rec[] = $_GET['rid']; $_SESSION['rec_id'] = $rec; // $is_cart = " and is_cart = 1 "; } else { //wap cart $rec = isset($_GET['rec_id']) ? $_GET['rec_id'] : $_SESSION['rec_id']; //准备进去订单的购物车信息 $_SESSION['rec_id'] = $rec; } } else { if ($_GET['rid'] > 0) { //不是手机 $rec[] = $_GET['rid']; $_SESSION['rec_id'] = $rec; // $is_cart = " and is_cart = 1 "; } else { $rec = isset($_POST['rec_id']) ? $_POST['rec_id'] : $_SESSION['rec_id']; //准备进去订单的购物车信息 $_SESSION['rec_id'] = $rec; } } if (!$rec) { return false; } $cart_model =& m('cart'); foreach ($rec as $rec_id) { //获取进入订单页面的购物车商品 $cart_items[] = $cart_model->get(array('conditions' => "user_id = " . $this->visitor->get('user_id') . " AND rec_id = {$rec_id} AND session_id='" . SESS_ID . "'" . $is_cart, 'join' => 'belongs_to_goodsspec')); } foreach ($cart_items as $item) { /* 小计 */ $item['subtotal'] = $item['price'] * $item['quantity']; $kinds[$item['store_id']][$item['goods_id']] = 1; /* 以店铺ID为索引 */ empty($item['goods_image']) && ($item['goods_image'] = Conf::get('default_goods_image')); $carts[$item['store_id']]['store_name'] = $item['store_name']; $carts[$item['store_id']]['amount'] += $item['subtotal']; //各店铺的总金额 $carts[$item['store_id']]['quantity'] += $item['quantity']; //各店铺的总数量 $carts[$item['store_id']]['goods'][] = $item; } foreach ($cart_items as $item) { /* 小计 */ $item['subtotal'] = $item['price'] * $item['quantity']; //每个商品的总价格 $carts['subtotal'] += $item['subtotal']; $carts['quantity'] += $item['quantity']; } if (empty($cart_items)) { return false; } $store_model =& m('store'); foreach ($carts as $id => $val) { if ($id > 0) { $store_info[$id] = $store_model->get($id); //每个店铺的信息都在里面 } } foreach ($carts as $id => $goods) { if ($id > 0) { $return[$id]['items'] = $goods['goods']; $return[$id]['store_id'] = $id; //store_id $return[$id]['store_name'] = $store_info[$id]['store_name']; //name $return[$id]['wx'] = $store_info[$id]['wx']; //name empty($return[$id]['wx']) && ($return[$id]['wx'] = "static/images/qrCodeSmall.png"); $return[$id]['quantity'] = $goods['quantity']; $return[$id]['amount'] = $goods['amount']; $return[$id]['allow_coupon'] = true; } else { $return[$id] = $goods; $return['type'] = 'material'; $return['otype'] = 'normal'; } } return $return; }
/** * 登录view */ public function login($msg = '') { if (!file_exists(USER_SYSTEM . 'install.lock')) { $this->display('install.html'); exit; } $this->assign('msg', $msg); if (is_wap()) { $this->display('login_wap.html'); } else { $this->display('login.html'); } exit; }
/** * 获取收货人信息 * * @author Garbin * @param int $user_id * @return array */ function _get_my_address($user_id, $addr_id) { if (!$user_id) { return array(); } $address_model =& m('address'); if (!is_wap()) { return $address_model->find('user_id=' . $user_id . " order by checked desc"); } else { if ($addr_id > 0) { return $address_model->find('user_id=' . $user_id . " and addr_id = " . $addr_id); } else { return $address_model->find('user_id=' . $user_id . " and checked = 1"); } } }
/** * * 绑定手机号 **/ function add_phone() { $user_id = $this->visitor->get('user_id'); if (!IS_POST) { /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=buyer_admin', "绑定手机号码"); /* 当前用户中心菜单 */ $this->_curitem('my_profile'); $_SESSION['send_code'] = $this->random(6, 1); $this->assign("send_code", $_SESSION['send_code']); /* 当前所处子菜单 */ $this->_curmenu('绑定手机号码'); $this->_config_seo('title', Lang::get('user_center') . ' - ' . "绑定手机号码"); $this->display('member.addphone.html'); } else { $phone_mob = isset($_POST['phone_mob']) ? trim($_POST['phone_mob']) : ''; if ($_SESSION['send_code'] != $_POST['send_code']) { $this->assign('msg', '验证码错误'); $this->display('member.addphone.html'); return; } if (!$phone_mob) { $this->assign('msg', '手机号码不能为空'); $this->display('member.addphone.html'); return; } if (!is_phone($phone_mob)) { $this->assign('msg', '手机号码格式错误'); $this->display('member.addphone.html'); return; } $data = array("phone_mob" => $phone_mob); $result = $model_user =& m('member'); $model_user->edit($user_id, $data); if (!$result) { $this->show_warning($this->ms->user->get_error()); return; } if (is_wap()) { $this->_curlocal(LANG::get('member_center'), 'index.php?app=buyer_admin', "修改手机号码成功"); $this->assign("phone_mob", $phone_mob); $this->display("member.phonesuccess.html"); return; } header("location:/index.php?app=member&act=profile"); } }
} } if ($br == 'WML') { return true; } else { return false; } } function checkSubstrs($list, $str) { $flag = false; for ($i = 0; $i < count($list); $i++) { if (stripos($str, $list[$i]) > 0) { $flag = true; break; } } return $flag; } echo '<br/>------------------------------------------------------------------------------------------<br/>'; if (is_wap()) { echo '手机上网'; } else { echo '电脑上网'; } echo '<br/>------------------------------------------------------------------------------------------<br/>'; if (is_wap1()) { echo '手机上网'; } else { echo '电脑上网'; }
public function detail() { if (isset($_GET['id'])) { $lang = LANG_SET; $condition = " a.id={$_GET['id']} and b.lang='{$lang}'"; $newsModel = M('news'); $newsModel->where("id={$_GET['id']}")->setInc('visits'); $join = 'left join __NEWSLANG__ b on a.id=b.fid'; $data = array(); $data = $newsModel->alias('a')->field('a.id,a.is_school,a.college_id, a.editer,a.visits,a.preview_img,FROM_UNIXTIME(a.create_time,"%d/%b/%Y")create_time, b.title,b.keyword,b.author,b.news_from,b.content')->join($join)->where("{$condition}")->select(); $data['0']['content'] = htmlspecialchars_decode(html_entity_decode($data['0']['content'])); $this->assign('data', $data); if (is_wap()) { $this->theme('bootstrap')->display(); exit; } $this->display(); } }
function view() { $article_id = empty($_GET['article_id']) ? 0 : intval($_GET['article_id']); $cate_ids = array(); if ($article_id > 0) { $article = $this->_article_mod->get('article_id=' . $article_id . ' AND code = "" AND if_show=1 AND store_id=0'); if (!$article) { $this->show_no(); return; } if ($article['link']) { //外链文章跳转 header("HTTP/1.1 301 Moved Permanently"); header('location:' . $article['link']); return; } if ($article) { $cate_id = $article['cate_id']; /* 取得当前分类及子孙分类cate_id */ $cate_ids = $this->_acategory_mod->get_descendant($cate_id); } else { $this->show_no(); return; } } else { $this->show_no(); return; } $this->_cate_ids = $cate_ids; $all = $this->_get_article('all'); $allarticle = $this->_get_all_acate(0); unset($allarticle['15']); $this->assign("allarticle", $allarticle); /* 当前位置 */ $this->assign("aid", $article_id); $curlocal = $this->_get_article_curlocal($cate_id); $curlocal[] = array('text' => Lang::get('content')); $this->_curlocal($curlocal); $this->assign('article', $article); $this->_config_seo('title', $article['title'] . ' - ' . Conf::get('site_title')); if (is_wap()) { $this->assign("title", $article['title']); } $this->display('article.view.html'); }
/** * 行为扩展的执行入口必须是run * @author jry <*****@*****.**> */ public function run(&$content) { // 安装模式下直接返回 if (defined('BIND_MODULE') && BIND_MODULE === 'Install') { return; } // 如果是后台并且不是Admin模块则设置默认控制器层为Admin if (MODULE_MARK === 'Admin' && MODULE_NAME !== 'Admin') { $oc_config['DEFAULT_C_LAYER'] = 'Admin'; } // 当前模块模版参数配置 $oc_config['TMPL_PARSE_STRING'] = C('TMPL_PARSE_STRING'); // 先取出配置文件中定义的否则会被覆盖 $oc_config['TMPL_PARSE_STRING']['__IMG__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/img'; $oc_config['TMPL_PARSE_STRING']['__CSS__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/css'; $oc_config['TMPL_PARSE_STRING']['__JS__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/js'; $oc_config['TMPL_PARSE_STRING']['__LIBS__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/libs'; // 获取当前主题的名称 $current_theme = D('Admin/Theme')->where(array('current' => 1))->order('id asc')->getField('name'); if ($current_theme) { // 前台Home模块静态资源路径及模板继承基本模板 $home_public_path = './Theme/' . $current_theme . '/Home/Public'; if (is_dir($home_public_path)) { $oc_config['HOME_PUBLIC_LAYOUT'] = $home_public_path . '/layout.html'; $oc_config['TMPL_PARSE_STRING']['__HOME_IMG__'] = __ROOT__ . '/' . $home_public_path . '/img'; $oc_config['TMPL_PARSE_STRING']['__HOME_CSS__'] = __ROOT__ . '/' . $home_public_path . '/css'; $oc_config['TMPL_PARSE_STRING']['__HOME_JS__'] = __ROOT__ . '/' . $home_public_path . '/js'; $oc_config['TMPL_PARSE_STRING']['__HOME_LIBS__'] = __ROOT__ . '/' . $home_public_path . '/libs'; } // 如果当前主题存在User模板则改变相关配置 if (is_dir('./Theme/' . $current_theme . '/User')) { $oc_config['USER_CENTER_SIDE'] = './Theme/' . $current_theme . '/User/Index/side.html'; $oc_config['USER_CENTER_FORM'] = './Theme/' . $current_theme . '/User/Builder/form.html'; $oc_config['USER_CENTER_LIST'] = './Theme/' . $current_theme . '/User/Builder/list.html'; $oc_config['USER_LOGIN_MODAL'] = './Theme/' . $current_theme . '/User/User/login_modal.html'; } // 当前主题 $current_theme_path = './Theme/' . $current_theme . '/' . MODULE_NAME . '/'; //当前主题文件夹路径 if (is_dir($current_theme_path)) { if (MODULE_MARK === 'Home') { $oc_config['VIEW_PATH'] = $current_theme_path; } $oc_config['CURRENT_THEME'] = $current_theme; //默认主题设为当前主题 // 各模块自带静态资源路径 $module_public_path = './Theme/' . $current_theme . '/' . MODULE_NAME . '/Public'; if (is_dir($module_public_path)) { $oc_config['TMPL_PARSE_STRING']['__IMG__'] = __ROOT__ . '/' . $module_public_path . '/img'; $oc_config['TMPL_PARSE_STRING']['__CSS__'] = __ROOT__ . '/' . $module_public_path . '/css'; $oc_config['TMPL_PARSE_STRING']['__JS__'] = __ROOT__ . '/' . $module_public_path . '/js'; $oc_config['TMPL_PARSE_STRING']['__LIBS__'] = __ROOT__ . '/' . $module_public_path . '/libs'; } } } C($oc_config); // 添加配置 // 读取数据库中的配置 $system_config = S('DB_CONFIG_DATA'); if (!$system_config) { // 获取所有系统配置 $system_config = D('Admin/Config')->lists(); // SESSION与COOKIE与前缀设置避免冲突 $system_config['SESSION_PREFIX'] = ENV_PRE . MODULE_MARK . '_'; // Session前缀 $system_config['COOKIE_PREFIX'] = ENV_PRE . MODULE_MARK . '_'; // Cookie前缀 // 获取所有安装的模块配置 $module_list = D('Admin/Module')->where(array('status' => '1'))->select(); foreach ($module_list as $val) { $module_config[strtolower($val['name'] . '_config')] = json_decode($val['config'], true); $module_config[strtolower($val['name'] . '_config')]['module_name'] = $val['name']; } if ($module_config) { // 合并模块配置 $system_config = array_merge($system_config, $module_config); // 加载模块标签库及行为扩展 $system_config['TAGLIB_PRE_LOAD'] = explode(',', C('TAGLIB_PRE_LOAD')); // 先取出配置文件中定义的否则会被覆盖 foreach ($module_config as $key => $val) { // 加载模块标签库 if ($val['taglib']) { foreach ($val['taglib'] as $tag) { $tag_path = APP_PATH . $val['module_name'] . '/' . 'TagLib' . '/' . $tag . '.class.php'; if (is_file($tag_path)) { $system_config['TAGLIB_PRE_LOAD'][] = $val['module_name'] . '\\TagLib\\' . $tag; } } } // 加载模块行为扩展 if ($val['behavior']) { foreach ($val['behavior'] as $bhv) { $bhv_path = APP_PATH . $val['module_name'] . '/' . 'Behavior' . '/' . $bhv . 'Behavior.class.php'; if (is_file($bhv_path)) { \Think\Hook::add('corethink_behavior', $val['module_name'] . '\\Behavior\\' . $bhv . 'Behavior'); } } } } $system_config['TAGLIB_PRE_LOAD'] = implode(',', $system_config['TAGLIB_PRE_LOAD']); } // 加载Formbuilder扩展类型 $system_config['FORM_ITEM_TYPE'] = C('FORM_ITEM_TYPE'); $formbuilder_extend = explode(',', D('Admin/Hook')->getFieldByName('FormBuilderExtend', 'addons')); if ($formbuilder_extend) { $addon_object = D('Admin/Addon'); foreach ($formbuilder_extend as $val) { $temp = json_decode($addon_object->getFieldByName($val, 'config'), true); if ($temp['status']) { $form_type[$temp['form_item_type_name']] = array($temp['form_item_type_title'], $temp['form_item_type_field']); $system_config['FORM_ITEM_TYPE'] = array_merge($system_config['FORM_ITEM_TYPE'], $form_type); } } } S('DB_CONFIG_DATA', $system_config, 3600); // 缓存配置 } // 移动端强制后台传统视图 if (is_wap()) { $system_config['ADMIN_TABS'] = 0; } C($system_config); // 添加配置 }
/** * 给卖家评价 * * @author Garbin * @param none * @return void */ function evaluate() { $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("order_id={$order_id} AND buyer_id=" . $this->visitor->get('user_id')); if (!$order_info) { $this->show_warning('no_such_order'); return; } if ($order_info['status'] != ORDER_FINISHED) { /* 不是已完成的订单,无法评价 */ $this->show_warning('cant_evaluate'); return; } if ($this->_order_goods_mod->all_evaluate($order_id)) { /* 已评价的订单 */ $this->show_warning('already_evaluate'); return; } if (!IS_POST) { $this->assign('order_info', $order_info); /* 获取订单商品 */ $goods_list = $this->_order_goods_mod->find("order_id={$order_id}"); if (empty($goods_list)) { /* 订单中没有订单商品 */ $this->show_warning('no_order_goods'); return; } foreach ($goods_list as $key => $goods) { empty($goods['goods_image']) && ($goods_list[$key]['goods_image'] = Conf::get('default_goods_image')); } $this->assign('goods_list', $goods_list); $this->assign('order', $order_info); $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_order'), 'index.php?app=buyer_order', LANG::get('evaluate')); /* 当前用户中心菜单 */ $this->_curitem('evaluate'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('credit_evaluate')); if (is_wap()) { $this->assign("title", "发表评价"); } $this->display('pr_order_comments.index.html'); } else { $evaluations = array(); /* 写入评价 */ foreach ($_POST['evaluations'] as $rec_id => $evaluation) { if ($evaluation['evaluation'] <= 0 || $evaluation['evaluation'] > 5) { $this->show_warning('evaluation_error'); return; } switch ($evaluation['evaluation']) { case 1: $credit_value = -1; break; case 2: $credit_value = 0; break; case 3: $credit_value = 0; break; case 4: $credit_value = 1; break; case 5: $credit_value = 1; break; default: $credit_value = -1; break; } $evaluations[intval($rec_id)] = array('evaluation_status' => 1, 'evaluation' => $evaluation['evaluation'], 'comment' => $evaluation['comment'], 'evaluation_time' => gmtime(), 'anonymous' => $_POST['anonymous'], 'credit_value' => $credit_value); } $goods_list = $this->_order_goods_mod->find("order_id={$order_id}"); foreach ($evaluations as $rec_id => $evaluation) { $this->_order_goods_mod->edit("rec_id={$rec_id} AND order_id={$order_id}", $evaluation); $goods_url = SITE_URL . '/' . url('app=goods&id=' . $goods_list[$rec_id]['goods_id']); $goods_name = $goods_list[$rec_id]['goods_name']; $this->send_feed('goods_evaluated', array('user_id' => $this->visitor->get('user_id'), 'user_name' => $this->visitor->get('user_name'), 'goods_url' => $goods_url, 'goods_name' => $goods_name, 'evaluation' => Lang::get('order_eval.' . $evaluation['evaluation']), 'comment' => $evaluation['comment'], 'images' => array(array('url' => SITE_URL . '/' . $goods_list[$rec_id]['goods_image'], 'link' => $goods_url)))); } /* 更新订单评价状态 */ $this->_order_mod->edit($order_id, array('status' => 50, 'evaluation_time' => gmtime())); /* 更新卖家信用度及好评率 */ $this->_store_mod->edit($order_info['seller_id'], array('credit_value' => $this->_store_mod->recount_credit_value($order_info['seller_id']), 'praise_rate' => $this->_store_mod->recount_praise_rate($order_info['seller_id']))); /* 更新商品评价数 */ $model_goodsstatistics =& m('goodsstatistics'); $goods_ids = array(); foreach ($goods_list as $goods) { $goods_ids[] = $goods['goods_id']; } $model_goodsstatistics->edit($goods_ids, 'comments=comments+1'); echo "<script language='javascript' type='text/javascript'>window.location.href='index.php?app=buyer_order'</script>"; } }
/** * 弹出层内容. * * @access public * @return void * @author Liuping <*****@*****.**> */ public function ajaxPopLayer() { $data = $this->getPopLayerData(); $applyInfo = $data['applyInfo']; $haveApplyInfo = empty($applyInfo) ? FALSE : TRUE; $subjects = $this->processSubject($data['subject']); $this->assign('years', $data['years']); $this->assign('country', $data['country']); $this->assign('subject', $subjects); $this->assign('langScoreType', $data['langScoreType']); $this->assign('applyInfo', $applyInfo); $this->assign('haveApplyInfo', $haveApplyInfo); if (is_wap()) { $this->display('matchTpl'); } else { $this->display('ajaxPopLayer'); } }
public function detail() { if (is_wap()) { $this->theme('bootstrap'); } $this->display(); }
function show_no() { @header("http/1.1 404 not found"); @header("status: 404 not found"); if (is_wap()) { header("location:/errorpage/m404.html"); return; } header("location:/errorpage/404.html"); }
/** * 根据提供的订单信息进行支付 * * @author Garbin * @param none * @return void */ function index() { /* 外部提供订单号 */ $order_id = isset($_GET['order_id']) ? $_GET['order_id'] : 0; //数组的形式了 if (stripos($order_id, "-")) { $orders = explode("-", $order_id); } /* 内部根据订单号收银,获取收多少钱,使用哪个支付接口 */ $tag = true; $order_model =& m('order'); // $con= & m('orderextm'); if ($orders) { $order_info['order_list'] = 1; foreach ($orders as $key => $id) { $order_info[$key] = $order_model->get("order_id={$id} AND buyer_id=" . $this->visitor->get('user_id')); $subtotal += $order_info[$key]['order_amount']; $order_info['order_amount'] += $order_info[$key]['order_amount']; $order_info['order_id'] = $order_id; $order_info['order_sn'] += $order_info[$key]['order_sn']; $order_info['buy_name'] = $order_info[$key]['buy_name']; //取出收获人的地址 // $consignee=$con->get("order_id=".$id); if ($order_info[$key]['status'] != ORDER_PENDING) { $this->show_warning('no_such_order'); return; } if (!$order_info[$key]['payment_id']) { //还没有支付选项选择 $tag = false; } } } else { $order_info = $order_model->get("order_id={$order_id} AND buyer_id=" . $this->visitor->get('user_id')); $subtotal = $order_info['order_amount']; if ($order_info['payment_code'] != 'cod' && $order_info['status'] != ORDER_PENDING) { $this->show_no(); return; } if (!$order_info['payment_id']) { //还没有支付选项选择 $tag = false; } } //分别判断有没有该订单的信息 /* 订单有效性判断 */ $payment_model =& m('payment'); if (!$tag || !isset($_GET['payment_code'])) { /* 若还没有选择支付方式,则让其选择支付方式 */ $payments = $payment_model->get_enabled(1); if (empty($payments)) { $this->show_no(); return; } $all_payments = array('pc' => array(), 'wap' => array()); //判断是线上支付还是线下支付 foreach ($payments as $key => $payment) { if ($payment['is_wap'] > 0) { if (isWeixin()) { if ($payment['is_wap'] == 1) { $all_payments['wap'][] = $payment; } } else { if ($payment['is_wap'] > 1) { $all_payments['wap'][] = $payment; } } } } foreach ($payments as $key => $payment) { if ($payment['is_wap'] < 1) { $all_payments['pc'][] = $payment; } } if (isWeixin()) { $this->assign("iswei", 1); $payment_code = 'jspay'; $payment_info = $payment_model->get("payment_code = '{$payment_code}' AND store_id=1"); //获取支付接口的相关配 ///* 生成支付URL或表单 */ $wx = $this->_get_payment($payment_code, $payment_info); //获取该支付接口 $wxparam = $wx->get_payform($order_info, $payment_code); $this->assign("wxparam", $wxparam); //wx 参数 } $this->assign('subtotal', $subtotal); $this->assign('consignee', $consignee); $this->assign("order_id", $order_id); $this->assign('order', $order_info); $this->assign('payments', $all_payments); $this->_curlocal(LANG::get('cashier')); $this->_config_seo('title', Lang::get('confirm_payment') . ' - ' . Conf::get('site_title')); if (is_wap()) { $this->assign("title", "支付中心"); } $this->display('cashier.payment.html'); } else { /* 否则直接到网关支付 */ $payment_code = $_GET['payment_code']; $order_info['payment_code'] = $payment_code; $payment_info = $payment_model->get("payment_code = '{$payment_code}' AND store_id=1"); //获取支付接口的相关配置 /* 生成支付URL或表单 */ $payment = $this->_get_payment($payment_code, $payment_info); //获取该支付接口 $payment_form = $payment->get_payform($order_info, $payment_code); // if(isWeixin()){ // // $this->assign("wxparam",$payment_form); // $data=$this->fetch("wx.html"); // echo $data; // exit; // } /* 微信支付,则显示提示页面 */ if ($payment_info['payment_code'] == 'wxnative') { /* 跳转到真实收银台 */ $this->_config_seo('title', Lang::get('cashier')); $this->assign('payform', $payment_form); $this->assign('payment', $payment_info); $this->assign('order', $order_info); header('Content-Type:text/html;charset=' . CHARSET); if (is_wap()) { $this->assign("title", "立即支付"); } $this->display('cashier.payform_wxnative.html'); return; } /* 跳转到真实收银台 */ $this->_config_seo('title', Lang::get('cashier')); $this->assign('payform', $payment_form); $this->assign('payment', $payment_info); $this->assign('order', $order_info); header('Content-Type:text/html;charset=' . CHARSET); if (is_wap()) { $this->assign("title", "支付成功"); } $this->display('cashier.payform.html'); } }
private function news($id, $lang) { $newsModel = M('news'); $join = 'left join __NEWSLANG__ b on a.id=b.fid'; $where = "b.lang='{$lang}' and a.college_id={$id}"; $count = $newsModel->alias('a')->join($join)->where($where)->count(); $num = 6; if (is_wap()) { $num = 10000; } // $num = 1; $page = new \Think\Page($count, $num); $html = $page->show(); $data = $newsModel->alias('a')->field('a.id,a.is_school,a.college_id, a.editer,a.visits,a.preview_img,FROM_UNIXTIME(a.create_time,"%d/%m/%Y") create_time, b.lang,b.title,b.keyword,b.author,b.news_from,b.content')->join($join)->where("{$where}")->limit($page->firstRow, $page->listRows)->order('a.create_time desc')->select(); return array('data' => $data, 'html' => $html); }
/** * 得到收藏的学校ID * @access public * @param $id int 专业ID * @return string * @author liuxiaolin <*****@*****.**> */ public function getCourseTpl($id) { $majorModel = M('university_majorlang'); $lang = LANG_SET; $field = 'a.fid as id, a.us_id, a.su_id, a.sub_id, a.name, a.introduction, a.apply_way, a.category, a.degree, a.addr, b.url, b.duration, b.start_time, b.tuition, b.a_tuition, b.s_ship, b.p_ship,c.stip_val'; $where = array('a.fid' => $id, 'a.lang' => $lang); $join = array('inner join __UNIVERSITY_MAJOR__ as b on b.id = a.fid left join __UNIVERSITY__ c ON a.us_id=c.id'); //得到专业信息 $majorData = $majorModel->alias('a')->field($field)->join($join)->where($where)->find(); $time = date('Y-m', time()); $timeArr = explode('-', $time); if ($timeArr[1] >= 9) { $res = $timeArr[0] + 1; } else { $res = $timeArr[0]; } $majorData['year'] = $res; //处理入学时间; $majorData['start_time'] = month_map($majorData['start_time']); if ($majorData['tuition'] == 0) { $majorData['tuition'] = '--'; } $courseModel = M('university_major_courselang'); $field = 'a.name'; $where = array('a.mj_id' => $id, 'a.lang' => $lang); $join = array('inner join __UNIVERSITY_MAJOR_COURSE__ as b on b.id = a.fid'); //得到课程信息 $courseData = $courseModel->alias('a')->field($field)->join($join)->where($where)->select(); //处理专业详情及课程 $img = new \Home\Lib\CreatePic(); if (is_wap()) { $width = 480; } else { $width = 800; } $majorData['introduction'] = $img->gen($majorData['introduction'], $width, 11); $course = $img->gen(array_column($courseData, "name"), $width, 11); $this->assign('major', $majorData); $this->assign('course', $course); if (is_wap()) { $url = T('bootstrap/Match/courseTpl'); } else { $url = T('default/Match/courseTpl'); } $html = $this->fetch($url); echo $html; }
/** * 行为扩展的执行入口必须是run * @author jry <*****@*****.**> */ public function run(&$content) { // 安装模式下直接返回 if (defined('BIND_MODULE') && BIND_MODULE === 'Install') { return; } // 数据缓存前缀 // 获取ThinkPHP控制器分级时控制器名称 $controller_name = explode('/', CONTROLLER_NAME); if (sizeof($controller_name) === 2) { C('DATA_CACHE_PREFIX', ENV_PRE . MODULE_NAME . '_' . $controller_name[0] . '_'); } else { C('DATA_CACHE_PREFIX', ENV_PRE . MODULE_NAME . '_'); } // 读取数据库中的配置 $system_config = S('DB_CONFIG_DATA'); if (!$system_config) { // 获取所有系统配置 $system_config = D('Admin/Config')->lists(); // 获取所有安装的模块配置 $module_list = D('Admin/Module')->where(array('status' => '1'))->select(); foreach ($module_list as $val) { $module_config[strtolower($val['name'] . '_config')] = json_decode($val['config'], true); $module_config[strtolower($val['name'] . '_config')]['module_name'] = $val['name']; } if ($module_config) { // 合并模块配置 $system_config = array_merge($system_config, $module_config); // 加载模块标签库及行为扩展 $system_config['TAGLIB_PRE_LOAD'] = explode(',', C('TAGLIB_PRE_LOAD')); // 先取出配置文件中定义的否则会被覆盖 foreach ($module_config as $key => $val) { // 加载模块标签库 if ($val['taglib']) { foreach ($val['taglib'] as $tag) { $system_config['TAGLIB_PRE_LOAD'][] = $val['module_name'] . '\\TagLib\\' . $tag . ''; } } // 加载模块行为扩展 if ($val['behavior']) { foreach ($val['behavior'] as $bhv) { \Think\Hook::add('corethink_behavior', $val['module_name'] . '\\Behavior\\' . $bhv . 'Behavior'); } } } $system_config['TAGLIB_PRE_LOAD'] = implode(',', $system_config['TAGLIB_PRE_LOAD']); } // 获取当前主题的名称 $current_theme = D('Admin/Theme')->where(array('current' => 1))->order('id asc')->find(); // 当前模块模版参数配置 $system_config['TMPL_PARSE_STRING'] = C('TMPL_PARSE_STRING'); // 先取出配置文件中定义的否则会被覆盖 $system_config['TMPL_PARSE_STRING']['__IMG__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/img'; $system_config['TMPL_PARSE_STRING']['__CSS__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/css'; $system_config['TMPL_PARSE_STRING']['__JS__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/js'; $system_config['TMPL_PARSE_STRING']['__LIBS__'] = __ROOT__ . '/' . APP_PATH . MODULE_NAME . '/View/Public/libs'; if ($current_theme) { $current_theme['module'] = explode(',', $current_theme['module']); $current_theme['module'][] = 'Home'; // 强制支持主题对Home的支持 // 一旦开启主题那么前台必须启用主题相关模版(后台无需支持主题) $theme_public_path = './Theme/' . $current_theme['name'] . '/Home/Public'; if (is_dir($theme_public_path)) { $system_config['TMPL_PARSE_STRING']['__HOME_IMG__'] = __ROOT__ . '/' . $theme_public_path . '/img'; $system_config['TMPL_PARSE_STRING']['__HOME_CSS__'] = __ROOT__ . '/' . $theme_public_path . '/css'; $system_config['TMPL_PARSE_STRING']['__HOME_JS__'] = __ROOT__ . '/' . $theme_public_path . '/js'; $system_config['TMPL_PARSE_STRING']['__HOME_LIBS__'] = __ROOT__ . '/' . $theme_public_path . '/libs'; } // 如果启用的主题配置里勾选了当前模块那么当前模块启用主题相关模版否则仍启用系统模版 if (in_array(MODULE_NAME, $current_theme['module'])) { $system_config['CURRENT_THEME'] = $current_theme['name']; // 设置当前主题 $theme_public_path = './Theme/' . $current_theme['name'] . '/' . MODULE_NAME . '/Public'; $theme_wap_path = './Theme/' . $current_theme['name'] . '/' . MODULE_NAME . '/wap'; if (is_dir($theme_public_path)) { $system_config['TMPL_PARSE_STRING']['__IMG__'] = __ROOT__ . '/' . $theme_public_path . '/img'; $system_config['TMPL_PARSE_STRING']['__CSS__'] = __ROOT__ . '/' . $theme_public_path . '/css'; $system_config['TMPL_PARSE_STRING']['__JS__'] = __ROOT__ . '/' . $theme_public_path . '/js'; $system_config['TMPL_PARSE_STRING']['__LIBS__'] = __ROOT__ . '/' . $theme_public_path . '/libs'; } // 判断是否含有wap专用模版 if (is_dir($theme_wap_path)) { $system_config['HAS_WAP'] = 'wap'; } } } else { // 判断是否含有wap专用模版 if (sizeof($controller_name) === 2) { if (is_dir(APP_PATH . MODULE_NAME . '/View/Home/wap')) { $system_config['HAS_WAP'] = 'wap'; } } else { if (is_dir(APP_PATH . MODULE_NAME . '/View/wap')) { $system_config['HAS_WAP'] = 'wap'; } } } // 不直接在config里配置这些参数而要在这里配置是为了支持功能模块的相关架构 if (MODULE_NAME === 'Admin' || $controller_name[0] === 'Admin') { // Admin后台与模块后台标记 $system_config['MODULE_MARK'] = 'Admin'; // SESSION与COOKIE与前缀设置避免冲突 $system_config['SESSION_PREFIX'] = ENV_PRE . 'Admin_'; // Session前缀 $system_config['COOKIE_PREFIX'] = ENV_PRE . 'Admin_'; // Cookie前缀 // 错误页面模板 $system_config['TMPL_ACTION_ERROR'] = APP_PATH . 'Admin/View/Public/think/error.html'; // 错误跳转对应的模板文件 $system_config['TMPL_ACTION_SUCCESS'] = APP_PATH . 'Admin/View/Public/think/success.html'; // 成功跳转对应的模板文件 $system_config['TMPL_EXCEPTION_FILE'] = APP_PATH . 'Admin/View/Public/think/exception.html'; // 异常页面的模板文件 } else { if (MODULE_NAME === 'Home' || $controller_name[0] === 'Home') { // Home前台与模块前台标记 $system_config['MODULE_MARK'] = 'Home'; // SESSION与COOKIE与前缀设置避免冲突 $system_config['SESSION_PREFIX'] = ENV_PRE . 'Home_'; // Session前缀 $system_config['COOKIE_PREFIX'] = ENV_PRE . 'Home_'; // Cookie前缀 // 错误页面模板 $system_config['TMPL_ACTION_ERROR'] = APP_PATH . 'Home/View/Public/think/error.html'; // 错误跳转对应的模板文件 $system_config['TMPL_ACTION_SUCCESS'] = APP_PATH . 'Home/View/Public/think/success.html'; // 成功跳转对应的模板文件 $system_config['TMPL_EXCEPTION_FILE'] = APP_PATH . 'Home/View/Public/think/exception.html'; // 异常页面的模板文件 } } S('DB_CONFIG_DATA', $system_config, 3600); // 缓存配置 } C($system_config); // 添加配置 // 如果存在wap专用模版同时又确实是wap方式访问则设置WAP标记 if (C('HAS_WAP') && is_wap()) { C('IS_WAP', C('HAS_WAP')); } // 检测系统授权 if ($system_config['MODULE_MARK'] === 'Home' && C('CT_USERNAME') !== 'trial') { $sn_decode = \Think\Crypt::decrypt(C('CT_SN'), md5(sha1(C('CT_USERNAME')))); if ($sn_decode) { $sn_decode = explode('[ct]', base64_decode($sn_decode)); $sn_decode_server = json_decode($sn_decode[0], true); if (!in_array($_SERVER['SERVER_NAME'], $sn_decode_server)) { die('很抱歉,该域名未授权!请联系:<a href="http://www.corethink.cn">http://www.corethink.cn</a>'); } if (md5(sha1(C('CT_USERNAME'))) !== $sn_decode[1]) { die('很抱歉,该帐号未授权!请联系:<a href="http://www.corethink.cn">http://www.corethink.cn</a>'); } } else { die('很抱歉,您的授权已过期!请联系:<a href="http://www.corethink.cn">http://www.corethink.cn</a>'); } } }
function view() { $cate_id = !empty($_GET['cate_id']) ? intval($_GET['cate_id']) : 15; //如果cate_id为空则默认story $this->assign("cid", $cate_id); /* 文章分类 */ $acategories = $this->_get_acategory($cate_id); foreach ($acategories as $k => &$cate) { $sql = "SELECT COUNT(*) FROM {$this->_article_mod->table} WHERE cate_id = " . $cate['cate_id']; $cate['count'] = $this->_article_mod->getone($sql); } $article_id = empty($_GET['article_id']) ? 0 : intval($_GET['article_id']); $gid = empty($_GET['gid']) ? 0 : intval($_GET['gid']); if ($gid) { //isgid $info = $this->_article_mod->get("gid like'%{$gid}%'"); $article_id = $info['article_id']; } if ($article_id > 0) { $article = $this->_article_mod->get('article_id=' . $article_id . ' AND code = "" AND if_show=1'); if (!$article) { $this->show_no(); return; } if ($article) { $cate_id = $article['cate_id']; /* 取得当前分类及子孙分类cate_id */ $cate_ids = $this->_acategory_mod->get_descendant($cate_id); } else { $this->show_no(); return; } } else { $this->show_no(); return; } $pre_article = $this->_article_mod->get('article_id<' . $article_id . ' AND cate_id =' . $cate_id . ' ORDER BY article_id DESC limit 1'); $pre_article && ($pre_article['target'] = $pre_article['link'] ? '_blank' : '_self'); $next_article = $this->_article_mod->get('article_id>' . $article_id . ' AND cate_id =' . $cate_id . ' ORDER BY article_id ASC limit 1'); $next_article && ($next_article['target'] = $next_article['link'] ? '_blank' : '_self'); /* 当前位置 */ $this->assign("aid", $article_id); $curlocal = $this->_get_article_curlocal($cate_id); $curlocal[] = array('text' => $article['title']); $this->_curlocal($curlocal); $user_mod =& m('member'); $info = $user_mod->get_info($article['uid']); $article['author'] = $info['user_name']; $article['wx'] = $this->generateQRfromGoogle($article['article_id']); $article['add_time'] = date("Y.m.d", $article['add_time']); $article['tag'] = unserialize($article['tag']); $this->assign('article', $article); $this->assign("hottags", $this->hot_tag()); $this->_config_seo('title', $article['title'] . ' - ' . Conf::get('site_title')); $this->assign('acategories', $acategories); $this->assign('pre_article', $pre_article); $this->assign('next_article', $next_article); if (is_wap()) { $this->assign("title", "食材详情"); } $this->display('story.view.html'); }