接口全部目錄版本判斷php
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_info = array(); $_data = array(); $_clean = array(); $_newVersion= array(); //getAllVersions(); $_oldVersion= array(); /* $_clean['version'] = _check($_POST['version']);*/ $_clean['version'] = '-1;-1'; if($_clean['version']!=''){ $_oldVersion = explode(";",$_clean['version']); if($_oldVersion[0]!=$_newVersion[0]){ echo _json(getAreaMenuData()); }elseif($_oldVersion[1]!=$_newVersion[1]){ echo _json(getDjzdlMenuData()); }elseif($_oldVersion[2]!=$_newVersion[2]){ echo _json(getDjzxlMenuData()); }elseif($_oldVersion[3]!=$_newVersion[3]){ echo _json(getLjzdlMenuData()); }elseif($_oldVersion[4]!=$_newVersion[4]){ echo _json(getLjzxlMenuData()); }elseif($_oldVersion[5]!=$_newVersion[5]){ echo _json(getMsdlMenuData()); }elseif($_oldVersion[6]!=$_newVersion[6]){ echo _json(getThdlMenuData()); }elseif($_oldVersion[7]!=$_newVersion[7]){ echo _json(getDhdlMenuData()); }elseif($_oldVersion[8]!=$_newVersion[8]){ echo _json(getTgbdlMenuData()); }elseif($_oldVersion[9]!=$_newVersion[9]){ echo _json(getTgbxlMenuData()); }elseif($_oldVersion[10]!=$_newVersion[10]){ echo _json(getLmbdlMenuData()); }elseif($_oldVersion[11]!=$_newVersion[11]){ echo _json(getLmbxlMenuData()); }elseif($_oldVersion[12]!=$_newVersion[12]){ echo _json(getJybdlMenuData()); }elseif($_oldVersion[13]!=$_newVersion[13]){ echo _json(getJybxlMenuData()); } } //獲取所有區域的數據 function getAreaMenuData(){ $_area = array(); $_html2['id'] = '-2'; $_html2['areaId'] = '2'; $_html2['areaName'] = '所有區域'; $_area[] = $_html2; //區縣 $_sql2 = "SELECT id,areaName,areaId,sort FROM tb_earea WHERE areaType in (3,4) AND state = 0 ORDER BY sort ASC"; $_result2 = _query($_sql2); while ( $_rows2 = _fetch_array($_result2) ) { $_html2 = array(); $_html2['id'] = $_rows2['id']; $_html2['areaId'] = $_rows2['areaId']; $_html2['areaName'] = $_rows2['areaName']; $_html2 = _html($_html2); $_area[] = $_html2; } return $_area; } //獲取點就賺的數據 function getDjzdlMenuData(){ $_bigClass1 = array(); $_html3 = array(); $_html3['id'] = '-2'; $_html3['categoryName'] = '所有類型'; $_bigClass1[] = $_html3; $_sql3 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 1 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result3 = _query($_sql3); while ( $_rows3 = _fetch_array($_result3) ) { $_html3 = array(); $_html3['id'] = $_rows3['id']; $_html3['categoryName'] = $_rows3['categoryName']; $_html3 = _html($_html3); $_bigClass1[] = $_html3; } return $_bigClass1; } //點就賺小類 function getDjzxlMenuData(){ $_smallClass = array(); $_html4 = array(); $_sql4 = "SELECT id,categoryName FROM tb_ecategory WHERE grade=1 and categoryId=1 AND state = 0 ORDER BY sort ASC"; $_result4 = _query($_sql4); while ( $_rows4 = _fetch_array($_result4) ) { $_html4 = array(); $_html4['id'] = $_rows4['id']; $_html4['categoryName'] = $_rows4['categoryName']; $_html4 = _html($_html4); $_smallClass[] = $_html4; } return $_smallClass; } //獲取來就賺的數據 function getLjzdlMenuData(){ $_bigClass2 = array(); $_sql5 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 2 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result5= _query($_sql5); while ( $_rows5 = _fetch_array($_result5) ) { $_html5 = array(); $_html5['id'] = $_rows5['id']; $_html5['categoryName'] = $_rows5['categoryName']; $_html5 = _html($_html5); $_bigClass2[] = $_html5; } return $_bigClass2; } //來就轉小類 function getLjzxlMenuData() { $_smallClass1 = array(); $_html9 = array(); $_sql9 = "SELECT id,categoryName FROM tb_ecategory WHERE grade=2 and categoryId=1 AND state = 0 ORDER BY sort ASC"; $_result9 = _query($_sql9); while ( $_rows9 = _fetch_array($_result9) ) { $_html9 = array(); $_html9['id'] = $_rows9['id']; $_html9['categoryName'] = $_rows9['categoryName']; $_html9 = _html($_html9); $_smallClass1[] = $_html9; } return $_smallClass1; } //獲取秒殺大類 function getMsdlMenuData() { $_bigClass3 = array(); $_sql6 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 4 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result6= _query($_sql6); while ( $_rows6 = _fetch_array($_result6) ) { $_html6 = array(); $_html6['id'] = $_rows6['id']; $_html6['categoryName'] = $_rows6['categoryName']; $_html6 = _html($_html6); $_bigClass3[] = $_html6; } return $_bigClass3; } //特惠 function getThdlMenuData() { $_bigClass4 = array(); $_sql7 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 5 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result7= _query($_sql7); while ( $_rows7 = _fetch_array($_result7) ) { $_html7 = array(); $_html7['id'] = $_rows7['id']; $_html7['categoryName'] = $_rows7['categoryName']; $_html7 = _html($_html7); $_bigClass4[] = $_html7; } return $_bigClass4; } //兌換 function getDhdlMenuData() { $_bigClass5 = array(); $_sql8 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 6 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result8= _query($_sql8); while ( $_rows8 = _fetch_array($_result8) ) { $_html8 = array(); $_html8['id'] = $_rows8['id']; $_html8['categoryName'] = $_rows8['categoryName']; $_html8 = _html($_html8); $_bigClass5[] = $_html8; } return $_bigClass5; } //團購寶 function getTgbdlMenuData() { $_bigClass6 = array(); $_sql10 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 9 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result10= _query($_sql10); while ( $_rows10 = _fetch_array($_result10) ) { $_html10 = array(); $_html10['id'] = $_rows10['id']; $_html10['categoryName'] = $_rows10['categoryName']; $_html10 = _html($_html10); $_bigClass6[] = $_html10; } return $_bigClass6; } //小類 function getTgbxlMenuData(){ $_smallClass6 = array(); $_html11 = array(); $_sql11 = "SELECT id,categoryName FROM tb_ecategory WHERE grade=9 and categoryId>0 AND state = 0 ORDER BY sort ASC"; $_result11 = _query($_sql11); while ( $_rows11 = _fetch_array($_result11) ) { $_html11 = array(); $_html11['id'] = $_rows11['id']; $_html11['categoryName'] = $_rows11['categoryName']; $_html11 = _html($_html11); $_smallClass6[] = $_html11; } return $_smallClass6; } //聯盟寶 function getLmbdlMenuData(){ $_bigClass7 = array(); $_sql12 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 10 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result12= _query($_sql12); while ( $_rows12 = _fetch_array($_result12) ) { $_html12 = array(); $_html12['id'] = $_rows12['id']; $_html12['categoryName'] = $_rows12['categoryName']; $_html12 = _html($_html12); $_bigClass7[] = $_html12; } return $_bigClass7; } //小類 function getLmbxlMenuData(){ $_smallClass7 = array(); $_html13 = array(); $_sql13 = "SELECT id,categoryName FROM tb_ecategory WHERE grade=11 and categoryId>0 AND state = 0 ORDER BY sort ASC"; $_result13 = _query($_sql13); while ( $_rows13 = _fetch_array($_result13) ) { $_html13 = array(); $_html13['id'] = $_rows13['id']; $_html13['categoryName'] = $_rows13['categoryName']; $_html13 = _html($_html13); $_smallClass7[] = $_html13; } return $_smallClass7; } //交易寶 function getJybdlMenuData(){ $_bigClass8 = array(); $_sql14 = "SELECT id,categoryName FROM tb_ecategory WHERE grade = 11 AND categoryId = 0 AND state = 0 ORDER BY sort ASC"; $_result14= _query($_sql14); while ( $_rows14 = _fetch_array($_result14) ) { $_html14 = array(); $_html14['id'] = $_rows14['id']; $_html14['categoryName'] = $_rows14['categoryName']; $_html14 = _html($_html14); $_bigClass8[] = $_html14; } return $_bigClass8; } //交易寶小類 function getJybxlMenuData(){ $_smallClass8 = array(); $_html15 = array(); $_sql15 = "SELECT id,categoryName FROM tb_ecategory WHERE grade=10 and categoryId>0 AND state = 0 ORDER BY sort ASC"; $_result15 = _query($_sql15); while ( $_rows15 = _fetch_array($_result15) ) { $_html15 = array(); $_html15['id'] = $_rows15['id']; $_html15['categoryName'] = $_rows15['categoryName']; $_html15 = _html($_html15); $_smallClass8[] = $_html15; } return $_smallClass8; } //獲取全部數據表的名字 // function getAllVersions(){ // $_result1 = _query("SELECT version,tableName FROM tb_version"); // while ($_rows1 = _fetch_array($_result1)){ // // for($y=0;$y<count($_rows1); $y++){ // // $_html1 = array(); // $_html1['version'] = $_rows1['version']; // $_html1['tableName'] = $_rows1['tableName']; // $_newVersion[$y]=$_html1['tableName']; // } // } // } _free_result($_result2); _free_result($_result3); _free_result($_result4); _free_result($_result5); _free_result($_result6); _free_result($_result7); _free_result($_result8); _free_result($_result9); _free_result($_result10); _free_result($_result11); _free_result($_result12); _free_result($_result13); _free_result($_result14); _free_result($_result15); _close(); ?>
屏幕大小控制網頁css
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['adInfoId'] = _check($_POST['adInfoId']); $_clean['screenWidth'] = _check($_POST['screenWidth']); $_data = array(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body{ font-size:16px; background:#fff;} dl{ width:<?php echo $_clean['screenWidth']?>px;} dl dd{ width:80%;} dl dd span.a1{ display:block; width:25%; float:left;} dl dd span.a2{ display:block; width:75%; float:left;} </style> </head> <body> <div style="width:<?php echo $_clean['screenWidth']?>px"> <?php $_sql = "SELECT brandService,perCapita,preferentialInfo,startDate,endDate,preferentialConditions,parkingEnvironment,theBusGuide,merchantIntroduce FROM tb_adInfo WHERE id = '{$_clean['adInfoId']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data['brandService'] = $_rows['brandService']; $_data['perCapita'] = $_rows['perCapita']; $_data['preferentialInfo'] = $_rows['preferentialInfo']; $_data['startDate'] = $_rows['startDate']; $_data['endDate'] = $_rows['endDate']; $_data['preferentialConditions'] = $_rows['preferentialConditions']; $_data['parkingEnvironment'] = $_rows['parkingEnvironment']; $_data['theBusGuide'] = $_rows['theBusGuide']; $_data['merchantIntroduce'] = $_rows['merchantIntroduce']; ?> <dl> <dd><span class="a1">招牌服務:</span><span class="a2"><?php echo $_data['brandService']?></span></dd> <dd><span class="a1">人均消費:</span><span class="a2"><?php echo $_data['perCapita']?></span></dd> <dd><span class="a1">優惠信息:</span><span class="a2"><?php echo $_data['preferentialInfo']?></span></dd> <dd><span class="a1">起始日期:</span><span class="a2"><?php echo $_data['startDate']?>至<?php echo $_data['endDate']?></span></dd> <dd><span class="a1">優惠細則:</span><span class="a2"><?php echo $_data['preferentialConditions']?></span></dd> <dd><span class="a1">停車環境:</span><span class="a2"><?php echo $_data['parkingEnvironment']?></span></dd> <dd><span class="a1">公交指南:</span><span class="a2"><?php echo $_data['theBusGuide']?></span></dd> <dd><span class="a1">商戶介紹:</span><span class="a2"><?php echo $_data['merchantIntroduce']?></span></dd> </dl> </div> </body> </html>
廣告html
廣告 <?php require dirname(__FILE__).'/includes/common.inc.php'; $_ads = array(); $_data = array(); $_sql = "SELECT id,adName,adImage,adUrl FROM tb_ad WHERE state = 0 AND adLocation = 7"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['id']; $_html['title'] = $_rows['adName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows['adImage']; $_html['url'] = $_rows['adUrl']; $_html = _html($_html); $_data[] = $_html; } $_ads['state'] = 0; $_ads['info'] = ''; $_ads['data'] = $_data; echo _json($_ads); _free_result($_result); _close(); ?>
大類和全部小類 和 其餘信息html5
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_info = array(); $_data = array(); //查找出大類名和圖片 $_sql = "SELECT id,categoryName,images FROM tb_category WHERE grade = 1 AND state = 0"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['id']; $_html['categoryName'] = $_rows['categoryName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows['images']; $_smallClass = array(); //查找全部大類id下的全部小類 $_sql1 = "SELECT id,categoryName FROM tb_category WHERE grade = 2 AND state = 0 AND categoryId = '{$_html['id']}'"; $_result1 = _query($_sql1); while ( $_rows1 = _fetch_array($_result1) ) { $_html1 = array(); $_html1['id'] = $_rows1['id']; $_html1['categoryName'] = $_rows1['categoryName']; $_html1 = _html($_html1); $_smallClass[] = $_html1; } $_html['smallClass'] = $_smallClass; $_data[] = $_html; } $_html['id'] = '-3'; $_html['categoryName'] = '積分專區'; $_html['pic'] = "http://www.youpinge.cn/images/icon/5.png"; $_data[] = $_html; $_html['id'] = '-2'; $_html['categoryName'] = '企業採購'; $_html['pic'] = "http://www.youpinge.cn/images/icon/6.png"; $_data[] = $_html; $_html['id'] = '-1'; $_html['categoryName'] = '商家批發'; $_html['pic'] = "http://www.youpinge.cn/images/icon/7.png"; $_data[] = $_html; $_info['state'] = 0; $_info['info'] = ''; $_info['data'] = $_data; echo _json($_info); _free_result($_result); _close(); ?>
帥選查找結果 還有升降排序mysql
<?php require dirname(__FILE__).'/includes/common.inc.php'; define('SCRIPT','choose'); global $_pagesize,$_pagenum; $_productList = array(); $_clean = array(); // $_clean['distributionArea'] = _check($_POST['distributionArea']); // $_clean['selling'] = _check($_POST['selling']); // $_clean['newGoods'] = _check($_POST['newGoods']); // $_clean['bigClassId'] = _check($_POST['bigClassId']); // $_clean['smallClassId'] = _check($_POST['smallClassId']); // $_clean['sort'] = _check($_POST['sort']);//0:價格升序;1:價格降序 // $_clean['preferential'] = _check($_POST['preferential']); $_clean['distributionArea'] = 2; $_clean['selling'] = 1; $_clean['newGoods'] = 0; $_clean['bigClassId'] = 1; $_clean['smallClassId'] = 0; $_clean['sort'] = 0;//0:價格升序;1:價格降序 $_clean['preferential'] = 0; $_productList['info'] = ''; $_productList['state'] = 0; if ( $_clean['selling'] == 1 ) { $_selling = "AND selling = 1"; } if ( $_clean['newGoods'] == 1 ) { $_newGoods = "AND newGoods = 1"; } if ( $_clean['smallClassId'] != '' ) { $_smallClassId = "AND smallClassId = '{$_clean['smallClassId']}'"; } elseif ( $_clean['smallClassId'] == '' ) { $_smallClassId = ''; } if ( $_clean['preferential'] > 0 ) { $_preferential = "AND preferential > 0"; } if ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 1 AND distributionArea = '{$_clean['distributionArea']}' AND bigClassId = '{$_clean['bigClassId']}' $_selling $_newGoods $_smallClassId $_preferential ORDER BY memberPrice ASC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic2,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 1 AND distributionArea = '{$_clean['distributionArea']}' AND bigClassId = '{$_clean['bigClassId']}' $_selling $_newGoods $_preferential $_smallClassId ORDER BY memberPrice ASC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 1 AND distributionArea = '{$_clean['distributionArea']}' AND bigClassId = '{$_clean['bigClassId']}' $_selling $_newGoods $_smallClassId $_preferential ORDER BY memberPrice DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic2,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 1 AND distributionArea = '{$_clean['distributionArea']}' AND bigClassId = '{$_clean['bigClassId']}' $_selling $_newGoods $_smallClassId $_preferential ORDER BY memberPrice DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } $_productList['data'] = $_data; echo _json($_productList); _close(); ?>
根據 0:熱賣;1:特價;2:推薦;3:最新 作篩選web
<?php require dirname(__FILE__).'/includes/common.inc.php'; define('SCRIPT','chooseSmallClassId'); global $_pagesize,$_pagenum; $_clean = array(); $_clean['sort'] = _check($_POST['sort']);//(0:熱賣;1:特價;2:推薦;3:最新) $_clean['distributionArea'] = _check($_POST['distributionArea']); $_clean['smallClassId'] = _check($_POST['smallClassId']); $_productList = array(); if( $_clean['smallClassId'] != '' ){ $_productList['info'] = ''; $_productList['state'] = 0; if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND smallClassId = '{$_clean['smallClassId']}' AND GoodType = 1 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,retailPrice FROM tb_GoodsInfo WHERE state = 0 AND smallClassId = '{$_clean['smallClassId']}' AND GoodType = 1 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,retailPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,retailPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,retailPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,retailPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 1 AND smallClassId = '{$_clean['smallClassId']}' AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } }else{ $_productList['info'] = '參數有誤'; $_productList['state'] = 1; } $_productList['data'] = $_data; echo _json($_productList); _close(); ?>
評論sql
<?php require dirname(__FILE__) . '/includes/common.inc.php'; $_clean = array(); $_clean['userId'] = 146; $_clean['GoodsInfoId'] = 2; $_clean['postComments'] = 2; $_info = array(); $_data = array(); // $_now = date('y-m-d H:i:s',time()); //用戶ID 商品ID 內容 查詢用戶名 if ( $_clean['userId'] > 0 && $_clean['GoodsInfoId'] > 0 && $_clean['postComments'] != '' ) { $_info['state'] = 0; $_info['info'] = ''; $_sql1 = "SELECT userName FROM tb_user WHERE id = '{$_clean['userId']}'"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); //插入數據 $_sql = "INSERT INTO tb_GoodsComments ( GoodsInfoId, userid, addDates, addIP, postComments, state ) VALUES ( '{$_clean['GoodsInfoId']}', '{$_clean['userId']}', '$_now', '來自Android', '{$_clean['postComments']}', 0 )"; _query($_sql); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '評論成功!'; $_data['addDates'] = $_now; $_data['postComments'] = $_clean['postComments']; $_data['userName'] = $_rows1['userName']; } else { $_data['state'] = 1; $_data['info'] = '評論失敗!'; } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _close(); ?>
今天已抽獎 今天爲抽獎就會抽獎json
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userId'] =146; $_now = date('Y-m-d H:i:s',time()); $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 ) { $_info['state'] = '0'; $_info['info'] = ''; //查處添加時間 $_sql = "SELECT addDates FROM tb_DailyLotteryLog WHERE userid = '{$_clean['userId']}' ORDER BY addDates DESC LIMIT 1"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_html = array(); $_html['addDates'] = _html($_rows['addDates']); $_lastAddDates = $_html['addDates']; if ( date("Y-m-d",strtotime($_now)) == date("Y-m-d",strtotime($_lastAddDates)) ) { $_data['state'] = 0; $_data['info'] = '今日已抽獎!'; } else { $_data['state'] = 1; $_data['info'] = '今日未抽獎!'; $prize_arr = array( '0' => array('id'=>1,'prize'=>'1積分','v'=>90), '1' => array('id'=>2,'prize'=>'10積分','v'=>9), '2' => array('id'=>3,'prize'=>'100積分','v'=>1) ); foreach ($prize_arr as $key => $val){ $arr[$val['id']] = $val['v']; } $rid = getRand($arr); $_data['title'] = $prize_arr[$rid-1]['prize']; //中獎項 mysql_query("BEGIN"); //添加抽獎記錄 $rs1=_query("insert into tb_DailyLotteryLog values (null,'{$_clean['userId']}','$_now','來自Android')"); //給會員添加積分 if($rid==1){ $jf=1; }elseif($rid==2){ $jf=10; }elseif($rid==3){ $jf=100; } $rs2=_query("update tb_user set integral=integral+'$jf' where id='{$_clean['userId']}'"); //添加積分變更(增長)記錄 $rs3=_query("insert into tb_integralRecord values(null,'{$_clean['userId']}','','6','$jf',0,'$_now','來自Android')"); if($rs1&&$rs2){ mysql_query("COMMIT"); $_data["msg"]="success"; }else{ mysql_query("ROLLBACK"); $_data["msg"]="error"; } } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _free_result($_result); _close(); ?>
訂單假刪除 後臺管理能夠看到api
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['orderNumber'] = _check($_POST['orderNumber']); $_info = array(); $_data = array(); //用戶ID 訂單號 if ( $_clean['userId'] > 0 && $_clean['orderNumber'] != '' ) { $_info['state'] = 0; $_info['info'] = ''; //更新訂單表狀態 訂單已經刪除 $_sql = "UPDATE tb_order SET state = 4 WHERE userid = '{$_clean['userId']}' AND orderNumber = '{$_clean['orderNumber']}'"; _query($_sql); // if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '訂單已做廢'; } else { $_data['state'] = 1; $_data['info'] = '訂單做廢失敗!'; } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _close(); ?>
商品信息ide
<?php require dirname(__FILE__) . '/includes/common.inc.php'; $_fruitList = array(); $_data = array(); define('SCRIPT','fruitList'); global $_pagesize,$_pagenum; //ʾҳ $_sql1 = "SELECT id FROM tb_goodsInfo WHERE GoodType = 1 AND state = 0"; _page($_sql1,10); //ͨƷϢ $_sql = "SELECT id,GoodsName,GoodsPic2,marketPrice,memberPrice,weight FROM tb_goodsInfo WHERE GoodType = 1 AND state = 0 ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['id']; $_html['title'] = $_rows['GoodsName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows['GoodsPic2']; $_html['marketPrice'] = $_rows['marketPrice']; $_html['memberPrice'] = $_rows['memberPrice']; $_html['weight'] = $_rows['weight']; $_html = _html($_html); $_data[] = $_html; } $_fruitList['state'] = 0; $_fruitList['info'] = ''; $_fruitList['data'] = $_data; echo _json($_fruitList); _free_result($_result); _close(); ?>
登陸 註冊 提交交易信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userName'] = _check($_POST['userName']); $_clean['userPwd'] = _check($_POST['userPwd']); $_now = date('Y-m-d H:i:s',time()); //若是不等空都正常 不然參數有誤 $_loginInfo = array(); if( $_clean['userName'] != '' && $_clean['userPwd'] != '' ){ $_loginInfo['state'] = 0; $_loginInfo['info'] = ''; }else{ $_loginInfo['state'] = 1; $_loginInfo['info'] = '參數有誤'; } $_data = array(); $_sql = "SELECT id,state,identity FROM tb_user WHERE userName = '{$_clean['userName']}' AND userPwd = '{$_clean['userPwd']}' LIMIT 1"; $_result = _query($_sql); $_rows = _fetch_array($_result); //若是有值成功不然失敗 if(!!$_rows){ $_html = array(); $_html['id'] = $_rows['id']; $_html['state'] = $_rows['state']; $_html['identity'] = $_rows['identity']; //若是等於10 if ( $_html['state'] == 10 ) { $_data['id'] = $_html['id']; $_data['state'] = 10; $_data['info'] = '請提交交易密碼'; }elseif( $_html['state'] == 0 ){ $_data['info'] = '登陸成功'; $_data['state'] = 0; $_data['id'] = $_html['id']; $_data['identity'] = $_html['identity']; } }else{ $_data['state'] = 1; $_data['info'] = '登陸失敗,用戶名或密碼錯誤'; } $_loginInfo['data'] = $_data; echo _json($_loginInfo); _free_result($_result); _close(); ?>
<?php require dirname(__FILE__) . '/includes/common.inc.php'; $_clean = array(); $_clean['userName'] = _check($_POST['userName']); $_clean['userPwd'] = _check($_POST['userPwd']); $_clean['userEmail'] = _check($_POST['userEmail']); $_clean['referees'] = _check($_POST['referees']); $_regInfo = array(); $_data = array(); if ( $_clean['userName'] != '' && $_clean['userPwd'] != '' && $_clean['userEmail'] != '' ) { $_regInfo['state'] = 0; $_regInfo['info'] = ''; $_sql1 = "SELECT userName FROM tb_user WHERE userName = '{$_clean['userName']}' LIMIT 1"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); if( $_rows1 ){ $_data['state'] = 2; $_data['info'] = '對不起,該用戶名已註冊!'; $_regInfo['data'] = $_data; echo _json($_regInfo); die; } $_now = date('y-m-d H:i:s',time()); if ( $_clean['referees'] == '' ) { $_sql = "INSERT INTO tb_user VALUES (null,'$_now','來自Android','{$_clean['userName']}','{$_clean['userEmail']}','{$_clean['userPwd']}','','','','','','','','','','',1000,1000,0,0,10,0,'',3)"; _query($_sql); } elseif ( $_clean['referees'] != '' ) { $_sql = "INSERT INTO tb_user VALUES (null,'$_now','來自Android','{$_clean['userName']}','{$_clean['userEmail']}','{$_clean['userPwd']}','','','','','','','','','','',1000,1000,0,0,10,0,'{$_clean['referees']}',3)"; _query($_sql); $_sql3 = "SELECT id FROM tb_user WHERE userName = '{$_clean['referees']}'"; $_result3 = _query($_sql3); $_rows3 = _fetch_array($_result3); $_sql5 = "UPDATE tb_user SET integral = integral + 2000 WHERE id = '{$_rows3['id']}'"; _query($_sql5); //推薦人易幣增長記錄 $_sql4 = "INSERT INTO tb_integralRecord VALUES (NULL,'{$_rows3['id']}','',4,2000,0,'$_now','來自Android')"; _query($_sql4); } /** * 取影響條數 @return int */ if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '註冊成功'; $_sql2 = "SELECT id FROM tb_user WHERE userName = '{$_clean['userName']}'"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); $_data['id'] = $_rows2['id']; $_sql6 = "INSERT INTO tb_integralRecord VALUES (NULL,'{$_rows2['id']}','',3,2000,0,'$_now','來自Android')"; _query($_sql6); } else { _close(); $_data['state'] = 1; $_data['info'] = '註冊失敗'; } $_regInfo['data'] = $_data; } else { $_regInfo['state'] = 1; $_regInfo['info'] = '參數有誤'; } echo _json($_regInfo); ?>
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['tradingPwd'] = _check($_POST['tradingPwd']); $_clean['encryptedQuestion'] = _check($_POST['encryptedQuestion']); $_clean['encryptedAnswer'] = _check($_POST['encryptedAnswer']); $_submitInfo = array(); //提交交易密碼 $_data = array(); if ( $_clean['userId'] != '' && $_clean['tradingPwd'] != '' && $_clean['encryptedQuestion'] != '' && $_clean['encryptedAnswer'] != '' ) { $_submitInfo['state'] = 0; $_submitInfo['info'] = ''; $_sql = "UPDATE tb_user SET tradingPwd = '{$_clean['tradingPwd']}', encryptedQuestion = '{$_clean['encryptedQuestion']}', encryptedAnswer = '{$_clean['encryptedAnswer']}', state = 0' WHERE id = '{$_clean['userId']}'"; _query($_sql); if ( _affected_rows() == 1 ) { _close(); $_data['state'] = 0; $_data['info'] = '提交成功'; } else { _close(); $_data['state'] = 1; $_data['info'] = '提交失敗'; } } else { $_submitInfo['state'] = 1; $_submitInfo['info'] = '參數有誤'; } $_submitInfo['data'] = $_data; echo _json($_submitInfo); ?>
目錄 類別
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_category = array(); $_data = array(); $_nature = array(); $_html4 = array(); $_html4['id'] = '-1'; $_html4['categoryName'] = '所有種類'; $_html4['categoryId'] = 0; $_nature[] = $_html4; $_sql4 = "SELECT id,categoryName,categoryId FROM tb_category WHERE grade = 5 AND state = 0"; $_result4 = _query($_sql4); while( $_rows4 = _fetch_array($_result4) ){ $_html4['id'] = $_rows4['id']; $_html4['categoryName'] = $_rows4['categoryName']; $_html4['categoryId'] = $_rows4['categoryId']; $_html4 = _html($_html4); $_nature[] = $_html4; } $_data['nature'] = $_nature; $_area = array(); $_html3 = array(); $_html3['id'] = '-1'; $_html3['categoryName'] = '全部區域'; $_html3['categoryId'] = 0; $_area[] = $_html3; $_sql3 = "SELECT id,categoryName,categoryId FROM tb_category WHERE grade = 4 AND state = 0"; $_result3 = _query($_sql3); while( $_rows3 = _fetch_array($_result3) ){ $_html3['id'] = $_rows3['id']; $_html3['categoryName'] = $_rows3['categoryName']; $_html3['categoryId'] = $_rows3['categoryId']; $_html3 = _html($_html3); $_area[] = $_html3; } $_data['area'] = $_area; $_brand = array(); $_html2 = array(); $_html2['id'] = '-1'; $_html2['categoryName'] = '全部品牌'; $_html2['categoryId'] = 0; $_brand[] = $_html2; $_sql2 = "SELECT id,categoryName,categoryId FROM tb_category WHERE grade = 3 AND state = 0"; $_result2 = _query($_sql2); while( $_rows2 = _fetch_array($_result2) ){ $_html2['id'] = $_rows2['id']; $_html2['categoryName'] = $_rows2['categoryName']; $_html2['categoryId'] = $_rows2['categoryId']; $_html2 = _html($_html2); $_brand[] = $_html2; } $_data['brand'] = $_brand; $_category['state'] = 0; $_category['info'] = ''; $_category['data'] = $_data; echo _json($_category); _free_result($_result); _free_result($_result1); _close(); ?>
經過訂單好查詢訂單信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['orderNumber'] = _check($_POST['orderNumber']); $_orderProduct = array(); $_data = array(); //若是訂單號不等空 if ( $_clean['orderNumber'] != '' ) { //用於顯示上面 $_orderProduct['state'] = 0; $_orderProduct['info'] = ''; //查找出訂單i商品ID 和數量 $_sql5 = "SELECT GoodsInfoId,number FROM tb_orderGoods WHERE orderNumber = '{$_clean['orderNumber']}'"; $_result5 = _query($_sql5); while ( $_rows5 = _fetch_array($_result5) ) { $_html5 = array(); $_html5['GoodsInfoId'] = $_rows5['GoodsInfoId']; $_html5['number'] = $_rows5['number']; $_html5 = _html($_html5); $_sql6 = "SELECT GoodsName,GoodsPic2,memberPrice,weight FROM tb_GoodsInfo WHERE id = '{$_html5['GoodsInfoId']}'"; $_result6 = _query($_sql6); $_rows6 = _fetch_array($_result6); $_html6 = array(); $_html6['title'] = $_rows6['GoodsName']; $_html6['pic'] = 'http://www.youpinge.cn/' . $_rows6['GoodsPic2']; $_html6['memberPrice'] = $_rows6['memberPrice']; $_html6['weight'] = $_rows6['weight']; $_html6['number'] = $_rows5['number']; $_html6 = _html($_html6); $_data[] = $_html6; } $_orderProduct['data'] = $_data; } else { $_orderProduct['state'] = 1; $_orderProduct['info'] = '參數有誤!'; } echo _json($_orderProduct); _free_result($_result5); _free_result($_result6); _close(); ?>
經過訂單狀態查詢訂單信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; define('SCRIPT','allOrder'); global $_pagesize,$_pagenum; $_clean = array(); $_clean['userId'] = 146; $_clean['action'] = 2;//0:未付款;1:已付款;2:已做廢 $_orderList = array(); $_data = array(); //有值 if ( $_clean['userId'] != '' && $_clean['action'] >= 0 ) { $_orderList['state'] = 0; $_orderList['info'] = ''; //等於0查處商品信息 if ( $_clean['action'] == 0 ) { $_sql1 = "SELECT id FROM tb_order WHERE userid = '{$_clean['userId']}' AND state = 0"; _page($_sql1,5); $_sql = "SELECT orderNumber,id,addDates,payMoney FROM tb_order WHERE userid = '{$_clean['userId']}' AND state = 0 LIMIT $_pagenum,$_pagesize"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['id']; $_html['addDates'] = $_rows['addDates']; $_html['payMoney'] = $_rows['payMoney']; $_html['orderNumber'] = $_rows['orderNumber']; $_sql2 = "SELECT GoodsInfoId FROM tb_orderGoods WHERE orderNumber = '{$_html['orderNumber']}'"; $_result2 = _query($_sql2); while ($_rows2 = _fetch_array($_result2)){ $_sql3 = "SELECT GoodsPic2 FROM tb_GoodsInfo WHERE id = '{$_rows2['GoodsInfoId']}' LIMIT 1"; $_result3 = _query($_sql3); $_rows3 = _fetch_array($_result3); $_html['pic'] = "http://www.youpinge.cn/" . $_rows3['GoodsPic2']; } $_html = _html($_html); $_data[] = $_html; } //已付款 } elseif ( $_clean['action'] == 1 ) { $_sql1 = "SELECT id FROM tb_order WHERE userid = '{$_clean['userId']}' AND state IN (1,2,3)"; _page($_sql1,5); $_sql = "SELECT orderNumber,id,state,addDates,payMoney FROM tb_order WHERE userid = '{$_clean['userId']}' AND state IN (1,2,3) LIMIT $_pagenum,$_pagesize"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['id']; $_html['state'] = $_rows['state']; $_html['addDates'] = $_rows['addDates']; $_html['payMoney'] = $_rows['payMoney']; $_html['orderNumber'] = $_rows['orderNumber']; $_sql2 = "SELECT GoodsInfoId FROM tb_orderGoods WHERE orderNumber = '{$_html['orderNumber']}' LIMIT 1"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); $_sql3 = "SELECT GoodsPic2 FROM tb_GoodsInfo WHERE id = '{$_rows2['GoodsInfoId']}'"; $_result3 = _query($_sql3); $_rows3 = _fetch_array($_result3); $_html['pic'] = "http://www.youpinge.cn/" . $_rows3['GoodsPic2']; $_html = _html($_html); $_data[] = $_html; } //2:已做廢 } elseif ( $_clean['action'] == 2 ) { $_sql1 = "SELECT id FROM tb_order WHERE userid = '{$_clean['userId']}' AND state IN (4,5)"; _page($_sql1,5); $_sql = "SELECT orderNumber,id,state,addDates,payMoney FROM tb_order WHERE userid = '{$_clean['userId']}' AND state IN (4,5) LIMIT $_pagenum,$_pagesize"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['id']; $_html['state'] = $_rows['state']; $_html['addDates'] = $_rows['addDates']; $_html['payMoney'] = $_rows['payMoney']; $_html['orderNumber'] = $_rows['orderNumber']; $_sql2 = "SELECT GoodsInfoId FROM tb_orderGoods WHERE orderNumber = '{$_html['orderNumber']}' LIMIT 1"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); $_sql3 = "SELECT GoodsPic2 FROM tb_GoodsInfo WHERE id = '{$_rows2['GoodsInfoId']}'"; $_result3 = _query($_sql3); $_rows3 = _fetch_array($_result3); $_html['pic'] = "http://www.youpinge.cn/" . $_rows3['GoodsPic2']; $_html = _html($_html); $_data[] = $_html; } } $_orderList['data'] = $_data; } else { $_orderList['state'] = 1; $_orderList['info'] = '參數有誤!'; } echo _json($_orderList); _free_result($_result); _free_result($_result2); _free_result($_result3); _close(); ?>
搜索
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['content'] = _check($_POST['content']); define('SCRIPT','research'); global $_pagesize,$_pagenum; $_productList = array(); $_data = array(); if ( $_clean['content'] == '' ) { $_productList['state'] = 1; $_productList['info'] = '參數有誤!'; } elseif ( $_clean['content'] != '' ) { $_productList['state'] = 0; $_productList['info'] = ''; //普通商品名 $_sql2 = "SELECT GoodsName FROM tb_GoodsInfo WHERE GoodType = 1 AND state = 0"; $_result2 = _query($_sql2); while($_rows2 = _fetch_array($_result2)){ $_html2 = array(); $_html2['GoodsName'] = _html($_rows2['GoodsName']); //strpos對大小寫敏捷 如需進行對大小寫不敏感的搜索 $_true = strpos($_html2['GoodsName'],$_clean['content']); // 若是 $_true不是布爾類型 if ( !is_bool($_true) ) { $_goodsName = $_html2['GoodsName']; $_sql = "SELECT Id FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 1 AND goodsName = '$_goodsName' ORDER BY Id DESC"; _page($_sql,4); //查處全部信息 $_sql1 = "SELECT Id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 1 AND goodsName = '$_goodsName' ORDER BY Id DESC LIMIT $_pagenum,$_pagesize"; _sprProduct($_sql1); function _sprProduct($_sql1){ // global $_result1,$_rows1,$_html1,$_data; // $_result1 = _query($_sql1); // $_data = array(); // while ( $_rows1 = _fetch_array($_result1) ) { // $_html1 = array(); // $_html1['id'] = $_rows1['Id']; // $_html1['pic'] = 'http://www.youpinge.cn/' . $_rows1['GoodsPic']; // $_html1['title'] = $_rows1['GoodsName']; // $_html1['marketPrice'] = $_rows1['marketPrice']; // $_html1['memberPrice'] = $_rows1['memberPrice']; // $_html1 = _html($_html1); // // $_data[] = $_html1; // } // } // } } $_productList['data'] = $_data; } echo _json($_productList); _free_result($_result1); _free_result($_result2); _close(); ?>
經過商品ID 查找全部評論信息
<?php require dirname(__FILE__) . '/includes/common.inc.php'; $_clean = array(); $_clean['GoodsInfoId'] = _check($_POST['GoodsInfoId']); define('SCRIPT','goodsComments'); global $_pagesize,$_pagenum; //分頁 $_sql1 = "SELECT id FROM tb_GoodsComments WHERE GoodsInfoId = '{$_clean['GoodsInfoId']}' AND state = 0 ORDER BY addDates DESC"; _page($_sql1,10); $_info = array(); $_data = array(); if ( $_clean['GoodsInfoId'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; //查找上海品內容 用戶名 $_sql = "SELECT addDates,userid,postComments FROM tb_GoodsComments WHERE GoodsInfoId = '{$_clean['GoodsInfoId']}' AND state = 0 ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['addDates'] = $_rows['addDates']; $_html['postComments'] = $_rows['postComments']; $_sql2 = "SELECT userName FROM tb_user WHERE id = '{$_rows['userid']}'"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); $_html['userName'] = $_rows2['userName']; $_html = _html($_html); $_data[] = $_html; } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _free_result($_result); _free_result($_result2); _close(); ?>
經過userid查找購物裏面 信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_shoppingCartProductList = array(); $_data = array(); if ( $_clean['userId'] > 0 ) { $_shoppingCartProductList['state'] = 0; $_shoppingCartProductList['info'] = ''; //查找購物車中 數量 商品 ID $_sql = "SELECT GoodsInfoId,number FROM tb_shopCart WHERE userid = '{$_clean['userId']}' AND state = 0"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['GoodsInfoId']; $_html['number'] = $_rows['number']; //查找商品全部信息 $_sql1 = "SELECT GoodsName,GoodsPic2,memberPrice,weight,returnIntegral,preferential,postagePrice FROM tb_GoodsInfo WHERE Id = '{$_html['id']}'"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); $_html['title'] = $_rows1['GoodsName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows1['GoodsPic2']; $_html['memberPrice'] = $_rows1['memberPrice']; $_html['weight'] = $_rows1['weight']; $_html['totalMoney'] = $_html['memberPrice'] * $_html['number']; $_html['returnIntegral'] = $_rows1['returnIntegral'] * $_html['number']; $_html['preferential'] = $_rows1['preferential'] * $_html['number']; $_html = _html($_html); $_data[] = $_html; } //顯示出來的 $_shoppingCartProductList['data'] = $_data; } else { $_shoppingCartProductList['state'] = 1; $_shoppingCartProductList['info'] = '參數有誤!'; } echo _json($_shoppingCartProductList); _free_result($_result); _free_result($_result1); _close(); ?>
根據傳過來的大小 顯示頁面信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; //用POST GET 判斷接受參數 $_clean = array(); $_clean['GoodsInfoId1'] = _check($_POST['GoodsInfoId']); $_clean['screenWidth1'] = _check($_POST['screenWidth']); $_clean['GoodsInfoId2'] = _check($_GET['GoodsInfoId']); $_clean['screenWidth2'] = _check($_GET['screenWidth']); $_data = array(); if ( $_clean['GoodsInfoId1'] != '' && $_clean['screenWidth1'] != '' && $_clean['GoodsInfoId2'] == '' && $_clean['screenWidth2'] == '' ) { $_clean['GoodsInfoId'] = $_clean['GoodsInfoId1']; $_clean['screenWidth'] = $_clean['screenWidth1']; } elseif ( $_clean['GoodsInfoId1'] == '' && $_clean['screenWidth1'] == '' && $_clean['GoodsInfoId2'] != '' && $_clean['screenWidth2'] != '' ) { $_clean['GoodsInfoId'] = $_clean['GoodsInfoId2']; $_clean['screenWidth'] = $_clean['screenWidth2']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div style="width:<?php echo $_clean['screenWidth'] ?>px"> <?php $_sql = "SELECT describeGoods,introduceGoods FROM tb_GoodsInfo WHERE id = '{$_clean['GoodsInfoId']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data = array(); $_data['describeGoods'] = $_rows['describeGoods']; $_data['introduceGoods'] = $_rows['introduceGoods']; echo $_data['describeGoods'].$_data['introduceGoods']; _free_result($_result); _close(); ?> </div> </body> </html>
充現金
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userId'] = 146; $_clean['cash'] = 2; $_now = date('Y-m-d H:i:s',time()); $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 && $_clean['cash'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; $year_code = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); $_data['orderNumber'] = $year_code[intval(date('Y'))-2014].strtoupper(dechex(date('m'))).date('d').substr(time(),-5).substr(microtime(),2,5).sprintf('d',rand(0,99));//生成訂單號 $_sql = "INSERT INTO tb_cashRecord VALUES (NULL,'{$_clean['userId']}',2,'{$_data['orderNumber']}','{$_clean['cash']}',0,'$_now','來自Android',0)"; _query($_sql); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '充值訂單提交成功'; } else { $_data['state'] = 0; $_data['info'] = '充值訂單提交失敗'; } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _close(); ?>
(0:熱賣;1:特價;2:推薦;3:最新)查詢詳細信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; define('SCRIPT','wholesaleBusinesses'); global $_pagesize,$_pagenum; $_productList = array(); // $_clean = array(); $_clean['sort'] = 3;//(0:熱賣;1:特價;2:推薦;3:最新) $_clean['distributionArea'] = 1; $_productList['info'] = ''; $_productList['state'] = 0; //若是大類不等於空 if( $_clean['bigClassId'] != '' ){ //若是sort等於空 批發商品 if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); //查出圖片 價格 $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //等於熱賣 }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //特價 }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //推薦 }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //最新 }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } }else{//sort等於空 if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } } $_productList['data'] = $_data; echo _json($_productList); _close(); ?>
<?php require dirname(__FILE__).'/includes/common.inc.php'; define('SCRIPT','enterprisePurchase'); global $_pagesize,$_pagenum; $_productList = array(); $_clean = array(); $_clean['sort'] = _check($_POST['sort']);//(0:熱賣;1:特價;2:推薦;3:最新) $_clean['distributionArea'] = _check($_POST['distributionArea']); $_productList['info'] = ''; $_productList['state'] = 0; if( $_clean['bigClassId'] != '' ){ if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } }else{ if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 3 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } } $_productList['data'] = $_data; echo _json($_productList); _close(); ?>
<?php require dirname(__FILE__).'/includes/common.inc.php'; define('SCRIPT','jifenChoose'); global $_pagesize,$_pagenum; $_productList = array(); $_clean = array(); $_clean['sort'] = _check($_POST['sort']);//(0:熱賣;1:特價;2:推薦;3:最新) $_clean['distributionArea'] = _check($_POST['distributionArea']); $_productList['info'] = ''; $_productList['state'] = 0; if ( $_clean['distributionArea'] != '' ) { $_distributionArea = "AND distributionArea = '{$_clean['distributionArea']}'"; } if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 2 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } $_productList['data'] = $_data; echo _json($_productList); _close(); ?>
<?php require dirname(__FILE__).'/includes/common.inc.php'; define('SCRIPT','wholesaleBusinesses'); global $_pagesize,$_pagenum; $_productList = array(); // $_clean = array(); $_clean['sort'] = _check($_POST['sort']);//(0:熱賣;1:特價;2:推薦;3:最新) $_clean['distributionArea'] = _check($_POST['distributionArea']); $_productList['info'] = ''; $_productList['state'] = 0; //若是大類不等於空 if( $_clean['bigClassId'] != '' ){ //若是sort等於空 批發商品 if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); //查出圖片 價格 $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //等於熱賣 }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //特價 }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //推薦 }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); //最新 }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND bigClassId = '{$_clean['bigClassId']}' AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } }else{//sort等於空 if( $_clean['sort'] == '' ){ $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 0 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND selling = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 1 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND specialOffer = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 2 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND recommendedGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); }elseif ( $_clean['sort'] == 3 ) { $_sql1 = "SELECT id FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC"; _page($_sql1,5); $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice FROM tb_GoodsInfo WHERE state = 0 AND newGoods = 1 AND GoodType = 4 AND distributionArea = '{$_clean['distributionArea']}' ORDER BY addDates DESC LIMIT $_pagenum,$_pagesize"; _productList($_sql); } } $_productList['data'] = $_data; echo _json($_productList); _close(); ?>
經過查找訂單 郵費 價格等
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['orderNumber'] = _check($_POST['orderNumber']); $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 && $_clean['orderNumber'] != '' ) { $_info['state'] = 0; $_info['info'] = ''; ///查找訂單所需信息 $_sql = "SELECT payMoney,payment,distribution,addDates,payIntegral,theGoodsName,theGoodsAddress,theGoodsCode,theGoodsPhone FROM tb_order WHERE userid = '{$_clean['userId']}' AND orderNumber = '{$_clean['orderNumber']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data['payMoney'] = $_rows['payMoney']; $_data['addDates'] = $_rows['addDates']; $_data['theGoodsName'] = $_rows['theGoodsName']; $_data['theGoodsAddress'] = $_rows['theGoodsAddress']; $_data['theGoodsCode'] = $_rows['theGoodsCode']; $_data['theGoodsPhone'] = $_rows['theGoodsPhone']; $_data['payIntegral'] = $_rows['payIntegral']; switch ( $_rows['distribution'] ) { case 1: $_data['distribution'] = '快遞配送'; break; case 2: $_data['distribution'] = '門店自提'; break; } switch ( $_rows['payment'] ) { case 0: $_data['payment'] = '未支付'; break; case 1: $_data['payment'] = '優品閣帳號'; break; case 4: $_data['payment'] = '支付寶支付'; break; } //查找會員價 郵費 數字 $_sql1 = "SELECT memberPrice,postagePrice,number FROM tb_orderGoods WHERE orderNumber = '{$_clean['orderNumber']}'"; $_result1 = _query($_sql1); while ( $_rows1 = _fetch_array($_result1) ) { $_html1 = array(); $_html1['memberPrice'] = $_rows1['memberPrice']; $_html1['postagePrice'] = $_rows1['postagePrice']; $_html1['number'] = $_rows1['number']; $_data['memberPrice'] += $_html1['memberPrice'] * $_html1['number']; if ( $_html1['postagePrice'] == 0 ) { $_data['postagePrice'] = 0.00; } else { $_data['postagePrice'] += $_html1['postagePrice'] * $_html1['number']; } } $_data = _html($_data); $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _free_result($_result); _free_result($_result1); _close(); ?>
查找收藏夾
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['GoodsInfoId'] = _check($_POST['GoodsInfoId']); $_productDetail = array(); if ( $_clean['GoodsInfoId'] != '' ) { $_productDetail['info'] = ''; $_productDetail['state'] = 0; //查出商品信息 $_sql = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice,returnIntegral,postagePrice,brand,distributionArea,articleNumber,weight,viewed FROM tb_GoodsInfo WHERE id = '{$_clean['GoodsInfoId']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data = array(); $_data['id'] = $_rows['id']; $_data['title'] = $_rows['GoodsName']; $_data['pic'] = 'http://www.youpinge.cn/' . $_rows['GoodsPic']; $_data['marketPrice'] = $_rows['marketPrice']; $_data['memberPrice'] = $_rows['memberPrice']; $_data['returnIntegral'] = $_rows['returnIntegral']; $_data['postagePrice'] = $_rows['postagePrice']; $_data['brand'] = $_rows['brand']; $_data['distributionArea'] = $_rows['distributionArea']; $_data['productEfficacy'] = $_rows['productEfficacy']; $_data['shelfLife'] = $_rows['shelfLife']; $_data['storages'] = $_rows['storages']; $_data['articleNumber'] = $_rows['articleNumber']; $_data['weight'] = $_rows['weight']; $_data['viewed'] = $_rows['viewed']; $_data = _html($_data); $_sql1 = "SELECT * FROM tb_productcollection WHERE productId = '{$_clean['GoodsInfoId']}' AND state = 0"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); if ( !!$_rows1 ) { $_data['state'] = 0; $_data['info'] = '已收藏'; } else { $_data['state'] = 1; $_data['info'] = '未收藏'; } $_productDetail['data'] = $_data; }else{ $_productDetail['info'] = '參數有誤'; $_productDetail['state'] = 1; } echo _json($_productDetail); _free_result($_result); _free_result($_result1); _close(); ?>
添加購物車 查處數量 和商品所有信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['GoodsInfoId'] = _check($_POST['GoodsInfoId']); $_clean['number'] = _check($_POST['number']); $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 && $_clean['GoodsInfoId'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; //查找數量 $_sql = "SELECT number FROM tb_shopCart WHERE GoodsInfoId = '{$_clean['GoodsInfoId']}' AND userid = '{$_clean['userId']}' AND state = 0"; $_result = _query($_sql); $_rows = _fetch_array($_result); //若是數量等於0 if ( $_rows['number'] == 0 ) { //若是傳過來的數量有值 插入數據 if ( $_clean['number'] > 0 ) { $_sql1 = "INSERT INTO tb_shopCart VALUES (NULL,'{$_clean['userId']}','{$_clean['GoodsInfoId']}','{$_clean['number']}',0)"; _query($_sql1); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '添加購物車成功!'; } else { $_data['state'] = 1; $_data['info'] = '添加購物車失敗!'; } } //不然購物車原本有商品 穿過的等於有值插入購物車 } elseif ( $_rows['number'] > 0 ) { if ( $_clean['number'] > 0 ) { $_sql2 = "UPDATE tb_shopCart SET number = '{$_clean['number']}' WHERE GoodsInfoId = '{$_clean['GoodsInfoId']}' AND userid = '{$_clean['userId']}' AND state = 0"; $_result2 = _query($_sql2); if ( !!$_result2 ) { $_data['state'] = 0; $_data['info'] = '修改購物車成功!'; } else { $_data['state'] = 1; $_data['info'] = '修改購物車失敗!'; } //若是傳過來的沒有值 而後刪除購物車 } elseif ( $_clean['number'] == 0 ) { $_sql3 = "DELETE FROM tb_shopCart WHERE GoodsInfoId = '{$_clean['GoodsInfoId']}' AND userid = '{$_clean['userId']}' AND state = 0"; _query($_sql3); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '刪除成功!'; } else { $_data['state'] = 1; $_data['info'] = '刪除失敗!'; } } } // //查找購物車數量 $_sql2 = "SELECT number FROM tb_shopCart WHERE userid = '{$_clean['userId']}' AND GoodsInfoId = '{$_clean['GoodsInfoId']}' AND state = 0"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); $_html = array(); $_html['number'] = $_rows2['number']; // $_sql1 = "SELECT GoodsName,GoodsPic2,memberPrice,weight,returnIntegral,preferential,postagePrice FROM tb_GoodsInfo WHERE Id = '{$_clean['GoodsInfoId']}'"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); $_html['title'] = $_rows1['GoodsName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows1['GoodsPic2']; $_html['memberPrice'] = $_rows1['memberPrice']; $_html['weight'] = $_rows1['weight']; $_html['totalMoney'] = $_rows1['memberPrice'] * $_html['number']; $_html['returnIntegral'] = $_rows1['returnIntegral'] * $_html['number']; $_html['preferential'] = $_rows1['preferential'] * $_html['number']; $_html = _html($_html); $_data['totalMoney'] = $_html['totalMoney']; $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _free_result($_result); _free_result($_result1); _close(); ?>
經過id 超找購物車 數量 商品id 和信息 和剩餘易幣 查處算出來的信息
<?php require dirname(__FILE__).'/includes/common.inc.php'; //總價格 $_clean = array(); $_clean['userId'] = 11; $_shoppingCartProductList = array(); $_data = array(); if ( $_clean['userId'] > 0 ) { $_shoppingCartProductList['state'] = 0; $_shoppingCartProductList['info'] = ''; //積分 $_sql2 = "SELECT integral FROM tb_user WHERE id = '{$_clean['userId']}'"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); $_data['integral'] = $_rows2['integral']; //購物車 數量 商品id $_sql = "SELECT GoodsInfoId,number FROM tb_shopCart WHERE userid = '{$_clean['userId']}' AND state = 0"; $_result = _query($_sql); while ( !!$_rows = _fetch_array($_result) ) { $_html = array(); $_html['id'] = $_rows['GoodsInfoId']; $_html['number'] = $_rows['number']; //查出商品信息 $_sql1 = "SELECT GoodsName,GoodsPic2,memberPrice,weight,returnIntegral,preferential,postagePrice FROM tb_GoodsInfo WHERE Id = '{$_html['id']}'"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); $_html['title'] = $_rows1['GoodsName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows1['GoodsPic2']; $_html['memberPrice'] = $_rows1['memberPrice']; $_html['weight'] = $_rows1['weight']; $_html['totalMoney'] = $_rows1['memberPrice'] * $_html['number']; $_html['returnIntegral'] = $_rows1['returnIntegral'] * $_html['number']; $_html['preferential'] = $_rows1['preferential'] * $_html['number']; $_html['postagePrice'] = $_rows1['postagePrice'] * $_html['number']; $_html = _html($_html); //取得行的數目 $_row = _num_rows($_result); // if ( $_row > 0 ) { $_data['totalMoney'] += $_html['memberPrice'] * $_html['number']; $_data['returnIntegral'] += $_html['returnIntegral'] * $_html['number']; $_data['preferential'] += $_html['preferential'] * $_html['number']; $_data['postagePrice'] += $_html['postagePrice'] * $_html['number']; } else { $_data['totalMoney'] = 0.00; } } $_shoppingCartProductList['data'] = $_data; } else { $_shoppingCartProductList['state'] = 1; $_shoppingCartProductList['info'] = '參數有誤!'; } echo _json($_shoppingCartProductList); _free_result($_result); _free_result($_result1); _close(); ?>
點就賺判斷是否已經驗證
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['id'] = _check($_POST['id']); $_now = date('Y-m-d H:i:s',time()); $_info = array(); $_data = array(); if ( $_clean['id'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; //查處全部信息 $_sql = "SELECT merchantName,merchantPic,serviceTelephone,businessAddress,preferentialInfo,startDate,endDate,brandService,perCapita,merchantIntroduce,preferentialConditions,parkingEnvironment,theBusGuide,totalReward,oneReward,productUrl FROM tb_point WHERE id = '{$_clean['id']}' AND State = 1"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data['title'] = $_rows['merchantName']; $_data['pic'] = "http://www.youpinge.cn/" . $_rows['merchantPic']; $_data['serviceTelephone'] = $_rows['serviceTelephone']; $_data['businessAddress'] = $_rows['businessAddress']; $_data['preferentialInfo'] = $_rows['preferentialInfo']; $_data['startDate'] = $_rows['startDate']; $_data['endDate'] = $_rows['endDate']; $_data['brandService'] = $_rows['brandService']; $_data['perCapita'] = $_rows['perCapita']; $_data['merchantIntroduce'] = $_rows['merchantIntroduce']; $_data['preferentialConditions'] = $_rows['preferentialConditions']; $_data['parkingEnvironment'] = $_rows['parkingEnvironment']; $_data['theBusGuide'] = $_rows['theBusGuide']; $_data['totalReward'] = $_rows['totalReward']; $_data['oneReward'] = $_rows['oneReward']; $_data['productUrl'] = $_rows['productUrl']; $_data = _html($_data); if ( $_clean['userId'] > 0 ) { //查出時間 若是參與過跟今天的時間同樣就說明已驗證 $_sql5 = "SELECT addDates FROM tb_pointLog WHERE pointId = '{$_clean['id']}' AND userid = '{$_clean['userId']}' ORDER BY addDates DESC LIMIT 1"; $_result5 = _query($_sql5); $_rows5 = _fetch_array($_result5); $_html5 = array(); $_html5['addDates'] = _html($_rows5['addDates']); $_lastAddDates = $_html5['addDates']; if( date("Y-m-d",strtotime($_now)) == date("Y-m-d",strtotime($_lastAddDates)) ){ $_data['state'] = 0; $_data['info'] = '今日已驗證!'; }else{ $_data['state'] = 1; $_data['info'] = '今日未驗證!'; } // } elseif ( $_clean['userId'] == '' ) { $_data['state'] = 1; $_data['info'] = '今日未驗證!'; } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤'; } echo _json($_info); _free_result($_result); _close(); ?>
點就賺列表
<?php require dirname(__FILE__).'/../includes/common.inc.php'; define('SCRIPT','djz/List'); global $_pagesize,$_pagenum; $_clean = array(); $_clean['cityId'] = _check($_POST['cityId']); $_clean['countyId'] = _check($_POST['countyId']); $_clean['regionId'] = _check($_POST['regionId']); $_clean['infoId'] = _check($_POST['infoId']); $_clean['page'] = _check($_POST['page']); $_clean['preferentialTerms'] = _check($_POST['preferentialTerms']); if ( $_clean['countyId'] != '' ) { $_countyId = "AND countyId = '{$_clean['countyId']}'"; } // if ( $_clean['regionId'] != '' ) { $_regionId = "AND regionId = '{$_clean['regionId']}'"; } //Ϣ if ( $_clean['infoId'] != '' ) { $_infoId = "AND infoId = '{$_clean['infoId']}'"; } //Ż if ( $_clean['preferentialTerms'] != '' ) { $_preferentialTerms = "AND preferentialTerms = '{$_clean['preferentialTerms']}'"; } $_list = array(); $_data = array(); $_list['state'] = 0; $_list['info'] = ''; $_sql = "SELECT id FROM tb_point WHERE cityId = '{$_clean['cityId']}' AND State = 1 {$_countyId} {$_regionId} {$_infoId} {$_preferentialTerms}"; _page($_sql,5); //ȡϢ $_sql1 = "SELECT id,merchantName,merchantPic,businessAddress,merchantIntroduce,totalReward,oneReward FROM tb_point WHERE cityId = '{$_clean['cityId']}' AND State = 1 {$_countyId} {$_regionId} {$_infoId} {$_preferentialTerms} LIMIT $_pagenum,$_pagesize"; $_result1 = _query($_sql1); while ( $_rows1 = _fetch_array($_result1) ) { $_html = array(); $_html['id'] = $_rows1['id']; $_html['title'] = $_rows1['merchantName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows1['merchantPic']; $_html['businessAddress'] = $_rows1['businessAddress']; $_html['merchantIntroduce'] = $_rows1['merchantIntroduce']; $_html['totalReward'] = $_rows1['totalReward']; $_html['oneReward'] = $_rows1['oneReward']; $_html = _html($_html); $_data[] = $_html; } $_list['data'] = $_data; echo _json($_list); _free_result($_result1); _close(); ?>
四個字驗證今天是否驗證
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['id'] = _check($_POST['id']); $_clean['userId'] = _check($_POST['userId']); $_clean['title'] = _check($_POST['title']); $_now = date('Y-m-d H:i:s',time()); $_check = array(); $_data = array(); if ( $_clean['id'] != '' && $_clean['userId'] != '' && $_clean['title'] != '' ) { $_check['state'] = 0; $_check['info'] = ''; $_sql = "SELECT merchantName,totalReward,oneReward FROM tb_point WHERE id = '{$_clean['id']}' AND state = 1"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_html = array(); $_html['title'] = $_rows['merchantName']; $_html['totalReward'] = $_rows['totalReward']; $_html['oneReward'] = $_rows['oneReward']; $_html = _html($_html); $_title = _utfSubstr($_html['title'],0,4,1); if( $_clean['title'] != '' ){ $_sqll = "SELECT addDates FROM tb_pointLog WHERE pointId = '{$_clean['id']}' AND userid = '{$_clean['userId']}' ORDER BY addDates DESC LIMIT 1"; $_resultt = _query($_sqll); $_rowss = _fetch_array($_resultt); $_htmll = array(); $_htmll['addDates'] = _html($_rowss['addDates']); $_lastAddDates = $_htmll['addDates']; if ( date("Y-m-d",strtotime($_now)) == date("Y-m-d",strtotime($_lastAddDates)) ) { $_data['state'] = 1; $_data['info'] = '今日已驗證!'; $_check['data'] = $_data; echo _json($_check); die; } else { if ( $_title == $_clean['title'] ) { $_data['state'] = 0; $_data['info'] = '驗證成功!'; $_sql2 = "INSERT INTO tb_pointLog VALUES (NULL,'{$_clean['userId']}','{$_clean['id']}','$_now','來自Android')"; _query($_sql2); $_sql1 = "SELECT integral FROM tb_user WHERE id = '{$_clean['userId']}'"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); $_html1 = array(); $_html1['integral'] = _html($_rows1['integral']); if ( $_html['totalReward'] >= $_html['oneReward'] ) { $_data['totalReward'] = $_html['totalReward'] - $_html['oneReward']; $_data['oneReward'] = $_html['oneReward']; $_sql3 = "UPDATE tb_point SET totalReward = '{$_data['totalReward']}' WHERE id = '{$_clean['id']}' AND state = 1"; _query($_sql3); $_data['integral'] = $_html1['integral'] + $_html['oneReward']; $_sql4 = "UPDATE tb_user SET integral = '{$_data['integral']}' WHERE id = '{$_clean['userId']}'"; _query($_sql4); $_sql5 = "INSERT INTO tb_cashAndebLog VALUES (null,'{$_clean['userId']}','',7,'{$_html['oneReward']}',0,'$_now','來自Android')"; _query($_sql5); } else { $_data['totalReward'] = $_html['totalReward']; $_data['integral'] = $_html1['integral']; } } else { $_data['state'] = 2; $_data['info'] = '驗證失敗!'; $_check['data'] = $_data; echo _json($_check); die; } } } $_check['data'] = $_data; } else { $_check['state'] = 1; $_check['info'] = '參數有誤!'; } echo _json($_check); _free_result($_result); _free_result($_result1); _free_result($_result4); _free_result($_result5); _close(); ?>
搶特惠
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['productId'] = _check($_POST['productId']); // $_clean['userId'] = 1; // $_clean['productId'] = 66; $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 && $_clean['productId'] > 0 ) { date_default_timezone_set('PRC'); $_now = date('H:i:s',time()); $_info['state'] = 0; $_info['info'] = ''; $_sql1 = "select id from tb_order where userid='{$_clean['userId']}' and state in (0,1,2,3) and orderNumber in (select orderNumber from tb_orderGoods where GoodsInfoId='{$_clean['productId']}')"; $_result1 = _query($_sql1); $count = mysql_num_rows($_result1); _free_result($_result1); if ( $count>0 ) { $_data['state'] = 2; $_data['info'] = '您已搶過該商品!'; $_info['data'] = $_data; echo _json($_info); die(); }else{ if ( $_now >= '12:00:00' && $_now < '14:00:00' ) { //判斷狀態 $_sql2 = "select numberOf,memberPrice from tb_GoodsInfo where GoodType=2 and state=0 and id='{$_clean['productId']}'"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); _free_result($_result2); $_html2 = array(); $_html2['memberPrice'] = $_rows2['memberPrice']; $_html2['numberOf'] = $_rows2['numberOf']; $_html2 = _html($_html2); if ($_html2['numberOf']>0){ mysql_query("BEGIN");//開啓一個事物 $flag=0; //獲取訂單號 $orderNumber=getOrderNumber(); //添加訂單 $_sql4 = "insert into tb_order values(null,now(),'$orderNumber','{$_clean['userId']}',null,null,null,null,null,0,0,'{$_html2['memberPrice']}',0,0,'每日秒殺訂單')"; _query($_sql4); //添加訂單商品 $_sql5 = "insert into tb_orderGoods values(null,now(),'$orderNumber','{$_clean['productId']}','{$_html2['memberPrice']}',0,0,0,1)"; // mysql_query($_sql5); $flag=1; if($flag==1){ mysql_query("COMMIT"); //非autocommit模式,必須手動執行COMMIT使操做生效 $_data['state'] = 0; $_data['info'] = '搶特惠成功!'; $_data["orderNumber"]=$orderNumber; $_info['data'] = $_data; echo _json($_info); die; }else{ mysql_query("ROLLBACK"); //非autocommit模式,執行ROLLBACK使事務操做無效 $_data['state'] = 1; $_data['info'] = '搶特惠失敗!'; $_info['data'] = $_data; echo _json($_info); die; } }else{ $_info['info'] = '本商品已售完'; $_info['data'] = $_data; echo _json($_info); die(); } }elseif ( $_now < '12:00:00' ) { $_data['info'] = '等待中!'; $_info['data'] = $_data; echo _json($_info); die; } elseif ( $_now >= '14:00:00' ) { $_data['info'] = '今日已結束!'; $_info['data'] = $_data; echo _json($_info); die; } } }else{ $_info['info'] = '參與錯誤'; $_info['data'] = $_data; echo _json($_info); } _close(); ?>
列表顯示 時間段
<?php require dirname(__FILE__).'/../includes/common.inc.php'; define('SCRIPT','qth/productList'); global $_pagesize,$_pagenum; $_clean = array(); $_clean['distributionArea'] = _check($_POST['distributionArea']); $_now = date('H:i:s',time()); $_list = array(); $_data = array(); if ( $_clean['distributionArea'] > 0 ) { $_list['state'] = 0; $_list['info'] = ''; $_sql = "SELECT id FROM tb_GoodsInfo WHERE GoodType = 2 AND state = 0"; _page($_sql,5); $_sql1 = "SELECT id,GoodsName,GoodsPic2,memberPrice,marketPrice,weight FROM tb_GoodsInfo WHERE GoodType = 2 AND state = 0 AND distributionArea = '{$_clean['distributionArea']}' LIMIT $_pagenum,$_pagesize"; $_result1 = _query($_sql1); while ( $_rows1 = _fetch_array($_result1) ) { $_html = array(); $_html['id'] = $_rows1['id']; $_html['title'] = $_rows1['GoodsName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows1['GoodsPic2']; $_html['memberPrice'] = $_rows1['memberPrice']; $_html['marketPrice'] = $_rows1['marketPrice']; $_html['discount'] = $_html['memberPrice'] / $_html['marketPrice'] * 10; $_html['discount'] = number_format($_html['discount'],1, '.', '') . '折'; $_html['disprice'] = $_html['marketPrice'] - $_html['memberPrice']; $_html['weight'] = $_rows1['weight']; if ( $_now >= '10:00:00' && $_now < '12:00:00' ) { $_html['info'] = "正在瘋搶"; } elseif ( $_now < '10:00:00' ) { $_html['info'] = "等待中"; } elseif ( $_now >= '12:00:00' ) { $_html['info'] = "今日已結束"; } $_html = _html($_html); $_data[] = $_html; } $_list['data'] = $_data; } else { $_list['state'] = 1; $_list['info'] = '參數有誤'; } echo _json($_list); _free_result($_result1); _close(); ?>
秒殺跟上面同樣 列表
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['productId'] = _check($_POST['productId']); $_clean['userId'] =1; $_clean['productId'] = 65; $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 && $_clean['productId'] > 0 ) { date_default_timezone_set('PRC'); $_now = date('H:i:s',time()); $_info['state'] = 0; $_info['info'] = ''; $_sql1 = "select id from tb_order where userid='{$_clean['userId']}' and state in (0,1,2,3) and orderNumber in (select orderNumber from tb_orderGoods where GoodsInfoId='{$_clean['productId']}')"; $_result1 = _query($_sql1); $count = mysql_num_rows($_result1); _free_result($_result1); if ( $count>0 ) { $_data['state'] = 2; $_data['info'] = '您已秒殺該商品!'; $_info['data'] = $_data; echo _json($_info); die(); }else{ if ( $_now >= '12:00:00' && $_now < '20:00:00' ) { //判斷狀態和庫存 $_sql2 = "select numberOf,memberPrice from tb_GoodsInfo where GoodType=5 and state=0 and id='{$_clean['productId']}'"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); _free_result($_result2); $_html2 = array(); $_html2['numberOf'] = $_rows2['numberOf']; $_html2['memberPrice'] = $_rows2['memberPrice']; $_html2 = _html($_html2); if ($_html2['numberOf']>0){ mysql_query("BEGIN"); $flag=0; //扣除庫存 $_sql3 = " update tb_GoodsInfo set numberOf=numberOf-1 where id='{$_clean['productId']}'"; _query($_sql3); //獲取訂單號 $orderNumber=getOrderNumber(); //添加訂單 $_sql4 = "insert into tb_order values(null,now(),'$orderNumber','{$_clean['userId']}',null,null,null,null,null,0,0,'{$_html2['memberPrice']}',0,0,'每日秒殺訂單')"; _query($_sql4); //添加訂單商品 $_sql5 = "insert into tb_orderGoods values(null,now(),'$orderNumber','{$_clean['productId']}','{$_html2['memberPrice']}',0,0,0,1)"; mysql_query($_sql5); $flag=1; if($flag==1){ mysql_query("COMMIT"); $_data['state'] = 0; $_data['info'] = '秒殺成功!'; $_data["orderNumber"]=$orderNumber; $_info['data'] = $_data; echo _json($_info); die; }else{ mysql_query("ROLLBACK"); $_data['state'] = 1; $_data['info'] = '秒殺失敗!'; $_info['data'] = $_data; echo _json($_info); die; } }else{ $_info['info'] = '本商品已售完'; $_info['data'] = $_data; echo _json($_info); die(); } }elseif ( $_now < '12:00:00' ) { $_data['info'] = '等待中!'; $_info['data'] = $_data; echo _json($_info); die; } elseif ( $_now >= '20:00:00' ) { $_data['info'] = '今日已結束!'; $_info['data'] = $_data; echo _json($_info); die; } } }else{ $_info['info'] = '參與錯誤'; $_info['data'] = $_data; echo _json($_info); } _close(); ?>
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['distributionArea'] = _check($_POST['distributionArea']); $_now = date('H:i:s',time()); $_list = array(); $_data = array(); if ( $_clean['distributionArea'] > 0 ) { $_list['state'] = 0; $_list['info'] = ''; $_sql = "SELECT id,GoodsName,GoodsPic2,memberPrice,marketPrice,weight,numberOf FROM tb_GoodsInfo WHERE GoodType = 5 AND state = 0 AND distributionArea = '{$_clean['distributionArea']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data['id'] = $_rows['id']; $_data['title'] = $_rows['GoodsName']; $_data['pic'] = "http://www.youpinge.cn/" . $_rows['GoodsPic2']; $_data['memberPrice'] = $_rows['memberPrice']; $_data['marketPrice'] = $_rows['marketPrice']; $_data['weight'] = $_rows['weight']; $_data['discount'] = $_data['memberPrice'] / $_data['marketPrice'] * 10; $_data['discount'] = number_format($_data['discount'],1, '.', '') . '折'; $_data['disprice'] = $_data['marketPrice'] - $_data['memberPrice']; $_data['numberOf'] = $_rows['numberOf']; if ( $_now >= '12:00:00' && $_now < '20:00:00' ) { $_data['info'] = "正在秒殺"; } elseif ( $_now < '12:00:00' ) { $_data['info'] = "等待中"; } elseif ( $_now >= '20:00:00' ) { $_data['info'] = "今日已結束"; } $_list['data'] = $_data; } else { $_list['state'] = 1; $_list['info'] = '參數有誤'; } echo _json($_list); _free_result($_result); _close(); ?>
商品信息
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['distributionArea'] = _check($_POST['distributionArea']); $_now = date('H:i:s',time()); $_list = array(); $_data = array(); if ( $_clean['distributionArea'] > 0 ) { $_list['state'] = 0; $_list['info'] = ''; $_sql = "SELECT id,GoodsName,GoodsPic2,memberPrice FROM tb_GoodsInfo WHERE GoodType = 6 AND state = 0 AND distributionArea = '{$_clean['distributionArea']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data['id'] = $_rows['id']; $_data['title'] = $_rows['GoodsName']; $_data['memberPrice'] = $_rows['memberPrice']; $_data['pic'] = "http://www.youpinge.cn/" . $_rows['GoodsPic2']; $_list['data'] = $_data; } else { $_list['state'] = 1; $_list['info'] = '參數有誤'; } echo _json($_list); _free_result($_result); _free_result($_result1); _close(); ?>
用戶信息修改
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['realName'] = _check($_POST['realName']); $_clean['province'] = _check($_POST['province']); $_clean['theCity'] = _check($_POST['theCity']); $_clean['county'] = _check($_POST['county']); $_clean['address'] = _check($_POST['address']); $_clean['phone'] = _check($_POST['phone']); $_userInfo = array(); $_data = array(); if( $_clean['userId'] != '' && ($_clean['realName'] != '' || $_clean['province'] > 0 || $_clean['theCity'] > 0 || $_clean['county'] > 0 || $_clean['address'] != '' || $_clean['phone'] != '') ){ $_userInfo['info'] = ''; $_userInfo['state'] = 0; $_sql = "UPDATE tb_user SET realName = '{$_clean['realName']}', province = '{$_clean['province']}', theCity = '{$_clean['theCity']}', county = '{$_clean['county']}', address = '{$_clean['address']}', phone = '{$_clean['phone']}' WHERE id = '{$_clean['userId']}'"; $_result = _query($_sql); if( !!$_result ){ $_data['state'] = 0; $_data['info'] = '修改爲功'; }else{ $_data['state'] = 1; $_data['info'] = '修改失敗'; } $_userInfo['data'] = $_data; }else{ $_userInfo['info'] = '參數有誤'; $_userInfo['state'] = 1; } echo _json($_userInfo); _free_result($_result); _close(); ?>
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['realName'] = _check($_POST['realName']); $_clean['userEmail'] = _check($_POST['userEmail']); $_clean['province'] = _check($_POST['province']); $_clean['theCity'] = _check($_POST['theCity']); $_clean['county'] = _check($_POST['county']); $_clean['address'] = _check($_POST['address']); $_clean['qq'] = _check($_POST['qq']); $_clean['phone'] = _check($_POST['phone']); $_userInfo = array(); $_data = array(); if( $_clean['userId'] != '' && ($_clean['realName'] != '' || $_clean['userEmail'] != '' || $_clean['province'] > 0 || $_clean['theCity'] > 0 || $_clean['county'] > 0 || $_clean['address'] != '' || $_clean['qq'] != '' || $_clean['phone'] != '') ){ $_userInfo['info'] = ''; $_userInfo['state'] = 0; $_sql = "UPDATE tb_user SET realName = '{$_clean['realName']}', userEmail = '{$_clean['userEmail']}', province = '{$_clean['province']}', theCity = '{$_clean['theCity']}', county = '{$_clean['county']}', address = '{$_clean['address']}', qq = '{$_clean['qq']}', phone = '{$_clean['phone']}' WHERE id = '{$_clean['userId']}'"; $_result = _query($_sql); if( !!$_result ){ $_data['state'] = 0; $_data['info'] = '修改爲功'; }else{ $_data['state'] = 1; $_data['info'] = '修改失敗'; } $_userInfo['data'] = $_data; }else{ $_userInfo['info'] = '參數有誤'; $_userInfo['state'] = 1; } echo _json($_userInfo); _free_result($_result); _close(); ?>
修改密碼和交易密碼
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['regPwd'] = _check($_POST['regPwd']); $_clean['newRegPwd'] = _check($_POST['newRegPwd']); $_clean['tradingPwd'] = _check($_POST['tradingPwd']); $_clean['newTradingPwd'] = _check($_POST['newTradingPwd']); $_clean['encryptedQuestion'] = _check($_POST['encryptedQuestion']); $_clean['encryptedAnswer'] = _check($_POST['encryptedAnswer']); $_modify = array(); $_data = array(); if ( $_clean['userId'] > 0 ) { $_modify['state'] = 0; $_modify['info'] = ''; // 查找會員密碼 和轉過來的作匹配 $_sql = "SELECT userPwd,tradingPwd FROM tb_user WHERE id = '{$_clean['userId']}' AND state = 0"; $_result = _query($_sql); $_rows = _fetch_array($_result); if ( $_clean['regPwd'] != '' && $_clean['newRegPwd'] != '' && $_clean['tradingPwd'] == '' && $_clean['newTradingPwd'] == '' && $_clean['encryptedQuestion'] == '' && $_clean['encryptedAnswer'] == '' ) { if ( $_rows['userPwd'] == $_clean['regPwd'] ) { $_sql1 = "UPDATE tb_user SET userPwd = '{$_clean['newRegPwd']}' WHERE id = '{$_clean['userId']}'"; _query($_sql1); } else { $_data['state'] = 1; $_data['info'] = '舊密碼輸入不正確!'; $_modify['data'] = $_data; echo _json($_modify); die; } //更新交易密碼 } elseif ( $_clean['regPwd'] == '' && $_clean['newRegPwd'] == '' && $_clean['tradingPwd'] != '' && $_clean['newTradingPwd'] != '' && $_clean['encryptedQuestion'] == '' && $_clean['encryptedAnswer'] == '' ) { if ( $_rows['tradingPwd'] == $_clean['tradingPwd'] ) { $_sql1 = "UPDATE tb_user SET tradingPwd = '{$_clean['newTradingPwd']}' WHERE id = '{$_clean['userId']}'"; _query($_sql1); } else { $_data['state'] = 2; $_data['info'] = '舊交易密碼輸入不正確!'; $_modify['data'] = $_data; echo _json($_modify); die; } } elseif ( $_clean['regPwd'] == '' && $_clean['newRegPwd'] == '' && $_clean['tradingPwd'] == '' && $_clean['newTradingPwd'] == '' && $_clean['encryptedQuestion'] != '' && $_clean['encryptedAnswer'] != '' ) { $_sql1 = "UPDATE tb_user SET encryptedQuestion = '{$_clean['encryptedQuestion']}', encryptedAnswer = '{$_clean['encryptedAnswer']}' WHERE id = '{$_clean['userId']}'"; } else { $_data['state'] = 2; $_data['info'] = '其他參數有誤!'; } if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '修改爲功!'; } else { $_data['state'] = 3; $_data['info'] = '修改失敗!'; } $_modify['data'] = $_data; } else { $_modify['state'] = 1; $_modify['info'] = '請輸入會員ID'; } echo _json($_modify); _free_result($_result); _close(); ?>
用戶id獲取收藏裏所有信息
<?php require dirname(__FILE__).'/../includes/common.inc.php'; define('SCRIPT','user/productcollectionList'); global $_pagesize,$_pagenum; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_productCollectionList = array(); $_data = array(); if ( $_clean['userId'] > 0 ) { $_productCollectionList['state'] = 0; $_productCollectionList['info'] = ''; $_sql2 = "SELECT pcId FROM tb_productcollection WHERE userId = '{$_clean['userId']}' AND state = 0"; _page($_sql2,10); //id 商品ID 打印商品全部的信息 $_sql = "SELECT pcId,productId FROM tb_productcollection WHERE userId = '{$_clean['userId']}' AND state = 0 ORDER BY pcId DESC LIMIT $_pagenum,$_pagesize"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_sql1 = "SELECT id,GoodsName,GoodsPic,marketPrice,memberPrice,weight FROM tb_goodsInfo WHERE id = '{$_rows['productId']}'"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); $_html['id'] = $_rows1['id']; $_html['title'] = $_rows1['GoodsName']; $_html['pic'] = "http://www.youpinge.cn/" . $_rows1['GoodsPic']; $_html['marketPrice'] = $_rows1['marketPrice']; $_html['memberPrice'] = $_rows1['memberPrice']; $_html['weight'] = $_rows1['weight']; $_html = _html($_html); $_data[] = $_html; } $_productCollectionList['data'] = $_data; } else { $_productCollectionList['state'] = 1; $_productCollectionList['info'] = '參數有誤!'; } echo _json($_productCollectionList); _free_result($_result); _free_result($_result1); _close(); ?>
添加收藏夾
<?php require dirname(__FILE__).'/../includes/common.inc.php'; //收藏表 $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['GoodsInfoId'] = _check($_POST['GoodsInfoId']); $_clean['action'] = _check($_POST['action']); // 0:添加;1:刪除 // $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 && $_clean['GoodsInfoId'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; if ( $_clean['action'] == 0 ) { $_sql = "INSERT INTO tb_productcollection VALUES (NULL,'{$_clean['userId']}','{$_clean['GoodsInfoId']}',0)"; _query($_sql); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '收藏成功!'; } else { $_data['state'] = 1; $_data['info'] = '收藏失敗!'; } } elseif ( $_clean['action'] == 1 ) { $_sql = "DELETE FROM tb_productcollection WHERE userId = '{$_clean['userId']}' AND productId = '{$_clean['GoodsInfoId']}'"; _query($_sql); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '刪除成功!'; } else { $_data['state'] = 1; $_data['info'] = '刪除失敗!'; } } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _close(); ?>
查找用戶信息
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_userInfo = array(); $_data = array(); if( $_clean['userId'] != '' ){ $_userInfo['info'] = ''; $_userInfo['state'] = 0; }else{ $_userInfo['info'] = '參數有誤'; $_userInfo['state'] = 1; } $_sql = "SELECT realName,tradingPwd,userEmail,province,theCity,county,address,qq,phone,encryptedQuestion,encryptedAnswer FROM tb_user WHERE id = '{$_clean['userId']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data['realName'] = $_rows['realName']; $_data['userEmail'] = $_rows['userEmail']; $_data['province'] = $_rows['province']; $_data['theCity'] = $_rows['theCity']; $_data['county'] = $_rows['county']; $_data['address'] = $_rows['address']; $_data['qq'] = $_rows['qq']; $_data['phone'] = $_rows['phone']; $_data = _html($_data); $_sql1 = "SELECT areaName FROM tb_area WHERE id = '{$_data['province']}'"; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); $_data['provinceName'] = $_rows1['areaName']; $_sql2 = "SELECT areaName FROM tb_area WHERE id = '{$_data['theCity']}'"; $_result2 = _query($_sql2); $_rows2 = _fetch_array($_result2); $_data['theCityName'] = $_rows2['areaName']; $_sql3 = "SELECT areaName FROM tb_area WHERE id = '{$_data['county']}'"; $_result3 = _query($_sql3); $_rows3 = _fetch_array($_result3); $_data['countyName'] = $_rows3['areaName']; $_userInfo['data'] = $_data; echo _json($_userInfo); _free_result($_result); _close(); ?>
查找網站是否開啓功能 和充值
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['userId'] = 1 ; $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; //查詢網站是否開啓充值功能 $_sql = "SELECT gift FROM tb_webSite"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html['gift'] = $_rows['gift']; $_html = _html($_html); } if($_html['gift']==1){ $_info1['state'] = 1; $_info1['info'] = '充值送積分'; $_data = $_info1; } elseif ($_html['gift']==2){ $_info1['state'] = 2; $_info1['info'] = '充值送現金'; $_data = $_info1; } elseif ($_html['gift']== 3){ $_sql = "SELECT Giftid,Amount,GiftNumber,Giftimage FROM tb_gift where Giftid = 3"; $_result = _query($_sql); while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_info1['state'] = 3; $_info1['info'] = '充值送實物'; $_html['Giftimage'] = "http://www.youpinge.cn/" . $_rows1['Giftimage']; $_html = _html($_html); $_data = $_info1; } } else{ $_info['info'] = '充值未開啓'; } } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } $_info['data'] = $_data; echo _json($_info); _free_result($_result); _close(); ?>
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_clean['cash'] = _check($_POST['cash']);//充值金額 if ( $_clean['userId'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; //查詢網站設置的充值類型值功能 $_sql = "SELECT gift FROM tb_webSite where 1"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_html = array(); $_html['gift'] = $_rows['gift']; $_html = _html($_html); //充值有禮類型 $_sql = "SELECT Giftid,Amount,GiftNumber,Giftimage FROM tb_gift where Giftid='{$_html['gift']}'"; $_result = _query($_sql); $_rows=_fetch_array($_result); $_html1 = array(); $_html1['Giftid'] = $_rows['Giftid']; $_html1['Amount'] = $_rows['Amount']; $_html1['GiftNumber'] = $_rows['GiftNumber']; $_html1['Giftimage'] = $_rows['Giftimage']; $_html1 = _html($_html1); if($_html['gift']==1){ $_html1['integral'] = floor($_clean['cash']/$_html1['Amount']) * $_html1['GiftNumber']; $_sql = "UPDATE tb_user SET integral = integral+'{$_html1['integral']}',cash = cash + '{$_clean['cash']}' WHERE id = '{$_clean['userId']}'"; _query($_sql); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '充值成功!'; } else { $_data['state'] = 1; $_data['info'] = '充值失敗!'; } } elseif($_html['gift']==2){ $_html1['cash'] = floor($_clean['cash']/$_html1['Amount']) * $_html1['GiftNumber']; $_sql = "UPDATE tb_user SET cash = cash + '{$_clean['cash']}' + '{$_html1['cash']}' WHERE id = '{$_clean['userId']}'"; _query($_sql); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '充值成功!'; } else { $_data['state'] = 1; $_data['info'] = '充值失敗!'; } } elseif($_html['gift']==3){ $_html1['cash'] = floor($_clean['cash']/$_html1['Amount']) * $_html1['GiftNumber']; $_sql = "UPDATE tb_user SET cash = cash + '{$_clean['cash']}' + '{$_html1['cash']}' WHERE id = '{$_clean['userId']}' "; _query($_sql); if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '充值成功!'; } else { $_data['state'] = 1; $_data['info'] = '充值失敗!'; } } elseif($_html['gift']==0){ $_data['state'] = 0; $_data['info'] = '充值活動送禮結束!'; } }else { $_info['state'] = 1; $_info['info'] = '參數錯誤'; } $_info['data'] = $_data; echo _json($_info); _free_result($_result); _close(); ?>
用戶易幣
<?php require dirname(__FILE__).'/../includes/common.inc.php'; $_clean = array(); $_clean['userId'] = _check($_POST['userId']); $_info = array(); $_data = array(); if ( $_clean['userId'] > 0 ) { $_info['state'] = 0; $_info['info'] = ''; $_sql = "SELECT cash,integral FROM tb_user WHERE id = '{$_clean['userId']}'"; $_result = _query($_sql); $_rows = _fetch_array($_result); $_data['cash'] = $_rows['cash']; $_data['integral'] = $_rows['integral']; $_data = _html($_data); $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _free_result(); _close(); ?>
訂單支付
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['payment'] = _check($_POST['payment']); $_clean['userId'] = _check($_POST['userId']); $_clean['orderNumber'] = _check($_POST['orderNumber']); $_clean['theGoodsName'] = _check($_POST['theGoodsName']); $_clean['theGoodsAddress'] = _check($_POST['theGoodsAddress']); $_clean['theGoodsPhone'] = _check($_POST['theGoodsPhone']); $_clean['theGoodsCode'] = _check($_POST['theGoodsCode']); $_info = array(); $_data = array(); $_now = date('y-m-d H:i:s',time()); // if ( $_clean['userId'] > 0 && $_clean['orderNumber'] != '' ) { $_info['state'] = 0; $_info['info'] = ''; //返還的積分數 實付現金 實付積分 $_sql = "SELECT returnIntegral,payMoney,payIntegral FROM tb_order WHERE orderNumber = '{$_clean['orderNumber']}' AND userid = '{$_clean['userId']}' AND state = 0"; $_result = _query($_sql); $_rows = _fetch_array($_result); if ( !$_rows ) { $_data['state'] = 1; $_data['info'] = '該訂單不存在!'; $_info['data'] = $_data; echo _json($_info); die; } elseif ( !!$_rows ) { $_html = array(); $_html['returnIntegral'] = $_rows['returnIntegral']; $_html['payMoney'] = $_rows['payMoney']; $_html['payIntegral'] = $_rows['payIntegral']; $_html = _html($_html); } //查出E幣 $_sql9 = "SELECT cash FROM tb_user WHERE id = '{$_clean['userId']}'"; $_result9 = _query($_sql9); $_rows9 = _fetch_array($_result9); $_html9 = array(); $_html9['cash'] = $_rows9['cash']; $_html9 = _html($_html9); // $_sql5 = "UPDATE tb_order SET theGoodsName = '{$_clean['theGoodsName']}',theGoodsAddress = '{$_clean['theGoodsAddress']}',theGoodsPhone = '{$_clean['theGoodsPhone']}',theGoodsCode = '{$_clean['theGoodsCode']}',payment = '{$_clean['payment']}' WHERE orderNumber = '{$_clean['orderNumber']}' AND userid = '{$_clean['userId']}'"; _query($_sql5); $_sql8 = "SELECT payMoney FROM tb_order WHERE orderNumber = '{$_clean['orderNumber']}' AND userid = '{$_clean['userId']}'"; $_result8 = _query($_sql8); $_rows8 = _fetch_array($_result8); $_html8 = array(); $_html8['payMoney'] = $_rows8['payMoney']; $_html8 = _html($_html8); if ( $_clean['payment'] == 1 ) { if ( $_html8['payMoney'] < $_html9['cash'] && $_html9['cash'] > 0 ) { $_sql1 = "UPDATE tb_user SET cash = cash - '{$_html['payMoney']}',integral = integral - '{$_html['payIntegral']}' + '{$_html['returnIntegral']}' WHERE id = '{$_clean['userId']}'"; _query($_sql1); } else { $_data['state'] = 1; $_data['info'] = '現金不足!'; $_order['data'] = $_data; echo _json($_order); die; } if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '支付成功!'; $_sql2 = "INSERT INTO tb_cashRecord VALUES (NULL,'{$_clean['userId']}',1,'{$_clean['orderNumber']}',0,'{$_html['payMoney']}','$_now','來自Android',1)"; _query($_sql2); if ( $_html['payIntegral'] > 0 ) { $_sql3 = "INSERT INTO tb_integralRecord VALUES (null,'{$_clean['userId']}','{$_clean['orderNumber']}',1,0,'{$_html['preferential']}','$_now','來自Android')"; _query($_sql3); } if ( $_html['returnIntegral'] > 0 ) { $_sql4 = "INSERT INTO tb_integralRecord VALUES (null,'{$_clean['userId']}','{$_clean['orderNumber']}',1,'{$_html['returnIntegral']}',0,'$_now','來自Android')"; _query($_sql4); } } else { $_data['state'] = 1; $_data['info'] = '支付失敗!'; } } elseif ( $_clean['payment'] == 4 ) { $_data['state'] = 0; $_data['info'] = ''; } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _free_result($_result); _close(); ?>
購物車帳單結算
<?php require dirname(__FILE__).'/includes/common.inc.php'; $_clean = array(); $_clean['payment'] = _check($_POST['payment']); $_clean['userId'] = _check($_POST['userId']); $_clean['orderNumber'] = _check($_POST['orderNumber']); $_clean['theGoodsName'] = _check($_POST['theGoodsName']); $_clean['theGoodsAddress'] = _check($_POST['theGoodsAddress']); $_clean['theGoodsPhone'] = _check($_POST['theGoodsPhone']); $_clean['theGoodsCode'] = _check($_POST['theGoodsCode']); $_info = array(); $_data = array(); $_now = date('y-m-d H:i:s',time()); // if ( $_clean['userId'] > 0 && $_clean['orderNumber'] != '' ) { $_info['state'] = 0; $_info['info'] = ''; //返還的積分數 實付現金 實付積分 $_sql = "SELECT returnIntegral,payMoney,payIntegral FROM tb_order WHERE orderNumber = '{$_clean['orderNumber']}' AND userid = '{$_clean['userId']}' AND state = 0"; $_result = _query($_sql); $_rows = _fetch_array($_result); if ( !$_rows ) { $_data['state'] = 1; $_data['info'] = '該訂單不存在!'; $_info['data'] = $_data; echo _json($_info); die; } elseif ( !!$_rows ) { $_html = array(); $_html['returnIntegral'] = $_rows['returnIntegral']; $_html['payMoney'] = $_rows['payMoney']; $_html['payIntegral'] = $_rows['payIntegral']; $_html = _html($_html); } //查出E幣 $_sql9 = "SELECT cash FROM tb_user WHERE id = '{$_clean['userId']}'"; $_result9 = _query($_sql9); $_rows9 = _fetch_array($_result9); $_html9 = array(); $_html9['cash'] = $_rows9['cash']; $_html9 = _html($_html9); // $_sql5 = "UPDATE tb_order SET theGoodsName = '{$_clean['theGoodsName']}',theGoodsAddress = '{$_clean['theGoodsAddress']}',theGoodsPhone = '{$_clean['theGoodsPhone']}',theGoodsCode = '{$_clean['theGoodsCode']}',payment = '{$_clean['payment']}' WHERE orderNumber = '{$_clean['orderNumber']}' AND userid = '{$_clean['userId']}'"; _query($_sql5); $_sql8 = "SELECT payMoney FROM tb_order WHERE orderNumber = '{$_clean['orderNumber']}' AND userid = '{$_clean['userId']}'"; $_result8 = _query($_sql8); $_rows8 = _fetch_array($_result8); $_html8 = array(); $_html8['payMoney'] = $_rows8['payMoney']; $_html8 = _html($_html8); if ( $_clean['payment'] == 1 ) { if ( $_html8['payMoney'] < $_html9['cash'] && $_html9['cash'] > 0 ) { $_sql1 = "UPDATE tb_user SET cash = cash - '{$_html['payMoney']}',integral = integral - '{$_html['payIntegral']}' + '{$_html['returnIntegral']}' WHERE id = '{$_clean['userId']}'"; _query($_sql1); } else { $_data['state'] = 1; $_data['info'] = '現金不足!'; $_order['data'] = $_data; echo _json($_order); die; } if ( _affected_rows() == 1 ) { $_data['state'] = 0; $_data['info'] = '支付成功!'; $_sql2 = "INSERT INTO tb_cashRecord VALUES (NULL,'{$_clean['userId']}',1,'{$_clean['orderNumber']}',0,'{$_html['payMoney']}','$_now','來自Android',1)"; _query($_sql2); if ( $_html['payIntegral'] > 0 ) { $_sql3 = "INSERT INTO tb_integralRecord VALUES (null,'{$_clean['userId']}','{$_clean['orderNumber']}',1,0,'{$_html['preferential']}','$_now','來自Android')"; _query($_sql3); } if ( $_html['returnIntegral'] > 0 ) { $_sql4 = "INSERT INTO tb_integralRecord VALUES (null,'{$_clean['userId']}','{$_clean['orderNumber']}',1,'{$_html['returnIntegral']}',0,'$_now','來自Android')"; _query($_sql4); } } else { $_data['state'] = 1; $_data['info'] = '支付失敗!'; } } elseif ( $_clean['payment'] == 4 ) { $_data['state'] = 0; $_data['info'] = ''; } $_info['data'] = $_data; } else { $_info['state'] = 1; $_info['info'] = '參數有誤!'; } echo _json($_info); _free_result($_result); _close(); ?>