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
{
$first = explode('.', $oldVersion);
$end = explode('.', $newVersion);
while (count($first) > 0) {
$shift = (int)array_shift($first);
$endShift = (int)array_shift($end);
if ($endShift == $shift) {
continue;
}
if ($endShift < $shift) {
return true;
} else {
return false;
}
}
return false;
$first = explode('.', $oldVersion);
$end = explode('.', $newVersion);
while (count($first) > 0) {
$shift = (int)array_shift($first);
$endShift = (int)array_shift($end);
if ($endShift == $shift) {
continue;
}
if ($endShift < $shift) {
return TRUE;
} else {
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([
"Datacenter" => "dc1",
"Node" => "iz8vbi3edjyskl7kpuwudqz",
"SkipNodeUpdate" => false,
"Service" => [
"ID" => "redis1",
"Service" => "FriendRpcService",
"Address" => "172.26.221.211",
"TaggedAddresses" => [
"lan" => [
"address" => "127.0.0.1",
"port" => 9627
],
"wan" => [
"address" => "172.26.221.211",
"port" => 9627
]
],
"Meta" => [
"redis_version" => "4.0"
],
"Port" => 9627
],
"Check" => [
"Node" => "iz8vbi3edjyskl7kpuwudqz",
"CheckId" => "service:redis1",
"Name" => "Redis health check",
"Notes" => "Script based health check",
"Status" => "passing",
"ServiceID" => "redis1",
"Definition" => [
"Http" => "http://172.26.221.211:9627",
"Interval" => "5s",
"Timeout" => "1s",
"DeregisterCriticalServiceAfter" => "30s"
],
],
"Datacenter" => "dc1",
"Node" => "iz8vbi3edjyskl7kpuwudqz",
"SkipNodeUpdate" => FALSE,
"Service" => [
"ID" => "redis1",
"Service" => "FriendRpcService",
"Address" => "172.26.221.211",
"TaggedAddresses" => [
"lan" => [
"address" => "127.0.0.1",
"port" => 9627,
],
"wan" => [
"address" => "172.26.221.211",
"port" => 9627,
],
],
"Meta" => [
"redis_version" => "4.0",
],
"Port" => 9627,
],
"Check" => [
"Node" => "iz8vbi3edjyskl7kpuwudqz",
"CheckId" => "service:redis1",
"Name" => "Redis health check",
"Notes" => "Script based health check",
"Status" => "passing",
"ServiceID" => "redis1",
"Definition" => [
"Http" => "http://172.26.221.211:9627",
"Interval" => "5s",
"Timeout" => "1s",
"DeregisterCriticalServiceAfter" => "30s",
],
],
]));
+16 -6
View File
@@ -27,11 +27,21 @@ namespace Ar;
use Swoole\Coroutine\Http\Client;
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);
$client->get('/v1/agent/services?filter=Service == FriendRpcService');
$client->close();
var_dump($client->getBody());
function order(int $userId): string
{
$explode = current(explode(' ', str_replace('0.', '', round((float)microtime(),6))));
});
return 'N'.sprintf('%09d', $userId) . '.' . date('YmdHis') . '.' . str_pad($explode,6,0);
}
var_dump(
order(1)
);