<?php include "common.inc.php"; InitGP(array("action", "type", "keyword", "aid", "page")); //初始化变量全局返回 include_once INC_PATH . "/order.class.php"; $orderobj = OrderClass::init(); $keyword = FilterSearch(stripslashes($keyword)); //过滤搜索 if ($keyword != '' || strlen($keyword) > 2) { $wherestr[] = "goodsname like '%" . $keyword . "%'"; } $type = GetNum($type); if ($type) { $wherestr[] = "typeid='" . $type . "'"; } //$wherestr[]="uname='".$_USERS['uname']."'"; if (!empty($wherestr)) { $wheresql = implode(' AND ', $wherestr); } //条件汇总 //获取当前页码 $total = $orderobj->getcount($wheresql); //总信息数 if ($total > 1000) { $total = 1000; } //显示最大一千条 $pagesize = 10; //一页显示信息数 $page = isset($page) ? max(1, intval($page)) : 1;
function carttoorder($id) { global $_USERS; if (!empty($id)) { $wherestr[] = $this->joinid($id); } $wherestr[] = "uname ='" . $_USERS['uname'] . "'"; if (empty($wherestr) || empty($_USERS['uname'])) { return false; } if (!empty($wherestr)) { $wheresql = implode(' AND ', $wherestr); } //条件汇总 //获取数据 $temparray = $this->getdata("", $wheresql); if (!empty($temparray)) { //进入用户操作类 include_once INC_PATH . "/member.class.php"; $m = new memberclass(); foreach ($temparray as $value) { $addarray = $value; $tempstate = $value['type'] == 1 ? 1 : 3; //带发直接状态修改成在途中 unset($addarray['gid']); //丢掉 unset($addarray['anonymous']); //丢掉 $addarray['addtime'] = time(); //添加时间 $addarray['state'] = $tempstate; //订单状态 //处理插入数据库 include_once INC_PATH . "/order.class.php"; $order = OrderClass::init(); $info = $order->add($addarray); if (GetNum($info)) { $seccessid[] = $info; //扣除用户帐户余额操作 if ($value['type'] != 2) { $tempmoney = $value['goodsprice'] * $value['goodsnum']; $note = lang('Buy') . "<a href=\\'" . $value['goodsurl'] . "\\' target=\\'_blank\\'>《" . $value['goodsname'] . "》</a> " . $value['goodsnum'] . lang('Pieces_order_ID') . $info; $m->moneyedit($_USERS['uname'], -$tempmoney, 1, $note); //扣去账户余额 } } else { $order->del($seccessid); //手动回滚操作 return lang('process_CartID') . $value['gid'] . lang('orderid_error'); } } //运费扣费处理 $result = $this->countmoney($temparray); //统计运费 foreach ($result['s'] as $key => $val) { $note = lang('goodsseller') . "[" . $key . "]" . lang('Domestic_Ship') . $val; $m->moneyedit($_USERS['uname'], -$val, 2, $note); //扣去账户余额 } $this->clear($id); //删除购物车商品 return 'OK'; } else { return '订单为空'; } }
<?php @header("Content-Type:text/plain; charset=utf-8"); //弹出一键填单相关ajax数据处理 include "../common.inc.php"; InitGP(array("action", "url", "refuname", "referer", "aid", "cityid")); //初始化变量全局返回 AjaxHead(); $jsonarray = $dataarray = array(); if ($action == 'maqueeproduct') { include_once INC_PATH . "/order.class.php"; $o = OrderClass::init(); // $wherestr[]="uname='".$_USERS['uname']."'"; if (!empty($wherestr)) { $wheresql = implode(' AND ', $wherestr); } //条件汇总 $dataarray = $o->getdata(10, $wheresql, "oid desc", "*"); //获取数据 $jsonarray = array(); foreach ($dataarray as $key => $val) { $jsonarray[$key]['c'] = $val['typeid']; $jsonarray[$key]['d'] = ddate('m-d', $val['addtime']); $jsonarray[$key]['id'] = $val['oid']; $jsonarray[$key]['m'] = $val['goodsprice']; $jsonarray[$key]['n'] = $val['goodsname']; $jsonarray[$key]['p'] = $val['showimg']; $jsonarray[$key]['s'] = $val['goodssite']; $jsonarray[$key]['u'] = $val['goodsurl']; $jsonarray[$key]['un'] = substrs($val['uname'], 2, 1) . "***"; }