-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend_tasks.php
45 lines (37 loc) · 1.35 KB
/
send_tasks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
if(!isset($CRON_GUVENLIK)){
echo "You cannot run cron file manually";
exit;
}
$smmapi = new SMMApi();
if($settings["auto_refill"] == 2):
$orders = $conn->prepare("SELECT * FROM tasks WHERE task_status=:status && task_type=:type ");
$orders->execute(array(
"status" => "pending",
"type" => 2
));
$orders = $orders->fetchAll(PDO::FETCH_ASSOC);
foreach ($orders as $order):
$id = $order["task_id"];
$api = $conn->prepare("SELECT * FROM tasks LEFT JOIN services ON services.service_id = tasks.service_id LEFT JOIN orders ON orders.order_id = tasks.order_id LEFT JOIN service_api ON services.service_api = service_api.id WHERE tasks.task_id=:id ");
$api->execute(array(
"id" => $id
));
$api = $api->fetch(PDO::FETCH_ASSOC);
$send_refill = $smmapi->action(array(
'key' => $api["api_key"],
'action' => 'refill',
'order' => $api["api_orderid"],
), $api["api_url"]);
print_r($send_refill);
if (@$send_refill->refill):
$r_id = $send_refill->refill;
$update = $conn->prepare("UPDATE tasks SET task_status=:status, refill_orderid=:r_id WHERE task_id=:id");
$update = $update->execute(array(
"status" => 'success',
"id" => $id,
"r_id" => $r_id
));
endif;
endforeach;
endif;