/** * 虚拟商品购买第二步 */ public function buy_step2Op() { $logic_buy_virtual = uk86_Logic('buy_virtual'); $_POST['order_from'] = 1; $result = $logic_buy_virtual->buyStep3($_POST, $_SESSION['member_id']); if (!$result['state']) { $this->wap_showDialog($result['msg'], 'error', uk86_getReferer()); } //转向到商城支付页面 uk86_redirect('index.php?act=wap_buy_virtual&op=pay&order_id=' . $result['data']['order_id']); }
/** * 登录操作 * */ public function indexOp() { $lang = Uk86Language::uk86_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 = uk86_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 (Uk86process::uk86_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 { Uk86process::uk86_addprocess('login'); showDialog($lang['login_index_login_fail'], '', 'error', $script, 2); } $model_member->createSession($member_info); Uk86process::uk86_clear('login'); // cookie中的cart存入数据库 Model('cart')->mergecart($member_info, $_SESSION['store_id']); // cookie中的浏览记录存入数据库 Model('goods_browse')->mergebrowse($_SESSION['member_id'], $_SESSION['store_id']); //添加会员U币 $model_member->addPoint($member_info); showDialog(L('login_index_login_success'), 'reload', 'succ', '', 2); } if (empty($_GET['ref_url'])) { $_GET['ref_url'] = uk86_getReferer(); } Tpl::output('html_title', C('site_name') . ' - ' . $lang['login_index_login']); Tpl::output('nchash', uk86_getNchash()); if ($_GET['inajax'] == 1) { Tpl::showpage('login_inajax', 'null_layout'); } else { return false; } }
public function indexOp() { header("Content-type:text/html; charset=utf-8"); $goods_id = intval($_GET['goods_id']); //添加浏览记录 $this->addbrowse($goods_id); $model_goods = Model('goods'); $goods_detail = $model_goods->getGoodsDetail($goods_id); $goods_info = $goods_detail['goods_info']; if (empty($goods_info)) { $this->wap_showDialog('商品已下架或不存在', 'error', uk86_getReferer()); } $rs = $model_goods->getGoodsList(array('goods_commonid' => $goods_info['goods_commonid'])); $count = 0; foreach ($rs as $v) { $count += $v['goods_salenum']; } $goods_info['goods_salenum'] = $count; // 添加 end $this->getStoreInfo($goods_info['store_id']); Tpl::output('spec_list', $goods_detail['spec_list']); Tpl::output('spec_image', $goods_detail['spec_image']); Tpl::output('goods_image', $goods_detail['goods_image_mobile']); Tpl::output('mansong_info', $goods_detail['mansong_info']); Tpl::output('gift_array', $goods_detail['gift_array']); // 生成缓存的键值 $hash_key = $goods_info['goods_id']; $_cache = uk86_rcache($hash_key, 'product'); if (empty($_cache)) { // 查询SNS中该商品的信息 $snsgoodsinfo = Model('sns_goods')->getSNSGoodsInfo(array('snsgoods_goodsid' => $goods_info['goods_id']), 'snsgoods_likenum,snsgoods_sharenum'); $data = array(); $data['likenum'] = $snsgoodsinfo['snsgoods_likenum']; $data['sharenum'] = $snsgoodsinfo['snsgoods_sharenum']; // 缓存商品信息 uk86_wcache($hash_key, $data, 'product'); } $goods_info = array_merge($goods_info, $_cache); $inform_switch = true; // 检测商品是否下架,检查是否为店主本人 if ($goods_info['goods_state'] != 1 || $goods_info['goods_verify'] != 1 || $goods_info['store_id'] == $_SESSION['store_id']) { $inform_switch = false; } Tpl::output('inform_switch', $inform_switch); // 如果使用运费模板 if ($goods_info['transport_id'] > 0) { // 取得三种运送方式默认运费 $model_transport = Model('transport'); $transport = $model_transport->getExtendList(array('transport_id' => $goods_info['transport_id'], 'is_default' => 1)); if (!empty($transport) && is_array($transport)) { foreach ($transport as $v) { $goods_info[$v['type'] . "_price"] = $v['sprice']; } } } Tpl::output('goods', $goods_info); $model_plate = Model('store_plate'); // 顶部关联版式 if ($goods_info['plateid_top'] > 0) { $plate_top = $model_plate->getStorePlateInfoByID($goods_info['plateid_top']); Tpl::output('plate_top', $plate_top); } // 底部关联版式 if ($goods_info['plateid_bottom'] > 0) { $plate_bottom = $model_plate->getStorePlateInfoByID($goods_info['plateid_bottom']); Tpl::output('plate_bottom', $plate_bottom); } Tpl::output('store_id', $goods_info['store_id']); // 输出一级地区 $area_list = Model('area')->getTopLevelAreas(); if (strtoupper(CHARSET) == 'GBK') { $area_list = Uk86Language::uk86_getGBK($area_list); } Tpl::output('area_list', $area_list); //优先得到推荐商品 $goods_commend_list = $model_goods->getGoodsOnlineList(array('store_id' => $goods_info['store_id'], 'goods_commend' => 1), 'goods_id,goods_name,goods_jingle,goods_image,store_id,goods_price', 0, 'rand()', 5, 'goods_commonid'); Tpl::output('goods_commend', $goods_commend_list); // 当前位置导航 $nav_link_list = Model('goods_class')->getGoodsClassNav($goods_info['gc_id'], 0); $nav_link_list[] = array('title' => $goods_info['goods_name']); Tpl::output('nav_link_list', $nav_link_list); //评价信息 $goods_evaluate_info = Model('evaluate_goods')->getEvaluateGoodsInfoByGoodsID($goods_id); Tpl::output('goods_evaluate_info', $goods_evaluate_info); //所有评价 Tpl::output('all_comments', $this->_get_comments($goods_info['goods_id'], 'all')); //好评 Tpl::output('good_comments', $this->_get_comments($goods_info['goods_id'], '1')); //中评 Tpl::output('normal_comments', $this->_get_comments($goods_info['goods_id'], '2')); //差评 Tpl::output('bad_comments', $this->_get_comments($goods_info['goods_id'], '3')); $seo_param = array(); $seo_param['name'] = $goods_info['goods_name']; $seo_param['key'] = $goods_info['goods_keywords']; $seo_param['description'] = $goods_info['goods_description']; Model('seo')->type('product')->param($seo_param)->show(); Tpl::showpage('goods_info'); }
</span></a></li> <li><a href="JavaScript:void(0);" class="current"><span>确认收款</span></a></li> </ul> </div> </div> <div class="fixed-empty"></div> <form method="post" name="form1" id="form1" action="index.php?act=<?php echo $_GET['act']; ?> &op=change_state&state_type=receive_pay&order_id=<?php echo intval($_GET['order_id']); ?> "> <input type="hidden" name="form_submit" value="ok" /> <input type="hidden" value="<?php echo uk86_getReferer(); ?> " name="ref_url"> <table class="table tb-type2"> <tbody> <tr class="noborder"> <td colspan="2" class="required"><label for="site_name">订单编号<?php echo $lang['nc_colon']; ?> </label></td> </tr> <tr class="noborder"> <td class="vatop rowform"><?php echo $output['order_info']['order_sn']; ?> </td>
<!--顶部结束--> <div id="content" class="p_bottom"> <form action="" id="login_check" method="get"> <div class="check_login"> <div class="check_login_1"><input type="text" id="member_name" name="member_name" value="" placeholder="用户名"/></div> <div><input type="password" id="member_password" name="member_password" value="" placeholder="请输入密码"/></div> </div> <div class="login_link"><a href="#">忘记密码?</a><a class="login_link_right" href="#">我是商家</a></div> <div class="check_submit"> <input class="check_submit_1" type="button" value="登录" /> <a href="index.php?act=wap_login&op=register&url=<?php echo $_GET['url'] ? $_GET['url'] : uk86_getReferer(); ?> "><input class="check_submit_2" type="button" value="注册" /></a> <input type="hidden" id="server_url" value="<?php echo $_GET['url'] ? $_GET['url'] : uk86_getReferer(); ?> " /> </div> </form> <div class="login_line"><div>第三方账号快速登录</div></div> <div class="ort_login"> <div class="list_ort_login"> <ul> <li><dl><dt><a href="#"><img src="<?php echo SHOP_TEMPLATES_URL; ?> /images/wap/weibo_login.png"></a></dt><dt class="login_name">微博</dt></dl></li> <li><dl><dt><a href="<?php echo SHOP_SITE_URL; ?>
/** * 系统站内信查看操作 * * @param * @return */ public function showmsgbatchOp() { $model_message = Model('message'); $message_id = intval($_GET['message_id']); $drop_type = trim($_GET['drop_type']); $referer_url = uk86_getReferer(); if (!in_array($drop_type, array('msg_system', 'msg_seller')) || $message_id <= 0) { uk86_showMessage(Uk86Language::uk86_get('wrong_argument'), $referer_url, 'html', 'error'); } //查询站内信 $param = array(); $param['message_id'] = "{$message_id}"; $param['to_member_id'] = "{$_SESSION['member_id']}"; $param['no_del_member_id'] = "{$_SESSION['member_id']}"; $message_info = $model_message->getRowMessage($param); if (empty($message_info)) { uk86_showMessage(Uk86Language::uk86_get('home_message_no_record'), $referer_url, 'html', 'error'); } if ($drop_type == 'msg_system') { $message_info['from_member_name'] = Uk86Language::uk86_get('home_message_system_message'); } if ($drop_type == 'msg_seller') { //查询店铺信息 $model_store = Model('store'); $store_info = $model_store->getStoreInfo(array('member_id' => "{$message_info['from_member_id']}")); $message_info['from_member_name'] = $store_info['store_name']; $message_info['store_id'] = $store_info['store_id']; } $message_list[0] = $message_info; Tpl::output('message_list', $message_list); //站内信列表 //更新为已读信息 $tmp_readid_str = ''; if (!empty($message_info['read_member_id'])) { $tmp_readid_arr = explode(',', $message_info['read_member_id']); if (!in_array($_SESSION['member_id'], $tmp_readid_arr)) { $tmp_readid_arr[] = $_SESSION['member_id']; } foreach ($tmp_readid_arr as $readid_k => $readid_v) { if ($readid_v == '') { unset($tmp_readid_arr[$readid_k]); } } $tmp_readid_arr = array_unique($tmp_readid_arr); //去除相同 sort($tmp_readid_arr); //排序 $tmp_readid_str = "," . implode(',', $tmp_readid_arr) . ","; } else { $tmp_readid_str = ",{$_SESSION['member_id']},"; } $model_message->updateCommonMessage(array('read_member_id' => $tmp_readid_str), array('message_id' => "{$message_id}")); //更新未读站内信数量cookie值 $cookie_name = 'msgnewnum' . $_SESSION['member_id']; $countnum = $model_message->countNewMessage($_SESSION['member_id']); uk86_setNcCookie($cookie_name, $countnum, 2 * 3600); //保存2小时 Tpl::output('message_num', $countnum); // 新消息数量 $this->showReceivedNewNum(); Tpl::output('drop_type', $drop_type); $this->profile_menu('showmsg'); Tpl::showpage('member_message.view'); }
/** * 调用显示模板 * * @param string $page_name * @param string $layout * @param int $time */ public static function showpage($page_name = '', $layout = '', $time = 2000) { if (!defined('TPL_NAME')) { define('TPL_NAME', 'default'); } self::getInstance(); if (!empty(self::$tpl_dir)) { $tpl_dir = self::$tpl_dir . DS; } //默认是带有布局文件 if (empty($layout)) { $layout = 'layout' . DS . self::$layout_file . '.php'; } else { $layout = 'layout' . DS . $layout . '.php'; } $layout_file = BASE_PATH . '/templates/' . TPL_NAME . DS . $layout; $tpl_file = BASE_PATH . '/templates/' . TPL_NAME . DS . $tpl_dir . $page_name . '.php'; if (file_exists($tpl_file)) { //对模板变量进行赋值 $output = self::$output_value; //页头 $output['html_title'] = $output['html_title'] != '' ? $output['html_title'] : $GLOBALS['setting_config']['site_name']; $output['seo_keywords'] = $output['seo_keywords'] != '' ? $output['seo_keywords'] : $GLOBALS['setting_config']['site_name']; $output['seo_description'] = $output['seo_description'] != '' ? $output['seo_description'] : $GLOBALS['setting_config']['site_name']; $output['ref_url'] = uk86_getReferer(); Uk86Language::uk86_read('common'); $lang = Uk86Language::uk86_getLangContent(); @header("Content-type: text/html; charset=" . CHARSET); //判断是否使用布局方式输出模板,如果是,那么包含布局文件,并且在布局文件中包含模板文件 if ($layout != '') { if (file_exists($layout_file)) { include_once $layout_file; } else { $error = 'Tpl ERROR:' . 'templates' . DS . $layout . ' is not exists'; uk86_throw_exception($error); } } else { include_once $tpl_file; } } else { $error = 'Tpl ERROR:' . 'templates' . DS . $tpl_dir . $page_name . '.php' . ' is not exists'; uk86_throw_exception($error); } }
public function del_card_batchOp() { if (empty($_POST['ids']) || !is_array($_POST['ids'])) { uk86_showMessage('参数错误', '', 'html', 'error'); } Model('rechargecard')->delRechargeCardById($_POST['ids']); $count = count($_POST['ids']); $this->log("删除{$count}张充值卡"); uk86_showMessage('操作成功', uk86_getReferer()); }
/** * 不显示信息直接跳转 * * @param string $url */ function uk86_redirect($url = '') { if (empty($url)) { if (!empty($_REQUEST['ref_url'])) { $url = $_REQUEST['ref_url']; } else { $url = uk86_getReferer(); } } @header('Location: ' . $url); exit; }
/** * 退出登录操作 */ public function login_outOp() { uk86_setNcCookie('msgnewnum' . $_SESSION['member_id'], '', -3600); session_unset(); session_destroy(); uk86_setNcCookie('cart_goods_num', '', -3600); $url = uk86_getReferer(); uk86_redirect('index.php?act=wap_login&op=login&url=' . $url); }
/** * * 修改广告 */ public function adv_editOp() { if ($_POST['form_submit'] != 'ok') { $adv = Model('adv'); $condition['adv_id'] = intval($_GET['adv_id']); $adv_list = $adv->getList($condition); $ap_info = $adv->getApList(); Tpl::output('ref_url', uk86_getReferer()); Tpl::output('adv_list', $adv_list); Tpl::output('ap_info', $ap_info); Tpl::showpage('adv.edit'); } else { $lang = Uk86Language::uk86_getLangContent(); $adv = Model('adv'); $upload = new Uk86UploadFile(); /** * 验证 */ $obj_validate = new Uk86Validate(); $obj_validate->validateparam = array(array("input" => $_POST["adv_name"], "require" => "true", "message" => $lang['ap_can_not_null']), array("input" => $_POST["adv_start_date"], "require" => "true", "message" => $lang['must_select_start_time']), array("input" => $_POST["adv_end_date"], "require" => "true", "message" => $lang['must_select_end_time'])); $error = $obj_validate->uk86_validate(); if ($error != '') { uk86_showMessage($error); } else { $param['adv_id'] = intval($_GET['adv_id']); $param['adv_title'] = trim($_POST['adv_name']); $param['adv_start_date'] = $this->getunixtime(trim($_POST['adv_start_date'])); $param['adv_end_date'] = $this->getunixtime(trim($_POST['adv_end_date'])); /** * 建立图片广告信息的入库数组 */ if ($_POST['mark'] == '0') { if ($_FILES['adv_pic']['name'] != '') { $upload->uk86_set('default_dir', ATTACH_ADV); $result = $upload->uk86_upfile('adv_pic'); if (!$result) { uk86_showMessage($upload->error, '', '', 'error'); } $ac = array('adv_pic' => $upload->file_name, 'adv_pic_url' => trim($_POST['adv_pic_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } else { $ac = array('adv_pic' => trim($_POST['pic_ori']), 'adv_pic_url' => trim($_POST['adv_pic_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } } /** * 建立文字广告信息的入库数组 */ if ($_POST['mark'] == '1') { //判断页面编码确定汉字所占字节数 switch (CHARSET) { case 'UTF-8': $charrate = 3; break; case 'GBK': $charrate = 2; break; } if (strlen($_POST['adv_word']) > $_POST['adv_word_len'] * $charrate) { $error = $lang['wordadv_toolong']; uk86_showMessage($error); die; } $ac = array('adv_word' => trim($_POST['adv_word']), 'adv_word_url' => trim($_POST['adv_word_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } /** * 建立Flash广告信息的入库数组 */ if ($_POST['mark'] == '3') { if ($_FILES['flash_swf']['name'] != '') { $upload->uk86_set('default_dir', ATTACH_ADV); $result = $upload->uk86_upfile('flash_swf'); $ac = array('flash_swf' => $upload->file_name, 'flash_url' => trim($_POST['flash_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } else { $ac = array('flash_swf' => trim($_POST['flash_ori']), 'flash_url' => trim($_POST['flash_url'])); $ac = serialize($ac); $param['adv_content'] = $ac; } } $result = $adv->update($param); if ($result) { $url = array(array('url' => trim($_POST['ref_url']), 'msg' => $lang['goback_ap_manage'])); $this->log(L('adv_change_succ') . '[' . $_POST["ap_name"] . ']', null); uk86_showMessage($lang['adv_change_succ'], $url); } else { uk86_showMessage($lang['adv_change_fail'], $url); } } } }
/** * 手机端提示信息 * @param string $msg * @param string $succ * @param string $url * @param string $is_url * @param number $time */ protected function wap_showDialog($msg, $succ = 'error', $url = '', $is_url = true, $time = 2, $exit = true) { if ($is_url) { if ($url == '' || empty($url)) { $url = uk86_getReferer(); } } $html = '<!DOCTYPE><html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"> <meta name="apple-themes-web-app-capable" content="yes"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta content="telephone=no" name="format-detection"> <meta content="email=no" name="format-detection"> <meta name="format-detection" content="telephone=no"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="' . RESOURCE_SITE_URL . DS . 'js/wap/jquery.min.js"></script> <script type="text/javascript" src="' . RESOURCE_SITE_URL . DS . 'js/wap/common.js"></script> <script type="text/javascript" src="' . RESOURCE_SITE_URL . DS . 'js/wap/dialog.js"></script> <link rel="stylesheet" href="' . SHOP_TEMPLATES_URL . '/css/wap/dialog.css" type="text/css"> </head> <body style="background:url(' . SHOP_TEMPLATES_URL . '/images/wap/dialog_background.png) no-repeat; background-size:100% 100%;"> </body> <script type="text/javascript"> $(document).ready(function(){'; if ($succ == 'error') { $html .= 'showError("' . $msg . '", ' . $time . ', "' . $url . '")'; } elseif ($succ == 'succ') { $html .= 'showDialog("' . $msg . '", ' . $time . ', "' . $url . '")'; } $html .= '}); </script> </html>'; echo $html; if ($exit) { exit; } }
<div class="ncsc-form-goods"> <h3 id="demo1"><?php echo $lang['store_goods_index_goods_base_info']; ?> </h3> <dl> <dt><?php echo $lang['store_goods_index_goods_class'] . $lang['nc_colon']; ?> </dt> <dd id="gcategory"> <?php echo $output['goods_class']['gc_tag_name']; ?> <a class="ncsc-btn" href="<?php if ($output['edit_goods_sign']) { echo uk86_urlShop('store_goods_online', 'edit_class', array('commonid' => $output['goods']['goods_commonid'], 'ref_url' => uk86_getReferer())); } else { echo uk86_urlShop('store_goods_add', 'add_step_one'); } ?> "><?php echo $lang['nc_edit']; ?> </a> <input type="hidden" id="cate_id" name="cate_id" value="<?php echo $output['goods_class']['gc_id']; ?> " class="text" /> <input type="hidden" name="cate_name" value="<?php echo $output['goods_class']['gc_tag_name']; ?>
/** * 保存商品(商品发布第二步使用) */ public function save_goodsOp() { if (uk86_chksubmit()) { // 验证表单 $obj_validate = new Uk86Validate(); $obj_validate->validateparam = array(array("input" => $_POST["g_name"], "require" => "true", "message" => L('store_goods_index_goods_name_null')), array("input" => $_POST["g_price"], "require" => "true", "validator" => "Double", "message" => L('store_goods_index_goods_price_null'))); $error = $obj_validate->uk86_validate(); if ($error != '') { uk86_showMessage(L('error') . $error, uk86_urlShop('seller_center'), 'html', 'error'); } $model_goods = Model('goods'); $model_type = Model('type'); // 分类信息 $goods_class = Model('goods_class')->getGoodsClassLineForTag(intval($_POST['cate_id'])); $common_array = array(); $common_array['goods_name'] = $_POST['g_name']; $common_array['goods_jingle'] = $_POST['g_jingle']; $common_array['gc_id'] = intval($_POST['cate_id']); $common_array['gc_id_1'] = intval($goods_class['gc_id_1']); $common_array['gc_id_2'] = intval($goods_class['gc_id_2']); $common_array['gc_id_3'] = intval($goods_class['gc_id_3']); $common_array['gc_name'] = $_POST['cate_name']; $common_array['brand_id'] = $_POST['b_id']; $common_array['brand_name'] = $_POST['b_name']; $common_array['type_id'] = intval($_POST['type_id']); $common_array['goods_image'] = $_POST['image_path']; $common_array['goods_price'] = floatval($_POST['g_price']); $common_array['goods_marketprice'] = floatval($_POST['g_marketprice']); $common_array['goods_costprice'] = floatval($_POST['g_costprice']); $common_array['goods_discount'] = floatval($_POST['g_discount']); $common_array['goods_serial'] = $_POST['g_serial']; $common_array['goods_storage_alarm'] = intval($_POST['g_alarm']); $common_array['goods_attr'] = serialize($_POST['attr']); $common_array['goods_body'] = $_POST['g_body']; $common_array['store_mentioning'] = intval($_POST['g_mentioning']); $common_array['store_floor_id'] = intval($_POST['store_floor_id']); //楼层id $common_array['store_floor_name'] = $_POST['store_floor_name']; //楼层名称 // 序列化保存手机端商品描述数据 if ($_POST['m_body'] != '') { $_POST['m_body'] = str_replace('"', '"', $_POST['m_body']); $_POST['m_body'] = json_decode($_POST['m_body'], true); if (!empty($_POST['m_body'])) { $_POST['m_body'] = serialize($_POST['m_body']); } else { $_POST['m_body'] = ''; } } $common_array['mobile_body'] = $_POST['m_body']; $common_array['goods_commend'] = intval($_POST['g_commend']); $common_array['goods_state'] = $this->store_info['store_state'] != 1 ? 0 : intval($_POST['g_state']); // 店铺关闭时,商品下架 $common_array['goods_addtime'] = TIMESTAMP; $common_array['goods_selltime'] = strtotime($_POST['starttime']) + intval($_POST['starttime_H']) * 3600 + intval($_POST['starttime_i']) * 60; $common_array['goods_verify'] = C('goods_verify') == 1 ? 10 : 1; $common_array['store_id'] = $_SESSION['store_id']; $common_array['store_name'] = $_SESSION['store_name']; $common_array['spec_name'] = is_array($_POST['spec']) ? serialize($_POST['sp_name']) : serialize(null); $common_array['spec_value'] = is_array($_POST['spec']) ? serialize($_POST['sp_val']) : serialize(null); $common_array['goods_vat'] = intval($_POST['g_vat']); $common_array['areaid_1'] = intval($_POST['province_id']); $common_array['areaid_2'] = intval($_POST['city_id']); $common_array['transport_id'] = $_POST['freight'] == '0' ? '0' : intval($_POST['transport_id']); // 运费模板 $common_array['transport_title'] = $_POST['transport_title']; $common_array['goods_freight'] = floatval($_POST['g_freight']); //查询店铺商品分类 $goods_stcids_arr = array(); if (!empty($_POST['sgcate_id'])) { $sgcate_id_arr = array(); foreach ($_POST['sgcate_id'] as $k => $v) { $sgcate_id_arr[] = intval($v); } $sgcate_id_arr = array_unique($sgcate_id_arr); $store_goods_class = Model('store_goods_class')->getStoreGoodsClassList(array('store_id' => $_SESSION['store_id'], 'stc_id' => array('in', $sgcate_id_arr), 'stc_state' => '1')); if (!empty($store_goods_class)) { foreach ($store_goods_class as $k => $v) { if ($v['stc_id'] > 0) { $goods_stcids_arr[] = $v['stc_id']; } if ($v['stc_parent_id'] > 0) { $goods_stcids_arr[] = $v['stc_parent_id']; } } $goods_stcids_arr = array_unique($goods_stcids_arr); sort($goods_stcids_arr); } } if (empty($goods_stcids_arr)) { $common_array['goods_stcids'] = ''; } else { $common_array['goods_stcids'] = ',' . implode(',', $goods_stcids_arr) . ','; // 首尾需要加, } $common_array['plateid_top'] = intval($_POST['plate_top']) > 0 ? intval($_POST['plate_top']) : ''; $common_array['plateid_bottom'] = intval($_POST['plate_bottom']) > 0 ? intval($_POST['plate_bottom']) : ''; $common_array['is_virtual'] = intval($_POST['is_gv']); $common_array['virtual_indate'] = $_POST['g_vindate'] != '' ? strtotime($_POST['g_vindate']) + 24 * 60 * 60 - 1 : 0; // 当天的最后一秒结束 $common_array['virtual_limit'] = intval($_POST['g_vlimit']) > 10 || intval($_POST['g_vlimit']) < 0 ? 10 : intval($_POST['g_vlimit']); $common_array['virtual_invalid_refund'] = intval($_POST['g_vinvalidrefund']); $common_array['is_fcode'] = intval($_POST['is_fc']); $common_array['is_appoint'] = intval($_POST['is_appoint']); // 只有库存为零的商品可以预约 $common_array['appoint_satedate'] = $common_array['is_appoint'] == 1 ? strtotime($_POST['g_saledate']) : ''; // 预约商品的销售时间 $common_array['is_presell'] = $common_array['goods_state'] == 1 ? intval($_POST['is_presell']) : 0; // 只有出售中的商品可以预售 $common_array['presell_deliverdate'] = $common_array['is_presell'] == 1 ? strtotime($_POST['g_deliverdate']) : ''; // 预售商品的发货时间 $common_array['is_own_shop'] = in_array($_SESSION['store_id'], model('store')->getOwnShopIds()) ? 1 : 0; // 保存数据 $common_id = $model_goods->addGoodsCommon($common_array); if ($common_id) { // 生成的商品id(SKU) $goodsid_array = array(); require_once BASE_RESOURCE_PATH . DS . 'phpqrcode' . DS . 'index.php'; $PhpQRCode = new PhpQRCode(); $PhpQRCode->set('pngTempDir', BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $_SESSION['store_id'] . DS); // 商品规格 if (is_array($_POST['spec'])) { foreach ($_POST['spec'] as $value) { $goods = array(); $goods['goods_commonid'] = $common_id; $goods['goods_name'] = $common_array['goods_name'] . ' ' . implode(' ', $value['sp_value']); $goods['goods_jingle'] = $common_array['goods_jingle']; $goods['store_id'] = $common_array['store_id']; $goods['store_name'] = $_SESSION['store_name']; $goods['gc_id'] = $common_array['gc_id']; $goods['gc_id_1'] = $common_array['gc_id_1']; $goods['gc_id_2'] = $common_array['gc_id_2']; $goods['gc_id_3'] = $common_array['gc_id_3']; $goods['brand_id'] = $common_array['brand_id']; $goods['goods_price'] = $value['price']; $goods['goods_promotion_price'] = $value['price']; $goods['goods_marketprice'] = $value['marketprice'] == 0 ? $common_array['goods_marketprice'] : $value['marketprice']; $goods['goods_serial'] = $value['sku']; $goods['goods_storage_alarm'] = intval($value['alarm']); $goods['goods_spec'] = serialize($value['sp_value']); $goods['goods_storage'] = $value['stock']; $goods['goods_image'] = $common_array['goods_image']; $goods['goods_state'] = $common_array['goods_state']; $goods['goods_verify'] = $common_array['goods_verify']; $goods['goods_addtime'] = TIMESTAMP; $goods['goods_edittime'] = TIMESTAMP; $goods['areaid_1'] = $common_array['areaid_1']; $goods['areaid_2'] = $common_array['areaid_2']; $goods['color_id'] = intval($value['color']); $goods['transport_id'] = $common_array['transport_id']; $goods['goods_freight'] = $common_array['goods_freight']; $goods['goods_vat'] = $common_array['goods_vat']; $goods['goods_commend'] = $common_array['goods_commend']; $goods['goods_stcids'] = $common_array['goods_stcids']; $goods['is_virtual'] = $common_array['is_virtual']; $goods['virtual_indate'] = $common_array['virtual_indate']; $goods['virtual_limit'] = $common_array['virtual_limit']; $goods['virtual_invalid_refund'] = $common_array['virtual_invalid_refund']; $goods['is_fcode'] = $common_array['is_fcode']; $goods['is_appoint'] = $common_array['is_appoint']; $goods['is_presell'] = $common_array['is_presell']; $goods['is_own_shop'] = $common_array['is_own_shop']; $goods['store_mentioning'] = $common_array['store_mentioning']; $goods['store_floor_id'] = $common_array['store_floor_id']; //楼层id $goods['store_floor_name'] = $common_array['store_floor_name']; //楼层名称 $goods_id = $model_goods->addGoods($goods); $model_type->addGoodsType($goods_id, $common_id, array('cate_id' => $_POST['cate_id'], 'type_id' => $_POST['type_id'], 'attr' => $_POST['attr'])); $goodsid_array[] = $goods_id; // 生成商品二维码 $PhpQRCode->set('date', WAP_SITE_URL . '/tmpl/product_detail.html?goods_id=' . $goods_id); $PhpQRCode->set('pngTempName', $goods_id . '.png'); $PhpQRCode->init(); } } else { $goods = array(); $goods['goods_commonid'] = $common_id; $goods['goods_name'] = $common_array['goods_name']; $goods['goods_jingle'] = $common_array['goods_jingle']; $goods['store_id'] = $common_array['store_id']; $goods['store_name'] = $_SESSION['store_name']; $goods['gc_id'] = $common_array['gc_id']; $goods['gc_id_1'] = $common_array['gc_id_1']; $goods['gc_id_2'] = $common_array['gc_id_2']; $goods['gc_id_3'] = $common_array['gc_id_3']; $goods['brand_id'] = $common_array['brand_id']; $goods['goods_price'] = $common_array['goods_price']; $goods['goods_promotion_price'] = $common_array['goods_price']; $goods['goods_marketprice'] = $common_array['goods_marketprice']; $goods['goods_serial'] = $common_array['goods_serial']; $goods['goods_storage_alarm'] = $common_array['goods_storage_alarm']; $goods['goods_spec'] = serialize(null); $goods['goods_storage'] = intval($_POST['g_storage']); $goods['goods_image'] = $common_array['goods_image']; $goods['goods_state'] = $common_array['goods_state']; $goods['goods_verify'] = $common_array['goods_verify']; $goods['goods_addtime'] = TIMESTAMP; $goods['goods_edittime'] = TIMESTAMP; $goods['areaid_1'] = $common_array['areaid_1']; $goods['areaid_2'] = $common_array['areaid_2']; $goods['color_id'] = 0; $goods['transport_id'] = $common_array['transport_id']; $goods['goods_freight'] = $common_array['goods_freight']; $goods['goods_vat'] = $common_array['goods_vat']; $goods['goods_commend'] = $common_array['goods_commend']; $goods['goods_stcids'] = $common_array['goods_stcids']; $goods['is_virtual'] = $common_array['is_virtual']; $goods['virtual_indate'] = $common_array['virtual_indate']; $goods['virtual_limit'] = $common_array['virtual_limit']; $goods['virtual_invalid_refund'] = $common_array['virtual_invalid_refund']; $goods['is_fcode'] = $common_array['is_fcode']; $goods['is_appoint'] = $common_array['is_appoint']; $goods['is_presell'] = $common_array['is_presell']; $goods['is_own_shop'] = $common_array['is_own_shop']; $goods['store_mentioning'] = $common_array['store_mentioning']; $goods_id = $model_goods->addGoods($goods); $model_type->addGoodsType($goods_id, $common_id, array('cate_id' => $_POST['cate_id'], 'type_id' => $_POST['type_id'], 'attr' => $_POST['attr'])); $goodsid_array[] = $goods_id; } // 生成商品二维码 if (!empty($goodsid_array)) { //QueueClient::push('createGoodsQRCode', array('store_id' => $_SESSION['store_id'], 'goodsid_array' => $goodsid_array)); $PhpQRCode->set('date', WAP_SITE_URL . '/tmpl/product_detail.html?goods_id=' . $goods_id); $PhpQRCode->set('pngTempName', $goods_id . '.png'); $PhpQRCode->init(); } // 商品加入上架队列 if (isset($_POST['starttime'])) { $selltime = strtotime($_POST['starttime']) + intval($_POST['starttime_H']) * 3600 + intval($_POST['starttime_i']) * 60; if ($selltime > TIMESTAMP) { $this->addcron(array('exetime' => $selltime, 'exeid' => $common_id, 'type' => 1), true); } } // 记录日志 $this->recordSellerLog('添加商品,平台货号:' . $common_id); // 生成F码 if ($common_array['is_fcode'] == 1) { Uk86QueueClient::push('createGoodsFCode', array('goods_commonid' => $common_id, 'fc_count' => intval($_POST['g_fccount']), 'fc_prefix' => $_POST['g_fcprefix'])); } uk86_redirect(uk86_urlShop('store_goods_add', 'add_step_three', array('commonid' => $common_id))); } else { uk86_showMessage(L('store_goods_index_goods_add_fail'), uk86_getReferer(), 'html', 'error'); } } }
/** * 用户中心右边,小导航 * * @param string $menu_type 导航类型 * @param string $menu_key 当前导航的menu_key * @param boolean $allow_promotion * @return */ private function profile_menu($menu_type, $menu_key, $allow_promotion = array()) { $menu_array = array(); switch ($menu_type) { case 'goods_list': $menu_array = array(array('menu_key' => 'goods_list', 'menu_name' => '出售中的商品', 'menu_url' => uk86_urlShop('store_goods_online', 'index'))); break; case 'edit_detail': if ($allow_promotion['lock'] === false) { $menu_array = array(array('menu_key' => 'edit_detail', 'menu_name' => '编辑商品', 'menu_url' => uk86_urlShop('store_goods_online', 'edit_goods', array('commonid' => $_GET['commonid'], 'ref_url' => $_GET['ref_url']))), array('menu_key' => 'edit_image', 'menu_name' => '编辑图片', 'menu_url' => uk86_urlShop('store_goods_online', 'edit_image', array('commonid' => $_GET['commonid'], 'ref_url' => $_GET['ref_url'] ? $_GET['ref_url'] : uk86_getReferer())))); } if ($allow_promotion['gift']) { $menu_array[] = array('menu_key' => 'add_gift', 'menu_name' => '赠送赠品', 'menu_url' => uk86_urlShop('store_goods_online', 'add_gift', array('commonid' => $_GET['commonid'], 'ref_url' => $_GET['ref_url'] ? $_GET['ref_url'] : uk86_getReferer()))); } if ($allow_promotion['combo']) { $menu_array[] = array('menu_key' => 'add_combo', 'menu_name' => '推荐组合', 'menu_url' => uk86_urlShop('store_goods_online', 'add_combo', array('commonid' => $_GET['commonid'], 'ref_url' => $_GET['ref_url'] ? $_GET['ref_url'] : uk86_getReferer()))); } break; case 'edit_class': $menu_array = array(array('menu_key' => 'edit_class', 'menu_name' => '选择分类', 'menu_url' => uk86_urlShop('store_goods_online', 'edit_class', array('commonid' => $_GET['commonid'], 'ref_url' => $_GET['ref_url']))), array('menu_key' => 'edit_detail', 'menu_name' => '编辑商品', 'menu_url' => uk86_urlShop('store_goods_online', 'edit_goods', array('commonid' => $_GET['commonid'], 'ref_url' => $_GET['ref_url']))), array('menu_key' => 'edit_image', 'menu_name' => '编辑图片', 'menu_url' => uk86_urlShop('store_goods_online', 'edit_image', array('commonid' => $_GET['commonid'], 'ref_url' => $_GET['ref_url'] ? $_GET['ref_url'] : uk86_getReferer())))); break; } Tpl::output('member_menu', $menu_array); Tpl::output('menu_key', $menu_key); }
/** * 删除分类 */ public function store_class_delOp() { $lang = Uk86Language::uk86_getLangContent(); $model_class = Model('store_class'); if (intval($_GET['sc_id']) > 0) { $array = array(intval($_GET['sc_id'])); $result = $model_class->delStoreClass(array('sc_id' => intval($_GET['sc_id']))); if ($result) { $this->log(L('nc_del,store_class') . '[ID:' . $_GET['sc_id'] . ']', 1); uk86_showMessage($lang['nc_common_del_succ'], uk86_getReferer()); } } uk86_showMessage($lang['nc_common_del_fail'], 'index.php?act=store_class&op=store_class'); }
/** * 退出操作 * * @param int $id 记录ID * @return array $rs_row 返回数组形式的查询结果 */ public function logoutOp() { Uk86Language::uk86_read("home_login_index"); $lang = Uk86Language::uk86_getLangContent(); // 清理消息COOKIE uk86_setNcCookie('msgnewnum' . $_SESSION['member_id'], '', -3600); session_unset(); session_destroy(); uk86_setNcCookie('cart_goods_num', '', -3600); if (empty($_GET['ref_url'])) { $ref_url = uk86_getReferer(); } else { $ref_url = $_GET['ref_url']; } uk86_redirect('index.php?act=login&ref_url=' . urlencode($ref_url)); }
public function delOp() { $storeId = (int) $_GET['id']; $storeModel = model('store'); $storeArray = $storeModel->field('is_own_shop,store_name')->find($storeId); if (empty($storeArray)) { uk86_showMessage('自营店铺不存在', '', 'html', 'error'); } if (!$storeArray['is_own_shop']) { uk86_showMessage('不能在此删除非自营店铺', '', 'html', 'error'); } $condition = array('store_id' => $storeId); if ((int) model('goods')->getGoodsCount($condition) > 0) { uk86_showMessage('已经发布商品的自营店铺不能被删除', '', 'html', 'error'); } // 完全删除店铺 $storeModel->delStoreEntirely($condition); // 删除自营店id缓存 Model('store')->dropCachedOwnShopIds(); $this->log("删除自营店铺: {$storeArray['store_name']}"); uk86_showMessage('操作成功', uk86_getReferer()); }