新增字段
找到你的29数据库,找到表:qingka_wangke_class
添加完之后站长就可以修改他的值了,哪一个网课需要提交ID,你就把刚才新增的字段的值改成1就行,不需要的就不管默认0就行!
修改29 接口源码
接口文件:api.php
修改查项目方法
case 'getclass':
$uid = trim(strip_tags(daddslashes($_POST['uid'])));
$key = trim(strip_tags(daddslashes($_POST['key'])));
if ($uid == '' || $key == '') {
exit('{"code":0,"msg":"所有项目不能为空"}');
}
$userrow = $DB->get_row("select * from qingka_wangke_user where uid='$uid' limit 1");
if ($userrow['key'] == '0') {
$result = array("code" => -1, "msg" => "你还没有开通接口哦");
exit(json_encode($result));
} elseif ($userrow['key'] != $key) {
$result = array("code" => -2, "msg" => "密匙错误");
exit(json_encode($result));
}
if ($_REQUEST['cid']) {
$a = $DB->query("select * from qingka_wangke_class where status=1 and cid = '{$_REQUEST['cid']}' order by sort desc");
} else {
$a = $DB->query("select * from qingka_wangke_class where status=1 order by sort desc");
}
while ($row = $DB->fetch($a)) {
if ($row['yunsuan'] == "*") {
$price = round($row['price'] * $userrow['addprice'], 2);
$price1 = $price;
} elseif ($row['yunsuan'] == "+") {
$price = round($row['price'] + $userrow['addprice'], 2);
$price1 = $price;
} else {
$price = round($row['price'] * $userrow['addprice'], 2);
$price1 = $price;
}
//密价
$mijia = $DB->get_row("select * from qingka_wangke_mijia where uid='{$userrow['uid']}' and cid='{$row['cid']}' ");
if ($mijia) {
if ($mijia['mode'] == 0) {
$price = round($price - $mijia['price'], 2);
if ($price <= 0) {
$price = 0;
}
} elseif ($mijia['mode'] == 1) {
$price = round(($row['price'] - $mijia['price']) * $userrow['addprice'], 2);
if ($price <= 0) {
$price = 0;
}
} elseif ($mijia['mode'] == 2) {
$price = $mijia['price'];
if ($price <= 0) {
$price = 0;
}
}
$row['name'] = "【密价】{$row['name']}";
}
if ($price >= $price1) { //密价价格大于原价,恢复原价
$price = $price1;
}
$data[] = array(
'sort' => $row['sort'],
'cid' => $row['cid'],
'kcid' => $row['kcid'],
'name' => $row['name'],
'noun' => $row['noun'],
'price' => $price,
'content' => $row['content'],
'status' => $row['status'],
'miaoshua' => $miaoshua
);
}
foreach ($data as $key => $row) {
$sort[$key] = $row['sort'];
$cid[$key] = $row['cid'];
$kcid[$key] = $row['kcid'];
$name[$key] = $row['name'];
$noun[$key] = $row['noun'];
$price[$key] = $row['price'];
$info[$key] = $row['info'];
$content[$key] = $row['content'];
$status[$key] = $row['status'];
$miaoshua[$key] = $row['miaoshua'];
}
array_multisort($sort, SORT_ASC, $cid, SORT_DESC, $data);
$data = array('code' => 1, 'data' => $data);
exit(json_encode($data));
break;
修改交单代码
$Res = $DB->get_row("select * from qingka_wangke_order where ptname='{$rs['name']}' and school='$school' and user='$user' and pass='$pass' and kcid='$kcid' and kcname='$kcname' order by oid desc limit 1;");
$oid = $Res['oid'];
exit('{"code":0,"msg":"提交成功","status":0,"message":"提交成功","id":"'.$oid.'"}');
修改查单代码
$username=trim(strip_tags(daddslashes($_POST['username'])));
$id=trim(strip_tags(daddslashes($_REQUEST['oid'])));
if($username==""){
if($id == ""){
$data=array('code'=>-1,'msg'=>"账号不能为空");
exit(json_encode($data));
}else if($id == ""){
$data=array('code'=>-1,'msg'=>"订单ID不能为空");
exit(json_encode($data));
}
}
if($username != ""){
$a=$DB->query("select * from qingka_wangke_order where user='$username' order by oid desc ");
}else if($id != ""){
$a=$DB->query("select * from qingka_wangke_order where oid='$id'");
}
修改查单代码就是整个都替换掉吧,,不需要保留别的吧 if ($a) {
while ($row = $DB -> fetch($a)) { $data[] = array( 这些内容要保留么??记得留备份,不确定你的29是否动过这部分代码。