You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.6 KiB
55 lines
1.6 KiB
|
|
<?php
|
|
// 载入db.php来连结资料库
|
|
require_once "database.php";
|
|
|
|
$accountid=$_REQUEST['accountid'];
|
|
$contractno=$_REQUEST['contractno'];
|
|
$facilitydata=[];//初始化
|
|
|
|
if($_POST['type']=='schedule'){
|
|
|
|
$contractno = $_POST["contractno"];//合同号
|
|
$creater = $_POST["creater"];//建档人
|
|
$create_at = date('Y/m/d H:i:s');//创建时间
|
|
$facilitynos=json_decode($_POST['facilitynos'], true);
|
|
$combonos=json_decode($_POST['combonos'], true);
|
|
$duedates=json_decode($_POST['duedates'], true);
|
|
$repairerids=json_decode($_POST['repairerids'], true);
|
|
$repairernames=json_decode($_POST['repairernames'], true);
|
|
$num=0;
|
|
for ($i = 0; $i<sizeof($facilitynos); $i++) {
|
|
//判断套餐是否已经添加
|
|
$schedulesql = "SELECT * FROM schedule where facilityno='$facilitynos[$i]' and duedate='$duedates[$i]'";
|
|
$schedule_nums_rows=mysqli_num_rows(mysqli_query($link,$schedulesql));
|
|
if($schedule_nums_rows==0){
|
|
$db_query = "INSERT INTO schedule(contractno, facilityno, combono, repairerid, repairername, duedate, creater, create_at) VALUES ('$contractno', '$facilitynos[$i]', '$combonos[$i]', '$repairerids[$i]', '$repairernames[$i]', '$duedates[$i]', '$creater', '$create_at')";
|
|
$result = mysqli_query($link,$db_query);
|
|
if (mysqli_affected_rows($link)>0) {
|
|
$num++;
|
|
}
|
|
}
|
|
}
|
|
if ($num>0) {
|
|
$jsonres['code']='200';
|
|
$jsonres['num']=$num;
|
|
echo json_encode($jsonres);
|
|
}else{
|
|
$jsonres['code']='1';
|
|
$jsonres['num']=0;
|
|
echo json_encode($jsonres);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|