/** * 分类列表 */ public function indexOp() { Language::read('home_category_index'); $lang = Language::getLangContent(); //得到分类类型 $type = trim($_GET['type']); switch ($type) { case 'store': $model_sc = Model('store_class'); $sc_list = $model_sc->getTreeList(); //导航 $nav_link = array('0' => array('title' => $lang['homepage'], 'link' => SiteUrl . '/index.php'), '1' => array('title' => $lang['category_index_store_class'])); $model_store = Model('store'); //推荐店铺 $recommend_store = $model_store->getRecommendStore(5); Tpl::output('recommend_store', $recommend_store); //最新店铺 $new_store = $model_store->getNewStore(5); Tpl::output('new_store', $new_store); Tpl::output('nav_link_list', $nav_link); Tpl::output('sc_list', $sc_list); Tpl::showpage('category_store'); break; default: //导航 $nav_link = array('0' => array('title' => $lang['homepage'], 'link' => SiteUrl . '/index.php'), '1' => array('title' => $lang['category_index_goods_class'])); //分类 $show_goods_class = ($g = F('goods_class')) ? $g : H('goods_class', true, 'file'); Tpl::output('nav_link_list', $nav_link); Tpl::output('gc_list', $show_goods_class); Tpl::output('html_title', C('site_name') . ' - ' . Language::get('category_index_goods_class')); Tpl::showpage('category_goods'); break; } }
public function indexOp() { $lang = Language::getLangContent(); $model_shares = Model('shares'); $condition = array(); $condition['store_id'] = $_SESSION['store_id']; if (!empty($_GET['order_id'])) { $condition['order_id'] = array('like', "%" . $_GET['order_id'] . "%"); } $if_start_time = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_start_time']); $if_end_time = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_end_time']); $start_unixtime = $if_start_time ? strtotime($_GET['query_start_time']) : null; $end_unixtime = $if_end_time ? strtotime($_GET['query_end_time']) : null; if ($start_unixtime || $end_unixtime) { $condition['add_time'] = array('time', array($start_unixtime, $end_unixtime)); } $shares_list = $model_shares->getSharesList($condition, "*", 50); $shares_sum = $model_shares->getSharesSum($_SESSION['store_id']); $ShopShares = $model_shares->getShopShares($_SESSION['store_id']); Tpl::output('ShopShares', $ShopShares['shares']); Tpl::output('show_page', $model_shares->showpage()); Tpl::output('shares_list', $shares_list); Tpl::output('shares_sum', $shares_sum); Tpl::output('shares_id', trim($_GET['shares_id'])); Tpl::output('shares_time', trim($_GET['shares_time'])); Tpl::showpage('shares'); }
/** * 图片裁剪 * */ public function pic_cutOp() { Language::read('admin_common'); $lang = Language::getLangContent(); import('function.thumb'); if (chksubmit()) { $thumb_width = $_POST['x']; $x1 = $_POST["x1"]; $y1 = $_POST["y1"]; $x2 = $_POST["x2"]; $y2 = $_POST["y2"]; $w = $_POST["w"]; $h = $_POST["h"]; $scale = $thumb_width / $w; $src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']); if (strpos($src, '..') !== false || strpos($src, BASE_UPLOAD_PATH) !== 0) { exit; } if (!empty($_POST['filename'])) { // $save_file2 = BASE_UPLOAD_PATH.'/'.$_POST['filename']; $save_file2 = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['filename']); } else { $save_file2 = str_replace('_small.', '_sm.', $src); } $cropped = resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale); @unlink($src); $pathinfo = pathinfo($save_file2); exit($pathinfo['basename']); } $save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']); $_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1'; Tpl::output('height', get_height($save_file)); Tpl::output('width', get_width($save_file)); Tpl::showpage('common.pic_cut', 'null_layout'); }
/** * 图片裁剪 * */ public function pic_cutOp() { import('function.thumb'); if (chksubmit()) { $thumb_width = $_POST['x']; $x1 = $_POST["x1"]; $y1 = $_POST["y1"]; $x2 = $_POST["x2"]; $y2 = $_POST["y2"]; $w = $_POST["w"]; $h = $_POST["h"]; $scale = $thumb_width / $w; $src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']); $save_file2 = str_replace('_small.', '_sm.', $src); $cropped = resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale); @unlink($src); $pathinfo = pathinfo($save_file2); exit($pathinfo['basename']); } else { Language::read('cut'); $lang = Language::getLangContent(); } $save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']); $_GET['x'] = intval($_GET['x']) > 50 && $_GET['x'] < 400 ? $_GET['x'] : 200; $_GET['y'] = intval($_GET['y']) > 50 && $_GET['y'] < 400 ? $_GET['y'] : 200; $_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1'; Tpl::output('height', get_height($save_file)); Tpl::output('width', get_width($save_file)); Tpl::showpage('cut', 'null_layout'); }
/** * 新增/编辑发货地址 */ public function daddress_addOp() { Language::read('member_member_index'); $lang = Language::getLangContent(); $model_daddress = Model('daddress'); if (chksubmit()) { //保存 新增/编辑 表单 $obj_validate = new Validate(); $obj_validate->validateparam = array( array("input"=>$_POST["seller_name"],"require"=>"true","message"=>$lang['store_daddress_receiver_null']), array("input"=>$_POST["area_id"],"require"=>"true","validator"=>"Number","message"=>$lang['store_daddress_wrong_area']), array("input"=>$_POST["city_id"],"require"=>"true","validator"=>"Number","message"=>$lang['store_daddress_wrong_area']), array("input"=>$_POST["area_info"],"require"=>"true","message"=>$lang['store_daddress_area_null']), array("input"=>$_POST["address"],"require"=>"true","message"=>$lang['store_daddress_address_null']), array("input"=>$_POST['telphone'],'require'=>'true','message'=>$lang['store_daddress_phone_and_mobile']) ); $error = $obj_validate->validate(); if ($error != ''){ showValidateError($error); } $data = array( 'store_id' => $_SESSION['store_id'], 'seller_name' => $_POST['seller_name'], 'area_id' => $_POST['area_id'], 'city_id' => $_POST['city_id'], 'area_info' => $_POST['area_info'], 'address' => $_POST['address'], 'telphone' => $_POST['telphone'], 'company' => $_POST['company'] ); $address_id = intval($_POST['address_id']); if ($address_id > 0){ $condition = array(); $condition['address_id'] = $address_id; $condition['store_id'] = $_SESSION['store_id']; $update = $model_daddress->editAddress($data,$condition); if (!$update){ showDialog($lang['store_daddress_modify_fail'],'','error'); } } else { $insert = $model_daddress->addAddress($data); if (!$insert){ showDialog($lang['store_daddress_add_fail'],'','error'); } } showDialog($lang['nc_common_op_succ'],'reload','succ','CUR_DIALOG.close()'); } elseif (is_numeric($_GET['address_id']) > 0) { //编辑 $condition = array(); $condition['address_id'] = intval($_GET['address_id']); $condition['store_id'] = $_SESSION['store_id']; $address_info = $model_daddress->getAddressInfo($condition); if (empty($address_info) && !is_array($address_info)){ showMessage($lang['store_daddress_wrong_argument'],'index.php?act=store_deliver_set&op=daddress_list','html','error'); } Tpl::output('address_info',$address_info); } Tpl::showpage('store_deliver_set.daddress_add','null_layout'); }
/** * 金币设置 */ public function settingOp() { /** * 读取语言包 */ $lang = Language::getLangContent(); /** * 实例化模型 */ $model_setting = Model('setting'); /** * 保存信息 */ if (chksubmit()) { /** * 验证 */ $obj_validate = new Validate(); $obj_validate->validateparam = array(array("input" => $_POST["gold_isuse"], "require" => "true", "message" => $lang['gold_isuse_check']), array("input" => $_POST["gold_rmbratio"], "require" => "true", "validator" => "Number", "message" => $lang['gold_rmbratio_isnum'])); $error = $obj_validate->validate(); if ($error != '') { showMessage($error); } else { /* * 构造更新数据数组 */ $update_array = array(); $update_array['promotion_allow'] = trim($_POST['promotion_allow']); $update_array['points_isuse'] = trim($_POST['points_isuse']); $update_array['gold_isuse'] = trim($_POST['gold_isuse']); $update_array['gold_rmbratio'] = trim($_POST['gold_rmbratio']); $update_array['predeposit_isuse'] = trim($_POST['predeposit_isuse']); $update_array['groupbuy_allow'] = trim($_POST['groupbuy_allow']); //积分中心 $update_array['pointshop_isuse'] = trim($_POST['pointshop_isuse']); if (C('payment') != 1) { $update_array['predeposit_isuse'] = 1; } //支付到平台时强制开启预存款功能 $result = $model_setting->updateSetting($update_array); if ($result === true) { showMessage($lang['nc_common_save_succ']); } else { showMessage($lang['nc_common_save_fail']); } } } /** * 读取设置内容 $list_setting */ $list_setting = $model_setting->getListSetting(); /** * 模板输出 */ Tpl::output('list_setting', $list_setting); Tpl::showpage('operation.setting'); }
/** * 性能优化 */ public function performOp() { if ($_GET['type'] == 'clear') { $lang = Language::getLangContent(); $cache = Cache::getInstance(C('cache.type')); $cache->clear(); showMessage($lang['nc_common_op_succ']); } Tpl::showpage('setting.perform_opt'); }
/** * 分类列表 */ public function indexOp() { Language::read('home_category_index'); $lang = Language::getLangContent(); //导航 $nav_link = array('0' => array('title' => $lang['homepage'], 'link' => SHOP_SITE_URL), '1' => array('title' => $lang['category_index_goods_class'])); Tpl::output('nav_link_list', $nav_link); Tpl::output('html_title', C('site_name') . ' - ' . Language::get('category_index_goods_class')); Tpl::showpage('category'); }
/** * 清理缓存 */ public function clearOp() { if (!chksubmit()) { Tpl::showpage('cache.clear'); return; } $lang = Language::getLangContent(); // 清理所有缓存 if ($_POST['cls_full'] == 1) { foreach ($this->cacheItems as $i) { dkcache($i); } // 表主键 Model::dropTablePkArrayCache(); // 商品分类 dkcache('gc_class'); dkcache('all_categories'); dkcache('goods_class_seo'); dkcache('class_tag'); // 广告 Model('adv')->makeApAllCache(); // 首页 Model('web_config')->getWebHtml('index', 1); delCacheFile('index'); } else { $todo = (array) $_POST['cache']; foreach ($this->cacheItems as $i) { if (in_array($i, $todo)) { dkcache($i); } } // 表主键 if (in_array('table', $todo)) { Model::dropTablePkArrayCache(); } // 商品分类 if (in_array('goodsclass', $todo)) { dkcache('gc_class'); dkcache('all_categories'); dkcache('goods_class_seo'); dkcache('class_tag'); } // 广告 if (in_array('adv', $todo)) { Model('adv')->makeApAllCache(); } // 首页 if (in_array('index', $todo)) { Model('web_config')->getWebHtml('index', 1); delCacheFile('index'); } } $this->log(L('cache_cls_operate')); showMessage($lang['cache_cls_ok']); }
/** * 删除 */ public function delOp() { $lang = Language::getLangContent(); if (intval($_GET['id']) > 0) { $model_link = Model('feedback'); $model_link->del(intval($_GET['id'])); showMessage($lang['feedback_del_succ'], 'index.php?act=feedback&op=flist'); } else { showMessage($lang['feedback_del_fiald'], 'index.php?act=feedback&op=flist'); } }
public function indexOp() { $lang = Language::getLangContent(); $model = Model('express'); if (preg_match('/^[A-Z]$/', $_GET['letter'])) { $model->where(array('e_letter' => $_GET['letter'])); } $list = $model->page(10)->order('e_order,e_state desc,id')->select(); Tpl::output('page', $model->showpage()); Tpl::output('list', $list); Tpl::showpage('express.index'); }
/** * 用户中心右边,小导航 * * @param string $menu_type 导航类型 * @param string $menu_key 当前导航的menu_key * @param array $array 附加菜单 * @return */ private function profile_menu($menu_key = '', $array = array()) { Language::read('member_layout'); $lang = Language::getLangContent(); $menu_array = array(); $menu_array = array(1 => array('menu_key' => 'points', 'menu_name' => $lang['nc_member_path_points'], 'menu_url' => 'index.php?act=member_points')); if (!empty($array)) { $menu_array[] = $array; } Tpl::output('member_menu', $menu_array); Tpl::output('menu_key', $menu_key); }
/** * 登录操作 * */ public function indexOp(){ $lang = Language::getLangContent(); $model_member = Model('member'); //检查登录状态 $model_member->checkloginMember(); $script="document.getElementsByName('codeimage')[0].src='".APP_SITE_URL."/index.php?act=seccode&op=makecode&nchash='+NC_HASH+'&t=' + Math.random();"; $result = chksubmit(true,true,'num'); if ($result !== false){ if ($result === -11){ showDialog(L('login_index_login_illegal'),'','error',$script,2); }elseif ($result === -12){ showDialog(L('login_index_wrong_checkcode'),'','error',$script,2); } if (process::islock('login')) { showDialog(L('login_index_op_repeat'),APP_SITE_URL); } $array = array(); $array['member_name'] = $_POST['user_name']; $array['member_passwd'] = md5($_POST['password']); $member_info = $model_member->infoMember($array); if(is_array($member_info) and !empty($member_info)) { if(!$member_info['member_state']){ showDialog($lang['login_index_account_stop']); } } else { process::addprocess('login'); showDialog($lang['login_index_login_fail'],'','error',$script,2); } $model_member->createSession($member_info); process::clear('login'); // cookie中的cart存入数据库 Model('cart')->mergecart($member_info,$_SESSION['store_id']); // cookie中的浏览记录存入数据库 Model('goods_browse')->mergebrowse($_SESSION['member_id'],$_SESSION['store_id']); //添加会员积分 $model_member->addPoint($member_info); showDialog(L('login_index_login_success'),'reload','succ','',2); } if(empty($_GET['ref_url'])) $_GET['ref_url'] = getReferer(); Tpl::output('html_title',C('site_name').' - '.$lang['login_index_login']); Tpl::output('nchash',getNchash()); if ($_GET['inajax'] == 1){ Tpl::showpage('login_inajax','null_layout'); }else{ return false; } }
public function indexOp() { $lang = Language::getLangContent(); if ($_GET['code'] == '') { showMessage($lang['para_error'], '', 'html', 'error'); } $model_doc = Model('document'); $doc = $model_doc->getOneByCode($_GET['code']); Tpl::output('doc', $doc); $nav_link = array(array('title' => '首页', 'link' => 'index.php'), array('title' => $doc['doc_title'])); Tpl::output('nav_link_list', $nav_link); Tpl::showpage('document.index'); }
public function detailOp() { Language::read('home_coupon_index'); $lang = Language::getLangContent(); $id = intval($_GET['coupon_id']); if ($id < 1) { showMessage(Language::get('coupon_index_error'), '', 'html', 'error'); //'该优惠券不存在' } $model_coupon = Model('coupon'); $coupon_detail = $model_coupon->getOneById($id); if (is_array($coupon_detail) && !empty($coupon_detail)) { //获取店铺信息 $store_info = $this->getStoreInfo($coupon_detail['store_id']); $_GET['id'] = $store_info['store_id']; //左侧分类的数据用到 //查询店铺动态评价 $this->show_storeeval($store_info['store_id']); /* * 下架到期的优惠券 */ $this->offsaleCoupon($store_info['store_id']); /* * 获取最新的优惠券 */ $condition = array(); $new = $model_coupon->getCoupon(array('order' => 'coupon_add_date desc', 'limit' => 3, 'coupon_state' => '2', 'store_id' => $store_info['store_id'])); if (!empty($new)) { foreach ($new as $key => $val) { $new[$key]['coupon_pic'] = $val['coupon_pic'] != '' ? $val['coupon_pic'] : SiteUrl . DS . ATTACH_COUPON . DS . 'default.gif'; } } Tpl::output('new', $new); /* * 如果存在则调用数据库生成数组 */ $coupon_detail['coupon_pic'] = $coupon_detail['coupon_pic'] != '' ? $coupon_detail['coupon_pic'] : SiteUrl . DS . ATTACH_COUPON . DS . 'default.gif'; $model_coupon->update_coupon(array('coupon_click' => array('sign' => 'increase', 'value' => 1)), array('coupon_id' => $_GET['coupon_id'])); Tpl::output('index_sign', 'coupon'); Tpl::output('detail', $coupon_detail); Tpl::output('page', 'coupon'); Model('seo')->type('coupon')->param(array('name' => $coupon_detail['coupon_title']))->show(); Tpl::showpage('coupon_detail'); } else { showMessage(Language::get('coupon_index_error'), '', 'html', 'error'); //'该优惠券不存在' } }
public function indexOp() { $lang = Language::getLangContent(); if ($_GET['code'] == '') { showMessage($lang['para_error'], '', 'html', 'error'); //'缺少参数:文章标识' } $model_doc = Model('document'); $doc = $model_doc->getOneByCode($_GET['code']); Tpl::output('doc', $doc); /** * 分类导航 */ $nav_link = array(array('title' => $lang['homepage'], 'link' => SHOP_SITE_URL), array('title' => $doc['doc_title'])); Tpl::output('nav_link_list', $nav_link); Tpl::showpage('document.index'); }
/** * 商品管理 */ public function fleaOp() { $lang = Language::getLangContent(); $model_goods = Model('flea'); /** * 推荐,编辑,删除 */ if ($_POST['form_submit'] == 'ok') { if (!empty($_POST['del_id'])) { $model_goods->dropGoods(implode(',', $_POST['del_id'])); showMessage($lang['goods_index_del_succ']); } else { showMessage($lang['goods_index_choose_del']); } showMessage($lang['goods_index_argument_invalid']); } /** * 排序 */ $condition['keyword'] = trim($_GET['search_goods_name']); $condition['like_member_name'] = trim($_GET['search_store_name']); //店铺名称 $condition['brand_id'] = intval($_GET['search_brand_id']); $condition['gc_id'] = intval($_GET['cate_id']); /** * 分页 */ $page = new Page(); $page->setEachNum(10); $page->setStyle('admin'); $goods_list = $model_goods->listGoods($condition, $page); /** * 商品类别 */ /** * 商品分类 */ $model_class = Model('flea_class'); $goods_class = $model_class->getTreeClassList(1); Tpl::output('search', $_GET); Tpl::output('goods_class', $goods_class); Tpl::output('goods_list', $goods_list); Tpl::output('page', $page->show()); Tpl::showpage('flea.index'); }
public function set_taxOp() { $lang = Language::getLangContent(); $model_class = Model('goods_class'); $goods_class = $model_class->get_all_category(); Tpl::output('show_goods_class', $goods_class); //商品分类 /* H('goods_class',true); $show_goods_class = ($g = F('goods_class')) ? $g : H('goods_class',true); Tpl::output('gc_list',$show_goods_class); */ if (trim($_GET['type']) == 'new') { Tpl::showpage('set_tax_new'); } else { Tpl::showpage('set_tax_index'); } }
public function indexOp() { $lang = Language::getLangContent(); $model = Model('express'); if (chksubmit()) { if (!empty($_POST['del_brand_id'])) { showMessage($lang['brand_index_del_succ']); } else { showMessage($lang['brand_index_choose']); } } if (preg_match('/^[A-Z]$/', $_GET['letter'])) { $model->where(array('e_letter' => $_GET['letter'])); } $list = $model->page(10)->order('e_order,e_state desc,id')->select(); Tpl::output('page', $model->showpage()); Tpl::output('list', $list); Tpl::showpage('express.index'); }
/** * 设置 */ public function flea_class_indexOp() { /** * 加载语言包 */ $lang = Language::getLangContent(); /** * 实例化商品分类模型 */ $model_class = Model('flea_class'); $goods_class = $model_class->getTreeClassList(1); Tpl::output('goods_class', $goods_class); /** * 获取设置信息 */ $fc_index = $model_class->getFleaIndexClass(array()); if (is_array($fc_index) && !empty($fc_index)) { foreach ($fc_index as $value) { Tpl::output($value['fc_index_code'], $value); } } if ($_POST['form_submit'] == 'ok') { $a = $model_class->setFleaIndexClass(array('fc_index_code' => 'shuma', 'fc_index_id1' => $_POST['shuma_cid1'], 'fc_index_id2' => $_POST['shuma_cid2'], 'fc_index_id3' => $_POST['shuma_cid3'], 'fc_index_id4' => $_POST['shuma_cid4'])); $b = $model_class->setFleaIndexClass(array('fc_index_code' => 'zhuangban', 'fc_index_id1' => $_POST['zhuangban_cid1'], 'fc_index_id2' => $_POST['zhuangban_cid2'], 'fc_index_id3' => $_POST['zhuangban_cid3'], 'fc_index_id4' => $_POST['zhuangban_cid4'])); $c = $model_class->setFleaIndexClass(array('fc_index_code' => 'jujia', 'fc_index_id1' => $_POST['jujia_cid1'], 'fc_index_id2' => $_POST['jujia_cid2'], 'fc_index_id3' => $_POST['jujia_cid3'], 'fc_index_id4' => $_POST['jujia_cid4'])); $d = $model_class->setFleaIndexClass(array('fc_index_code' => 'xingqu', 'fc_index_id1' => $_POST['xingqu_cid1'], 'fc_index_id2' => $_POST['xingqu_cid2'], 'fc_index_id3' => $_POST['xingqu_cid3'], 'fc_index_id4' => $_POST['xingqu_cid4'])); $e = $model_class->setFleaIndexClass(array('fc_index_code' => 'muying', 'fc_index_id1' => $_POST['muying_cid1'], 'fc_index_id2' => $_POST['muying_cid2'], 'fc_index_id3' => $_POST['muying_cid3'], 'fc_index_id4' => $_POST['muying_cid4'])); if ($a && $b && $c && $d && e) { $a = $model_class->setFleaIndexClass(array('fc_index_code' => 'shuma', 'fc_index_name1' => $_POST['shuma_cname1'], 'fc_index_name2' => $_POST['shuma_cname2'], 'fc_index_name3' => $_POST['shuma_cname3'], 'fc_index_name4' => $_POST['shuma_cname4'])); $b = $model_class->setFleaIndexClass(array('fc_index_code' => 'zhuangban', 'fc_index_name1' => $_POST['zhuangban_cname1'], 'fc_index_name2' => $_POST['zhuangban_cname2'], 'fc_index_name3' => $_POST['zhuangban_cname3'], 'fc_index_name4' => $_POST['zhuangban_cname4'])); $c = $model_class->setFleaIndexClass(array('fc_index_code' => 'jujia', 'fc_index_name1' => $_POST['jujia_cname1'], 'fc_index_name2' => $_POST['jujia_cname2'], 'fc_index_name3' => $_POST['jujia_cname3'], 'fc_index_name4' => $_POST['jujia_cname4'])); $d = $model_class->setFleaIndexClass(array('fc_index_code' => 'xingqu', 'fc_index_name1' => $_POST['xingqu_cname1'], 'fc_index_name2' => $_POST['xingqu_cname2'], 'fc_index_name3' => $_POST['xingqu_cname3'], 'fc_index_name4' => $_POST['xingqu_cname4'])); $e = $model_class->setFleaIndexClass(array('fc_index_code' => 'muying', 'fc_index_name1' => $_POST['muying_cname1'], 'fc_index_name2' => $_POST['muying_cname2'], 'fc_index_name3' => $_POST['muying_cname3'], 'fc_index_name4' => $_POST['muying_cname4'])); if ($a && $b && $c && $d && e) { showMessage(Language::get('flea_class_setting_ok')); } } else { showMessage(Language::get('flea_class_setting_error')); } } Tpl::showpage('flea_class_index'); }
/** * 积分设置 */ public function point_rule_settingOp() { /** * 读取语言包 */ $lang = Language::getLangContent(); /** * 实例化模型 */ $model_setting = Model('setting'); /** * 保存信息 */ if (chksubmit()) { /* * 构造更新数据数组 */ $update_array = array(); $update_array['points_reg'] = intval($_POST['points_reg']) ? $_POST['points_reg'] : 0; $update_array['points_login'] = intval($_POST['points_login']) ? $_POST['points_login'] : 0; $update_array['points_comments'] = intval($_POST['points_comments']) ? $_POST['points_comments'] : 0; $update_array['points_orderrate'] = intval($_POST['points_orderrate']) ? $_POST['points_orderrate'] : 0; $update_array['points_ordermax'] = intval($_POST['points_ordermax']) ? $_POST['points_ordermax'] : 0; $result = $model_setting->updateSetting($update_array); if ($result === true) { showMessage(Language::get('points_update_success')); } else { showMessage(Language::get('points_update_fail')); } } /** * 读取设置内容 $list_setting */ $list_setting = $model_setting->getListSetting(); /** * 模板输出 */ Tpl::output('list_setting', $list_setting); Tpl::showpage('setting.points_setting'); }
function flea_indexOp() { /** * 读取语言包 */ $lang = Language::getLangContent(); /** * 实例化模型 */ $model_setting = Model('setting'); /** * 保存信息 */ if ($_POST['form_submit'] == 'ok') { $update_array = array(); $update_array['flea_isuse'] = intval($_POST['flea_isuse']); $update_array['flea_site_name'] = trim($_POST['flea_site_name']); $update_array['flea_site_title'] = trim($_POST['flea_site_title']); $update_array['flea_site_description'] = trim($_POST['flea_site_description']); $update_array['flea_site_keywords'] = trim($_POST['flea_site_keywords']); $update_array['flea_hot_search'] = str_replace(',', ',', trim($_POST['flea_hot_search'])); $result = $model_setting->updateSetting($update_array); if ($result === true) { showMessage($lang['nc_common_save_succ']); } else { showMessage($lang['nc_common_save_fail']); } } /** * 读取设置内容 $list_setting */ $list_setting = $model_setting->getListSetting(); /** * 模板输出 */ Tpl::output('list_setting', $list_setting); Tpl::showpage('setting.flea_index'); }
/** * [export_indexOp 导出] * @return [type] [description] */ public function export_indexOp() { $lang = Language::getLangContent(); $model_order = Model('order'); $where = 'order_state in (\'30\', \'40\')'; if ($_GET['type'] == 1) { $where .= ' AND shipping_fee > 0'; } elseif ($_GET['type'] == 2) { $where .= ' AND shipping_fee = 0'; } if ($_GET['order_sn']) { $where .= ' AND order_sn like \'%' . $_GET['order_sn'] . '%\''; } if (!is_numeric($_GET['curpage'])) { $count = $model_order->getOrderCount($where); $array = array(); if ($count > self::EXPORT_SIZE) { $page = ceil($count / self::EXPORT_SIZE); for ($i = 1; $i <= $page; $i++) { $limit1 = ($i - 1) * self::EXPORT_SIZE + 1; $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE; $array[$i] = $limit1 . ' ~ ' . $limit2; } Tpl::output('list', $array); Tpl::output('murl', 'index.php?act=shipping_fee&op=index'); Tpl::showpage('export.excel'); } else { $data = $model_order->getOrderList($where, '', 'order_sn,add_time,payment_time,shipping_fee,shipping_code', 'order_id desc', self::EXPORT_SIZE); $this->createExcel($data); } } else { $limit1 = ($_GET['curpage'] - 1) * self::EXPORT_SIZE; $limit2 = self::EXPORT_SIZE; $data = $model_order->getOrderList($condition, '', 'order_sn,add_time,payment_time,shipping_fee,shipping_code', 'order_id desc', "{$limit1},{$limit2}"); $this->createExcel($data); } }
/** * 搜索设置 */ public function searchOp() { if (chksubmit()) { $lang = Language::getLangContent(); $model_setting = Model('setting'); /** * 转码 防止GBK下用中文逗号截取不正确 */ $comma = ','; if (strtoupper(CHARSET) == 'GBK') { $comma = Language::getGBK($comma); } $result = $model_setting->updateSetting(array('hot_search' => str_replace($comma, ',', $_POST['hot_search']))); if ($result) { showMessage($lang['nc_common_save_succ']); } else { showMessage($lang['nc_common_save_fail']); } } $model_setting = Model('setting'); $list_setting = $model_setting->getListSetting(); Tpl::output('list_setting', $list_setting); Tpl::showpage('setting.search'); }
/** * 店铺二级域名列表 */ public function store_domain_listOp() { $lang = Language::getLangContent(); $condition = array(); $condition['store_state'] = array('neq', 2); if (trim($_GET['store_name']) != '') { $condition['store_name'] = array('like', '%' . trim($_GET['store_name']) . '%'); } if (trim($_GET['store_domain']) != '') { $condition['store_domain'] = array(array('neq', ''), array('like', '%' . trim($_GET['store_domain']) . '%'), 'and'); } else { $condition['store_domain'] = array('neq', ''); } $model_store = Model('store'); $store_list = $model_store->where($condition)->order('store_sort asc')->page(10)->select(); if (!empty($store_list)) { foreach ($store_list as $k => $v) { $store_list[$k]['state'] = $v['store_state'] == 1 ? $lang['open'] : $lang['close']; } } Tpl::output('store_list', $store_list); Tpl::output('page', $model_store->showpage('2')); Tpl::showpage('store_domain.index'); }
/** * 卖家店铺主题设置 * * @param string * @param string * @return */ public function set_themeOp() { //读取语言包 $lang = Language::getLangContent(); $style = isset($_GET['style_name']) ? trim($_GET['style_name']) : null; if (!empty($style) && file_exists(BASE_TPL_PATH . DS . '/store/style/' . $style . '/images/preview.jpg')) { $store_class = Model('store'); $rs = $store_class->editStore(array('store_theme' => $style), array('store_id' => $_SESSION['store_id'])); showDialog($lang['store_theme_congfig_success'], 'reload', 'succ'); } else { showDialog($lang['store_theme_congfig_fail'], '', 'succ'); } }
/** * 删除页面导航 */ public function navigation_delOp() { $lang = Language::getLangContent(); $model_navigation = Model('navigation'); if (intval($_GET['nav_id']) > 0) { $model_navigation->del(intval($_GET['nav_id'])); dkcache('nav'); $this->log(L('navigation_edit_succ') . '[ID:' . intval($_GET['nav_id']) . ']', null); showMessage($lang['navigation_index_del_succ'], 'index.php?act=navigation&op=navigation'); } else { showMessage($lang['navigation_index_choose_del'], 'index.php?act=navigation&op=navigation'); } }
/** * 导出 * */ public function export_step1Op() { $lang = Language::getLangContent(); $model_order = Model('order'); $condition = array(); if ($_GET['order_sn']) { $condition['order_sn'] = $_GET['order_sn']; } if ($_GET['store_name']) { $condition['store_name'] = $_GET['store_name']; } if (in_array($_GET['order_state'], array('0', '10', '20', '30', '40'))) { $condition['order_state'] = $_GET['order_state']; } if ($_GET['payment_code']) { $condition['payment_code'] = $_GET['payment_code']; } if ($_GET['buyer_name']) { $condition['buyer_name'] = $_GET['buyer_name']; } $if_start_time = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_start_time']); $if_end_time = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_end_time']); $start_unixtime = $if_start_time ? strtotime($_GET['query_start_time']) : null; $end_unixtime = $if_end_time ? strtotime($_GET['query_end_time']) : null; if ($start_unixtime || $end_unixtime) { $condition['add_time'] = array('time', array($start_unixtime, $end_unixtime)); } if (!is_numeric($_GET['curpage'])) { $count = $model_order->getOrderCount($condition); $array = array(); if ($count > self::EXPORT_SIZE) { //显示下载链接 $page = ceil($count / self::EXPORT_SIZE); for ($i = 1; $i <= $page; $i++) { $limit1 = ($i - 1) * self::EXPORT_SIZE + 1; $limit2 = $i * self::EXPORT_SIZE > $count ? $count : $i * self::EXPORT_SIZE; $array[$i] = $limit1 . ' ~ ' . $limit2; } Tpl::output('list', $array); Tpl::output('murl', 'index.php?act=order&op=index'); Tpl::showpage('export.excel'); } else { //如果数量小,直接下载 $data = $model_order->getOrderList($condition, '', '*', 'order_id desc', self::EXPORT_SIZE); $this->createExcel($data); } } else { //下载 $limit1 = ($_GET['curpage'] - 1) * self::EXPORT_SIZE; $limit2 = self::EXPORT_SIZE; $data = $model_order->getOrderList($condition, '', '*', 'order_id desc', "{$limit1},{$limit2}"); $this->createExcel($data); } }
/** * 用户中心右边,小导航 * * @param string $menu_type 导航类型 * @param string $menu_key 当前导航的menu_key * @param array $array 附加菜单 * @return */ private function profile_menu($menu_key = '', $array = array()) { Language::read('member_layout'); $lang = Language::getLangContent(); $menu_array = array(); $menu_array = array(1 => array('menu_key' => 'ztc_list', 'menu_name' => $lang['nc_member_path_ztc_list'], 'menu_url' => 'index.php?act=store_ztc&op=ztc_list'), 2 => array('menu_key' => 'ztc_glist', 'menu_name' => $lang['nc_member_path_ztc_glist'], 'menu_url' => 'index.php?act=store_ztc&op=ztc_glist'), 3 => array('menu_key' => 'ztc_glog', 'menu_name' => $lang['nc_member_path_ztc_glog'], 'menu_url' => 'index.php?act=store_ztc&op=ztc_glog')); if ($_GET['op'] == 'ztc_add') { $menu_array = array_merge($menu_array, array(4 => array('menu_key' => 'ztc_add', 'menu_name' => $lang['nc_member_path_ztc_add'], 'menu_url' => 'index.php?act=store_ztc&op=ztc_add'))); } elseif ($_GET['op'] == 'edit_ztc') { $menu_array = array_merge($menu_array, array(4 => array('menu_key' => 'edit_ztc', 'menu_name' => $lang['store_ztc_index_edit_content'], 'menu_url' => 'index.php?act=store_ztc&op=edit_ztc&z_id=' . intval($_GET['z_id'])))); } if (!empty($array)) { $menu_array[] = $array; } Tpl::output('member_menu', $menu_array); Tpl::output('menu_key', $menu_key); }
/** * 删除分类 */ public function article_class_delOp() { $lang = Language::getLangContent(); $model_class = Model('article_class'); if (intval($_GET['ac_id']) > 0) { $array = array(intval($_GET['ac_id'])); $del_array = $model_class->getChildClass($array); if (is_array($del_array)) { foreach ($del_array as $k => $v) { $model_class->del($v['ac_id']); } } $this->log(l('nc_add,article_class_index_class') . '[ID:' . intval($_GET['ac_id']) . ']', 1); showMessage($lang['article_class_index_del_succ'], 'index.php?act=article_class&op=article_class'); } else { showMessage($lang['article_class_index_choose'], 'index.php?act=article_class&op=article_class'); } }