public function addWaste() { $postData = $_POST['txt_json']; echo urldecode(json_encode(addWaste($postData))); }
$resdata->error = $error; return $resdata; } //echo $wasteTotal; $wasteTotal = $wasteTotal + $addnum; $sql1 = "UPDATE rfid SET update_date_time = '{$time}',status = 3, waste_total = '{$wasteTotal}' WHERE rfid_id = '{$rfid}' AND waste_id = '{$wasteid}'"; $key = 0; if (!mysql_query($sql1, $con)) { $error[$key]->code = 3; $error[$key]->des = urlencode('更新RFID数据库失败'); $error[$key]->rfid = $rfid; $key++; } else { $sql2 = "INSERT INTO {$productionUnit} (rfid_id, waste_id, add_date_time,android_num,{$column}) VALUES ('{$rfid}', '{$wasteid}', '{$time}','{$imei}','{$addnum}')"; if (!mysql_query($sql2, $con)) { $error[$key]->code = 4; $error[$key]->des = urlencode('写入企业库存数据失败'); $error[$key]->rfid = $rfid; } } mysql_close($con); if (isset($error)) { $newerror['error'] = $error; return $newerror; } else { $resultData->code = 200; return $resultData; } } echo urldecode(json_encode(addWaste()));