首页 > 代码库 > 接口2
接口2
搜索
<?php require dirname(__FILE__).‘/includes/common.inc.php‘; $_clean = array(); //类型 $_clean[‘type‘] = _check($_POST[‘type‘]);//1.DH;2.MS;3.th //内容 $_clean[‘content‘] = _check($_POST[‘content‘]); define(‘SCRIPT‘,‘research‘); global $_pagesize,$_pagenum; $_productList = array(); if ( $_clean[‘type‘] == ‘‘ && $_clean[‘type‘] > 3 && $_clean[‘type‘] < 0 ) { $_productList[‘state‘] = 1; $_productList[‘info‘] = ‘参数有误!‘; //如果类型内容不等于空 }elseif ( $_clean[‘type‘] != ‘‘ && $_clean[‘content‘] != ‘‘ ) { //查找商品名 $_sql2 = "SELECT goodsName FROM tb_goods"; $_result2 = _query($_sql2); //循环 while($_rows2 = _fetch_array($_result2)){ $_html2 = array(); $_html2[‘goodsName‘] = _html($_rows2[‘goodsName‘]); $_true = strpos($_html2[‘goodsName‘],$_clean[‘content‘]); if ( !is_bool($_true) ) { $_goodsName = $_html2[‘goodsName‘]; $_sql = "SELECT goodsId FROM tb_goods WHERE goodsShow = 1 AND goodsModule = ‘{$_clean[‘type‘]}‘ AND goodsName = ‘$_goodsName‘ ORDER BY goodsId DESC"; _page($_sql,4); $_sql1 = "SELECT goodsId,goodsName,goodsPicture,goodsType,goodsOriginalPrice,goodsMoneyPrice,goodsDeliveryArea,goodsInventory FROM tb_goods WHERE goodsShow = 1 AND goodsModule = ‘{$_clean[‘type‘]}‘ AND goodsName = ‘$_goodsName‘ ORDER BY goodsId DESC LIMIT $_pagenum,$_pagesize"; _sprProduct($_sql1); } } $_productList[‘data‘] = $_data; } echo _json($_productList); _free_result($_result1); _close();?>
提交评论
<?php require dirname(__FILE__).‘/includes/common.inc.php‘; $_clean = array(); $_clean[‘phone‘] = _check($_POST[‘phone‘]); $_clean[‘title‘] = _check($_POST[‘title‘]); $_clean[‘comments‘] = _check($_POST[‘comments‘]); $_info = array(); $_data = array(); //电话不等于11 if ( $_clean[‘phone‘] > 0 && strlen($_clean[‘phone‘]) != 11 && $_clean[‘title‘] != ‘‘ && $_clean[‘comments‘] != ‘‘ ) { $_info[‘state‘] = 0; $_info[‘info‘] = ‘‘; $_sql = "INSERT INTO tb_submitComments ( phone, title, comments ) VALUES ( ‘{$_clean[‘phone‘]}‘, ‘{$_clean[‘title‘]}‘, ‘{$_clean[‘comments‘]}‘ )"; _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‘]); $_clean[‘adId‘] = _check($_POST[‘adId‘]); $_clean[‘content‘] = _check($_POST[‘content‘]); $_now = date(‘y-m-d H:i:s‘,time()); $_info = array(); $_data = array(); // if ( $_clean[‘userId‘] > 0 && $_clean[‘adId‘] > 0 && $_clean[‘content‘] != ‘‘ ) { $_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_easyAdComments VALUES (null,‘{$_clean[‘userId‘]}‘,‘{$_clean[‘adId‘]}‘,‘{$_clean[‘content‘]}‘,now(),‘来自Android‘,0,0)"; _query($_sql); if ( _affected_rows() == 1 ) { $_data[‘state‘] = 0; $_data[‘info‘] = ‘评论成功‘; $_data[‘addTimes‘] = $_now; $_data[‘content‘] = $_clean[‘content‘]; $_data[‘userName‘] = $_rows1[‘userName‘]; } else { $_data[‘state‘] = 1; $_data[‘info‘] = ‘评论失败‘; } $_info[‘data‘] = $_data; } else { $_info[‘state‘] = 1; $_info[‘info‘] = ‘参数有误!‘; } echo _json($_info); _close();?>
接口2
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。