creating infra for filament tracking by user
This commit is contained in:
@@ -147,8 +147,14 @@ function load_user()
|
||||
exec("curl --max-time 10 $url/api/job?apikey=$apikey > /var/www/html/user_files/$username/finish.json");
|
||||
$fg=file_get_contents("/var/www/html/user_files/$username/finish.json");
|
||||
$json=json_decode($fg,true);
|
||||
if(isset($json['job']['filament']['tool0']['length'])){
|
||||
$filament_usage=$json['job']['filament']['tool0']['length'];
|
||||
echo("used $filament_usage mm of filament");
|
||||
$sql="UPDATE users SET filament_usage = filemant_usage + $filament_usage WHERE id = $id";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
|
||||
//echo("used $filament_usage mm of filament");
|
||||
}
|
||||
if(isset($_GET['remove_queue'])&&$_GET["rid"]==($_SESSION["rid"]-1))
|
||||
{
|
||||
|
||||
@@ -28,7 +28,8 @@ $sql = "CREATE TABLE IF NOT EXISTS users (
|
||||
notification_way INT,
|
||||
notification_mail INT,
|
||||
notification_telegram INT,
|
||||
class_id INT
|
||||
class_id INT,
|
||||
filament_usage INT
|
||||
)";
|
||||
$link->query($sql);
|
||||
//printer table
|
||||
|
||||
Reference in New Issue
Block a user