Method and system for displaying income ranking list
By storing revenue ranking data in cache and disk systems at the same time, the problems of low data security and excessive cache usage in the existing technology are solved, and a fast and high-security revenue ranking display method is realized.
Patent Information
- Application Number
- CN202411136438.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-12-10
AI Technical Summary
The implementation method of the existing revenue rankings occupies too much cache space, affects the implementation of other functions, and has low data security and is prone to loss due to power outages and other reasons.
The ranking data is stored in the cache system and the disk system at the same time. If the cache system has data, it will be displayed directly from the cache. If the cache data is deleted, it will be loaded from the disk to the cache to display, ensuring that the data is not lost and the cache is cleaned to avoid overoccupying Multiple spaces.
It realizes the need to quickly display revenue rankings, while improving data security and avoiding the impact of functionalities caused by excessive cache usage.
Smart Images

Figure CN119105702A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of display technology, and in particular to a method and system for displaying an income ranking list. Background Art
[0002] Some e-commerce platforms and Internet logistics platforms provide income ranking display functions. Taking Internet logistics platforms as an example, drivers who undertake logistics and transportation business on the platform can create or participate in income rankings and view their own income rankings and other users on the list through the income rankings.
[0003] The current method for implementing the income ranking list is to directly store the income data of users participating in the ranking list in a high-speed read-write cache system, and display the income ranking list in real time based on the income data in the cache system.
[0004] The problem with this solution is that, on the one hand, it will take up too much cache space and affect the realization of other functions; on the other hand, the incoming data in the cache system is easily lost due to power outages or other reasons, and the data security is low. Summary of the invention
[0005] To this end, this application discloses the following technical solutions:
[0006] The first aspect of the present application provides a method for displaying an income ranking list, comprising:
[0007] In response to a request from a first user to display a first ranking list, determining whether the first user participates in the first ranking list;
[0008] When it is determined that the first user participates in the first ranking list, obtaining first ranking list data from the cache system;
[0009] If the cache system has the first ranking data, displaying the first ranking on the first device used by the first user according to the acquired first ranking data;
[0010] If the cache system does not have the first ranking data, the first ranking data is loaded from the disk system to the cache system, and the first ranking is displayed on the first device according to the first ranking data loaded into the cache system.
[0011] Optionally, loading the first ranking data from the disk system to the cache system includes:
[0012] In the case where the cache system stores the first ranking relationship data, loading the first ranking data from the disk system to the cache system;
[0013] In the case that the cache system does not store the first ranking relationship data, the first ranking data and the first ranking relationship data are loaded from the disk system to the cache system.
[0014] Optionally, also include:
[0015] When it is detected that the income data of the first user has changed and it is determined that the first user participates in the first ranking list, obtaining the first ranking list data corresponding to the first user from the cache system;
[0016] updating first ranking data corresponding to the first user in the cache system according to the changed income data of the first user;
[0017] An updated first ranking list is displayed on the first device according to the updated first ranking list data.
[0018] Optionally, also include:
[0019] In response to the first user's request to exit the first ranking list, deleting the first ranking list relationship data and first ranking list data corresponding to the first user in the cache system, and deleting the first ranking list relationship data and first ranking list data corresponding to other users in the cache system, where the other users refer to users who belong to the same first ranking list as the first user;
[0020] deleting the first ranking relationship data and the first ranking data corresponding to the first user from the disk system;
[0021] The first ranking relationship data and first ranking data corresponding to the first user in the cache system are deleted again, and the first ranking relationship data and first ranking data corresponding to other users in the cache system are deleted.
[0022] Optionally, also include:
[0023] In response to an invitation to join request for the first user, deleting the first ranking relationship data and the first ranking data corresponding to a second user from the cache system, the second user being the user who issued the invitation to join request;
[0024] Adding the first user to the first ranking relationship data corresponding to the second user in the disk system, and adding the income data of the first user to the first ranking data corresponding to the second user in the disk system;
[0025] deleting the first ranking relationship data and the first ranking data corresponding to the second user from the cache system again, the second user being the user who sent the invitation to join request;
[0026] The first ranking relationship data and the first ranking data corresponding to the second user in the disk system are loaded into the cache system.
[0027] Optionally, the adding the income data of the first user to the first ranking data corresponding to the second user in the disk system includes:
[0028] Filtering the income data of the first user according to the business filtering rule to obtain filtered income data of the first user;
[0029] The filtered income data of the first user is added to the first ranking data corresponding to the second user in the disk system.
[0030] A second aspect of the present application provides a system for displaying an income ranking list, comprising:
[0031] a determination module, configured to determine whether the first user participates in the first ranking list in response to a request from the first user to display the first ranking list;
[0032] an acquisition module, configured to acquire first ranking data from a cache system when it is determined that the first user participates in the first ranking;
[0033] A display module, configured to display the first ranking on a first device used by the first user according to the acquired first ranking data if the cache system has the first ranking data;
[0034] A loading module, configured to load the first ranking data from a disk system to the cache system if the cache system does not have the first ranking data;
[0035] The display module is used to display the first ranking list on the first device according to the first ranking list data loaded into the cache system.
[0036] Optionally, when the loading module loads the first ranking data from the disk system to the cache system, it is specifically used to:
[0037] In the case where the cache system stores the first ranking relationship data, loading the first ranking data from the disk system to the cache system;
[0038] In the case that the cache system does not store the first ranking relationship data, the first ranking data and the first ranking relationship data are loaded from the disk system to the cache system.
[0039] Optionally, an update module is also included to:
[0040] When it is detected that the income data of the first user has changed and it is determined that the first user participates in the first ranking list, obtaining the first ranking list data corresponding to the first user from the cache system;
[0041] updating first ranking data corresponding to the first user in the cache system according to the changed income data of the first user;
[0042] The display module is used for:
[0043] An updated first ranking list is displayed on the first device according to the updated first ranking list data.
[0044] Optionally, an exit module is also included to:
[0045] In response to the first user's request to exit the first ranking list, deleting the first ranking list relationship data and first ranking list data corresponding to the first user in the cache system, and deleting the first ranking list relationship data and first ranking list data corresponding to other users in the cache system, where the other users refer to users who belong to the same first ranking list as the first user;
[0046] deleting the first ranking relationship data and the first ranking data corresponding to the first user from the disk system;
[0047] The first ranking relationship data and first ranking data corresponding to the first user in the cache system are deleted again, and the first ranking relationship data and first ranking data corresponding to other users in the cache system are deleted.
[0048] The beneficial effect of this solution is that the ranking data is stored in the cache and on the disk at the same time. If the ranking needs to be displayed, if there is data in the cache, it will be displayed directly based on the cache data. If the data stored in the cache is deleted, the data will be loaded from the disk into the cache, and then displayed based on the cache data. This way, the data in the cache can be used to meet the need for quickly displaying the income ranking, and the disk can be used to ensure that data will not be lost, thereby improving data security. In addition, the data in the cache can be cleaned up when necessary to avoid occupying too much cache and affecting other functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0050] Figure 1This is a flow chart of a method for displaying an income ranking list provided in an embodiment of the present application;
[0051] Figure 2 It is an interactive flow chart for displaying income rankings provided by an embodiment of the present application;
[0052] Figure 3 This is a flow chart of a method for updating a ranking list provided in an embodiment of the present application;
[0053] Figure 4 This is a flow chart of a method for deleting a user from a ranking list provided by an embodiment of the present application;
[0054] Figure 5 This is a flowchart of inviting a user to join a ranking list provided by an embodiment of the present application;
[0055] Figure 6 It is a structural diagram of a system for displaying an income ranking list provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] This application embodiment provides a method for displaying an income ranking list, see Figure 1 , the method may include the following steps.
[0058] S101 , in response to a request from a first user to display a first ranking list, determining whether the first user participates in the first ranking list.
[0059] The method provided in this embodiment can be implemented by a server of an e-commerce platform or an Internet logistics platform that provides income rankings.
[0060] The first user can be a merchant user on an e-commerce platform, or a driver user who is responsible for logistics transportation on an Internet logistics platform.
[0061] See also Figure 2 In the interactive process shown, the first user can view the income ranking list on the first device, and the first device sends a request to display the first ranking list to the server in response to the operation. Figure 2 The ranking system is equivalent to the server of this embodiment.
[0062] The server may store ranking relationship data corresponding to multiple income rankings in the cache system and the disk system.
[0063] In step S101, the server may traverse each ranking relationship data to determine whether the first user is included therein. If there is at least one income ranking relationship data that includes the first user, the income ranking is determined to be the first ranking, and the first user is determined to participate in the first ranking. In this case, S102 may be executed; if each ranking relationship data does not include the first user, it may be determined that the first user does not participate in the first ranking. In this case, the display method of this embodiment ends.
[0064] The ranking list relationship data is used to indicate which users are included in each ranking list.
[0065] Ranking relationship data can be stored in different formats in the cache system and disk system.
[0066] As an example, when the cache system is a Redis system, the ranking relationship data in the cache system can be stored in the following hashMap format.
[0067] SQL
[0068] key: daily_income_ranking_list_users:driver_id
[0069] value: key: driver_id, value: join_time
[0070] In the above storage format, the key of the second line indicates the name of the ranking list and the user ID of the user who created the ranking list. The first value of the third line indicates a user included in the ranking list, that is, a user participating in the ranking list. The key of the third line indicates the user ID of the participating user. The second value of the third line indicates the time when the user joined the ranking list.
[0071] As an example, suppose that the income ranking list daily_income_ranking_list_users is created by user A, which includes user A and user B. User A's user id is 5432, and user B's user id is 2345. Then the cache system can store the following two ranking relationship data.
[0072] A ranking relationship data is.
[0073] SQL
[0074] key: daily_income_ranking_list_users:5432
[0075] value: key:5432, value:2021-10-0112:23:45
[0076] Another ranking relationship data is.
[0077] SQL
[0078] key: daily_income_ranking_list_users:5432
[0079] value:key:2345,value:2021-10-0112:30:50
[0080] Optionally, for the ranking relationship data in the above storage format, any specified ranking relationship data can be deleted and new ranking relationship data can be reset using the following code.
[0081] SQL
[0082] --Delete the map, reset the map, and set the expiration time
[0083] local key = KEYS[1]
[0084] local duration=tonumber(ARGV[1])
[0085] table.remove(ARGV,1)
[0086] redis.call('DEL',key)
[0087] foriinpairs(ARGV)do
[0088]
[0089] Optionally, the ranking relationship data stored in the cache system can be set with a corresponding expiration time (e.g., 24 hours, 12 hours). If a ranking relationship data is not updated after the expiration time, the server can actively update it, that is, delete the ranking relationship data in the cache system, copy the corresponding ranking relationship data from the disk system and load it into the cache system. This can avoid errors caused by long-term data non-updates.
[0090] S102: When it is determined that the first user participates in the first ranking list, first ranking list data is obtained from a cache system.
[0091] The first ranking data corresponding to the first user may include the name of the first ranking in which the first user participates, the time when the first user joins, the user ID of the user who created the ranking, the user ID of the first user himself, the ranking score of the first user and other data.
[0092] As an example, in the Redis cache system, the first ranking data corresponding to the first user can be represented by the following zset data structure.
[0093] SQL
[0094] key:daily_income_ranking_list:time:driver_id
[0095] member:driver_id
[0096] score: income. Cumulative joining time
[0097] The information after key is the name of the first ranking list, the time when the first user joined, the user ID of the user who created the ranking list, and the id after member is the user ID of the first user himself.
[0098] Score represents the ranking score of the first user in the ranking list. The larger the score is, the higher the first user is ranked in the first ranking list.
[0099] The income value may be expressed in points, and the income may represent the accumulated income amount of the first user in a recent period of time, such as the accumulated income amount in the most recent day, the accumulated income amount in the most recent week, and the like.
[0100] The cumulative joining time can be expressed in milliseconds, representing the time since the first user joined the ranking list. Under the condition of the same income, the earlier the user joins, the higher the ranking will be.
[0101] In step S102, the server may obtain the first ranking data of each user participating in the first ranking. For example, if users A, B, and C all participate in the first ranking, the first ranking data of user A, the first ranking data of user B, and the first ranking data of user C are obtained.
[0102] Optionally, for the ranking data in the above storage format, you can use the following code to delete any specified ranking data and reset new ranking data.
[0103] SQL
[0104] --Delete zset, reset zset, and set expiration time
[0105] local key = KEYS[1]
[0106] local duration=tonumber(ARGV[1])
[0107] table.remove(ARGV,1)
[0108] redis.call('DEL',key)
[0109] for i in pairs (ARGV) do
[0110] ifi>(table.getn(ARGV)) / 2then
[0111] break
[0112] end
[0113] redis.call('ZADD',key,ARGV[2*i-1],ARGV[2*i])
[0114] end
[0115] redis.call('EXPIRE',key,duration)
[0116] return 1
[0117] Optionally, the ranking data stored in the cache system (such as the aforementioned first ranking data) can be set with a corresponding expiration time (such as 24 hours, 12 hours). If a ranking data is not updated after the expiration time, the server can actively update it, that is, delete the ranking data in the cache system, copy the corresponding ranking data from the disk system and load it into the cache system. This can avoid errors caused by long-term non-update of data.
[0118] S103: If the cache system has the first ranking data, display the first ranking on a first device used by the first user according to the acquired first ranking data.
[0119] In step S103, if the cache system has first ranking data, the server can directly read out each first ranking data in the cache system, and then render and display the user IDs, user nicknames and other information of these users in order from large to small on the display screen of the first device according to the ranking scores of each user participating in the first ranking, with users with large ranking scores on the top and users with smaller ranking scores on the bottom, thereby displaying the first ranking on the first device.
[0120] S104: If the cache system does not have the first ranking data, load the first ranking data from the disk system to the cache system, and display the first ranking on the first device according to the first ranking data loaded into the cache system.
[0121] See also Figure 1 In step S104, step S1041 may be performed first to determine whether the cache system stores first ranking relationship data corresponding to the first ranking.
[0122] If the cache system stores the first ranking relationship data, executing step S1042, loading the first ranking data from the disk system into the cache system;
[0123] If the cache system does not store the first ranking relationship data, step S1043 may be executed to load the first ranking data and the first ranking relationship data from the disk system into the cache system.
[0124] The ranking relationship data and ranking data in the disk system can be stored in the form of a table. As an example, when the disk system is a MySQL system, a table storing the ranking relationship data and ranking data can be created in the disk system through the following table creation code.
[0125] SQL create table pk_relationship (
[0127] idint auto_increment,
[0128] initiatorintnotnull comment'initiator driver id',
[0129] invitees intnotnull comment'Invited driver id',
[0130] ˋstatusˋtinyint default 1null comment'0: invalid 1: valid',
[0131] created datetime default CURRENT_TIMESTAMP notnull,
[0132] updated datetime default CURRENT_TIMESTAMP not null on updateCURRENT_TIMESTAMP,
[0133] constraintpk_relationship
[0134] primarykey(id) )
[0136] comment'Driver income ranking relationship chart';
[0137] create index ix_invitees
[0138] onpk_relationship(invitees);
[0139] create index ix_initiator_invitees
[0140] onpk_relationship(initiator,invitees).
[0141] Optionally, the data stored in the disk system may also be refreshed at a certain period (eg, 24 hours) to avoid data errors.
[0142] Optionally, after receiving the income data reported by each user's client and receiving the client's request to join the leaderboard, the server can execute the above code to persist the received data to a table on the disk system, so that the data can be read from the disk system and reloaded into the cache system when the buffer fails.
[0143] After the first ranking data is loaded into the cache system, the manner of displaying the first ranking on the first device according to the first ranking data of the cache system can be referred to step S104, which will not be described in detail.
[0144] The beneficial effect of this solution is that the ranking data is stored in the cache and on the disk at the same time. If the ranking needs to be displayed, if there is data in the cache, it will be displayed directly based on the cache data. If the data stored in the cache is deleted, the data will be loaded from the disk into the cache, and then displayed based on the cache data. This way, the data in the cache can be used to meet the need for quickly displaying the income ranking, and the disk can be used to ensure that data will not be lost, thereby improving data security. In addition, the data in the cache can be cleaned up when necessary to avoid occupying too much cache and affecting other functions.
[0145] In some optional embodiments, the server may also update the ranking list when a change in the income data of the first user is detected.
[0146] like Figure 2 As shown, the server can receive income data of each user including the first user through a message queue (MQ).
[0147] If the income data of the first user changes, the server can Figure 3 The method shown updates the first ranking data, thereby updating the first ranking displayed by the first device.
[0148] S301: When it is detected that the income data of the first user has changed and it is determined that the first user participates in the first ranking list, first ranking list data corresponding to the first user is obtained from the cache system.
[0149] In step S301, the server can monitor the user income change events in the relevant system in real time. Taking the Internet logistics platform as an example, the server can monitor the income change events of each driver user in the Internet logistics platform, and obtain the latest income data of the driver user who has changed through the message queue when the income change event is monitored.
[0150] If the user whose income has changed has participated in the ranking list, the server may obtain the first ranking list data corresponding to the first user from the cache system; if the user whose income has changed has not participated in any ranking list, the method of this embodiment ends.
[0151] Taking the first user as an example, if the first user participates in the first ranking list when the first user's income changes, the server attempts to obtain the first ranking data corresponding to the first user from the cache system. If the first user does not participate in any ranking list when the income changes, this embodiment ends.
[0152] In step S301, if there is first ranking data in the cache system, the server directly executes S302 after obtaining the first ranking data. If there is no first ranking data in the cache system, the server can execute step S3011 and then execute step S302 based on the first ranking data loaded into the cache system.
[0153] S3011, obtaining first ranking data from a disk system and loading the first ranking data into a cache system.
[0154] S302: Update first ranking data corresponding to the first user in the cache system according to the changed income data of the first user.
[0155] In step S302, if the cache system does not have the first ranking data, the first ranking data may be loaded from the disk system to the cache system first, and then S302 is executed.
[0156] If there is first ranking data in the cache system, the server can call the following atomic update code based on the changed income data of the first user to update the first ranking data corresponding to the first user in the cache system through asynchronous update.
[0157] SQL
[0158] local key = KEYS[1]
[0159] local score = ARGV[1]
[0160] local member = ARGV[2]
[0161] local exists=redis.call('EXISTS',key)
[0162] ifexists == 1then
[0163] redis.call('ZADD',key,'XX',score,member)
[0164] end return 1
[0165] S303: Display the updated first ranking list on the first device according to the updated first ranking list data.
[0166] In step S303, the server may adjust the order of each user in the first ranking displayed on the first device according to the updated first ranking data corresponding to the first user, thereby displaying the updated first ranking.
[0167] When the income data of other users changes, the server may also update the first ranking data in the above manner, and display the updated first ranking on the devices (including the first device) of each user participating in the first ranking.
[0168] Optionally, after updating the first ranking data, the server may write the updated first ranking data into a disk system so as to persist the updated first ranking data.
[0169] In some optional embodiments, a user may also request to exit a ranking list that he has joined. For example, a first user may request to exit the aforementioned first ranking list. In this case, the server may Figure 4 The method shown removes the user from the leaderboard that he / she has joined.
[0170] S401, in response to a request by a first user to exit the first ranking list, deleting the first ranking list relationship data and first ranking list data corresponding to the first user in the cache system, and deleting the first ranking list relationship data and first ranking list data corresponding to other users in the cache system, where other users refer to users who belong to the same first ranking list as the first user.
[0171] In step S401, the first device may send a request to exit the first ranking list to the server according to the operation of exiting the first ranking list performed by the first user. In response to the request, the server searches the cache system for the first ranking relationship data and the first ranking data corresponding to the first user, as well as the first ranking relationship data and the first ranking data corresponding to other users, and then deletes all the found data.
[0172] The other users here refer to users who belong to the same first ranking list as the first user.
[0173] Optionally, after receiving the request to exit the first ranking list, the server may first determine whether the first user has joined the first ranking list.
[0174] The first ranking relationship data corresponding to the first user may be understood as the first ranking relationship data including the user ID of the first user.
[0175] The first ranking data corresponding to the first user may be understood as the first ranking data including the user ID of the first user.
[0176] The first ranking relationship data corresponding to other users may be understood as the first ranking relationship data including the user IDs of other users.
[0177] The first ranking data corresponding to other users may be understood as the first ranking data including the user IDs of other users.
[0178] S402: Delete the first ranking relationship data and the first ranking data corresponding to the first user from the disk system.
[0179] In step S402, the server may search the disk system for the first ranking relationship data and the first ranking data corresponding to the first user, and delete all of these data.
[0180] Exemplarily, the server may search for tables for storing the first ranking relationship data and the first ranking data in the disk system, and delete the records corresponding to the first user from these tables.
[0181] S403, deleting the first ranking relationship data and the first ranking data corresponding to the first user in the cache system again, and deleting the first ranking relationship data and the first ranking data corresponding to other users in the cache system.
[0182] In step S403, the server may perform the deletion operation in S401 again to delete the first ranking relationship data and first ranking data corresponding to the first user, and the first ranking relationship data and first ranking data corresponding to other users.
[0183] This method of performing two deletion operations on the cache system is called a delayed double deletion strategy. The advantage of this is that it ensures that the old first ranking data and first ranking relationship data in the cache system are deleted, and prevents the data stored in the cache system from not being updated in time after the data in the disk system is updated. Therefore, it is necessary to delete the corresponding data in the cache system before and after updating the disk system in step S402.
[0184] The above method of exiting the ranking list is described by taking the first user exiting the first ranking list as an example. According to actual conditions, the server may also delete the user from the ranking list in response to any user's request to exit the ranking list according to the above method.
[0185] Optionally, the server may, when the first user is invited and the first user agrees to the invitation, Figure 5 The manner shown adds the first user to the first ranking list.
[0186] S501, in response to an invitation to join request for a first user, deleting first ranking relationship data and first ranking data corresponding to a second user from a cache system, the second user being the user who sends the invitation to join request.
[0187] In step S501, the first ranking list may be a ranking list created by the second user. In this embodiment, the server may create a ranking list when any user sends an invitation to other users to join the ranking list, and the ranking list may be considered to be created by the sending user.
[0188] For example, in step S501, when the second user invites the first user to join the ranking list, if there is already a first ranking list created by the second user, step S501 is executed; if there is no first ranking list created by the second user at this time, a first ranking list can be created first, and then S501 is executed.
[0189] Optionally, before executing S501, it can be determined whether the first user meets the participation conditions and whether the first user is in the first ranking list invited to join. If the first user does not meet the participation conditions, or the first user is already in the first ranking list, this embodiment ends. If the first user meets the participation conditions and is not in the first ranking list, execute step S501.
[0190] The participation conditions may include the first user agreeing to join the first ranking list, and may also include that the first user is not a new user (i.e., the first user's cumulative registration time is greater than or equal to a certain threshold), and may also include other conditions, which can be set as needed and are not limited.
[0191] In step S501, each first ranking relationship data and first ranking data containing the user ID of the second user can be deleted from the cache system. For example, assuming that the user ID of the second user is 5432, each first ranking relationship data with the key daily_income_ranking_list_users:5432 can be deleted, and each first ranking data with the key daily_income_ranking_list:time:5432 can be deleted.
[0192] S502, adding the first user to the first ranking relationship data corresponding to the second user in the disk system, and adding the income data of the first user to the first ranking data corresponding to the second user in the disk system.
[0193] In step S502, the server can search for the data table storing the first ranking relationship data and the first ranking data in the disk system, and then add the user ID and income data of the first user to this data table, thereby obtaining the first ranking relationship data containing the first user, and the first ranking data containing the income data of the first user.
[0194] Writing data to the disk system can achieve data persistence and avoid data loss due to storage in the cache system.
[0195] S503: deleting the first ranking relationship data and the first ranking data corresponding to the second user from the cache system again, where the second user is the user who sent the invitation to join request.
[0196] The implementation of step S503 may be consistent with step S501 and will not be described in detail.
[0197] S504: Load the first ranking relationship data and the first ranking data corresponding to the second user in the disk system into the cache system.
[0198] In step S504, the first ranking relationship data in the disk system can be copied to the cache system in the aforementioned hashMap format, and the first ranking data can be copied to the cache system in the aforementioned zset format, so that when the first ranking needs to be displayed later, it can be displayed directly according to the first ranking data and the first ranking relationship data stored in the cache system, thereby improving the display efficiency of the ranking.
[0199] The income data of the first user may be received by the server through a message queue. For example, when applied to an Internet logistics platform, the Internet logistics platform may send the income data of the first user to a message queue, and then the server executing the method of this embodiment obtains the income data of the first user from the message queue to execute the above steps.
[0200] For example, assuming that the user ID of the first user is 5432, the user ID of the second user is 2345, the income of the first user is 50,000 (points), and the cumulative joining time is 10 hours (h), then the user ID and income data of the first user are added to the data table storing the first ranking relationship data and the first ranking data in the disk system, and after these data are loaded into the cache system, the cache system may have the following first ranking relationship data.
[0201] SQL
[0202] key: daily_income_ranking_list_users:2345
[0203] value: key:5432, value:2021-10-0112:23:45
[0204] The first ranking relationship data indicates that the first user 5432 has joined the first ranking created by the second user 2345;
[0205] And the cache system may have the following first ranking data.
[0206] The zset data structure is shown below.
[0207] SQL
[0208] key: daily_income_ranking_list: time: 2345
[0209] member:5432
[0210] score:50000.10h
[0211] When the first user or other users participating in the first ranking need to display the first ranking on their respective devices, the server can sort these users according to the ranking score of the first user in the first ranking data and the ranking scores of other users participating in the first ranking to form a first ranking including the first user.
[0212] The above method can be applied to adding any user to any ranking list. For example, when the second user first creates the first ranking list, the user ID and income data of the second user can be added to the table storing the data of the first ranking list in the above manner, and the added data can be loaded from the table to the cache system. When the second user invites a third user, the user ID and income data of the third user can be added to the table storing the data of the first ranking list in the above manner, and the added data can be loaded from the table to the cache system. The above process of adding the first user to the first ranking list is only an example.
[0213] In this embodiment, for any user, the leaderboard in which the user participates may only include the user himself, the users invited by the user to join, and the user who invited the user to join the leaderboard.
[0214] For example, suppose there are users A, B, C, and D, where A invites B and C, and B invites D and C, then:
[0215] The leaderboard that user A participates in may include A, B invited by A, and C invited by A;
[0216] The leaderboard that user B participates in may include B, A who invited user B, D who was invited by user B, and C who was invited by user B;
[0217] The leaderboard in which user C participates may include C, A who invited user C, and B who invited user C.
[0218] The leaderboard in which user D participates may include D and B who invited user D.
[0219] Optionally, when adding the income data of the first user to the first ranking data corresponding to the second user in the disk system, the server may first filter the income data in the following manner, and then add the filtered income data to the first ranking data.
[0220] Filtering the income data of the first user according to the business filtering rule to obtain filtered income data of the first user;
[0221] The filtered income data of the first user is added to the first ranking data corresponding to the second user in the disk system.
[0222] The above method of filtering income data can also be applied before the server updates the ranking list according to the income data, that is, the server first filters the updated income data according to the above method, and then ranks the ranking list based on the filtered income data. Figure 3 The method shown updates the leaderboard data.
[0223] Business filtering rules can be set as needed without limitation. As an example, when applied to an Internet logistics platform, business filtering rules may include:
[0224] The blacklist filtering rule for driver users, that is, if the first user currently invited to join belongs to the blacklist, the income data of the first user will not be added to the first ranking data.
[0225] The filtering rule for the driver's income amount being less than the target value is to filter out the income data that is less than the target value, and only include the income data that is greater than the target value in the first ranking data;
[0226] The filtering rule of the income type is to ignore the income data generated by a specific type of transaction in the income data. The ignored data is not counted in the income of the user's first ranking data.
[0227] In addition, business filtering rules may also include the calculation of additional red envelopes in income, the deduction of unrecorded amounts, the removal of duplicate data, etc., which will not be elaborated here.
[0228] The present application also provides a display system for income rankings, see Figure 6 The system may include the following modules.
[0229] A determination module 601 is used to determine whether the first user participates in the first ranking list in response to a request from the first user to display the first ranking list;
[0230] An acquisition module 602 is used to acquire first ranking data from a cache system when it is determined that the first user participates in the first ranking;
[0231] Display module 603, configured to display the first ranking list on a first device used by a first user according to the acquired first ranking list data if the cache system has the first ranking list data;
[0232] A loading module 604 is used to load the first ranking data from the disk system to the cache system if the cache system does not have the first ranking data;
[0233] The display module 603 is used to display the first ranking list on the first device according to the first ranking list data loaded into the cache system.
[0234] Optionally, when the loading module 604 loads the first ranking data from the disk system to the cache system, it is specifically used to:
[0235] In the case where the cache system stores the first ranking relationship data, loading the first ranking data from the disk system into the cache system;
[0236] In the case that the cache system does not store the first ranking relationship data, the first ranking data and the first ranking relationship data are loaded from the disk system to the cache system.
[0237] Optionally, an updating module 605 is also included, which is used to:
[0238] When it is detected that the income data of the first user has changed and it is determined that the first user participates in the first ranking list, the first ranking list relationship data corresponding to the first user is obtained from the cache system;
[0239] Determine other users belonging to the first ranking list according to the first ranking list relationship data corresponding to the first user;
[0240] Update the first ranking data corresponding to the first user in the cache system according to the changed income data of the first user and the income data of other users;
[0241] The display module 603 is used for:
[0242] An updated first ranking list is displayed on the first device according to the updated first ranking list data.
[0243] Optionally, an exit module 606 is further included, which is used to:
[0244] In response to the first user's request to exit the first ranking list, the first ranking list relationship data and first ranking list data corresponding to the first user in the cache system are deleted, and the first ranking list relationship data and first ranking list data corresponding to other users in the cache system are deleted, where other users refer to users who belong to the same first ranking list as the first user;
[0245] Deleting the first ranking relationship data and the first ranking data corresponding to the first user from the disk system;
[0246] The first ranking relationship data and the first ranking data corresponding to the first user in the cache system are deleted again, and the first ranking relationship data and the first ranking data corresponding to other users in the cache system are deleted.
[0247] Optionally, the system further includes an invitation module 607, which is used to:
[0248] In response to an invitation to join request for the first user, deleting the first ranking relationship data and the first ranking data corresponding to the second user from the cache system, the second user being the user who sent the invitation to join request;
[0249] Adding the first user to the first ranking relationship data corresponding to the second user in the disk system, and adding the income data of the first user to the first ranking data corresponding to the second user in the disk system;
[0250] Deleting the first ranking relationship data and the first ranking data corresponding to the second user from the cache system again, the second user being the user who sent the invitation to join request;
[0251] The first ranking relationship data and the first ranking data corresponding to the second user in the disk system are loaded into the cache system.
[0252] Optionally, when the invitation module 607 adds the income data of the first user to the first ranking data corresponding to the second user in the disk system, it is specifically used to:
[0253] Filtering the income data of the first user according to the business filtering rule to obtain filtered income data of the first user;
[0254] The filtered income data of the first user is added to the first ranking data corresponding to the second user in the disk system.
[0255] The working principle of the income ranking display system provided in this embodiment can be found in the relevant steps of the income ranking display method provided in any embodiment of the present application, and will not be repeated here.
[0256] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0257] For the convenience of description, the above system or system is described by dividing the functions into various modules or units. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0258] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the relevant technology in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0259] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0260] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for displaying an income ranking list, characterized in that: include: In response to a request from a first user to display a first ranking list, determining whether the first user participates in the first ranking list; When it is determined that the first user participates in the first ranking list, obtaining first ranking list data from the cache system; If the cache system has the first ranking data, displaying the first ranking on the first device used by the first user according to the acquired first ranking data; If the cache system does not have the first ranking data, the first ranking data is loaded from the disk system to the cache system, and the first ranking is displayed on the first device according to the first ranking data loaded into the cache system.
2. The method according to claim 1, characterized in that The step of loading the first ranking data from the disk system to the cache system includes: In the case where the cache system stores the first ranking relationship data, loading the first ranking data from the disk system to the cache system; In the case that the cache system does not store the first ranking relationship data, the first ranking data and the first ranking relationship data are loaded from the disk system to the cache system.
3. The method according to claim 1, characterized in that Also includes: When it is detected that the income data of the first user has changed and it is determined that the first user participates in the first ranking list, obtaining the first ranking list data corresponding to the first user from the cache system; updating first ranking data corresponding to the first user in the cache system according to the changed income data of the first user; An updated first ranking list is displayed on the first device according to the updated first ranking list data.
4. The method according to claim 1, characterized in that: Also includes: In response to the first user's request to exit the first ranking list, deleting the first ranking list relationship data and first ranking list data corresponding to the first user in the cache system, and deleting the first ranking list relationship data and first ranking list data corresponding to other users in the cache system, where the other users refer to users who belong to the same first ranking list as the first user; deleting the first ranking relationship data and the first ranking data corresponding to the first user from the disk system; The first ranking relationship data and first ranking data corresponding to the first user in the cache system are deleted again, and the first ranking relationship data and first ranking data corresponding to other users in the cache system are deleted.
5. The method according to claim 1, characterized in that: Also includes: In response to an invitation to join request for the first user, deleting the first ranking relationship data and the first ranking data corresponding to a second user from the cache system, the second user being the user who issued the invitation to join request; Adding the first user to the first ranking relationship data corresponding to the second user in the disk system, and adding the income data of the first user to the first ranking data corresponding to the second user in the disk system; deleting the first ranking relationship data and the first ranking data corresponding to the second user from the cache system again, the second user being the user who sent the invitation to join request; The first ranking relationship data and the first ranking data corresponding to the second user in the disk system are loaded into the cache system.
6. The method according to claim 1, characterized in that The step of adding the income data of the first user to the first ranking data corresponding to the second user in the disk system includes: Filtering the income data of the first user according to the business filtering rule to obtain filtered income data of the first user; The filtered income data of the first user is added to the first ranking data corresponding to the second user in the disk system.
7. A system for displaying income rankings, characterized in that: include: a determination module, configured to determine whether the first user participates in the first ranking list in response to a request from the first user to display the first ranking list; an acquisition module, configured to acquire first ranking data from a cache system when it is determined that the first user participates in the first ranking; A display module, configured to display the first ranking on a first device used by the first user according to the acquired first ranking data if the cache system has the first ranking data; A loading module, configured to load the first ranking data from a disk system to the cache system if the cache system does not have the first ranking data; The display module is used to display the first ranking list on the first device according to the first ranking list data loaded into the cache system.
8. The system according to claim 7, characterized in that When the loading module loads the first ranking data from the disk system to the cache system, it is specifically used to: In the case where the cache system stores the first ranking relationship data, loading the first ranking data from the disk system to the cache system; In the case that the cache system does not store the first ranking relationship data, the first ranking data and the first ranking relationship data are loaded from the disk system to the cache system.
9. The system according to claim 7, characterized in that Also includes update modules for: When it is detected that the income data of the first user has changed and it is determined that the first user participates in the first ranking list, obtaining the first ranking list data corresponding to the first user from the cache system; updating first ranking data corresponding to the first user in the cache system according to the changed income data of the first user; The display module is used for: An updated first ranking list is displayed on the first device according to the updated first ranking list data.
10. The system according to claim 7, characterized in that Also includes exit modules for: In response to the first user's request to exit the first ranking list, deleting the first ranking list relationship data and first ranking list data corresponding to the first user in the cache system, and deleting the first ranking list relationship data and first ranking list data corresponding to other users in the cache system, where the other users refer to users who belong to the same first ranking list as the first user; deleting the first ranking relationship data and the first ranking data corresponding to the first user from the disk system; The first ranking relationship data and first ranking data corresponding to the first user in the cache system are deleted again, and the first ranking relationship data and first ranking data corresponding to other users in the cache system are deleted.
