Ranking list generation method and device, computer device, and storage medium
Patent Information
- Application Number
- CN202211319654.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-26
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2042-10-26
AI Technical Summary
[0004]但是,通过维护全量数据库来生成直播排行榜,每次排序均需要获取对全量数据库中存储的全部用户助力信息进行处理,会降低排行榜的生成效率
[0017] The beneficial effects of the technical solutions provided in this application include at least the following:
Smart Images

Figure CN117255208B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a ranking generation method, apparatus, computer equipment, and storage medium. Background Technology
[0002] During the live stream, viewers can interact with the streamer by gifting virtual items. They can also view the top N viewers who gifted virtual items and their corresponding cumulative item support value through the live stream leaderboard.
[0003] In related technologies, a live streaming leaderboard is generated by maintaining a full database. This full database directly stores the item support values of each user who has performed item gifting in the live stream. Every time a live stream user performs an item gifting operation, the full database is updated to update the corresponding item support value for that user. Then, all the data in the full database is periodically sorted in order to obtain the support information of the top N users that need to be displayed.
[0004] However, generating a live stream leaderboard by maintaining the entire database requires processing all user support information stored in the database for each sort, which reduces the efficiency of leaderboard generation. Summary of the Invention
[0005] This application provides a method, apparatus, computer device, and storage medium for generating ranking lists. The technical solution is as follows:
[0006] According to one aspect of this application, a ranking list generation method is provided, the method comprising:
[0007] In response to the leaderboard update request, the i-th original slice corresponding to the i-th time slice is determined. The i-th original slice stores the i-th cumulative score of the first account. The first account is the account whose score was updated within the i-th time slice. The i-th cumulative score is the cumulative score of the first account before the i-th time slice. i is a positive integer.
[0008] Determine the (i-1)th merged slice corresponding to the (i-1)th time slice. The time interval between the i-th time slice and the (i-1)th time slice is the leaderboard update cycle. The (i-1)th merged slice stores the (i-1)th cumulative score of the second account. The second account is the account whose cumulative score was in the top N positions before the (i-1)th time slice. The (i-1)th cumulative score is the cumulative score of the second account before the (i-1)th time slice. N is a positive integer.
[0009] Based on the i-th original slice and the (i-1)-th merged slice, update the i-th leaderboard corresponding to the i-th time slice. The i-th leaderboard includes at least the accounts whose cumulative scores were in the top N positions before the i-th time slice.
[0010] According to another aspect of this application, a leaderboard generation apparatus is provided, the apparatus comprising:
[0011] The determination module is used to respond to the leaderboard update request and determine the i-th original slice corresponding to the i-th time slice. The i-th original slice stores the i-th cumulative score of the first account. The first account is the account whose score was updated within the i-th time slice. The i-th cumulative score is the cumulative score of the first account before the i-th time slice, where i is a positive integer.
[0012] The determining module is further configured to determine the (i-1)th merged slice corresponding to the (i-1)th time slice, wherein the time interval between the i-th time slice and the (i-1)th time slice is the leaderboard update cycle, and the (i-1)th merged slice stores the (i-1)th cumulative score of the second account, wherein the second account is the account whose cumulative score was in the top N positions before the (i-1)th time slice, and the (i-1)th cumulative score is the cumulative score of the second account before the (i-1)th time slice, where N is a positive integer;
[0013] An update module is used to update the i-th leaderboard corresponding to the i-th time slice based on the i-th original slice and the (i-1)-th merged slice. The i-th leaderboard includes at least the accounts whose cumulative scores were in the top N positions before the i-th time slice.
[0014] According to another aspect of this application, a computer device is provided, comprising: a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the leaderboard generation method as described above.
[0015] According to another aspect of this application, a computer-readable storage medium is provided, which stores a computer program that is loaded and executed by a processor to implement the leaderboard generation method described above.
[0016] According to another aspect of this application, a computer program product is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned ranking generation method.
[0017] The beneficial effects of the technical solutions provided in this application include at least the following:
[0018] This application provides a leaderboard generation method: during the update of the leaderboard in the i-th time slice, it is not necessary to sort the cumulative scores of all accounts. Only the i-th original slice of the i-th time slice (the cumulative scores of accounts whose scores have been updated only in the i-th time slice) and the i-1 merged slice of the (i-1)-th time slice (the cumulative scores of the Top N accounts before the (i-1)-th time slice) need to be processed. Compared with processing all the data, this can greatly reduce the amount of data processing in the leaderboard generation process, improve the real-time generation efficiency of the leaderboard, and improve the processing performance of computer equipment. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of a computer system illustrated in an exemplary embodiment of this application;
[0021] Figure 2 A flowchart illustrating a leaderboard generation method provided in an exemplary embodiment of this application is shown;
[0022] Figure 3 A flowchart of a ranking list generation method provided by another exemplary embodiment of this application is shown;
[0023] Figure 4 This is a schematic diagram illustrating a leaderboard display interface, as shown in an exemplary embodiment of this application.
[0024] Figure 5 This illustration shows a schematic diagram illustrating the relationship between the original slice, the merged slice, and the leaderboard in an exemplary embodiment of this application.
[0025] Figure 6 A flowchart of a ranking list generation method provided by another exemplary embodiment of this application is shown;
[0026] Figure 7 A schematic diagram illustrating the division of the original slice is shown in an exemplary embodiment of this application;
[0027] Figure 8 A flowchart illustrating how a score update operation triggers an update of the original slice is shown in an exemplary embodiment of this application;
[0028] Figure 9This application illustrates a periodic triggering flowchart for slice merging and updating a leaderboard, as shown in an exemplary embodiment.
[0029] Figure 10 This is a structural block diagram of a leaderboard generation apparatus provided in an exemplary embodiment of this application;
[0030] Figure 11 This is a schematic diagram of the structure of a computer device according to an exemplary embodiment. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0032] Figure 1 This is a schematic diagram of a computer system illustrating an exemplary embodiment of this application. Figure 1 As shown, the computer system includes a terminal 110 and a server 120.
[0033] Terminal 110 is a device that requires leaderboard updates. Terminal 110 includes, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft, etc., but this embodiment does not limit it to these. Terminal 110 can run applications that require leaderboard updates, such as game applications, live streaming applications, and social applications. In this embodiment, terminal 110 can send leaderboard update requests to server 120; optionally, terminal 110 can also receive the latest leaderboard from server 120.
[0034] Server 120 is the backend server or business server for the application running in terminal 110. It can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0035] In this embodiment, server 120 can receive leaderboard update requests sent by terminals and feed back the processed latest leaderboard data to terminal 110. Optionally, this embodiment can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0036] Artificial intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0037] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0038] The ranking generation method in this application mainly applies cloud computing, distributed storage, and big data processing technologies, which are fundamental technologies in artificial intelligence.
[0039] Please refer to Figure 2 The diagram illustrates a flowchart of a leaderboard generation method provided in an exemplary embodiment of this application, using an application of the method to a computer device as an example. The method includes:
[0040] Step 201: In response to the leaderboard update request, determine the i-th original slice corresponding to the i-th time slice. The i-th original slice stores the i-th cumulative score of the first account. The first account is the account whose score was updated within the i-th time slice. The i-th cumulative score is the cumulative score of the first account before the i-th time slice. i is a positive integer.
[0041] Taking live streaming as an example, viewers can interact with the streamer by gifting virtual items. The streamer can check the current item support rankings through the leaderboard, while viewers can also check the item support rankings of other users. Besides live streaming, leaderboard generation is also needed in other application scenarios, such as gaming and social media. Examples include power rankings, points rankings, and virtual character collection rankings in games; item support rankings, purchasing power rankings, fan points rankings, like rankings, and comment rankings in live streaming; and like rankings, comment rankings, and fan rankings in social media. Leaderboard update requests can be triggered in different application scenarios, and these requests can be used to update different types of score rankings. This application does not limit the specific rankings that the leaderboard update requests are used to update.
[0042] During the leaderboard generation process, the cumulative score of each account may change in real time. For example, viewers in the same live stream can send virtual gifts at different times, and each time a user sends a gift, the cumulative score of that user's account will change. In related technologies, computer equipment or backend servers update the leaderboard by maintaining a full database that stores the cumulative score of each account. When an account's score is updated, the corresponding cumulative score for that account in the full database is modified, and all accounts in the full database are sorted according to their cumulative scores after the update to generate the updated leaderboard. However, each time the leaderboard is updated, all the data stored in the full database needs to be processed. With a large number of accounts and a high update frequency, this obviously puts a lot of pressure on the device's processing performance and affects the efficiency of leaderboard updates.
[0043] Compared to related technologies that store the entire database and process it to generate the leaderboard, this application's embodiment addresses the issue of reduced data processing pressure and improved device storage and processing performance. Firstly, it divides the accumulated scores to be stored into multiple original slices based on time slices. Different original slices correspond to different time slices (time periods). Each original slice stores accounts whose scores have been updated within their corresponding time slice, along with the account's accumulated scores before the time slice, resulting in a relatively small amount of data stored in each original slice. Secondly, it periodically merges the original slices to obtain merged slices. Different merged slices correspond to different time slices, and each merged slice stores accounts whose accumulated scores were in the top N positions before their corresponding time, along with the account's accumulated scores before the time slice. Due to the relationship between the data stored in the original slices and merged slices, each leaderboard update eliminates the need to process the entire dataset. Only the original slice for the time to be updated and the merged slice corresponding to the last update time are retrieved, and the accumulated scores stored in these two slices are processed. This significantly reduces the amount of data involved in leaderboard updates, thereby improving the device's data processing performance.
[0044] Taking a one-minute time slice as an example, each minute corresponds to an original slice and each minute corresponds to a merged slice. The third original slice corresponding to the third minute stores the accounts whose scores were updated within the third minute, as well as the total accumulated score of that account before the third minute (i.e., the accumulated score of that account from the beginning of the 0th minute to the end of the 3rd minute). The second merged slice corresponding to the second minute stores the accounts whose accumulated scores were in the top N positions before the second minute, as well as the total accumulated score of that account before the second minute (i.e., the accumulated score of that account from the beginning of the 0th minute to the end of the 2nd minute). Therefore, to generate the leaderboard for the third minute, it is necessary to obtain the accounts whose accumulated scores were in the top N positions before the third minute, which can be obtained by processing the second merged slice corresponding to the second minute and the original slice corresponding to the third minute.
[0045] Based on the relationship between the original slice, the merged slice, and the leaderboard, in one possible implementation, when the computer device receives the leaderboard update request, it can determine the time to be merged and the last merge time, and determine the time to be merged as the i-th time slice, the last merge time as the (i-1)-th time slice, and then determine the i-th original slice corresponding to the i-th time slice to obtain the first account whose score was updated in the i-th time slice, and the cumulative score of the first account before the i-th time slice.
[0046] Optionally, i can be a positive integer, such as 1, 2, 3, etc.
[0047] Optionally, the cumulative score may differ depending on the update scenario of the leaderboard. For example, in a live streaming scenario, the cumulative score can be the cumulative item support value. When an account performs virtual item gifting, each virtual item corresponds to a certain item support value, and the cumulative item support value is the sum of the item support values of the virtual items gifted by the account. In a game scenario, the cumulative score can be the cumulative battle power value, which is the sum of the battle power values of each game account during the game. In a social application scenario, the cumulative score can be the cumulative number of likes for a certain post. The specific content of the cumulative score is not limited in this embodiment.
[0048] Step 202: Determine the (i-1)th merged slice corresponding to the (i-1)th time slice. The time interval between the ith time slice and the (i-1)th time slice is the leaderboard update cycle. The (i-1)th merged slice stores the (i-1)th cumulative score of the second account. The second account is the account whose cumulative score ranks in the top N before the (i-1)th time slice. The (i-1)th cumulative score is the cumulative score of the second account before the (i-1)th time slice. N is a positive integer.
[0049] While the computer device obtains the i-th original slice corresponding to the i-th time slice, it can also simultaneously determine the i-1 merged slice corresponding to the (i-1)-th time slice, thereby obtaining the second account whose cumulative score ranks in the top N before the (i-1)-th time slice, and the i-1-th cumulative score corresponding to the second account.
[0050] It should be noted that since the merged slice is used to store the top N accounts and cumulative scores corresponding to each time slice, which corresponds to the leaderboard displayed in that time slice, the merging period of the merged slice is the leaderboard update period. Therefore, the time interval between the i-th time slice and the (i-1)-th time slice is the leaderboard update period.
[0051] In an exemplary example, if the leaderboard update cycle is 1 minute, and the leaderboard for the 4th minute needs to be generated, the merge time is the 4th minute, the merge time - 1 (leaderboard update cycle) is the 3rd minute, the corresponding time slice i is the 4th minute, and the (i-1)th time slice is the 3rd minute. That is, the leaderboard corresponding to the 4th minute needs to be generated based on the 4th original slice corresponding to the 4th minute and the 3rd merge slice corresponding to the 3rd minute.
[0052] Optionally, the value of N can be determined based on the display requirements of the leaderboard in the application scenario. For example, in a live streaming scenario, it may be necessary to display the top 10 positions with the most item boosts, so N is 10; in a game scenario, it may be necessary to display the top 50 positions with the highest battle power, so N is 50.
[0053] Step 203: Based on the i-th original slice and the (i-1)-th merged slice, update the i-th leaderboard corresponding to the i-th time slice. The i-th leaderboard includes at least the accounts whose cumulative scores were in the top N before the i-th time slice.
[0054] In one possible implementation, since the i-th original slice stores the first account whose score was updated within the i-th time slice and its cumulative score; and the (i-1)-th merged slice stores the second account whose cumulative score was in the top N positions before the (i-1)-th time slice and its cumulative score; after merging the i-th original slice and the i-th merged slice, the accounts whose cumulative score was in the top N positions before the i-th time slice can be obtained, thereby obtaining the i-th leaderboard corresponding to the i-th time slice.
[0055] Optionally, the i-th leaderboard may include the accounts whose cumulative scores rank in the top N before the i-th time slice, and may also include the cumulative scores corresponding to the accounts; optionally, the i-th leaderboard may also include the avatar information, user nickname, etc. corresponding to the accounts.
[0056] In summary, according to the embodiments of this application, during the process of updating the leaderboard in the i-th time slice, it is not necessary to sort the cumulative scores of all accounts. Only the i-th original slice of the i-th time slice (the cumulative scores of accounts that have only been updated in the i-th time slice) and the i-1 merged slice of the (i-1)-th time slice (the cumulative scores of the Top N accounts before the (i-1)-th time slice) need to be processed. Compared with processing all the data, this can greatly reduce the amount of data processing, improve the real-time generation efficiency of the leaderboard, and improve the processing performance of computer equipment.
[0057] Since the leaderboard generation process in this embodiment is an iterative process, for example, the leaderboard at the 4th minute only needs to use the original slice at the 4th minute and the merged slice at the 3rd minute, the corresponding historical original slices and historical merged slices can be cleaned up periodically, thereby improving the utilization rate of data storage space in computer devices.
[0058] Please refer to Figure 3 The diagram illustrates a flowchart of a leaderboard generation method provided in another exemplary embodiment of this application, using an application of the method to a computer device as an example. The method includes:
[0059] Step 301: In response to the leaderboard update request, determine the i-th original slice corresponding to the i-th time slice.
[0060] Step 302: Determine the (i-1)th merged slice corresponding to the (i-1)th time slice.
[0061] The implementation methods for steps 301 and 302 can be referred to the above embodiments, and will not be repeated here.
[0062] Step 303: Merge the i-th original slice and the (i-1)-th merged slice to obtain the merged i-th merged data.
[0063] In one possible implementation, based on the relationship between the cumulative values stored in the i-th original slice and the (i-1)-th merged slice, if it is necessary to obtain the leaderboard (leaderboard data) corresponding to the i-th time slice, it is first necessary to merge the i-th original slice and the (i-1)-th merged slice so that, based on the TopN accounts and cumulative values corresponding to the (i-1)-th time slice, the accounts with updated scores and their corresponding cumulative values in the i-th time slice are added, thereby obtaining the merged i-th merged data.
[0064] Since both the i-th original slice and the (i-1)-th merged slice store cumulative values, the merging process between the i-th original slice and the (i-1)-th merged slice is not a simple addition of cumulative values, but rather the union of the cumulative values in the i-th original slice and the (i-1)-th merged slice. In an exemplary example, step 303 may further include steps 303A and 303B.
[0065] Step 303A: If the first account in the i-th original slice is the same as the second account in the (i-1)-th merged slice, the first account and the i-th cumulative score are determined as the i-th merged data after merging.
[0066] When merging the i-th original slice and the (i-1)-th merged slice, it is necessary to process them separately based on each first account or second account.
[0067] In one possible implementation, if a first account in the i-th original slice is the same as a second account in the (i-1)-th merged slice, it means that the first account (second account) had a cumulative score in the top N positions before the (i-1)-th time slice, and the first account (second account) had also had a score update in the i-th time slice. In this case, the i-th cumulative value stored in the i-th original slice for the first account (second account) is the sum of the (i-1)-th cumulative value and the new score added in the i-th time slice. Therefore, when merging the first account (second account), only the latest cumulative score (i-th cumulative score) needs to be retained. Correspondingly, the first account and its corresponding i-th cumulative score are determined as the i-th merged data corresponding to the first account after merging.
[0068] Step 303B: If there is no first account in the i-th original slice that is the same as the second account, the union of the first account, the i-th cumulative score, the second account, and the (i-1)-th cumulative score is determined as the i-th merged data.
[0069] Optionally, if a second account has not updated its score in the i-th time slice but has updated its score before the (i-1)-th time slice and its cumulative score is in the Top N, then there is no first account identical to the second account in the i-th original slice; or, if a first account has not updated its score before the (i-1)-th time slice but has updated its score in the i-th time slice; or, if a first account has updated its score before the (i-1)-th time slice but its cumulative score is not in the Top N, then there is no second account identical to the first account in the (i-1)-th merged slice; then, when performing the merging process, for the first and second accounts of the above categories, the union of the i-th merged slice and the (i-1)-th original slice needs to be taken; that is, the first account, the i-th cumulative score, the second account, and the (i-1)-th cumulative score belonging to the above categories are jointly determined as the i-th merged data after merging.
[0070] In an exemplary example, if the data stored in the i-th original slice includes: account A + cumulative score 1, account B + cumulative score 2, account C + cumulative score 3, account D + cumulative score 4; and the data stored in the (i-1)-th merged slice includes: account A + cumulative score 5, account B + cumulative score 6, account E + cumulative score 7, account F + cumulative score 8, then the i-th merged data obtained after merging the i-th original slice and the (i-1)-th merged slice includes: account A + cumulative score 1, account B + cumulative score 2, account C + cumulative score 3, account D + cumulative score 4, account E + cumulative score 7, account F + cumulative score 8; that is, for the same account, the cumulative value in the i-th original slice is taken, and for different accounts, the union is taken.
[0071] Step 304: Determine the third account whose cumulative score ranks in the top N from the i-th merged data.
[0072] Since the i-th time slice corresponds to the i-th leaderboard indicating the accounts whose cumulative scores are in the top N positions before the i-th time slice, in one possible implementation, after obtaining the i-th merged data, it is necessary to sort the i-th merged data according to the cumulative scores of each account in order to filter out the third account whose cumulative score is in the top N positions from the i-th merged data.
[0073] Step 305: Based on the third account, update the i-th leaderboard corresponding to the i-th time slice.
[0074] Optionally, after filtering out the third account whose cumulative score ranks in the top N, the leaderboard corresponding to the i-th time slice can be generated based on the third account and its corresponding cumulative score.
[0075] Optionally, the i-th leaderboard may also include the profile picture, nickname, etc. of the third account.
[0076] Optionally, when the computer device sends the generated i-th leaderboard back to the terminal, in order to avoid leaking sensitive information of other accounts, it is necessary to de-identify the leaderboard and send the de-identified i-th leaderboard back to the terminal so that the terminal can display the latest leaderboard information on the application interface.
[0077] like Figure 4 The diagram shown is a schematic representation of a leaderboard display interface according to an exemplary embodiment of this application. The leaderboard interface 401 displays the total support value of the live stream: 127497K, the number of supporting fans, and the top four accounts and their corresponding cumulative support values.
[0078] Optionally, since the leaderboard is updated in real time, users tend to pay more attention to the latest leaderboard data. Therefore, in one possible implementation, in order to avoid the server storing useless historical leaderboard data, when generating the i-th leaderboard, the computer device or server can directly clear the i-1 leaderboard corresponding to the i-1 time slice and only retain the latest updated i-th leaderboard data; thereby saving the storage space of the leaderboard data.
[0079] Step 306: Store the accumulated score of the third account before the i-th time slice into the i-th merge slice, and clear the i-th merge data.
[0080] Optionally, when updating the i-th leaderboard, the i-th original slice of the i-th time slice and the i-1 merged slice of the (i-1)-th time slice are needed. The (i-1)-th merged slice stores the accounts whose cumulative scores rank in the top N before the (i-1)-th time slice and their cumulative scores. Then, when calculating the i+1-th leaderboard, the i+1-th original slice and the i-th merged slice are needed. The i-th merged slice needs to store the accounts whose cumulative scores rank in the top N before the i-th time slice and their cumulative scores. It can be seen that the accounts stored in the i-th merged slice are the same as the third account in the i-th leaderboard. Therefore, while generating the i-th leaderboard, the third account and its cumulative scores before the i-th time slice can also be stored in the merged slice to obtain the i-th merged slice of the i-th time slice.
[0081] Optionally, since subsequent ranking generation and merge slice generation do not require the participation of the i-th merged data after the i-th ranking is generated, the i-th merged data can be directly cleared after obtaining the i-th merged slice. That is, after merging to obtain the i-th merged data, only the third account with the cumulative score in the top N and its cumulative score are retained, while the accounts and cumulative scores at the bottom can be directly cleared, thereby avoiding the occupation of computer storage space by useless data and improving the utilization rate of data storage space.
[0082] It should be noted that the processes of generating the i-th leaderboard based on the third account and obtaining the i-th merged slice can be performed simultaneously. Alternatively, the i-th leaderboard can be generated first based on the third account, and then the third account and its corresponding cumulative score can be stored in the i-th merged slice. Or, the third account and its corresponding cumulative score can be stored in the i-th merged slice first, and then the leaderboard data can be retrieved from the i-th merged slice later. The specific implementation order of this application embodiment does not constitute a limitation.
[0083] like Figure 5 The diagram illustrates the relationship between the original slice, merged slice, and leaderboard in an exemplary embodiment of this application. T1 corresponds to the first original slice, T2 to the second original slice, T3 to the third original slice, T4 to the fourth original slice, and T5 to the fifth original slice. The first original slice and the 0th merged slice (which does not exist) can be merged to obtain the first merged slice; the first merged slice and the second original slice can be merged to obtain the second merged slice; the second merged slice and the third original slice can be merged to obtain the third merged slice; the third merged slice and the fourth original slice can be merged to obtain the fourth merged slice; and the fourth merged slice and the fifth original slice can be merged to obtain the fifth merged slice. By encapsulating nicknames and de-identifying data in each merged slice, the corresponding external leaderboard for that time period can be obtained. For example, processing the second merged slice can yield the external leaderboard corresponding to T2.
[0084] Step 307: If the i-th merged slice is obtained, clear the (i-1)-th merged slice and the i-th original slice.
[0085] As can be seen from the relationship between the i-th original slice, the (i-1)-th merged slice, the i-th merged slice, and the i-th leaderboard in the above embodiments, the subsequent leaderboard update process only needs the original slice of the time to be merged and the merged slice of the previous merged time. For example, the i+2-th leaderboard needs the i+2-th original slice of the i+2-th time slice and the i+1-th merged slice of the i+1-th time slice. It does not need to use the original slices before the i+2-th time slice and the merged slices before the i+1-th time slice. Therefore, in order to further save the storage space of the leaderboard-related data, in one possible implementation, when the i-th merged slice is obtained, the i-1-th merged slice before the i-th merged slice and the i-th original slice before the i+1-th original slice can be cleared.
[0086] like Figure 5As shown, after the first merged slice is generated, the first original slice can be cleared; after the second merged slice is generated, the first merged slice and the second original slice can be cleared; after the third merged slice is generated, the second merged slice and the third original slice can be cleared; after the fourth merged slice is generated, the third merged slice and the fourth original slice can be cleared; after the fifth merged slice is generated, the fourth merged slice and the fifth original slice can be cleared.
[0087] In this embodiment, the accounts with the highest cumulative scores before the i-th time slice and their cumulative scores are stored in the i-th merged slice. The i-th merged slice is generated during the generation of the i-th leaderboard, so that the i-th merged slice can be recursively used in subsequent leaderboard updates. This eliminates the need to process all data in each subsequent leaderboard update, improving the real-time processing efficiency of the leaderboard. In addition, after generating the i-th merged slice, the tail data with cumulative scores outside the Top N before the i-th time slice, as well as the i-th original slice and the (i-1)-th merged slice, can be directly cleared. This ensures that subsequent leaderboard updates are maintained while also cleaning up useless data in a timely manner, saving leaderboard data storage space and improving the utilization rate of device storage space.
[0088] In the above embodiment, the original slices are divided based on different time slices, that is, different time slices correspond to different original slices. If there is still a lot of data in a certain time slice, it will result in a lot of data stored in each original slice, which is not conducive to subsequent processing performance. Therefore, in one possible implementation, each time slice can be further divided according to the account ID, so that the granularity of each original slice is smaller, further improving performance and data disaster recovery.
[0089] Please refer to Figure 6 The diagram illustrates a flowchart of a leaderboard generation method provided in another exemplary embodiment of this application, using an application of the method to a computer device as an example. The method includes:
[0090] Step 601: If the score of the first account is updated within the i-th time slice, determine the i-th slice index value of the i-th original slice based on the i-th time slice, wherein different original slices are divided according to different time slices.
[0091] The score update is triggered by the score update operation corresponding to the account. Different score update operations correspond to different application scenarios. For example, in the item support leaderboard scenario in live streaming, the score update operation is the item gifting operation; in the battle power leaderboard scenario in the game scenario, the score update operation is the game operation; in the like leaderboard, the score update operation is the like operation; and in the purchasing power leaderboard, the score update operation is the purchase operation.
[0092] In one possible implementation, the original slices are divided according to time slices, with different original slices corresponding to different time slices. When storing the accumulated score of an account in an original slice, it is necessary to index the original slice corresponding to the time slice in which the score of the account was updated. If the score of the first account is updated in the i-th time slice, then the i-th time slice in which the score was updated is needed to determine the i-th index value (key value) of the original slice, so that the original slice matching the i-th index value is determined as the i-th original slice that needs to be stored for the i-th accumulated score of the first account.
[0093] Optionally, the computer device also maintains a data storage area, in which the current cumulative score of each account can be stored; when the score of the first account is updated in the i-th time slice, the current cumulative score of the first account is first updated in the data storage area, and then the i-th original slice is indexed according to the i-th time slice, and the current cumulative score is inserted into the i-th original slice as the i-th cumulative score.
[0094] Optionally, to avoid a large number of accounts updating their scores within the same time slice, resulting in a large amount of data stored in the original slice, in other possible implementations, the original slice can be further subdivided according to the account identifier (e.g., account ID) of the first account. That is, the same time slice can also be divided into different original slices according to different account identifiers. Illustratively, the original slice corresponding to the i-th time slice may include three original slices: i-th time slice + ID1 to ID20 (indicating that the original slice stores the cumulative scores of accounts whose score updates occurred within the i-th time slice and whose account identifiers are in the range of 1 to 20), i-th time slice + ID21 to ID40 (indicating that the original slice stores the cumulative scores of accounts whose score updates occurred within the i-th time slice and whose account identifiers are in the range of 21 to 40), and i-th time slice + ID41 to ID60 (indicating that the original slice stores the cumulative scores of accounts whose score updates occurred within the i-th time slice and whose account identifiers are in the range of 41 to 60).
[0095] Optionally, if the original slice is divided according to time slice + account identifier, in one possible implementation, if the score of the first account is updated in the i-th time slice, the i-th slice index value of the original slice needs to be determined together according to the i-th time slice and the account identifier of the first account, so that the i-th cumulative score of the first account can be inserted into the i-th original slice according to the i-th slice index value.
[0096] like Figure 7 The diagram illustrates the division of the original slice according to an exemplary embodiment of this application. The second original slice can be further divided into two sub-slices: slice-1 and slice-2. Both slice-1 and slice-2 correspond to the time period T2.
[0097] Optionally, when the leaderboard update request is used to update the corresponding item support leaderboard for the live stream, since the item support leaderboard is determined based on each live stream, the original slices can also be divided based on the i-th time slice + live stream identifier + account identifier. Indicatively, the original slice corresponding to the i-th time slice may include three original slices: i-th time slice + 001 live room + ID1~ID20 (indicating that the score update stored in this original slice occurred in the i-th time slice and the 001 live room, and the account identifier is the cumulative score of the account in the range of 1~20), i-th time slice + 001 live room + ID21~ID40 (indicating that the score update stored in this original slice occurred in the i-th time slice and the 001 live room, and the account identifier is the cumulative score of the account in the range of 21~40), and i-th time slice + 001 live room + ID41~ID60 (indicating that the score update stored in this original slice occurred in the i-th time slice and the 001 live room, and the account identifier is the cumulative score of the account in the range of 41~60).
[0098] Optionally, when the original slice is divided based on time slice + live room identifier + account identifier, in one possible implementation, if the score of the first account is updated in the i-th time slice, it is necessary to determine the i-th slice index value of the original slice based on the i-th time slice, the account identifier of the first account and the live room identifier of the live room, so as to insert the i-th cumulative score of the first account into the i-th original slice based on the i-th slice index value.
[0099] Optionally, when the leaderboard update request is used to update the service area combat power leaderboard, since the combat power leaderboard is determined based on each service area, such as service area 01, the original slices can also be divided based on the i-th time slice + service area identifier + account identifier. Indicatively, the original slice corresponding to the i-th time slice may include three original slices: i-th time slice + 01 service area + ID1~ID20 (indicating that the score update in this original slice occurred in the i-th time slice and the 01 service area, and the account identifier is the cumulative score of the account in the range of 1~20), i-th time slice + 001 live room + ID21~ID40 (indicating that the score update in this original slice occurred in the i-th time slice and the 01 service area, and the account identifier is the cumulative score of the account in the range of 21~40), and i-th time slice + 001 live room + ID41~ID60 (indicating that the score update in this original slice occurred in the i-th time slice and the 01 service area, and the account identifier is the cumulative score of the account in the range of 41~60).
[0100] Optionally, when the original slice is divided based on time slice + service area identifier + account identifier, in one possible implementation, if the score of the first account is updated in the i-th time slice, it is necessary to determine the i-th slice index value of the i-th original slice based on the i-th time slice, the service area identifier of the service area, and the account identifier, so that the i-th cumulative score of the first account can be inserted into the i-th original slice based on the i-th slice index value.
[0101] Step 602: Based on the index value of the i-th slice, store the first account and the i-th cumulative score into the i-th original slice.
[0102] Optionally, once the index value of the i-th slice is determined, the original slice that matches the index value of the i-th slice can be identified as the i-th original slice, and the first account and the i-th cumulative score of that account can be inserted into the i-th original slice.
[0103] Optionally, the data storage structure of the i-th original slice can be a sorted set, which can automatically sort the data stored in the i-th original slice according to the cumulative score.
[0104] Step 603: In response to the leaderboard update request, determine the most recent update time of the leaderboard.
[0105] When a computer device receives a leaderboard update request, it usually updates the leaderboard for the current time (historical leaderboards are not relevant to the display). To avoid duplicate leaderboard updates, in one possible implementation, when the computer device receives a leaderboard update request, it can first obtain the most recent update time of the leaderboard to determine whether the leaderboard data for the current time has been updated.
[0106] Step 604: If the most recent update time of the leaderboard is before the current time, determine the i-th time slice based on the current time.
[0107] Optionally, if the computer determines that the most recent update time of the leaderboard is before the current time, it means that the leaderboard data for the current time has not been updated and needs to be updated. In this case, the i-th time slice can be determined based on the current time, that is, the current time can be defined as the time not yet to be merged or the time yet to be updated. For example, if the current time is 10:30 and the most recent update time of the leaderboard is 10:29, it means that the leaderboard update process needs to continue, and the current time 10:30 can be defined as the i-th time slice.
[0108] Optionally, if the computer determines that the most recent update time of the leaderboard is equal to the current time, it means that the leaderboard data for the current time has already been updated, and there is no need to repeat the leaderboard update operation; the current leaderboard update process can be terminated. For example, if the current time is 10:29 and the most recent update time of the leaderboard is 10:29, it means that the leaderboard at 10:29 has been updated, and the leaderboard update operation should be stopped.
[0109] Step 605: Determine the (i-1)th time slice based on the i-th time slice and the leaderboard update cycle.
[0110] The time difference between the time to be merged and the previous merge time is determined by the leaderboard update cycle. Therefore, in one possible implementation, once the merge time (the i-th time slice) is obtained, the (i-1)-th time slice can be determined based on the difference between the i-th time slice and the leaderboard update cycle. For example, if the i-th time slice is 10:30 and the leaderboard update cycle is 1 minute, then the (i-1)-th time slice is 10:29. If the i-th time slice is 10:30 and the leaderboard update cycle is 2 minutes, then the (i-1)-th time slice is 10:28.
[0111] Step 606: Determine the i-th original slice corresponding to the i-th time slice.
[0112] Once the i-th time slice is obtained, at least one i-th original slice corresponding to the i-th time slice can be indexed based on the i-th time slice. If the original slice is divided only according to the time slice, then the i-th time slice corresponds to only one i-th original slice. If the original slice is divided according to the time slice + account identifier, then the i-th time slice corresponds to at least one i-th original slice.
[0113] Step 607: Determine the (i-1)th merged slice corresponding to the (i-1)th time slice.
[0114] The merged slices are divided only according to time slices, and each merged slice stores the accounts and cumulative scores of the Top N positions before the time slice. In one possible implementation, the (i-1)th time slice can be directly indexed to the (i-1)th merged slice to obtain the i-th merged slice corresponding to the i-th time slice.
[0115] Optionally, the data storage structure in the (i-1)th merged slice can also be a sorted set. Using this data storage structure, the data stored in the (i-1)th merged slice can be automatically sorted according to the cumulative score.
[0116] Optionally, if the merged slice uses a sorted set data structure, all the data of the i-th merge can be stored in the i-th merged slice. The data of the i-th merge will be automatically sorted according to the cumulative score in the i-th merged slice, and the top N accounts and cumulative scores will be extracted, and the tail data outside the top N will be removed. Subsequently, the i-th leaderboard can be directly obtained from the i-th merged slice.
[0117] Optionally, since the ranking calculation relies on the recursive processing of the previous merged slices, if the previous merged slice processing fails, it may result in the inability to find the required merged slice. In this case, data repair processing of the previous merged slices is required. In one possible implementation, when generating the i-th ranking, if the (i-1)-th merged slice is not obtained, the i-th ranking cannot be generated immediately. The (i-1)-th merged slice needs to be recovered first. Correspondingly, the i-th time slice is updated to the (i-1)-th time slice, and the (i-1)-th time slice is updated to the (i-2)-th time slice. Thus, based on the (i-1)-th original slice corresponding to the (i-1)-th time slice and the (i-2)-th merged slice corresponding to the (i-2)-th time slice, the (i-1)-th merged slice is recovered. After the (i-1)-th merged slice is recovered, the step of generating the i-th merged slice and the i-th ranking based on the (i-1)-th merged slice and the i-th original slice is executed.
[0118] Optionally, when generating the (i-1)th merged slice, it depends on the (i-2)th merged slice and the (i-1)th original slice. If the (i-2)th merged slice does not exist at this time, the (i-2)th merged slice needs to be recovered first based on the (i-3)th merged slice and the (i-2)th original slice. After the (i-2)th merged slice is recovered, the (i-1)th merged slice is then recovered.
[0119] Optionally, if too many missing merged slices are found simultaneously (exceeding the threshold), continuing data recovery would cause a single leaderboard update task to take too long, thus blocking the calculation of other sessions. Therefore, to avoid this situation, in one possible implementation, if the computer device fails to obtain the i-th merged slice corresponding to the i-th time slice, and the time difference between the j-th time slice and the current time is greater than the time threshold, it indicates that there are too many missing merged slices. In this case, the recovery of previous merged slices is stopped, that is, the generation of the j-th merged slice corresponding to the j-th time slice is stopped, and a data missing alarm record is generated to promptly remind business personnel to manually repair the data.
[0120] Step 608: Based on the i-th original slice and the (i-1)-th merged slice, update the i-th leaderboard corresponding to the i-th time slice.
[0121] The implementation method of step 608 can be referred to the above embodiment, and will not be repeated here.
[0122] In this embodiment, in addition to dividing the original slices based on time slices, a further split based on account identifiers is introduced, making each original slice more granular and further improving performance and data disaster recovery. In addition, if historical merged slices are found to be missing during the leaderboard update process, data recovery of merged slices can be performed without affecting task performance. If a large number of merged slices are missing, data recovery can be stopped to avoid the long time required for a single leaderboard update task, which would affect the processing of other scheduled tasks.
[0123] Please refer to Figure 8 This document illustrates a flowchart of a score update operation triggering an update of the original slice, as shown in an exemplary embodiment of this application. The flowchart uses a live-streaming scenario's item gifting operation as an example. The process includes:
[0124] Step 801: Submit the session ID, item ID, and quantity.
[0125] When the terminal receives a user's gifting operation for the live stream, it will determine the item ID and the quantity of the item gifted based on the gifting operation, and encapsulate the item ID, the quantity of the item, and the live stream session ID into a reward request, and send the reward request to the backend server (computer device).
[0126] Step 802, restrict single-user lock.
[0127] A single-user lock will be set to limit user concurrency and prevent multiple donation requests from being submitted simultaneously due to accidental operation.
[0128] Step 803: Retrieve session data and check if the sessions are valid.
[0129] Retrieve the session information from the live stream and check if the live stream is currently broadcasting. If it is, the session is valid.
[0130] Step 804: Retrieve item details and check if the item is valid.
[0131] Retrieve the item details and check if the item ID exists. If it does, the item is valid.
[0132] Step 805: Deduct points?
[0133] Determine whether this item gifting operation consumes points (a virtual resource); if it consumes points, retrieve the user's point balance; if it does not consume points, retrieve the user's points balance.
[0134] Step 806: Retrieve points balance.
[0135] Step 807: Retrieve user's points balance.
[0136] Step 808: Check if the balance is sufficient.
[0137] Check if the user's points or credits balance is sufficient to purchase the item. If so, continue to retrieve the user's character information to generate a donation order.
[0138] Step 809: Retrieve user role information.
[0139] Step 810: Encapsulate the reward order information to generate a unique serial number.
[0140] Step 811: Is the payment type in-game currency (points)?
[0141] Step 812: Call the purchase interface and pass in the purchase callback parameters.
[0142] Step 813: Retrieve DB points balance.
[0143] The points or game points deduction interface is called based on the order information (different deduction interfaces are called depending on the business; for example, there are two payment methods: one is to call Daojucheng to deduct game points, and the other is to deduct points from DB).
[0144] Step 814: Was the purchase successful?
[0145] Step 815: Record failed orders and conduct asynchronous callbacks for reconciliation later.
[0146] Step 816 triggers the reward callback update.
[0147] After the balance is successfully deducted, the tipping callback process begins.
[0148] Step 817: Set callback processing for anti-duplicate qualification.
[0149] In the tipping callback process, the player's tipping callback anti-duplicate qualification and personal tipping cumulative value are updated first, and then the global tipping value (including leaderboard slice, live stream tipping total value, corresponding item tipping times, number of fans, etc.) are updated.
[0150] The callback handling anti-duplicate qualification is set to prevent the same reward order from being updated in the leaderboard multiple times.
[0151] Step 818: Has it already been set?
[0152] Step 819: The leaderboard update has been processed.
[0153] If callback handling to prevent duplicates has already been set, it means the leaderboard update has been processed and subsequent operations should be stopped; if callback handling to prevent duplicates has not been set, the total number of player donations needs to be updated.
[0154] Step 820: Update the total value of player donations.
[0155] Step 821: Calculate the leaderboard slice index corresponding to the current time.
[0156] Once the total value of player donations (equivalent to the cumulative score in the above example) is updated, the original slice index can be calculated based on the time slice in which the score update occurred, so that the total value of donations can be inserted into the corresponding original slice.
[0157] Step 822: Insert or update the total reward value for each player in the leaderboard slice.
[0158] Step 823: Update the total value of live stream donations.
[0159] Step 824: Update the cumulative number of rewards for items.
[0160] Step 825: Update the number of fans who have donated during the live stream.
[0161] Step 826: Trigger the broadcast of the donation message.
[0162] After the original slice is updated, the total number of donations in the live stream, the cumulative number of donations for this item in the live stream, the number of fans who have donated in the live stream, and the donation message broadcast can also be triggered.
[0163] Depend on Figure 8 It can be seen that during the leaderboard update process, all data retrieval and inspection logic is executed first, while critical operations such as data updates are executed uniformly later. In this way, if data retrieval fails or verification fails in the early stages, the process can be safely terminated or retried, minimizing the complexity of the original slice processing logic.
[0164] In order to avoid repeated triggering of the logic, anti-duplicate qualification is set before each successful reward callback (the qualification is based on the reward order serial number as key: openid_area_roundid_timestamp_random 5-digit suffix). The callback processing can only start after the qualification is set successfully.
[0165] In addition, introducing Redis Lua scripts into the original slice update can effectively merge the Redis update operations that were originally split into multiple Redis updates into two Redis requests through Lua scripts. On the one hand, this can reduce the number of Redis calls, and on the other hand, it can atomically perform multiple Redis operations on a script basis.
[0166] Please refer to Figure 9 This illustrates a periodic triggering flowchart for slice merging and updating a leaderboard, as shown in an exemplary embodiment of this application. The process includes:
[0167] Step 901: The leaderboard statistics task is triggered.
[0168] When the leaderboard update cycle is 1 minute, the leaderboard statistics task is triggered once every minute. First, the currently valid reward sessions are retrieved. For each valid session, a merge update task is executed. First, the original slice corresponding to the current minute is retrieved, then the merge slice triggered in the previous minute is retrieved, then the merge slice for the current minute is generated, and finally, additional information (including user nickname, avatar, number of followers, etc.) is retrieved based on the merge slice to generate the TopN external leaderboard for the current minute.
[0169] Step 902: Record the current time (accurate to the minute).
[0170] Step 903: Retrieve the list of ongoing tipping sessions.
[0171] Step 904: Iterate through and execute the leaderboard merging task for each session.
[0172] Step 905: Check the latest update time corresponding to the current leaderboard.
[0173] Step 906: The most recent update time is greater than or equal to the current time.
[0174] Step 907: Set the time to be merged to the current time; the last merge time to the time to be merged - 1 minute.
[0175] Step 908: The leaderboard for this session has already been processed.
[0176] Step 909: Retrieve the merged leaderboard board1 from the last merge time.
[0177] Step 910: Does the data exist?
[0178] When fetching the merged slice from the previous minute, if it is detected that it is missing (possibly due to a previous calculation failure), data repair will be performed. The dependent previous merged slices will be recursively calculated. At the same time, if too many previous merged slices are found to be missing (exceeding the threshold), the repair will be stopped and an alarm will be issued to avoid blocking other calculations due to excessive execution of a single task. Waiting for manual repair is faster. If no previous merged slices are calculated, the original slices and log records that they depend on will not be cleared, which serves as a backup for data repair.
[0179] Step 911 indicates that the ranking data for the last merge time has not yet been generated; the time to be merged = the last merge time; the last merge time = one minute before the time to be merged.
[0180] Step 912: Is the difference between the current time and the time to be merged greater than the time threshold?
[0181] Step 913: Terminate the task and trigger an alarm.
[0182] Step 914: Retrieve the leaderboard slice board2 corresponding to the time to be merged.
[0183] Step 915: Process the Top N bits of merged board1 and board2.
[0184] Step 916: Generate the TopN leaderboard board3 corresponding to the time to be merged.
[0185] Step 917: Is the time to be merged less than the current time?
[0186] Step 918: Last merge time = Time to be merged; Time to be merged = Time to be merged + 1 minute.
[0187] Step 919: Retrieve and merge the nicknames and avatars of each user on the leaderboard board3.
[0188] Step 920: Retrieve the number of fans who have given tips and the total value of tips at the current time.
[0189] Step 921: Package and update the leaderboard displayed externally, and the merging process is complete.
[0190] In terms of deployment, scheduled tasks are distributed to multiple machines. The logic implementation of each scheduled update task ensures idempotency, so each machine serves as a backup for the others. If one machine fails, the others will retry, eliminating the need for a master-slave switching synchronization mechanism, thus reducing deployment and maintenance costs. At the same time, as the number of subsequent sessions increases, it also supports horizontal expansion of the number of machines, distributing the computation of different sessions to different groups of machines.
[0191] If the entire ranking data is relatively short (e.g., only the top 10 are needed), then the external ranking storage structure can be a Redis String. In this way, the backend interface only needs a single get operation to retrieve the ranking information. If the ranking is long, considering the Redis bandwidth limitations and the fact that the data retrieved at one time should not be too large, a Redis List can be used to perform paginated queries.
[0192] Figure 10 This is a structural block diagram of a leaderboard generation apparatus provided in an exemplary embodiment of this application. The apparatus includes:
[0193] The determination module 1001 is used to respond to the leaderboard update request and determine the i-th original slice corresponding to the i-th time slice. The i-th original slice stores the i-th cumulative score of the first account. The first account is the account whose score was updated in the i-th time slice. The i-th cumulative score is the cumulative score of the first account before the i-th time slice. i is a positive integer.
[0194] The determining module 1001 is further configured to determine the (i-1)th merged slice corresponding to the (i-1)th time slice, wherein the time interval between the i-th time slice and the (i-1)th time slice is the leaderboard update cycle, and the (i-1)th merged slice stores the (i-1)th cumulative score of the second account, wherein the second account is the account whose cumulative score was in the top N positions before the (i-1)th time slice, and the (i-1)th cumulative score is the cumulative score of the second account before the (i-1)th time slice, where N is a positive integer;
[0195] The update module 1002 is used to update the i-th leaderboard corresponding to the i-th time slice based on the i-th original slice and the (i-1)-th merged slice. The i-th leaderboard includes at least the accounts whose cumulative scores were in the top N positions before the i-th time slice.
[0196] Optionally, the update module 1002 is further configured to:
[0197] The i-th original slice and the (i-1)-th merged slice are merged to obtain the i-th merged data.
[0198] Determine the third account whose cumulative score ranks among the top N from the i-th merged data;
[0199] Based on the third account, update the i-th leaderboard corresponding to the i-th time slice.
[0200] Optionally, the update module 1002 is further configured to:
[0201] If the first account in the i-th original slice is the same as the second account in the (i-1)-th merged slice, the first account and the i-th cumulative score are determined as the merged i-th merged data;
[0202] If there is no first account identical to the second account in the i-th original slice, the union of the first account, the i-th cumulative score, the second account, and the (i-1)-th cumulative score is determined as the merged i-th merged data.
[0203] Optionally, the device further includes:
[0204] The storage module is used to store the cumulative score of the third account before the i-th time slice into the i-th merged slice, and to clear the i-th merged data.
[0205] Optionally, the device further includes:
[0206] The clearing module is used to clear the (i-1)th merged slice and the i-th original slice when the i-th merged slice is obtained.
[0207] Optionally, the device further includes:
[0208] The determining module 1001 is used to determine the i-th slice index value of the i-th original slice based on the i-th time slice when the score of the first account is updated within the i-th time slice, wherein different original slices are divided according to different time slices;
[0209] The storage module is used to store the first account and the i-th cumulative score into the i-th original slice based on the i-th slice index value.
[0210] Optionally, the determining module 1001 is further configured to:
[0211] Based on the i-th time slice and the account identifier of the first account, the i-th slice index value of the i-th original slice is determined.
[0212] Optionally, the determining module 1001 is further configured to:
[0213] When the leaderboard update request is used to update the corresponding props assist leaderboard of the live broadcast room, the index value of the i-th original slice is determined based on the i-th time slice, the live broadcast room identifier of the live broadcast room and the account identifier;
[0214] When the leaderboard update request is used to update the service area combat power leaderboard, the i-th slice index value of the i-th original slice is determined based on the i-th time slice, the service area identifier of the service area, and the account identifier.
[0215] Optionally, the device further includes:
[0216] Module 1001 is also used to determine the most recent update time of the leaderboard;
[0217] The determining module 1001 is further configured to determine the i-th time slice based on the current time when the most recent update time of the leaderboard is before the current time;
[0218] The determining module 1001 is further configured to determine the (i-1)th time slice based on the i-th time slice and the leaderboard update cycle.
[0219] Optionally, the device further includes:
[0220] The determining module 1001 is further configured to update the i-th time slice to the i-1 time slice and update the i-1 time slice to the i-2 time slice when the (i-1)-th merged slice is not obtained;
[0221] The generation module is used to generate the (i-1)th merged slice based on the (i-1)th original slice corresponding to the (i-1)th time slice and the (i-2)th merged slice corresponding to the (i-2)th time slice.
[0222] Optionally, the device further includes:
[0223] The stop generation module is used to stop generating the j-th merged slice corresponding to the j-th time slice and generate a data missing alarm record when the j-th time slice corresponding to the j-th time slice is not obtained and the time difference between the j-th time slice and the current time slice is greater than a time threshold. Here, j is a positive integer less than i.
[0224] Optionally, the device further includes:
[0225] The clearing module is used to clear the (i-1)th leaderboard corresponding to the (i-1)th time slice when the i-th leaderboard is generated.
[0226] In summary, in this embodiment of the application, during the process of updating the leaderboard in the i-th time slice, it is not necessary to sort the cumulative scores of all accounts. Only the i-th original slice of the i-th time slice (the cumulative scores of accounts that have only been updated in the i-th time slice) and the i-1 merged slice of the (i-1)-th time slice (the cumulative scores of the Top N accounts before the (i-1)-th time slice) need to be processed. Compared with processing all the data, this can greatly reduce the amount of data processing, improve the real-time generation efficiency of the leaderboard, and improve the processing performance of computer equipment.
[0227] Figure 11This is a schematic diagram illustrating the structure of a computer device according to an exemplary embodiment. The computer device 1100 includes a Central Processing Unit (CPU) 1101, a system memory 1104 including Random Access Memory (RAM) 1102 and Read-Only Memory (ROM) 1103, and a system bus 1105 connecting the system memory 1104 and the CPU 1101. The computer device 1100 also includes a basic input / output system (I / O system) 1106 to facilitate information transfer between various devices within the computer device, and a mass storage device 1107 for storing an operating system 1113, application programs 1114, and other program modules 1115.
[0228] The basic input / output system 1106 includes a display 1108 for displaying information and an input device 1109 for user input, such as a mouse or keyboard. Both the display 1108 and the input device 1109 are connected to the central processing unit 1101 via an input / output controller 1110 connected to the system bus 1105. The basic input / output system 1106 may also include the input / output controller 1110 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1110 also provides output to a display screen, printer, or other types of output devices.
[0229] The mass storage device 1107 is connected to the central processing unit 1101 via a mass storage controller (not shown) connected to the system bus 1105. The mass storage device 1107 and its associated computer device-readable media provide non-volatile storage for the computer device 1100. That is, the mass storage device 1107 may include computer device-readable media (not shown), such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
[0230] Without loss of generality, the computer device readable medium may include computer device storage media and communication media. Computer device storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer device readable instructions, data structures, program modules, or other data. Computer device storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), CD-ROM, digital video disc (DVD) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer device storage media are not limited to the above-mentioned types. The system memory 1104 and mass storage device 1107 described above can be collectively referred to as memory.
[0231] According to various embodiments of this disclosure, the computer device 1100 can also be connected to a remote computer device on a network, such as the Internet. That is, the computer device 1100 can be connected to the network 1111 via a network interface unit 1112 connected to the system bus 1105, or the network interface unit 1112 can be used to connect to other types of networks or remote computer device systems (not shown).
[0232] The memory also includes one or more programs, which are stored in the memory. The central processing unit 1101 executes the one or more programs to implement all or part of the steps of the above-mentioned ranking generation method.
[0233] This application also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the ranking list generation method provided in the above method embodiments.
[0234] This application provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the ranking list generation method provided in the above-described method embodiments.
[0235] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0236] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0237] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for generating a leaderboard, characterized in that, The method includes: In response to the leaderboard update request, the i-th original slice corresponding to the i-th time slice is determined. The i-th original slice stores the i-th cumulative score of the first account. The first account is the account whose score is updated during the i-th time slice. The i-th cumulative score is the cumulative score of the first account at the end of the i-th time slice, where i is a positive integer. Determine the (i-1)th merged slice corresponding to the (i-1)th time slice. The time interval between the i-th time slice and the (i-1)th time slice is the leaderboard update cycle. The (i-1)th merged slice stores the (i-1)th cumulative score of the second account. The second account is the account whose cumulative score ranks in the top N at the end of the (i-1)th time slice. The (i-1)th cumulative score is the cumulative score of the second account at the end of the (i-1)th time slice. N is a positive integer. Based on the i-th original slice and the (i-1)-th merged slice, update the i-th leaderboard corresponding to the i-th time slice. The i-th leaderboard includes at least the accounts whose cumulative scores are in the top N positions at the end of the i-th time slice.
2. The method according to claim 1, characterized in that, The step of updating the i-th leaderboard corresponding to the i-th time slice based on the i-th original slice and the (i-1)-th merged slice includes: The i-th original slice and the (i-1)-th merged slice are merged to obtain the i-th merged data. Determine the third account whose cumulative score ranks among the top N from the i-th merged data; Based on the third account, update the i-th leaderboard corresponding to the i-th time slice.
3. The method according to claim 2, characterized in that, The process of merging the i-th original slice and the (i-1)-th merged slice to obtain the merged i-th merged data includes: If the first account in the i-th original slice is the same as the second account in the (i-1)-th merged slice, the first account and the i-th cumulative score are determined as the merged i-th merged data; If there is no first account identical to the second account in the i-th original slice, the union of the first account, the i-th cumulative score, the second account, and the (i-1)-th cumulative score is determined as the merged i-th merged data.
4. The method according to claim 2, characterized in that, The method further includes: Store the accumulated score of the third account at the end of the i-th time slice into the i-th merge slice, and clear the i-th merge data.
5. The method according to claim 4, characterized in that, The method further includes: If the i-th merged slice is obtained, the (i-1)-th merged slice and the i-th original slice are cleared.
6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: If the score of the first account is updated within the i-th time slice, the i-th slice index value of the i-th original slice is determined based on the i-th time slice, wherein different original slices are divided according to different time slices; Based on the index value of the i-th slice, the first account and the i-th cumulative score are stored in the i-th original slice.
7. The method according to claim 6, characterized in that, The step of determining the i-th slice index value of the i-th original slice based on the i-th time slice further includes: Based on the i-th time slice and the account identifier of the first account, the i-th slice index value of the i-th original slice is determined.
8. The method according to claim 7, characterized in that, The step of determining the index value of the i-th original slice based on the i-th time slice and the account identifier of the first account includes: When the leaderboard update request is used to update the corresponding props assist leaderboard of the live broadcast room, the index value of the i-th original slice is determined based on the i-th time slice, the live broadcast room identifier of the live broadcast room and the account identifier; When the leaderboard update request is used to update the service area combat power leaderboard, the i-th slice index value of the i-th original slice is determined based on the i-th time slice, the service area identifier of the service area, and the account identifier.
9. The method according to any one of claims 1 to 5, characterized in that, Following the response to the leaderboard update request, the method further includes: Determine the last update time of the leaderboard; If the most recent update time of the leaderboard is before the current time, the i-th time slice is determined based on the current time; The (i-1)th time slice is determined based on the i-th time slice and the leaderboard update cycle.
10. The method according to claim 9, characterized in that, The method further includes: If the (i-1)th merged slice is not obtained, the i-th time slice is updated to the (i-1)th time slice, and the (i-1)th time slice is updated to the (i-2)th time slice; The (i-1)th original slice corresponding to the (i-1)th time slice and the (i-2)th merged slice corresponding to the (i-2)th time slice are used to generate the (i-1)th merged slice.
11. The method according to claim 10, characterized in that, The method further includes: If the j-th merged slice corresponding to the j-th time slice is not obtained, and the time difference between the j-th time slice and the current time is greater than the time threshold, stop generating the j-th merged slice corresponding to the j-th time slice, and generate a data missing alarm record, where j is a positive integer less than i.
12. The method according to any one of claims 1 to 5, characterized in that, The method further includes: In the case of generating the i-th leaderboard, the i-1 leaderboard corresponding to the (i-1)-th time slice is cleared.
13. A leaderboard generation device, characterized in that, The device includes: The determination module is used to respond to the leaderboard update request and determine the i-th original slice corresponding to the i-th time slice. The i-th original slice stores the i-th cumulative score of the first account. The first account is the account whose score is updated during the i-th time slice. The i-th cumulative score is the cumulative score of the first account at the end of the i-th time slice, where i is a positive integer. The determining module is further configured to determine the (i-1)th merged slice corresponding to the (i-1)th time slice, wherein the time interval between the i-th time slice and the (i-1)th time slice is the leaderboard update cycle, and the (i-1)th merged slice stores the (i-1)th cumulative score of the second account, wherein the second account is the account whose cumulative score is in the top N positions at the end of the (i-1)th time slice, and the (i-1)th cumulative score is the cumulative score of the second account at the end of the (i-1)th time slice, where N is a positive integer; An update module is used to update the i-th leaderboard corresponding to the i-th time slice based on the i-th original slice and the (i-1)-th merged slice. The i-th leaderboard includes at least the accounts whose cumulative scores are in the top N positions at the end of the i-th time slice.
14. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the leaderboard generation method as described in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is loaded and executed by a processor to implement the leaderboard generation method as described in any one of claims 1 to 12.
Citation Information
Patent Citations
List generation method and device and storage medium
CN110609967A
Ranking list data updating method and device and server
CN111898037A