You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1003 B
PHP
41 lines
1003 B
PHP
<?php
|
|
|
|
namespace Workerman\Lib;
|
|
|
|
use Workerman\Worker;
|
|
|
|
$bot_loop = new Worker();
|
|
$bot_loop->count = 1;
|
|
$bot_loop->name = "OrderCancel";
|
|
|
|
function OrderCancelFunc()
|
|
{
|
|
$res= post("http://yijiyuyue/api/admin/NoPayCancel","");
|
|
var_dump(json_encode(json_decode($res),JSON_UNESCAPED_UNICODE));
|
|
}
|
|
|
|
|
|
$bot_loop->onWorkerStart = function () {
|
|
Timer::add(3, function () {
|
|
OrderCancelFunc();
|
|
});
|
|
};
|
|
|
|
|
|
function post($url, $data_string)
|
|
{
|
|
$curl = curl_init();
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
|
// curl_setopt($curl, CURLOPT_POST, true);
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, [
|
|
'Content-Type: application/json; charset=utf-8',
|
|
'Content-Length: ' . strlen($data_string)
|
|
]);
|
|
// curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
|
|
$r = curl_exec($curl);
|
|
curl_close($curl);
|
|
return $r;
|
|
} |