Social co-presence verification method and system based on heartbeat tracking and identity determination
By using server-side two-way heartbeat tracking and multi-dimensional identity determination, the accuracy problem of user co-presentation verification in existing technologies is solved. It achieves accurate verification without trusting the client, ensuring data authenticity and atomicity of scene switching, and adaptively adjusts the heartbeat frequency to improve judgment accuracy.
Patent Information
- Application Number
- CN202611349033.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-02
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2046-09-02
AI Technical Summary
Existing technologies cannot accurately verify whether two users are present together for a specified duration. Client-side timing is easily tampered with, abnormal exits lead to data loss, fixed heartbeat intervals lack behavioral authenticity detection, and there is no ability to subdivide the duration statistics at the scene or room level, as well as a lack of data on the correlation between users.
By using server-side bidirectional heartbeat tracking and multi-dimensional identity determination, the system utilizes distributed caching to maintain the tracking data structure, performs scenario consistency checks, basic identity verification, and tracking data consistency checks, combines exclusive locks to control the heartbeat frequency, uses time-series statistical features to detect abnormal behavior, and determines whether both parties are present together under a scheduled task.
It implements a method to accurately verify the presence of two users without trusting the client, eliminating the possibility of duration data forgery, ensuring the authenticity and accuracy of the data, supporting atomic operations during scene switching, and adaptively adjusting the heartbeat frequency to improve judgment accuracy.
Smart Images

Figure CN122863633B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of social platform data processing technology, specifically to a social co-presence verification method and system based on heartbeat tracking and identity determination. Background Technology
[0002] With the rapid development of internet technology, user invitation activities in the entertainment scenarios of social platforms are becoming increasingly frequent. To incentivize existing users to invite new users back or to register, platforms typically have reward mechanisms. However, the prerequisite for reward distribution is the ability to accurately verify whether the inviter and the invitee are present together for a specified duration. However, existing technologies have many shortcomings in achieving this verification.
[0003] Currently, the relevant technologies mainly employ the following methods: First, the client-side local timing reporting method. This method relies entirely on the client for data, and malicious users can easily tamper with the duration information by modifying the local timing logic or forging reported data, resulting in extremely low data reliability. Second, the server-side entry and exit event difference calculation method. This method calculates the dwell time by recording the time a user enters and leaves the scene, but abnormal exit behaviors such as crashes, network disconnections, and forced process closures can prevent the departure event from being reported normally, leaving the server unaware that the user has left and causing severe data loss. Third, the one-way keep-alive method where the client periodically sends heartbeat requests to the server to maintain online status. However, this method only performs simple online status maintenance, lacks detection of the authenticity of the heartbeat signal, and the fixed heartbeat interval cannot save resources in the early stages of tracking or improve the accuracy of judgment when the target is close to being met. Fourth, the single-user one-way statistical method based on dwell time. This method only records the online time of a single user, and cannot bind the dwell time to a specific scene or room, nor can it perform detailed statistics on user behavior at the scene level. Fifth, one-way interactive detection methods, such as timed face recognition or pop-up interactive verification, although they have authenticity detection, lack time accumulation semantics, do not have heartbeat timing data, and cannot generate correlation data between users.
[0004] The aforementioned existing technologies all perform online status monitoring or duration statistics on a single-user basis, failing to address the accurate verification problem of two users being present simultaneously. Client-side timing is susceptible to tampering; entry and exit events rely on uncontrollable departure event reporting; fixed heartbeat intervals lack behavioral authenticity detection and cannot adaptively adjust frequency; single-user statistics cannot correlate the states of both parties; and interactive verification lacks duration accumulation logic. Existing solutions either distrust the client and cannot handle abnormal departure events, or rely on client reporting but lack anti-tampering mechanisms. Neither can build a server-controllable, independent, scenario-specific joint presence verification solution without trusting the client.
[0005] Therefore, there is an urgent need in this field for a method that can accurately verify the presence of two users for a specified duration through two-way heartbeat tracking and multi-dimensional real-time identity determination on the server side, without trusting the client. Summary of the Invention
[0006] To address the problems in existing technologies, such as the ease with which local client-side timing data can be tampered with, the lack of exit events due to abnormal exits, the fixed heartbeat intervals and the lack of behavioral authenticity detection, the inability to subdivide dwell time statistics at the scene or room level, and the inability to generate user-related data, this invention provides a social co-presence verification method and system based on heartbeat tracking and identity determination to solve the aforementioned technical deficiencies.
[0007] This invention proposes a social co-presence verification method based on heartbeat tracking and identity determination, comprising the following steps: S1. In the distributed cache, maintain a tracking data structure for the invitation relationship. The tracking data structure includes the identifiers of both parties, the cumulative stay time of both parties, the last heartbeat time of both parties, and the scene identifier. S2. Receive the heartbeat signal reported by the reporting party at heartbeat intervals, perform verification on the heartbeat signal, including scene consistency verification, basic identity validity verification and tracking data consistency verification. After all verifications pass, acquire the directional exclusive lock. Under the protection of the directional exclusive lock, perform an accumulation operation on the cumulative dwell time corresponding to the reporting party in the tracking data structure, and update the last heartbeat time corresponding to the reporting party in the tracking data structure. S3. During the execution of the accumulation operation, the heartbeat sequence is judged to be abnormal based on the time-series statistical characteristics of the heartbeat arrival time interval. If it is determined to be abnormal, the accumulation of the reporting party's cumulative dwell time is prohibited. S4. Driven by a timed task, read the cumulative dwell time and the last heartbeat time of both parties from the tracking data structure; when the cumulative dwell time of both parties reaches the preset threshold, the joint presence verification is confirmed to be successful; when the last heartbeat time of both parties meets the timeout condition, the timeout status is determined. S5. When the joint presence verification is successful in step S4 and when the timeout is determined, perform multi-dimensional identity determination; if the identity determination result is invalid, terminate the current verification and output the verification failure determination result; if the identity determination result is valid, output the corresponding determination result according to the determination result in step S4 and terminate the current verification.
[0008] This invention also proposes a social co-presence verification system based on heartbeat tracking and identity determination to implement the above method. The system includes: The data structure maintenance module is configured to maintain a tracking data structure for invitation relationships in a distributed cache. The tracking data structure includes the identifiers of both parties, the cumulative stay time of both parties, the last heartbeat time of both parties, and the scene identifier. The heartbeat receiving and accumulating module is configured to receive heartbeat signals reported by the reporting party at heartbeat intervals, perform verification on the heartbeat signals, including scene consistency verification, basic identity validity verification, and tracking data consistency verification. After all verifications pass, it acquires a directional exclusive lock. Under the protection of the directional exclusive lock, it performs an accumulation operation on the cumulative dwell time corresponding to the reporting party in the tracking data structure, and updates the last heartbeat time corresponding to the reporting party in the tracking data structure. The anomaly detection module is configured to determine whether the heartbeat sequence is abnormal based on the time-series statistical characteristics of the heartbeat arrival time interval during the execution of the accumulation operation. If an anomaly is determined, the accumulation of the reporting party's cumulative dwell time is prohibited. The timed check module is configured to be driven by a timed task. It reads the cumulative dwell time of both parties and the last heartbeat time of both parties from the tracking data structure. When the cumulative dwell time of both parties reaches the preset threshold, the joint presence verification is confirmed to be successful. When the last heartbeat time of both parties meets the timeout condition, the timeout status is determined. The identity determination module is configured to perform multi-dimensional identity determination when the timed check module determines that the joint presence verification has passed or when a timeout occurs. If the identity determination result is invalid, the current verification will be terminated and a verification failure result will be output. If the identity determination result is valid, the corresponding determination result will be output according to the determination result of the timed check module and the current verification will be terminated.
[0009] The present invention also proposes a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, it implements the steps of the above-mentioned social co-presence verification method based on heartbeat tracking and identity determination.
[0010] The present invention also proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the aforementioned social co-presence verification method based on heartbeat tracking and identity determination.
[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) By controlling the fixed value of the cumulative step size on the server side and combining it with an exclusive lock to limit the heartbeat processing frequency in the same direction within the preset mutual exclusion window, the client cannot accelerate the accumulation of dwell time, thus fundamentally eliminating the possibility of falsifying the duration data.
[0012] (2) By maintaining the cumulative dwell time and last heartbeat time of both the inviter and the invitee in the same tracking data structure of the distributed cache, and determining whether both parties have reached the threshold during the periodic check, bidirectional collaborative verification is achieved.
[0013] (3) By binding heartbeat tracking with scene identifiers, and combining the three steps of reading the current scene identifier, comparing with the target scene identifier, and writing the conditions to the new scene identifier into an atomic execution when a scene switching operation is detected, the race window in the first read and then set scheme is eliminated, the atomicity of clearing old data and initializing new scene is achieved when scene switching, and cross-scene data pollution is prevented. At the same time, when clicking repeatedly in the same scene, the existing accumulated time is retained and the survival time is not refreshed, thus avoiding accidental reset of the existing progress.
[0014] (4) By calculating the interval standard deviation, kurtosis and autocorrelation coefficient of the heartbeat arrival time interval sequence, the interval standard deviation is less than the first threshold and the kurtosis is less than the second threshold, or the interval standard deviation is less than the first threshold and the absolute value of the autocorrelation coefficient is less than the third threshold. The automated fake heartbeat is identified without relying on device fingerprint or client auxiliary information, and the behavior authenticity verification based on time-series statistical features is realized.
[0015] (5) The current tracking progress is determined by the ratio of the larger of the cumulative dwell time of both parties to the preset threshold. A larger heartbeat interval is used during the warm-up period to reduce the processing pressure on the server, and a smaller heartbeat interval is used during the sprint period to improve the sampling density and judgment accuracy, thus realizing adaptive closed-loop control of the heartbeat frequency.
[0016] (6) The identity determination module repeatedly performs identity determination at multiple key nodes such as the verification stage and the timed check stage, and terminates the verification process when the identity expires, so as to ensure that only users who meet the identity conditions throughout the process can complete the binding verification. Attached Figure Description
[0017] Other features, objects, and advantages of the present invention will become more apparent from the following detailed description of non-limiting embodiments, taken with reference to the accompanying drawings: Figure 1 This is a flowchart of a social co-presence verification method based on heartbeat tracking and identity determination; Figure 2 This is a structural diagram of a social co-presence verification system based on heartbeat tracking and identity determination; Figure 3 This is a schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present invention. Detailed Implementation
[0018] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0019] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0020] Figure 1 A flowchart illustrating a social co-presence verification method based on heartbeat tracking and identity determination is shown. Figure 1 As shown, the method includes the following steps S1 to S5, as detailed below.
[0021] Step S1: Maintain a tracking data structure for the invitation relationship in the distributed cache. The tracking data structure includes the identifiers of both parties, the cumulative stay time of both parties, the last heartbeat time of both parties, and the scene identifier.
[0022] In this embodiment, the distributed cache is implemented using Redis distributed cache, and the tracking data structure is stored using Redis's hash structure. For each ongoing invitation relationship, a hash key is maintained in Redis. The fields of this hash key include inviter identifier, invitee identifier, scenario type, scenario identifier, inviter's cumulative stay time, invitee's cumulative stay time, inviter's last heartbeat time, invitee's last heartbeat time, and last check time. The inviter identifier uniquely identifies the user who initiated the invitation, the invitee identifier uniquely identifies the user who received the invitation, the scenario type identifies the category of the scenario (e.g., voice chat room, chat circle, or family), and the scenario identifier uniquely identifies the specific scenario room within the same scenario category. The time-to-live (TTL) of this hash key is aligned with the validity period of the invitation card and is automatically cleared by Redis after expiration, requiring no additional cleanup task. Simultaneously, a card click marker is maintained in Redis as a string structure. The key of this marker is a fixed key name, and the value is a string in the format "scenario type:scenario identifier". The TTL of this card click marker is also aligned with the validity period of the invitation card. Each invitation relationship corresponds to an invitation record, which is stored in a relational database and includes at least the inviter identifier, the invitee identifier, the scenario identifier, the invitation status, and the invitation initiation time.
[0023] As an alternative implementation, for caching middleware, Redis can be replaced with Memcached, Tair, or a local process memory cache; for relational databases paired with Redis, MongoDB plus Redis can be used, or ClickHouse can be used to store heartbeat details. Regarding the tracking data structure, a dual-user independent heartbeat tracking storage structure can be adopted, i.e., two independent hash structures are used to store the heartbeat data of the inviter and the invitee respectively; a Redis Stream time-series structure is used to store each heartbeat report record, with offline aggregation of duration; no time-to-live (TTL) binding is used, and expired and invalid tracking data is cleaned up in batches by a separate scheduled task; MongoDB is used for persistent storage of heartbeat details, and Redis is only used for hotspot caching to accelerate the process.
[0024] Step S2: Receive the heartbeat signal reported by the reporting party at heartbeat intervals, and perform verification on the heartbeat signal. The verification includes scene consistency verification, basic identity validity verification, and tracking data consistency verification. After all verifications pass, acquire the directional exclusive lock. Under the protection of the directional exclusive lock, perform an accumulation operation on the cumulative dwell time corresponding to the reporting party in the tracking data structure, and update the last heartbeat time corresponding to the reporting party in the tracking data structure.
[0025] In this embodiment, the heartbeat signal is sent periodically by the client. The heartbeat interval is dynamically determined by the server and sent to the client. The client reports the heartbeat according to the heartbeat interval. The heartbeat signal carries the reporting party's role identifier, scene type, scene identifier, and heartbeat signal sending timestamp. The reporting party can be either the inviter or the invitee. The role identifier is used to indicate whether the current heartbeat signal comes from the inviter or the invitee.
[0026] The heartbeat signal is validated, including scenario consistency validation, basic identity validity validation, and tracking data consistency validation.
[0027] In the scenario consistency check, the card click marker in Redis is read to obtain the scenario type and scenario identifier, which are then compared with the scenario type and scenario identifier carried in the heartbeat signal. If the scenario type in the card click marker does not match the scenario type in the heartbeat signal, or if the scenario identifier in the card click marker does not match the scenario identifier in the heartbeat signal, it indicates that the invitation context corresponding to the heartbeat signal has expired. The heartbeat signal is then discarded and the current check process is terminated.
[0028] In the basic identity validity verification, the identity determination logic is invoked to perform basic identity verification on both the reporting party and the other party. This basic identity verification is a fast interception layer that queries the identity determination results in the distributed cache to determine whether the reporting party and the other party possess the basic identity qualifications. If the basic identity of either the reporting party or the other party is invalid, the heartbeat signal is discarded and the current verification process is terminated. The reporting party is either the inviter or the invitee, and the other party is either the inviter or the invitee.
[0029] During the trace data consistency check, the trace data structure in Redis is read, and the inviter identifier and scenario identifier in the trace data structure are checked against the inviter identifier and scenario identifier in the invitation record. If they are inconsistent, it indicates that the trace data has been corrupted or the record has been modified. The heartbeat signal is discarded, and the current verification process is terminated.
[0030] After all validations pass, an exclusive lock is acquired for each direction, defined by the reporting party and the receiving party. This exclusive lock is implemented using a Redis distributed lock, with the lock key set to "direction lock:reporting party ID:receiving party ID". The lock's mutual exclusion window is 3 seconds. If the same direction repeatedly sends heartbeat requests within 3 seconds, subsequent requests will be blocked or rejected because they cannot acquire the lock, thus preventing repeated processing in the same direction within a short period. The lock from the inviter to the invitee and the lock from the invitee to the inviter are two independent locks that do not block each other.
[0031] After acquiring the directional exclusive lock, under its protection, an increment operation is performed on the cumulative dwell time corresponding to the reporting party in the tracking data structure. An atomic increment operation is performed on the cumulative dwell time field corresponding to the reporting party using Redis, with the increment being a fixed heartbeat interval value. Simultaneously, an update operation is performed in Redis to update the last heartbeat time field corresponding to the reporting party to the current server timestamp, and the lifetime of the tracking data structure is refreshed using Redis's time-to-live (TTL) setting operation. Additionally, the last check time in the tracking data structure is updated to the current server time to ensure the timeout judgment benchmark for the scheduled task remains up-to-date. These three operations are completed atomically via a Redis pipeline in a single network round trip. The directional exclusive lock is released after the increment operation is completed.
[0032] As an alternative implementation, instead of using pipelines, incremental operations, update operations, and time-to-live (TTL) settings can be performed step-by-step, one-by-one.
[0033] Step S3: During the execution of the accumulation operation, determine whether the heartbeat sequence is abnormal based on the time-series statistical characteristics of the heartbeat arrival time interval. If it is determined to be abnormal, then continue to accumulate the cumulative dwell time of the reporting party.
[0034] In this embodiment, during the execution of the accumulation operation, the anomaly of the heartbeat sequence is determined based on the temporal statistical characteristics of the heartbeat arrival time interval. These temporal statistical characteristics include the standard deviation of the interval, kurtosis, and autocorrelation coefficient. This step serves as a bypass analysis, not blocking the heartbeat receiving process itself. The sliding window is maintained on the server side, and the client cannot perceive or intervene in it. The threshold parameters are distributed through the configuration center and can be dynamically adjusted based on actual operational data.
[0035] The server maintains a sliding window for heartbeat arrival times for each reporting party, with a window size of [size missing]. The value is 10, recording the most recent The sequence of time intervals between heartbeats is denoted as... Calculate the standard deviation of the heartbeat arrival time interval sequence. kurtosis and autocorrelation coefficient .
[0036] Standard deviation of interval Calculated using the following expression:
[0037] in, For the first The time interval between heartbeats; This represents the mean of the heartbeat arrival time interval sequence. ; To adjust the sliding window size, .
[0038] Kudo Calculated using the following expression:
[0039] in, For the first The time interval between heartbeats; This is the mean of the heartbeat arrival time interval sequence; To adjust the sliding window size, .
[0040] For normal users, due to occasional long intervals, kurtosis A value greater than 0 indicates a leptokurtic (peaked) and heavy-tailed distribution; for script-forged sequences, the kurtosis... A value approximately equal to 0 indicates a near-normal distribution, while a value less than 0 indicates an overly concentrated distribution.
[0041] Autocorrelation coefficient Calculated using the following expression:
[0042] in, For the first The time interval between heartbeats; For the first The time interval between heartbeats; This is the mean of the heartbeat arrival time interval sequence; To adjust the sliding window size, .
[0043] For normal users, the autocorrelation coefficient Typically, the autocorrelation coefficient is between 0.1 and 0.4, showing a slight positive correlation; for script-faked sequences, the autocorrelation coefficient is... It approaches 0, indicating no correlation at all.
[0044] When the standard deviation of the interval Less than the first threshold (For example, (seconds) and kurtosis Less than the second threshold (For example, When this occurs, the heartbeat sequence is determined to be abnormal.
[0045] Or, when the interval standard deviation Less than the first threshold And the autocorrelation coefficient absolute value Less than the third threshold (For example, When this occurs, the heartbeat sequence is determined to be abnormal.
[0046] When a heartbeat sequence is determined to be abnormal, the accumulation of the reporting party's cumulative dwell time is prohibited. That is, the accumulation operation of the cumulative dwell time field corresponding to that reporting party is suspended. However, heartbeat signals continue to be received, and the last heartbeat time corresponding to that reporting party in the tracking data structure is updated to avoid triggering a timeout judgment due to a prolonged absence of heartbeats. Simultaneously, a suspected abnormal state is marked in the tracking data structure.
[0047] Once an abnormality is identified in the heartbeat sequence, if the time-series statistical characteristics of the subsequent sliding window return to the normal range, i.e., the interval standard deviation... No longer less than the first threshold or kurtosis No longer less than the second threshold And the autocorrelation coefficient absolute value No longer less than the third threshold If the pause is lifted, the accumulation operation on the tracking data structure will resume.
[0048] Step S4: Driven by a timed task, read the cumulative dwell time of both parties and the last heartbeat time of both parties from the tracking data structure; when the cumulative dwell time of both parties reaches the preset threshold, the joint presence verification is confirmed to be successful; when the last heartbeat time of both parties meets the timeout condition, the timeout situation is determined.
[0049] In this embodiment, the scheduled task is a periodic task scheduler built into the server, which executes once every 10 seconds to check all invitation records in the tracking state in parallel.
[0050] Driven by a scheduled task, the system reads the cumulative dwell time of inviters from the tracking data structure. Total length of stay for invitees The inviter's last heartbeat time The invitee's last heartbeat time and the final inspection time Each time a scheduled task is executed, after reading the cumulative dwell time and the last heartbeat time of both parties from the tracking data structure, the last check time in the tracking data structure is updated to the current server time to ensure that the benchmark for subsequent timeout judgments is always up-to-date.
[0051] When the inviter's cumulative stay time Total length of stay for invitees All reached or exceeded the preset threshold. At that time, that is and The joint presence was confirmed to verify the results.
[0052] The timeout status is determined when the last heartbeat time between both parties meets the timeout condition. The timeout condition includes any of the following: First, calculate the last heartbeat time of the inviter. Last heartbeat time with the invitee The difference between them, when the difference is greater than or equal to twice the heart rate interval. At that time, that is This indicates that one party has disconnected but the other party is still reporting, confirming a timeout situation.
[0053] Second, calculate the current server time. With the last check time in the tracking data structure The difference between them, when the difference is greater than or equal to three times the heart rate interval. At that time, that is This indicates that the scheduled task itself has experienced a delay and needs to be compensated for, thus determining the timeout situation.
[0054] Third, check the reporting status of both parties. If one of the inviter and the invitee has never reported a heartbeat (i.e., the last heartbeat time of that party is zero) and the other party has reported a heartbeat, it means that one party has not responded since the tracking started, thus confirming a timeout.
[0055] Fourth, check the consistency of the tracking data. When the inviter identifier or scene identifier in the tracking data structure is inconsistent with the corresponding identifier in the invitation record, it indicates that the tracking data has been abnormally changed or the record has been tampered with, and the timeout situation is determined.
[0056] Once the joint presence verification is successful, a completion event is published via a message queue, and subsequent binding logic is executed asynchronously by an independent consumer. The message queue is implemented using message middleware such as Kafka or RocketMQ. The completion event includes the inviter's identifier, the invitee's identifier, and the scene identifier. The subsequent binding logic includes updating the user's status and recording the binding relationship. When a timeout is detected, the invitation record status is rolled back to "sent" instead of being deleted. If the invitation needs to be reactivated later, the invitee needs to click the invitation card again to enter the associated room. When the client determines that entry is valid, it calls the server interface to regenerate the tracking data structure mentioned in step S1. The rollback and recovery design ensures that temporary interruptions such as brief network fluctuations or temporary client focus loss will not cause the invitation task to permanently fail. When the user returns to the scene, the system can continue accumulating from the existing tracking data.
[0057] The verification is terminated based on the joint presence verification pass result or timeout result. Terminating the verification means terminating the heartbeat reception and accumulation operation in step S2 and the timed drive check in step S4, and releasing the direction exclusive lock obtained in step S2.
[0058] As an alternative implementation, in terms of message queues, Kafka or RocketMQ can be replaced with other message middleware such as Pulsar or RabbitMQ; in terms of scheduled task components, the server-side built-in periodic task scheduler can be replaced with distributed scheduling frameworks such as XXL-Job or Airflow.
[0059] Step S5: When the joint presence verification is successful in step S4 and when the timeout is determined, perform multi-dimensional identity determination; if the identity determination result is invalid, terminate the current verification and output the verification failure determination result; if the identity determination result is valid, output the corresponding determination result according to the determination result in step S4 and terminate the current verification.
[0060] In this embodiment, the multi-dimensional identity determination includes the determination of the inviter's identity and the determination of the referrer's identity. The referrer is the invitee, and this role is referred to as the referrer in the identity determination dimension to distinguish it from the inviter role. This determines whether the target user possesses the potential value of being invited back to the scenario.
[0061] For inviter identity verification, a three-stage architecture is adopted, consisting of fast caching, multi-dimensional concurrent verification, and result caching. First, the inviter verification result is queried from the distributed cache. A dual-caching strategy (positive and negative) is used, caching both valid and invalid inviter verification results for a 2-minute lifespan. If the cache is hit, the verification result is returned directly without further verification. If the cache is missed, multi-dimensional verification tasks are executed concurrently within a unified timeout upper bound. The unified timeout upper bound is 5 seconds, and all concurrent verification tasks must be completed within 5 seconds. Multi-dimensional verification tasks include at least one of the following: determining whether a user belongs to the inviter profile group through a user profiling service; the inclusion criteria for the inviter profile group are determined by at least one feature vector from registration duration, active days, online time in specific scenarios, and violation records; calculating a time-decayed weighted activity score based on the user's behavioral event sequence, applying an exponential decay weight to each behavioral event, with recent behavior contributing significantly more than long-term behavior, thus capturing user activity trends rather than just total activity; obtaining the user's guild contract status and simultaneously evaluating their ability to initiate interactions on social networks and the effectiveness of historical invitations. After all multi-dimensional verification tasks are completed, the A / B testing platform is invoked to determine whether the user is in the experimental group. If the user is in the experimental group, the inviter's identity is deemed valid; if the user is in the control group, the inviter's identity is deemed invalid. The validity of the inviter's identity is determined based on the verification results of the multi-dimensional verification tasks, and the determination result is written to a distributed cache with a lifespan of 2 minutes.
[0062] For user identification during referrals, a layered funnel-style serial filtering architecture is employed. First, the binding relationship data source is queried. If the referral user has already been successfully bound by any inviter, they are directly excluded, and the same user cannot be repeatedly referred within a single cycle. Second, the user status marker in the distributed cache is queried. If the user status marker exists, the identity is deemed invalid, and the decision process terminates. The user status marker indicates whether the referral user has been marked as not meeting the referral criteria. This marker is initially empty and gradually accumulates through reverse filling in subsequent funnel layers; this is the core layer of the self-learning mechanism. Then, the user profile service determines whether the referral user belongs to a consumer user profile group (i.e., a user group with recent consumption behavior). If a match is found, the user's consumption marker is written back to the second-layer cache for self-learning backfilling, and the decision process terminates early. Subsequently, the business and financial transaction service is invoked to query whether the referred users have actual consumption records for the day. This layer is used to compensate for the T+1 update delay of the user profile service. That is, when a user profile has not been updated but a consumption has occurred on the same day, the business and financial transaction service is used to capture these users in real time and backfill the consumption mark to the cache, so that subsequent queries can directly hit the cache layer. If there is a consumption record, it is also written back to the second layer of cache before the judgment is terminated. When the query is abnormal, a conservative strategy is adopted to consider that there is consumption but not to write it to the cache, so as to avoid the solidification of erroneous results. Finally, the return potential of referred users is evaluated based on the user activity cycle model, excluding users who have completely churned. If the referred user is in a mild inactivity period (7 to 14 days without entering the scene), the identity is determined to be valid. If the user is in a moderate inactivity period (14 to 30 days without entering the scene), the identity is determined to be valid. If the user is in a deep inactivity period (more than 30 days without entering the scene), the identity is determined to be invalid.
[0063] If the identity verification result is invalid, the verification will be terminated and a verification failure result will be output. If the identity verification result is valid, the corresponding result will be output according to the determination result of step S4 and the verification will be terminated. That is, if step S4 determines that the joint presence verification is passed, the joint presence verification passed result will be output; if step S4 determines that the timeout is a case, the timeout result will be output.
[0064] In this embodiment of the invention, the identity verification method and the heartbeat tracking method do not operate independently, but rather form a multi-verification, defense-in-depth system throughout the entire lifecycle of the invitation process. In the basic identity validity verification in step S2, the identity verification logic is invoked to perform basic identity verification on both the reporting party and the other party, ensuring that users participating in heartbeat accumulation possess basic identity qualifications. This basic identity verification is a fast interception layer used to filter out obviously invalid users before heartbeat accumulation. In step S5, when the scheduled task determines that the joint presence verification has passed and when a timeout is determined, multi-dimensional identity verification is performed again. This multi-dimensional identity verification is based on multiple dimensions such as user profile segmentation, time-decay weighted activity evaluation, and social influence evaluation for in-depth judgment, ensuring higher accuracy of the judgment results.
[0065] The two identity verification steps mentioned above are not simply repetitive, but rather form different layers of defense-in-depth: the basic identity validity verification in step S2 is a preliminary fast filtering layer, focusing on response speed and basic qualification screening; the multi-dimensional identity verification in step S5 is a deep confirmation layer, focusing on comprehensive evaluation across multiple dimensions. Identity verification is performed multiple times during heartbeat tracking, ensuring that only users who meet all identity requirements throughout the process can complete the binding verification, thus resolving the issue of dynamic changes in user identities during the tracking period.
[0066] In this embodiment of the invention, when the invitee clicks on an invitation card pointing to a different scene, an atomic switch of the scene identifier is performed.
[0067] Specifically, atomic operations are implemented using Redis Lua scripts. This script combines the three steps of reading the current scene identifier, comparing it with the target scene identifier, and writing the condition to the new scene identifier into a single atomic execution, eliminating the race window in the traditional fetch-then-set approach. The Lua script's logic is as follows: First, a fetch operation is performed to retrieve the current value of the card click marker in Redis. The current value is a string combining the scene type and scene identifier, in the format "scene type:scene identifier". The retrieved current value is then compared with the target scene type and target scene identifier carried in the request parameters. If they match, it means the user clicked on an invitation card for the same scene, and the script returns 0. If they do not match, a set operation is performed to update the card click marker to the new "scene type:scene identifier" combination, and a value of 1 is returned.
[0068] When the return value is 1, indicating a scenario change, the system triggers a concurrent reset, performing the reset operation in a three-way parallel manner, setting a unified timeout upper bound. Specifically, the tracking data structure is reset, meaning the cumulative dwell time of the inviter and the cumulative dwell time of the invitee are reset to zero, the last heartbeat time of the inviter and the last heartbeat time of the invitee are reset to the current server time, and the scenario type and scenario identifier are updated to the new scenario information; the persistent heartbeat logs in the inviter's direction are reset; and the persistent heartbeat logs in the invitee's direction are reset.
[0069] When the return value is 0, indicating that the scenario has not changed, only the heartbeat time synchronization operation is performed. This means updating the last heartbeat time of the inviter and the last heartbeat time of the invitee in the tracking data structure to the current server time, while retaining the existing accumulated dwell time. At this time, the lifespan of the tracking data structure is not refreshed, meaning the validity period of the card click marker is not extended, ensuring that the original countdown of the card click marker is not disturbed and that the tracking has a clear end time.
[0070] When the tracking data structure is updated to a new scenario, if the invitee clicks the invitation card for the same scenario again, the Lua script will return a value of 0 because it detects that the current value is consistent with the target value. At this time, only the heartbeat time is synchronized, and the accumulated time is retained, thus avoiding the accidental reset of the existing progress.
[0071] In this embodiment of the invention, the invitation to enter the scene room before receiving the heartbeat signal is a high-frequency event. To reduce network latency, the system uses pipeline technology to simultaneously acquire three pieces of data in one network round trip: the value of the card click marker, all fields of the tracking data structure, and the remaining validity period of the card click marker.
[0072] Specifically, three requests are sent simultaneously through the Redis pipeline: one to retrieve the card click tag value, one to retrieve all fields of the tracking data structure, and one to retrieve the remaining validity period of the card click tag. The three responses are then merged into a single network round trip.
[0073] Multiple checks are performed locally based on the acquired data. If the card click marker is valid (i.e., the card click marker exists and has not expired), and the tracking data structure does not exist, a new tracking data structure is created. The inviter identifier, invitee identifier, scene type, and scene identifier are written into the data structure. The cumulative dwell time for both parties is initialized to 0, the last heartbeat time for both parties is initialized to the current server time, the last check time is initialized to the current server time, and the lifespan is set to the remaining validity period of the card click marker. If the card click marker is valid and the tracking data structure already exists, the existing cumulative dwell time is synchronized, i.e., the cumulative dwell time in the existing tracking data structure is directly used as the initial value, without recreating it. If the card click marker is invalid (i.e., the card click marker does not exist or has expired), the process is terminated, and no new tracking data structure is created.
[0074] In this embodiment, the current tracking progress is determined based on the ratio of the greater of the cumulative dwell times of both parties to a preset threshold. Progress Ratio Calculated using the following expression:
[0075] in, The progress ratio; The total length of stay for the inviter; The total length of stay for invitees; This is a preset threshold.
[0076] The target heartbeat interval is determined based on the current tracking progress. According to the progress ratio Dynamic calculation is represented by the following piecewise function:
[0077] in, The heart rate interval is a function of the rate of progress. The progress ratio; The preferred progress threshold is the first progress threshold. ; The preferred second progress threshold ; For the preheating interval, the preferred Second; To ensure a stable interval, the preferred method is... Second; For the sprint interval, the preferred Seconds. And, .
[0078] The adopted heartbeat interval is sent to the client. After receiving the new heartbeat interval, the client adjusts the reporting frequency of subsequent heartbeat signals according to this interval. After receiving the heartbeat signal with the adjusted frequency, the server continues to perform the accumulation and update operation according to step S2. This process is repeated iteratively to achieve adaptive closed-loop control of the heartbeat frequency.
[0079] When calculating the duration of shared presence, a method is used that combines the heartbeat time difference between the two parties with the server-side time difference. Validity is determined by reading the last heartbeat timestamp of each party during each scheduled check. and If and only if the time interval between the last heartbeats of both parties is less than twice the heartbeat interval. At that time, that is This determines that both parties are still in a state of joint presence. The duration accumulation rule is as follows: each time a valid heartbeat is received from one party, the server uses the current server time. Subtract the time of the last heartbeat of that person. As the cumulative amount ,Right now:
[0080] in, For the first The cumulative amount this time; The current server time; The time of Fang's last heartbeat.
[0081] The cumulative amount The atomic value is added to the cumulative dwell time field of the target server, and the target server's last heartbeat time is updated to the current server time. .
[0082] Further reference Figure 2As an implementation of the above method, this invention also proposes a social co-presence verification system based on heartbeat tracking and identity determination, which can be applied to various electronic devices. This social co-presence verification system 200 based on heartbeat tracking and identity determination includes the following modules: The data structure maintenance module 210 is configured to maintain a tracking data structure for invitation relationships in a distributed cache. The tracking data structure includes the identifiers of both parties, the cumulative stay time of both parties, the last heartbeat time of both parties, and the scene identifier.
[0083] The heartbeat receiving and accumulating module 220 is configured to receive heartbeat signals reported by the reporting party at heartbeat intervals, perform verification on the heartbeat signals, including scene consistency verification, basic identity validity verification, and tracking data consistency verification. After all verifications pass, it acquires a directional exclusive lock. Under the protection of the directional exclusive lock, it performs an accumulation operation on the cumulative dwell time corresponding to the reporting party in the tracking data structure, and updates the last heartbeat time corresponding to the reporting party in the tracking data structure.
[0084] The anomaly detection module 230 is configured to determine whether the heartbeat sequence is abnormal based on the time-series statistical characteristics of the heartbeat arrival time interval during the execution of the accumulation operation. If an anomaly is determined, the accumulation of the reporting party's cumulative dwell time is prohibited.
[0085] The timed check module 240 is configured to be driven by a timed task. It reads the cumulative dwell time of both parties and the last heartbeat time of both parties from the tracking data structure. When the cumulative dwell time of both parties reaches the preset threshold, it determines that the joint presence verification is passed. When the last heartbeat time of both parties meets the timeout condition, it determines the timeout situation.
[0086] The identity determination module 250 is configured to perform multi-dimensional identity determination when the timed check module determines that the joint presence verification has passed or when a timeout is determined. If the identity determination result is invalid, the current verification will be terminated and a verification failure result will be output. If the identity determination result is valid, the corresponding determination result will be output according to the determination result of the timed check module and the current verification will be terminated.
[0087] In a specific embodiment, the social co-presence verification system based on heartbeat tracking and identity determination provided by the present invention also includes a scene switching module, which is configured to read the current scene identifier in the tracking data structure through an atomic script when a scene switching operation is detected, compare the current scene identifier with the target scene identifier, and write a new scene identifier according to the comparison result. If the scene changes, the cumulative stay time of both parties is reset; if the scene does not change, the cumulative stay time of both parties is retained and the survival time of the tracking data structure is not refreshed.
[0088] In a specific embodiment, the social co-presence verification system based on heartbeat tracking and identity determination provided by the present invention further includes an adaptive frequency modulation module, configured to determine the current tracking progress based on the ratio of the larger of the cumulative dwell time of both parties to a preset threshold. When the ratio is lower than a first progress threshold, a first heartbeat interval is used; when the ratio is between the first progress threshold and a second progress threshold, a second heartbeat interval is used; when the ratio reaches or exceeds the second progress threshold, a third heartbeat interval is used, and the adopted heartbeat interval is sent to the client.
[0089] The following is for reference. Figure 3 It shows a schematic diagram of the structure of a computer system 300 suitable for implementing terminal devices or servers of the present invention. Figure 3 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0090] like Figure 3 As shown, the computer system 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 302 or programs loaded from storage section 308 into random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the computer system 300. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0091] The following components are connected to I / O interface 305: an input section 306 including a keyboard, mouse, etc.; an output section 307 including a liquid crystal display (LCD) and speakers, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card and a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to I / O interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 310 as needed so that computer programs read from it can be installed into storage section 308 as needed.
[0092] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the functions defined in the methods of this invention. It should be noted that the computer-readable medium described in this invention can be a computer-readable signal medium or a computer-readable medium or any combination thereof. The computer-readable medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0093] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0094] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0095] The above description is merely a preferred embodiment of the present invention and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention is not limited to the specific combination of the above-described technical features, but also includes other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in this invention.
Claims
1. A social co-presence verification method based on heartbeat tracking and identity determination, characterized in that, Includes the following steps: S1. In the distributed cache, maintain a tracking data structure for the invitation relationship. The tracking data structure includes the identifiers of both parties, the cumulative stay time of both parties, the last heartbeat time of both parties, and the scene identifier. The identifiers of both parties include the identifier of the inviter and the identifier of the invitee. The cumulative stay time of both parties includes the cumulative stay time of the inviter and the cumulative stay time of the invitee. The last heartbeat time of both parties includes the last heartbeat time of the inviter and the last heartbeat time of the invitee. S2. Receive heartbeat signals reported by the reporting party at heartbeat intervals, and perform verification on the heartbeat signals. The verification includes scene consistency verification, basic identity validity verification, and tracking data consistency verification. After all verifications pass, acquire a directional exclusive lock. The directional exclusive lock is used to prevent the same direction from repeatedly processing heartbeat requests within a preset mutual exclusion window. Under the protection of the directional exclusive lock, perform an accumulation operation on the cumulative dwell time corresponding to the reporting party in the tracking data structure, and update the last heartbeat time corresponding to the reporting party in the tracking data structure. S3. During the execution of the accumulation operation, the heartbeat sequence is judged to be abnormal based on the time-series statistical characteristics of the heartbeat arrival time interval. If it is determined to be abnormal, the accumulation of the cumulative dwell time of the reporting party is prohibited. S4. Driven by a timed task, read the cumulative dwell time of both parties and the last heartbeat time of both parties from the tracking data structure; When the cumulative time spent by both parties reaches the preset threshold, the joint presence verification is confirmed to be successful; when the last heartbeat time of both parties meets the timeout condition, the timeout situation is confirmed. S5. When the joint presence verification is confirmed to be successful in step S4 and when the timeout is confirmed, perform multi-dimensional identity determination; if the identity determination result is invalid, terminate the current verification and output the verification failure result. If the identity verification result is valid, the corresponding verification result will be output according to the determination result of step S4 and the verification will be terminated. In step S5, the multi-dimensional identity determination includes determining the identity of the inviter and the identity of the user who referred the user: The inviter identity determination includes: querying the inviter determination results in the distributed cache; if a match is found, the determination result is returned directly; if the cache misses, a multi-dimensional verification task is executed concurrently within a unified timeout upper bound; the validity of the inviter's identity is determined based on the verification results of the multi-dimensional verification task, and the determination result is written into the distributed cache. The identification of the referral user includes: querying the user status marker in the distributed cache; if the user status marker exists, the referral user's identity is determined to be invalid and the identification process is terminated; if the user status marker is not found, user behavior evaluation is performed; and the validity of the referral user's identity is determined based on the result of the user behavior evaluation.
2. The social co-presence verification method based on heartbeat tracking and identity determination according to claim 1, characterized in that, In step S2, the heartbeat signal carries the role identifier of the reporting party. Based on the role identifier, the heartbeat signal is routed to the cumulative dwell time field and the last heartbeat time field in the tracking data structure corresponding to the reporting party. Step S2 specifically includes the following sub-steps: S21. Read the scene identifier in the card click mark, and verify whether the scene identifier in the card click mark is consistent with the scene identifier in the heartbeat signal. If they are inconsistent, discard the heartbeat signal and terminate the current verification process. S22. Verify the basic identity validity of the reporting party and the other party. If the identity is invalid, discard the heartbeat signal and terminate the current verification process. The reporting party is either the inviter or the invitee, and the other party is either the inviter or the invitee. S23. Read the tracking data structure and verify whether the inviter identifier and scene identifier in the tracking data structure are consistent with the inviter identifier and scene identifier in the invitation record. If they are inconsistent, discard the heartbeat signal and terminate the current verification process. S24. After all the verifications in steps S21 to S23 pass, a directional exclusive lock is obtained with the reporting party and the other party as the dimensions. The directional exclusive lock is used to prevent the heartbeat request from being processed repeatedly in the same direction within a preset mutual exclusion window. S25. Under the protection of the directional exclusive lock, perform an accumulation operation on the cumulative dwell time corresponding to the reporting party, update the last heartbeat time corresponding to the reporting party to the current server timestamp, and release the directional exclusive lock after the accumulation operation is completed.
3. The social co-presence verification method based on heartbeat tracking and identity determination according to claim 1, characterized in that, In step S3, the abnormality of the heartbeat sequence is determined based on the temporal statistical characteristics of the heartbeat arrival time interval, which specifically includes the following sub-steps: S31. Obtain the sequence of the most recent W heartbeat arrival time intervals, where W represents the sliding window size; S32. Calculate the standard deviation of the interval, kurtosis and autocorrelation coefficient of the heartbeat arrival time interval sequence; S33. When the standard deviation of the interval is less than a first threshold and the kurtosis is less than a second threshold, the heartbeat sequence is determined to be abnormal; or, when the standard deviation of the interval is less than the first threshold and the absolute value of the autocorrelation coefficient is less than a third threshold, the heartbeat sequence is determined to be abnormal. S34. When the heartbeat sequence is determined to be abnormal, if the time-series statistical features of the subsequent sliding window return to the normal range, the pause state is automatically lifted and the accumulation operation on the tracking data structure is resumed.
4. The social co-presence verification method based on heartbeat tracking and identity determination according to claim 1, characterized in that, In step S4, a timeout is determined when the last heartbeat time for both parties meets any of the following timeout criteria: Calculate the difference between the last heartbeat times of the two parties, and determine the timeout situation when the difference is greater than or equal to twice the heartbeat interval; Calculate the difference between the current time and the last check time in the tracking data structure, and determine a timeout when the difference is greater than or equal to three times the heartbeat interval. The system detects the reporting status of both parties. If one party has never reported a heartbeat while the other party has, a timeout is determined.
5. The social co-presence verification method based on heartbeat tracking and identity determination according to claim 1, characterized in that, It also includes S6, when a scene switching operation is detected, performing an atomic switch of the scene identifier, specifically including the following sub-steps: S61. Read the current scene identifier in the tracking data structure through an atomic script, wherein the atomic script is a program script used to perform atomic operations; S62. Compare the current scene identifier with the target scene identifier to obtain the comparison result; S63. Write a new scene identifier based on the comparison results: If the scene changes, reset the cumulative stay time of both parties; If the scenario remains unchanged, the cumulative dwell time of both parties will be retained, and the lifespan of the tracking data structure will not be refreshed.
6. The social co-presence verification method based on heartbeat tracking and identity determination according to claim 1, characterized in that, It also includes S7, which performs adaptive adjustment of the heart rate interval, specifically including the following sub-steps: S71. Determine the current tracking progress based on the ratio of the larger of the cumulative dwell time of both parties to the preset threshold. S72. When the ratio is lower than the first progress threshold, the first heartbeat interval is used; S73. When the ratio is between the first progress threshold and the second progress threshold, the second heartbeat interval is used; S74. When the ratio reaches or exceeds the second progress threshold, a third heartbeat interval is used; S75. Send the adopted heartbeat interval to the client; wherein the first heartbeat interval is greater than the second heartbeat interval, and the second heartbeat interval is greater than the third heartbeat interval.
7. A social co-presence verification system based on heartbeat tracking and identity determination, used to implement the method as described in any one of claims 1 to 6, characterized in that, The system includes: The data structure maintenance module is configured to maintain a tracking data structure for invitation relationships in a distributed cache. The tracking data structure includes the identifiers of both parties, the cumulative stay time of both parties, the last heartbeat time of both parties, and the scene identifier. The identifiers of both parties include the identifier of the inviter and the identifier of the invitee. The cumulative stay time of both parties includes the cumulative stay time of the inviter and the cumulative stay time of the invitee. The last heartbeat time of both parties includes the last heartbeat time of the inviter and the last heartbeat time of the invitee. The heartbeat receiving and accumulating module is configured to receive heartbeat signals reported by the reporting party at heartbeat intervals, perform verification on the heartbeat signals, the verification includes scene consistency verification, basic identity validity verification and tracking data consistency verification, after all verifications pass, acquire a directional exclusive lock, under the protection of the directional exclusive lock, perform an accumulation operation on the cumulative dwell time corresponding to the reporting party in the tracking data structure, and update the last heartbeat time corresponding to the reporting party in the tracking data structure; An anomaly detection module is configured to determine whether the heartbeat sequence is abnormal based on the temporal statistical characteristics of the heartbeat arrival time interval during the execution of the accumulation operation. If an anomaly is determined, the accumulation of the reporting party's cumulative dwell time is prohibited. The timed check module is configured to be driven by a timed task, read the cumulative dwell time of both parties and the last heartbeat time of both parties in the tracking data structure; when the cumulative dwell time of both parties reaches the preset threshold, the joint presence verification is determined to be successful; when the last heartbeat time of both parties meets the timeout condition, the timeout situation is determined. The identity determination module is configured to perform multi-dimensional identity determination when the timed check module determines that the joint presence verification has passed or when a timeout is determined; if the identity determination result is invalid, the current verification is terminated and a verification failure result is output; if the identity determination result is valid, the corresponding determination result is output according to the determination result of the timed check module and the current verification is terminated. In the identity verification module, the multi-dimensional identity verification includes verification of the inviter's identity and verification of the referrer's identity: The inviter identity determination includes: querying the inviter determination results in the distributed cache; if a match is found, the determination result is returned directly; if the cache misses, a multi-dimensional verification task is executed concurrently within a unified timeout upper bound; the validity of the inviter's identity is determined based on the verification results of the multi-dimensional verification task, and the determination result is written into the distributed cache. The identification of the referral user includes: querying the user status marker in the distributed cache; if the user status marker exists, the referral user's identity is determined to be invalid and the identification process is terminated; if the user status marker is not found, user behavior evaluation is performed; and the validity of the referral user's identity is determined based on the result of the user behavior evaluation.
8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the social co-presence verification method based on heartbeat tracking and identity determination as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the social co-presence verification method based on heartbeat tracking and identity determination as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for accessing live broadcast room, live broadcast server and storage medium
CN111246308A
Friend invitation anti-cheating method, system and device and storage medium
CN118827608A
