<?php session_start(); include_once '../Index/head.php'; include_once '../Bin/MySqlHelper.class.php'; include_once '../Bin/Function.php'; //图片链接,运费等配置信息 include_once 'action/config.php'; $mysql = new MySqlHelper(); $gdid = $_REQUEST['gdid']; $sqlgoods = "SELECT * FROM sh_store_goods WHERE gdid=" . $gdid . " and state='ON' "; $datagoods = $mysql->FetchData($sqlgoods); $sqlgoodsdetail = "SELECT * FROM sh_store_goods_detail WHERE gdid=" . $gdid . " and state='ON' "; $datagoodsdetail = $mysql->FetchData($sqlgoodsdetail); $arrpic = explode("|", $datagoods[0]['gdpic']); //print_r($datagoods); $userID = $_SESSION['coustomid']; if ($userID == '') { $userID = '0'; } ?> <link rel="stylesheet" href="../Carwash/ResponsiveSlides/responsiveslides.css"> <link rel="stylesheet" href="../Carwash/ResponsiveSlides/demo/demo.css"> <link rel="stylesheet" href="jiaoben897/css/zzsc.css"> <link href="spinner/css/jquery.spinner.css" rel="stylesheet" type="text/css"> <script src="../Myjquery/JQUERY-CONFIRM/js/pretty.js"></script>
echo json_encode(array("code" => "110", "mess" => '修改失败!')); return; } } elseif ($m == 'LISTADDADDRESS') { //添加地址并使用 $name = $_REQUEST['name']; $tel = $_REQUEST['tel']; $province = $_REQUEST['province']; $city = $_REQUEST['city']; $country = $_REQUEST['country']; $detail_address = $_REQUEST['detail_address']; $time = date('Y-m-d H:i:s', time()); $Mysql = new MySqlHelper(); //检查是否已经存在默认地址; $sqlcheck = "SELECT id FROM sh_store_address where userid={$userID} AND delstate='N' AND state='ON'"; $datacheck = $Mysql->FetchData($sqlcheck); $flag = count($datacheck); //如果存在默认地址,则设置为普通地址,如果不存在默认地址,则设置成默认地址。 if ($flag > 0) { $state = 'OFF'; } else { $state = 'ON'; } $sqlinaddress = "INSERT INTO sh_store_address (userid,provinceid,cityid,countyid,detailaddress,createtime,tel,`name`,state) VALUES ({$userID},{$province},{$city},{$country},'{$detail_address}','{$time}','{$tel}','{$name}','{$state}')"; $row = $Mysql->ExecuteSql($sqlinaddress); $sqlsearchid = "SELECT id FROM sh_store_address WHERE userid={$userID} ORDER BY createtime DESC LIMIT 1"; $datasearchid = $Mysql->FetchData($sqlsearchid); if ($row > 0) { echo json_encode(array("code" => "200", "mess" => $datasearchid[0][0])); return; } else {
<?php include_once '../../Bin/MySqlHelper.class.php'; $id = $_REQUEST['id']; if ($id > 0) { $Mysql = new MySqlHelper(); $data = $Mysql->FetchData("select dnum,dprice from sh_store_goods_detail where detailid={$id}"); $num = $data[0]['dnum']; $price = $data[0]['dprice']; echo json_encode(array("msg" => "200", "num" => $num, "price" => $price)); } else { echo json_encode(array("msg" => "110", "num" => '0')); }
<?php include_once '../../Bin/MySqlHelper.class.php'; //连接数据库 include_once "../../Bin/Log.class.php"; $Mysql = new MySqlHelper(); //$user = array('demo1','demo2','demo3','demo3','demo4'); $sqllimit = $_REQUEST['sqllimit']; $page = $_REQUEST['page']; //$page=0; //获取请求的页数 $start = $page * 5; $sqllimit = $sqllimit . " " . $start . ",5 "; //new Log('',$username.'修改的sql语句==='.$sqllimit); $query = $Mysql->FetchData($sqllimit); echo json_encode($query); return; //转换为json数据输出 ?>
echo json_encode(array("code" => "110", "mess" => '确认收货失败!')); return; } } elseif ($m == 'BUYNOW') { $gdetailid = $_REQUEST['gdetailid']; $addressId = $_REQUEST['addressId']; $sdnum = $_REQUEST['sdnum']; $remarks = $_REQUEST['remarks']; $expressprice = EXPRESSPRICE; if ($remarks == '') { $remarks = '无备注'; } $orderNum = date('YmdHis') . rand(100, 999); $sqlInfo = "SELECT detailid,dprice,dnum,state FROM sh_store_goods_detail WHERE detailid={$gdetailid}"; $Mysql = new MySqlHelper(); $dataInfo = $Mysql->FetchData($sqlInfo); if ($dataInfo[0]['state'] != 'ON') { echo json_encode(array("code" => "110", "mess" => '该商品已经下架!')); return; } if ($dataInfo[0]['dnum'] < $sdnum) { echo json_encode(array("code" => "110", "mess" => '库存量不足!')); return; } $price = $dataInfo[0]['dprice']; $totalmoney = $price * $sdnum + $expressprice; $time = date("Y-m-d H:i:s", time()); $Mysql->Query("BEGIN"); $sqlInToOrder = "INSERT INTO sh_store_order (userid,ordertime,paystate,deliverstate,orderstate,money,discountmoney,countmoney,realpay,paytype,remarks,address,phone,`name`,expressPrice,ordernum) SELECT {$userID},'{$time}','N', 'NOT','PRE',{$totalmoney},0,{$totalmoney},0,4,'{$remarks}',concat(ar2.areaname,ar1.areaname,ar.areaname,a.detailaddress) AS address,a.tel,a.`name`,{$expressprice},'{$orderNum}' FROM sh_store_address a JOIN sh_store_area ar ON a.countyid=ar.areaid JOIN sh_store_area ar1 ON a.cityid=ar1.areaid JOIN sh_store_area ar2 ON a.provinceid=ar2.areaid WHERE id={$addressId} AND a.userid={$userID} AND delstate='N' limit 1"; //new Log("","ssss".$sqlInToOrder); $effectRow = $Mysql->ExecuteSql($sqlInToOrder);
<?php session_start(); include_once '../../Bin/MySqlHelper.class.php'; include_once '../../Bin/Log.class.php'; $userID = $_SESSION['coustomid']; $m = $_REQUEST['m']; //设置默认地址; if ($m == 'GETAREA') { $areaid = $_REQUEST['areaID']; $sql = "SELECT * FROM sh_store_area WHERE fid={$areaid}"; $Mysql = new MySqlHelper(); $dataArea = $Mysql->FetchData($sql); echo json_encode($dataArea); return; }
<?php session_start(); include_once '../Index/head.php'; include_once '../Bin/MySqlHelper.class.php'; include_once '../Bin/Function.php'; $Mysql = new MySqlHelper(); $userid = $_SESSION['coustomid']; $id = $_REQUEST['id']; //$id=19; $sqlprovince = "SELECT * FROM sh_store_area WHERE fid=0"; $dataTableProvince = $Mysql->FetchData($sqlprovince); $sqladdress = "SELECT * FROM sh_store_address WHERE id={$id} and userid={$userid}"; $dataTableAddress = $Mysql->FetchData($sqladdress); $flag = count($dataTableAddress); $sqlcity = "SELECT * FROM sh_store_area WHERE fid=" . $dataTableAddress[0]['provinceid']; $dataTableCity = $Mysql->FetchData($sqlcity); $sqlcountry = "SELECT * FROM sh_store_area WHERE fid=" . $dataTableAddress[0]['cityid']; $dataTableCountry = $Mysql->FetchData($sqlcountry); //查询商品信息 ?> <link rel="stylesheet" href="ResponsiveSlides/responsiveslides.css"> <link rel="stylesheet" href="ResponsiveSlides/demo/demo.css"> <script src="../Myjquery/JQUERY-CONFIRM/js/pretty.js"></script> <!-- Add the minified version of files from the /dist/ folder. -->
<?php session_start(); include_once '../Index/head.php'; include_once '../Bin/MySqlHelper.class.php'; include_once '../Bin/Function.php'; //图片链接,运费等配置信息 include_once 'action/config.php'; $Mysql = new MySqlHelper(); $userid = $_SESSION['coustomid']; $sqlprovince = "SELECT * FROM sh_store_area WHERE fid=0"; $dataTableProvince = $Mysql->FetchData($sqlprovince); //查询商品信息 $gdetailid = $_REQUEST['gdetailid']; $sdnum = $_REQUEST['sdnum']; if ($gdetailid != '' && $sdnum != '') { $flag = true; } ?> <link rel="stylesheet" href="ResponsiveSlides/responsiveslides.css"> <link rel="stylesheet" href="ResponsiveSlides/demo/demo.css"> <script src="../Myjquery/JQUERY-CONFIRM/js/pretty.js"></script> <!-- Add the minified version of files from the /dist/ folder. --> <!-- jquery-confirm files --> <link rel="stylesheet" type="text/css" href="../Myjquery/JQUERY-CONFIRM/css/jquery-confirm.css" />
$gdetailid = $_REQUEST['gdetailid']; $sdnum = $_REQUEST['sdnum']; $gsname = $_REQUEST['gsname']; $gdname = $_REQUEST['gdname']; if ($userID < 0 || $gdetailid < 0 || $sdnum < 0) { echo json_encode(array("code" => "120", "mess" => '数据异常,提交失败')); return; } if ($gsname == '' || $gdname == '') { echo json_encode(array("code" => "120", "mess" => '数据异常,提交失败')); return; } //查询购物车中是否已经有了改商品 $sqlsel = "SELECT id FROM sh_store_cart WHERE userid={$userID} AND gdetailid={$gdetailid} AND state='ON' limit 1 "; $Mysql = new MySqlHelper(); $datasel = $Mysql->FetchData($sqlsel); $flag = 0; $flag = count($datasel); $time = date('Y-m-d H:i:s'); //如果已经存在则增加数量,如果不存在则插入到购物车 //new Log('','sds'.$sqlsel); if ($flag > 0) { $sql = "UPDATE sh_store_cart SET snum=snum+{$sdnum} WHERE id=" . $datasel[0]['id']; } else { $sql = "INSERT INTO sh_store_cart (gdetailid,gsname,gdname,snum,userid,createtime) VALUES ({$gdetailid},'{$gsname}','{$gdname}',{$sdnum},{$userID},'{$time}')"; } $row = 0; $row = $Mysql->ExecuteSql($sql); $sqlnum = "SELECT sum(snum) AS scarnum FROM sh_store_cart WHERE state='ON' AND userid=" . $userID; $datanum = $Mysql->FetchData($sqlnum); $scarnum = $datanum[0][0];
public function updateNums($orderid = 0) { $Mysql = new MySqlHelper(); $where = ''; //两个条件满足一个就可以更改,orderid优先 if ($orderid < 1) { return false; } if ($orderid > 0) { $where = " where o.orderid={$orderid} "; } $sqlInfo = "SELECT d.goodsid,d.num FROM sh_store_order o JOIN sh_store_order_detail d ON o.orderid=d.orderid " . $where; new Log("", "" . $sqlInfo); $dataInfo = $Mysql->FetchData($sqlInfo); $row = count($dataInfo); if ($row > 0) { foreach ($dataInfo as $Items) { $upsql = "UPDATE sh_store_goods_detail SET dnum =dnum-" . $Items['num'] . " ,salenum =salenum+" . $Items['num'] . " WHERE detailid=" . $Items['goodsid']; $upRow = $Mysql->ExecuteSql($upsql); if ($upRow < 1) { new Log("", "更改商品数量失败,sql===" . $upsql); return false; } } return true; } else { return false; } }