Skip to content

Commit

Permalink
feat: support anonymous user
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangpengspin committed Sep 1, 2022
1 parent 0fc0a38 commit 9a929e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
composer.phar
.idea/
vendor/


2 changes: 1 addition & 1 deletion src/Model/Message/AppMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function jsonSerialize()
if ($this->traceId != null) $data["trace_id"] = $this->traceId;
if ($this->appId != null) $data["app_id"] = $this->appId;
if ($this->header != null) $data["header"] = $this->header;
if ($this->userUniqueId != null) $data["user_unique_id"] = $this->userUniqueId;
if ($this->userUniqueId !== null) $data["user_unique_id"] = $this->userUniqueId;
if ($this->eventV3 != null) $data["event_v3"] = $this->eventV3;
return $data;
}
Expand Down
7 changes: 7 additions & 0 deletions test/HttpTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
$header->setUserUniqueId("test-uuid2");
$header->setClientIp("49.7.44.244");
$header->setOs("android");
$header->setDeviceId(7786627007290925058);

$rc->sendUserDefineEvent($header, "", 10000000, null, "php_event_with_anonymous",
["php_name" => "php", "php_version" => "5.6", "float_param" => floatval(5), "session_id" => "1234567890"]);


$rc->sendUserDefineEvent($header, "test-uuid2", 10000000, null, "php_event_with_items",
["php_name" => "php", "php_version" => "5.6", "float_param" => floatval(5), "session_id" => "1234567890"], $items);
Expand All @@ -71,3 +76,5 @@
[["php_name" => "php", "php_version" => "5.6"]], [
[["item_name" => "book", "item_id" => "0001"], ["item_name" => "book", "item_id" => "0002"]]
]);

sleep(10);

0 comments on commit 9a929e0

Please sign in to comment.