$paymentlist = mysqld_selectall("select * from " . table("payment") . " where `enabled`=1 and `code`!='gold' and `online`=1 {$paymentconfig} "); $paymentscount = mysqld_selectcolumn("select count(id) from " . table("payment") . " where `enabled`=1 and `code`!='gold' and `online`=1 {$paymentconfig} "); if (empty($paymentscount)) { message("未找到可用的在线支付方式,暂时不支持余额充值。"); } if (checksubmit("submit")) { if (empty($_GP['charge']) || round($_GP['charge'], 2) <= 0) { message("请输入要充值的金额"); } $paytypecode = $_GP['paymentcode']; if (empty($paytypecode)) { message("请选择充值方式。"); } $payment = mysqld_select("select * from " . table("payment") . " where `enabled`=1 and `code`=:code and `code`!='gold' and `online`=1", array('code' => $paytypecode)); if (empty($payment['id'])) { message("未找到付款方式,付款失败"); } $goodtitle = "余额充值" . $_GP['charge'] . "元"; $ordersn = 'bg' . date('Ymd') . random(6, 1); $gold_order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE ordersn = '{$ordersn}'"); if (!empty($gold_order['ordersn'])) { $ordersn = 'bg' . date('Ymd') . random(6, 1); } $insert = array('openid' => $openid, 'ordersn' => $ordersn, 'price' => $_GP['charge'], 'status' => 0, 'createtime' => TIMESTAMP); mysqld_insert('gold_order', $insert); $order = mysqld_select("SELECT * FROM " . table('gold_order') . " WHERE ordersn = '{$ordersn}' and openid='{$openid}'"); require WEB_ROOT . '/system/modules/plugin/payment/' . $paytypecode . '/gold_payaction.php'; exit; } include themePage('rechargegold');
} else { if ($status == 99) { // $where.=" and ( status=-5 or status=-6 or status=3 )"; } else { $where .= " and status={$status}"; } } $list = mysqld_selectall("SELECT * FROM " . table('shop_order') . " WHERE {$where} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(), 'id'); $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_order') . " WHERE {$where} "); $pager = pagination($total, $pindex, $psize); if (!empty($list)) { foreach ($list as &$row) { $goods = mysqld_selectall("SELECT g.id, g.title, g.thumb, g.marketprice,o.total,o.optionid FROM " . table('shop_order_goods') . " o left join " . table('shop_goods') . " g on o.goodsid=g.id " . " WHERE o.orderid='{$row['id']}'"); foreach ($goods as &$item) { //属性 $option = mysqld_select("select title,marketprice,weight,stock from " . table("shop_goods_option") . " where id=:id limit 1", array(":id" => $item['optionid'])); if ($option) { $item['title'] = "[" . $option['title'] . "]" . $item['title']; $item['marketprice'] = $option['marketprice']; } } unset($item); $row['goods'] = $goods; $row['total'] = $goodsid; $row['dispatch'] = mysqld_select("select id,dispatchname from " . table('shop_dispatch') . " where id=:id limit 1", array(":id" => $row['dispatch'])); } } include themePage('order'); exit; } }
$sorturl .= "&isnew=1"; } if (!empty($_GP['ishot'])) { $condition .= " AND ishot = 1"; $sorturl .= "&ishot=1"; } if (!empty($_GP['isdiscount'])) { $condition .= " AND isdiscount = 1"; $sorturl .= "&isdiscount=1"; } if (!empty($_GP['istime'])) { $condition .= " AND istime = 1 "; $sorturl .= "&istime=1"; } $children = array(); $category = mysqld_selectall("SELECT * FROM " . table('shop_category') . " WHERE deleted=0 and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(), 'id'); foreach ($category as $index => $row) { if (!empty($row['parentid'])) { $children[$row['parentid']][$row['id']] = $row; unset($category[$index]); } } $list = mysqld_selectall("SELECT * FROM " . table('shop_goods') . " WHERE deleted=0 AND status = '1' {$condition} ORDER BY {$sortfield} "); $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('shop_goods') . " WHERE deleted=0 AND status = '1' {$condition}"); $pager = pagination($total, $pindex, $psize, $url = '', $context = array('before' => 0, 'after' => 0, 'ajaxcallback' => '')); $id = $profile['id']; if ($profile['status'] == 0) { $profile['flag'] = 0; } include themePage('goodlist');
} elseif ($operation == 'default') { $id = intval($_GP['id']); mysqld_update('shop_address', array('isdefault' => 0), array('openid' => $openid)); mysqld_update('shop_address', array('isdefault' => 1), array('id' => $id)); message(1, '', 'ajax'); } elseif ($operation == 'detail') { $id = intval($_GP['id']); $row = mysqld_select("SELECT id, realname, mobile, province, city, area, address FROM " . table('shop_address') . " WHERE id = :id", array(':id' => $id)); message($row, '', 'ajax'); } elseif ($operation == 'remove') { $id = intval($_GP['id']); if (!empty($id)) { $address = mysqld_select("select isdefault from " . table('shop_address') . " where id='{$id}' and openid='" . $openid . "' limit 1 "); if (!empty($address)) { //修改成不直接删除,而设置deleted=1 mysqld_update("shop_address", array("deleted" => 1, "isdefault" => 0), array('id' => $id, 'openid' => $openid)); if ($address['isdefault'] == 1) { //如果删除的是默认地址,则设置是新的为默认地址 $maxid = mysqld_selectcolumn("select max(id) as maxid from " . table('shop_address') . " where openid='" . $openid . "' limit 1 "); if (!empty($maxid)) { mysqld_update('shop_address', array('isdefault' => 1), array('id' => $maxid, 'openid' => $openid)); die(json_encode(array("result" => 1, "maxid" => $maxid))); } } } } die(json_encode(array("result" => 1, "maxid" => 0))); } else { $address = mysqld_selectall("SELECT * FROM " . table('shop_address') . " WHERE deleted=0 and openid = :openid", array(':openid' => $openid)); include themePage('address'); }
} $marketprice = $goods['marketprice']; $productprice = $goods['productprice']; $stock = $goods['total']; //规格及规格项 $allspecs = mysqld_selectall("select * from " . table('shop_goods_spec') . " where goodsid=:id order by displayorder asc", array(':id' => $goodsid)); foreach ($allspecs as &$s) { $s['items'] = mysqld_selectall("select * from " . table('shop_goods_spec_item') . " where `show`=1 and specid=:specid order by displayorder asc", array(":specid" => $s['id'])); } unset($s); //处理规格项 $options = mysqld_selectall("select id,title,thumb,marketprice,productprice, stock,weight,specs from " . table('shop_goods_option') . " where goodsid=:id order by id asc", array(':id' => $goodsid)); //排序好的specs $specs = array(); //找出数据库存储的排列顺序 if (count($options) > 0) { $specitemids = explode("_", $options[0]['specs']); foreach ($specitemids as $itemid) { foreach ($allspecs as $ss) { $items = $ss['items']; foreach ($items as $it) { if ($it['id'] == $itemid) { $specs[] = $ss; break; } } } } } include themePage('detail');
<?php if (checksubmit("submit")) { if (empty($_GP['mobile'])) { message("请输入手机号"); } if (empty($_GP['pwd'])) { message("请输入密码"); } $member = get_session_account(); $oldsessionid = $member['openid']; $loginid = member_login($_GP['mobile'], $_GP['pwd']); if ($loginid == -1) { message("账户已被禁用!"); } if (empty($loginid)) { message("用户名或密码错误"); } else { integration_session_account($loginid, $oldsessionid); header("location:" . to_member_loginfromurl()); } } $qqlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='qq'"); if (!empty($qqlogin) && !empty($qqlogin['id'])) { $showqqlogin = true; } include themePage('login');
if (empty($_GP['third_login'])) { if (empty($_GP['pwd'])) { message("请输入密码!"); } $pwd = md5($_GP['pwd']); } else { $pwd = ''; } $shop_regcredit = intval($cfg['shop_regcredit']); $openid = date("YmdH", time()) . rand(100, 999); $hasmember = mysqld_select("SELECT * FROM " . table('member') . " WHERE openid = :openid ", array(':openid' => $openid)); if (!empty($hasmember['openid'])) { $openid = date("YmdH", time()) . rand(100, 999); } $data = array('mobile' => $_GP['mobile'], 'pwd' => $pwd, 'createtime' => time(), 'status' => 1, 'istemplate' => 0, 'experience' => 0, 'openid' => $openid); mysqld_insert('member', $data); if (!empty($shop_regcredit)) { member_credit($openid, $shop_regcredit, "addcredit", "注册系统赠送积分"); } $member = get_session_account(); $oldsessionid = $member['openid']; $loginid = save_member_login('', $openid); integration_session_account($loginid, $oldsessionid); message('注册成功!', to_member_loginfromurl(), 'success'); } $qqlogin = mysqld_select("SELECT * FROM " . table('thirdlogin') . " WHERE enabled=1 and `code`='qq'"); if (!empty($qqlogin) && !empty($qqlogin['id'])) { $showqqlogin = true; } include themePage('regedit');
<?php $member = get_member_account(true, true); $openid = $member['openid']; $member = member_get($openid); $bonuslist = mysqld_selectall("select bonus_user.*,bonus_type.type_name,bonus_type.type_money,bonus_type.use_start_date,bonus_type.use_end_date from " . table("bonus_user") . " bonus_user left join " . table("bonus_type") . " bonus_type on bonus_type.type_id=bonus_user.bonus_type_id where bonus_user.deleted=0 and `openid`=:openid order by isuse,bonus_type.send_type ", array(':openid' => $openid)); include themePage('bonuslist');
<?php $cfg = globaSetting(); $advs = mysqld_selectall("select * from " . table('shop_adv') . " where enabled=1 order by displayorder desc"); $children_category = array(); $category = mysqld_selectall("SELECT *,'' as list FROM " . table('shop_category') . " WHERE isrecommand=1 and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(), 'id'); foreach ($category as $index => $row) { if (!empty($row['parentid'])) { $children_category[$row['parentid']][$row['id']] = $row; unset($category[$index]); } } $recommandcategory = array(); foreach ($category as &$c) { if ($c['isrecommand'] == 1) { $c['list'] = mysqld_selectall("SELECT * FROM " . table('shop_goods') . " WHERE isrecommand=1 and deleted=0 AND status = 1 and pcate='{$c['id']}' ORDER BY displayorder DESC, sales"); $recommandcategory[] = $c; } if (!empty($children_category[$c['id']])) { foreach ($children_category[$c['id']] as &$child) { if ($child['isrecommand'] == 1) { $child['list'] = mysqld_selectall("SELECT * FROM " . table('shop_goods') . " WHERE isrecommand=1 and deleted=0 AND status = 1 and pcate='{$c['id']}' and ccate='{$child['id']}' ORDER BY displayorder DESC, sales DESC "); $recommandcategory[] = $child; } } unset($child); } } include themePage('shopindex');
user-select:none } .hide,.h{ display:none !important } .show{ display:block !important } .zidingyi img{ max-width: 100%; height: auto; width: auto\9; vertical-align:bottom; vertical-align:top; } </style> <body style=" margin:0 auto;"> <div class="zidingyi"> <?php echo $singlepage['content']; ?> </div> <?php if (!empty($singlepage['open_footer'])) { include themePage('footer'); } ?> </body> </html>
} else { if ($op == 'update') { $id = intval($_GP['id']); $num = intval($_GP['num']); mysqld_query("update " . table('shop_cart') . " set total={$num} where id=:id", array(":id" => $id)); die(json_encode(array("result" => 1))); } else { $list = mysqld_selectall("SELECT * FROM " . table('shop_cart') . " WHERE session_id = '" . $openid . "'"); $totalprice = 0; if (!empty($list)) { foreach ($list as &$item) { $goods = mysqld_select("SELECT title, thumb, marketprice, total FROM " . table('shop_goods') . " WHERE id=:id limit 1", array(":id" => $item['goodsid'])); //属性 $option = mysqld_select("select title,marketprice,stock from " . table("shop_goods_option") . " where id=:id limit 1", array(":id" => $item['optionid'])); if ($option) { $goods['title'] = $goods['title']; $goods['optionname'] = $option['title']; $goods['marketprice'] = $option['marketprice']; $goods['total'] = $option['stock']; } $item['goods'] = $goods; $item['totalprice'] = floatval($goods['marketprice']) * intval($item['total']); $totalprice += $item['totalprice']; } unset($item); } include themePage('cart'); } } } }
<?php $member = get_member_account(true, true); $openid = $member['openid']; $memberinfo = member_get($openid); if (empty($memberinfo['pwd'])) { $hiddenoldpwd = true; } if (checksubmit("submit")) { if (!empty($memberinfo['pwd'])) { if (empty($_GP['pwd'])) { message("请输入密码!"); } if ($memberinfo['pwd'] != md5($_GP['oldpwd'])) { message("原始密码错误!"); } } $data = array('pwd' => md5($_GP['pwd'])); mysqld_update('member', $data, array('openid' => $openid)); message('密码修改成功!', mobile_url('fansindex'), 'success'); } include themePage('member_pwd');
<?php $cfg = globaSetting(); $member = get_member_account(true, true); $openid = $member['openid']; $memberinfo = member_get($openid); if (checksubmit("submit")) { if (empty($_GP['mobile'])) { message("请输入手机号!"); } $data = array('realname' => $_GP['realname'], 'email' => $_GP['email']); if ($memberinfo['mobile'] != $_GP['mobile']) { $ckmember = mysqld_select("SELECT * FROM " . table('member') . " where mobile=:mobile ", array(':mobile' => $_GP['mobile'])); if (!empty($ckmember['openid'])) { message($_GP['mobile'] . "已被注册。"); } $data['mobile'] = $_GP['mobile']; } mysqld_update('member', $data, array('openid' => $openid)); message('资料修改成功!', mobile_url('fansindex'), 'success'); } include themePage('member');
} $fee = round($_GP['charge'], 2); if ($fee > $member['gold']) { message('账户余额不足,最多能提取' . $member['gold'] . '元'); } $ordersn = 'rg' . date('Ymd') . random(6, 1); $gold_order = mysqld_select("SELECT * FROM " . table('gold_teller') . " WHERE ordersn = '{$ordersn}'"); if (!empty($gold_order['ordersn'])) { $ordersn = 'rg' . date('Ymd') . random(6, 1); } member_gold($openid, $fee, 'usegold', '余额提取' . $fee . '元'); mysqld_insert('gold_teller', array('openid' => $openid, 'fee' => $fee, 'status' => 0, 'ordersn' => $ordersn, 'createtime' => time())); message('余额提取申请成功!', 'refresh', 'success'); exit; } $applygold = mysqld_selectcolumn("select sum(fee) from " . table("gold_teller") . " where status=0 and openid=" . $openid); if (empty($applygold)) { $applygold = '0'; } include themePage('outchargegold'); exit; } if ($op == 'history') { $pindex = max(1, intval($_GP['page'])); $psize = 20; $list = mysqld_selectall("select * from " . table("gold_teller") . " where openid=:openid order by createtime desc LIMIT " . ($pindex - 1) * $psize . ',' . $psize, array(":openid" => $openid)); $total = mysqld_selectcolumn('SELECT COUNT(*) FROM ' . table('gold_teller') . " where openid=:openid ", array(":openid" => $openid)); $pager = pagination($total, $pindex, $psize); include themePage('outchargegold_history'); exit; }
<?php $cfg = globaSetting(); $help = $cfg['help']; include themePage('help');
<?php $category = mysqld_selectall("SELECT * FROM " . table('shop_category') . " WHERE deleted=0 and enabled=1 ORDER BY parentid ASC, displayorder DESC"); foreach ($category as $index => $row) { if (!empty($row['parentid'])) { $children[$row['parentid']][$row['id']] = $row; unset($category[$index]); } } include themePage('list_category');
<?php $member = get_member_account(false); $member = member_get($member['openid']); if (empty($member['openid'])) { $member = get_member_account(false); $member['createtime'] = time(); } $is_login = is_login_account(); $cfg = globaSetting(); $weixinfans = get_weixin_fans_byopenid($member['openid'], $member['openid']); if (!empty($weixinfans) && !empty($weixinfans['avatar'])) { $avatar = $weixinfans['avatar']; } include themePage('fansindex');
if (empty($payment['id'])) { message("没有获取到付款方式"); } $paytype = $this->getPaytypebycode($payment['code']); $data = array('openid' => $openid, 'ordersn' => $ordersns, 'price' => $goodsprice + $dispatchprice, 'dispatchprice' => $dispatchprice, 'goodsprice' => $goodsprice, 'credit' => $goodscredit, 'status' => 0, 'paytype' => $paytype, 'sendtype' => intval($dispatchitem['sendtype']), 'dispatchexpress' => $dispatchitem['express'], 'dispatch' => $dispatchid, 'paytypecode' => $payment['code'], 'paytypename' => $payment['name'], 'remark' => $_GP['remark'], 'address_mobile' => $address['mobile'], 'address_realname' => $address['realname'], 'address_province' => $address['province'], 'address_city' => $address['city'], 'address_area' => $address['area'], 'address_address' => $address['address'], 'createtime' => time()); mysqld_insert('shop_order', $data); $orderid = mysqld_insertid(); //插入订单商品 foreach ($allgoods as $row) { if (empty($row)) { continue; } $d = array('goodsid' => $row['id'], 'orderid' => $orderid, 'total' => $row['total'], 'price' => $row['marketprice'], 'createtime' => time(), 'optionid' => $row['optionid']); $o = mysqld_select("select title from " . table('shop_goods_option') . " where id=:id limit 1", array(":id" => $row['optionid'])); if (!empty($o)) { $d['optionname'] = $o['title']; } //获取商品id $ccate = $row['ccate']; mysqld_insert('shop_order_goods', $d); } //清空购物车 if (!$direct) { mysqld_delete("shop_cart", array("session_id" => $openid)); } $this->setOrderStock($orderid); clearloginfrom(); header("Location:" . mobile_url('pay', array('orderid' => $orderid, 'topay' => '1'))); } include themePage('confirm');