This commit is contained in:
2022-01-09 03:50:38 +08:00
parent 08dc3e262b
commit 5e02a79bf0
113 changed files with 12713 additions and 12703 deletions
+16 -16
View File
@@ -3,21 +3,21 @@
function version($oldVersion, $newVersion): bool function version($oldVersion, $newVersion): bool
{ {
$first = explode('.', $oldVersion); $first = explode('.', $oldVersion);
$end = explode('.', $newVersion); $end = explode('.', $newVersion);
while (count($first) > 0) { while (count($first) > 0) {
$shift = (int)array_shift($first); $shift = (int)array_shift($first);
$endShift = (int)array_shift($end); $endShift = (int)array_shift($end);
if ($endShift == $shift) { if ($endShift == $shift) {
continue; continue;
} }
if ($endShift < $shift) { if ($endShift < $shift) {
return true; return TRUE;
} else { } else {
return false; return FALSE;
} }
} }
return false; return FALSE;
} }
var_dump(version('1.4.4','1.4.3')); var_dump(version('1.4.4', '1.4.3'));
+36 -36
View File
@@ -51,40 +51,40 @@
var_dump(json_encode([ var_dump(json_encode([
"Datacenter" => "dc1", "Datacenter" => "dc1",
"Node" => "iz8vbi3edjyskl7kpuwudqz", "Node" => "iz8vbi3edjyskl7kpuwudqz",
"SkipNodeUpdate" => false, "SkipNodeUpdate" => FALSE,
"Service" => [ "Service" => [
"ID" => "redis1", "ID" => "redis1",
"Service" => "FriendRpcService", "Service" => "FriendRpcService",
"Address" => "172.26.221.211", "Address" => "172.26.221.211",
"TaggedAddresses" => [ "TaggedAddresses" => [
"lan" => [ "lan" => [
"address" => "127.0.0.1", "address" => "127.0.0.1",
"port" => 9627 "port" => 9627,
], ],
"wan" => [ "wan" => [
"address" => "172.26.221.211", "address" => "172.26.221.211",
"port" => 9627 "port" => 9627,
] ],
], ],
"Meta" => [ "Meta" => [
"redis_version" => "4.0" "redis_version" => "4.0",
], ],
"Port" => 9627 "Port" => 9627,
], ],
"Check" => [ "Check" => [
"Node" => "iz8vbi3edjyskl7kpuwudqz", "Node" => "iz8vbi3edjyskl7kpuwudqz",
"CheckId" => "service:redis1", "CheckId" => "service:redis1",
"Name" => "Redis health check", "Name" => "Redis health check",
"Notes" => "Script based health check", "Notes" => "Script based health check",
"Status" => "passing", "Status" => "passing",
"ServiceID" => "redis1", "ServiceID" => "redis1",
"Definition" => [ "Definition" => [
"Http" => "http://172.26.221.211:9627", "Http" => "http://172.26.221.211:9627",
"Interval" => "5s", "Interval" => "5s",
"Timeout" => "1s", "Timeout" => "1s",
"DeregisterCriticalServiceAfter" => "30s" "DeregisterCriticalServiceAfter" => "30s",
], ],
], ],
])); ]));
+16 -6
View File
@@ -27,11 +27,21 @@ namespace Ar;
use Swoole\Coroutine\Http\Client; use Swoole\Coroutine\Http\Client;
use function Swoole\Coroutine\run; use function Swoole\Coroutine\run;
run(function () { //run(function () {
//
// $client = new Client('47.92.194.207',8500);
// $client->get('/v1/agent/services?filter=Service == FriendRpcService');
// $client->close();
// var_dump($client->getBody());
//
//});
$client = new Client('47.92.194.207',8500); function order(int $userId): string
$client->get('/v1/agent/services?filter=Service == FriendRpcService'); {
$client->close(); $explode = current(explode(' ', str_replace('0.', '', round((float)microtime(),6))));
var_dump($client->getBody());
}); return 'N'.sprintf('%09d', $userId) . '.' . date('YmdHis') . '.' . str_pad($explode,6,0);
}
var_dump(
order(1)
);