Method and apparatus for synchronizing fan data in a database

By comparing and synchronizing fan data from the WeChat Official Accounts platform in Redis, the problem of inaccurate data during the synchronization process was solved, achieving high efficiency and accuracy of fan data in the database.

CN119003537BActive Publication Date: 2026-07-21BEIJING GRIDSUM TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING GRIDSUM TECH CO LTD
Filing Date
2023-05-19
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing technologies, due to the large amount of WeChat fan data and the long synchronization process, the fan data stored in the database is inaccurate when fan data changes during the data retrieval period.

Method used

The fan data in the database is read into Redis and compared with the actual fan data on the WeChat Official Account platform to determine if there are any data change messages. Based on the comparison results and change messages, the fan data to be synchronized is determined and modified once during synchronization.

Benefits of technology

This improved the accuracy of fan data in the database, reduced erroneous modifications caused by data changes, and ensured the accuracy of data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003537B_ABST
    Figure CN119003537B_ABST
Patent Text Reader

Abstract

The application provides a fan data synchronization method and device in a database, and relates to the technical field of data processing. The method comprises the following steps: reading fan data in a database to Redis to obtain fan data in Redis; calling a fan data acquisition interface to pull actual fan data in a WeChat public account platform; comparing the fan data in the Redis with the actual fan data to obtain a comparison result; judging whether a fan data change message sent by the WeChat public account platform is received; if yes, determining to-be-synchronized fan data according to the comparison result and the fan data change message; if no, determining the comparison result as the to-be-synchronized fan data; and synchronizing the to-be-synchronized fan data to the database. The application can improve the accuracy of fan data stored in the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method and apparatus for synchronizing fan data in a database. Background Technology

[0002] Some third-party companies are often commissioned to provide follower data for certain public accounts. To quickly and accurately obtain follower data, these third parties often create databases to store the follower data for each public account. However, since the follower data in the database may be inaccurate, it is necessary to periodically verify the follower data in the database to identify followers who are not actually following the account but are listed as such in the database.

[0003] When verifying the follower data in the database, the follower data is first read into Redis. Then, the WeChat follower retrieval API is called, fetching 100 messages from followed followers each time and storing them in a cache, until all actual follower data from WeChat is retrieved into the cache. Finally, the follower data in Redis is compared with the actual follower data retrieved through the WeChat follower retrieval API to identify followers who are not actually followed but are listed as followed in the database, and this data is synchronized back to the database.

[0004] Since WeChat has millions of followers, it often takes a long time to retrieve this data. If the database receives follower data change messages from the WeChat Official Accounts platform during this period, such as unfollowing events, the database will be modified based on these events. However, subsequent database synchronization may also modify the follower data, ultimately leading to inaccurate follower data stored in the database. Summary of the Invention

[0005] In view of this, this application provides a method and apparatus for synchronizing fan data in a database, which can improve the accuracy of fan data stored in the database.

[0006] To achieve the above objectives, this application mainly provides the following technical solutions:

[0007] Firstly, this application provides a method for synchronizing fan data in a database, the method comprising:

[0008] Read the fan data from the database into Redis, and obtain the fan data in Redis;

[0009] The actual fan data is retrieved from the WeChat Official Account platform by calling the fan data acquisition interface;

[0010] The fan data in Redis is compared with the actual fan data to obtain the comparison results;

[0011] Determine whether to receive the fan data change message sent by the WeChat Official Account platform;

[0012] If so, then determine the fan data to be synchronized based on the comparison results and the fan data change message;

[0013] If not, the comparison result will be determined as the fan data to be synchronized;

[0014] The fan data to be synchronized is synchronized to the database.

[0015] Secondly, this application provides a device for synchronizing fan data in a database, the device comprising:

[0016] The read unit is used to read fan data from the database into Redis, and obtain the fan data in Redis;

[0017] The pull unit is used to pull actual fan data from the WeChat Official Account platform by calling the fan data acquisition interface;

[0018] The comparison unit is used to compare the fan data in Redis with the actual fan data to obtain a comparison result;

[0019] The judgment unit is used to determine whether to receive the fan data change message sent by the WeChat official account platform;

[0020] The first determining unit is used to determine the fan data to be synchronized based on the comparison result and the fan data change message if the condition is met.

[0021] The second determining unit is used to determine the comparison result as the fan data to be synchronized if no;

[0022] The synchronization unit is used to synchronize the fan data to be synchronized to the database.

[0023] Thirdly, this application also provides an electronic device, which includes at least one processor, at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the fan data synchronization database method described in the first aspect.

[0024] Fourthly, this application provides a storage medium for storing a computer program, wherein the computer program, when running, controls the device where the storage medium is located to execute the method for synchronizing fan data in a database as described in the first aspect.

[0025] By employing the above technical solution, this application provides a method and apparatus for synchronizing fan data in a database. The method involves reading fan data from the database into Redis to obtain the fan data in Redis; retrieving actual fan data from the WeChat Official Account platform by calling a fan data retrieval interface; comparing the fan data in Redis with the actual fan data to obtain a comparison result; determining whether a fan data change message sent by the WeChat Official Account platform has been received; if so, determining the fan data to be synchronized based on the comparison result and the fan data change message; if not, determining the comparison result as the fan data to be synchronized; and synchronizing the fan data to be synchronized to the database. In this application, if a fan data change message is received during synchronization, the fan data to be synchronized is obtained based on the message, and then synchronization is performed based on this fan data. This means that during database synchronization, only one modification to the fan data in the database is needed, improving the accuracy of the fan data stored in the database.

[0026] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the 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.

[0028] Figure 1 This is a flowchart illustrating a method for synchronizing fan data in a database as disclosed in this application;

[0029] Figure 2 This is a flowchart illustrating a method for determining comparison results disclosed in this application;

[0030] Figure 3 This is a flowchart illustrating a method for synchronizing fan data in a database as disclosed in this application;

[0031] Figure 4 This is a flowchart illustrating another method for determining fan data to be synchronized disclosed in this application;

[0032] Figure 5 This is a flowchart illustrating a method for verifying fan data to be synchronized, as disclosed in this application.

[0033] Figure 6 This is a schematic diagram of the structure of a fan data device in a synchronous database disclosed in this application;

[0034] Figure 7 This is a schematic diagram of the structure of a fan data device in a synchronous database disclosed in this application;

[0035] Figure 8 This is a block diagram of a device disclosed in this application. Detailed Implementation

[0036] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.

[0037] Some third-party companies are often commissioned to provide follower data for certain public accounts. To quickly and accurately obtain follower data, these third parties often create databases to store the follower data for each public account. However, since the follower data in the database may be inaccurate, it is necessary to periodically verify the follower data in the database to identify followers who are not actually following the account but are listed as such in the database.

[0038] When verifying the follower data in the database, the follower data is first read into Redis. Then, the WeChat follower retrieval API is called, fetching 100 messages from followed followers each time and storing them in a cache, until all actual follower data from WeChat is retrieved into the cache. Finally, the follower data in Redis is compared with the actual follower data retrieved through the WeChat follower retrieval API to identify followers who are not actually followed but are listed as followed in the database, and this data is synchronized back to the database.

[0039] Since WeChat has millions of followers, it often takes a long time to retrieve this data. If the database receives follower data change messages from the WeChat Official Accounts platform during this period, such as unfollowing events, the database will be modified based on these events. However, subsequent database synchronization may also modify the follower data, ultimately leading to inaccurate follower data stored in the database.

[0040] To address the aforementioned problems, this application provides a method for synchronizing fan data in a database, which can improve the accuracy of fan data stored in the database. The specific execution steps are as follows: Figure 1 As shown, it includes:

[0041] Step 101: Read the fan data from the database into Redis to obtain the fan data in Redis.

[0042] The follower data in Redis should at least include the followed public account, the following username, and the following status. The following status is "followed". Of course, the follower data in Redis may also include other information, such as the time of following and the address of the following username, but this step is not limited to these.

[0043] This step involves a hardware-based database, while Redis is an in-memory database. Therefore, this step essentially involves reading the fan data stored in the hardware into memory. Since the database contains millions of fan records, to reduce the read load on the device, the read operation can be performed in multiple steps. For example, 1000 fan records can be read into Redis each time.

[0044] Step 102: Retrieve actual fan data from the WeChat Official Account platform by calling the fan data acquisition interface.

[0045] The actual follower data includes at least the followed public accounts and the usernames of the followers. Of course, the actual follower data also includes follow status, username information, etc., which are not limited here.

[0046] In the specific implementation of this step, some interfaces can only retrieve one specific piece of fan data, while others can retrieve a preset number of fan data pieces from the WeChat Official Accounts platform, until all fan data from the platform is retrieved. To obtain all actual fan data from the WeChat Official Accounts platform, this step uses a fan data retrieval interface to batch retrieve a preset number of actual fan data pieces, until all actual fan data from the platform is retrieved. For example, the fan data retrieval interface can be used to batch retrieve 1000 pieces of actual fan data, until all actual fan data from the platform is retrieved.

[0047] Step 103: Compare the fan data in Redis with the actual fan data to obtain the comparison results.

[0048] In this specific implementation, the official account and username are retrieved from the actual follower data, and the corresponding follower data is searched in the Redis follower data. If found, the follower data can be deleted from Redis. If not found, the follower data is retrieved again from the WeChat Official Account platform based on the official account and username, and added to the comparison results. If follower data still exists in Redis after searching with all the actual follower data, the follow status of these follower data is changed to unfollow, and added to the comparison results. Alternatively, it can be used... Figure 2 The method described to determine the comparison results is not limited here.

[0049] Step 104: Determine whether to receive the fan data change message sent by the WeChat Official Account platform.

[0050] Because databases often store millions of actual follower data entries, and each retrieval process can only retrieve 1,000 entries, it takes a very long time to retrieve all the actual follower data from the WeChat Official Accounts platform. If, during this period, a user clicks the unfollow button or the follow button on WeChat, that user's follow status in the database needs to change. Therefore, the WeChat Official Accounts platform will send a follower data change message to the current electronic device. If, during this period, no user clicks the unfollow button or the follow button on WeChat, the WeChat Official Accounts platform will not send a follower data change message to the current electronic device.

[0051] Step 105: If so, determine the fan data to be synchronized based on the comparison results and fan data change messages.

[0052] In the specific implementation of this step, if so, it means that when a fan data change message is received during the data retrieval process, the comparison result is modified according to the fan data change message to obtain the fan data to be synchronized.

[0053] The follower data change message in this step includes at least the official account, username, and follow status. When the follow status in the follower data change message is "followed," the comparison results can be checked to see if follower data for that official account and username exists. If yes, the comparison result is not modified if the follow status is "followed," and modified if the follow status is "unfollowed," based on the follow status in the follower data change message. If no, the follower data is retrieved again from the WeChat Official Account platform, and then this follower data and the follower data in the comparison result are identified as the follower data to be synchronized. When the follow status in the follower data change message is "unfollowed," it can be first checked whether the follower data corresponding to the official account and username in the follower data change message is in the comparison results. If yes, the comparison result is not modified if the follow status is "unfollowed," and modified if the follow status is "followed," based on the follow status in the follower data change message. If not, the fan data will be retrieved again from the WeChat Official Accounts platform, and then the fan data and the fan data in the comparison results will be identified as the fan data to be synchronized.

[0054] Step 106: If not, compare the results and determine them as fan data to be synchronized.

[0055] In the specific implementation of this step, if no fan data change message is received during the data retrieval period, the comparison result can be directly identified as the fan data to be synchronized.

[0056] Step 107: Synchronize the fan data to be synchronized to the database.

[0057] In the specific implementation of this step, based on the official account and username in the fan data to be synchronized, the following status corresponding to the official account and username is found in the database. Based on the following status in the fan data to be synchronized, the found following status is modified, thereby realizing the synchronization of the fan data to be synchronized to the database.

[0058] Furthermore, since the follow status in the follower data stored in the database is all "following", when the follow status of a follower is "unfollowing", the follower data can be deleted to avoid the follower data occupying the database storage space.

[0059] In this embodiment, fan data from the database is read into Redis to obtain fan data in Redis; actual fan data from the WeChat Official Account platform is retrieved by calling the fan data retrieval interface; the fan data in Redis and the actual fan data are compared to obtain a comparison result; it is determined whether a fan data change message sent by the WeChat Official Account platform has been received; if so, the fan data to be synchronized is determined based on the comparison result and the fan data change message; if not, the comparison result is used to determine the fan data to be synchronized; and the fan data to be synchronized is synchronized to the database. In this application, if a fan data change message is received during synchronization, the fan data to be synchronized is obtained based on the message, and then synchronization is performed based on the fan data to be synchronized. In this way, during database synchronization, only the fan data in the database needs to be modified once, improving the accuracy of the fan data stored in the database.

[0060] This application provides a method for determining comparison results. In this method, each piece of follower data in Redis corresponds to a synchronization timestamp, and the comparison result is determined based on the synchronization timestamp corresponding to each piece of follower data. Specifically, as follows... Figure 2 As shown, it includes:

[0061] Step 201: Generate a first timestamp based on the starting time of data retrieval, and set the synchronization timestamp of each actual fan data item as the first timestamp.

[0062] In this specific step, the starting time of data retrieval is used as the synchronization start time. This allows the generation of a first timestamp based on the data retrieval start time, and the synchronization timestamp of each actual follower data entry is set as the first timestamp to represent the actual follower data used in the current synchronization.

[0063] Step 202: Compare the fan data in Redis with the actual fan data whose synchronization timestamp is less than the first timestamp. If they match, set the synchronization timestamp of the matching fan data to the first timestamp.

[0064] Each fan data entry in Redis has a corresponding synchronization timestamp, which is determined by the last synchronization time or the time it was written to Redis.

[0065] In the specific implementation of this step, since the fan data with a synchronization timestamp greater than or equal to the first timestamp in Redis is written to Redis after synchronization, such data will be processed later. Therefore, this step only compares the fan data with a synchronization timestamp less than the first timestamp in Redis with the actual fan data. If the comparison is successful, the synchronization timestamp of the compared fan data is set to the first timestamp.

[0066] Step 203: Select the fan data with a synchronization timestamp that is less than the first timestamp as the comparison result.

[0067] In the specific implementation of this step, fan data with synchronization timestamps less than the first timestamp are selected and determined as the comparison results.

[0068] exist Figure 2 Based on the aforementioned embodiments, this application provides a method for determining fan data to be synchronized. This method can determine the fan data to be synchronized based on comparison results and fan data change messages, such as... Figure 3 As shown, the specific steps include:

[0069] Step 301: When the follow status changes to unfollow, generate a second timestamp based on the time point when the follower data change message is received.

[0070] The message indicating a change in follower data includes at least the followed official account, the following username, and the changed follow status ("unfollowed"). Essentially, a follow or unfollow event is sent by the WeChat Official Accounts platform. For example, if the changed follow status in the follower data change message is "unfollowed," then the message is essentially an unfollow event. If the changed follow status in the follower data change message is "followed," then the message is essentially a follow event.

[0071] Step 302: Based on the official account and username, find the fan data to be updated in the fan data in Redis.

[0072] The fan data to be updated includes at least the official account, username, and follow status.

[0073] In the specific implementation of this step, when the follower status in the follower data change message is "unfollowed," the corresponding follower data should theoretically be stored in Redis. Therefore, based on the official account and username in the follower data change message, it is necessary to find the corresponding follower data to be updated in Redis, so as to change the follower status in the follower data to "unfollowed." If the follower data corresponding to the follower data change message is not stored in Redis, the follower data in Redis will not be updated.

[0074] Step 303: Based on the changed follow status, update the follow status in the follower data to be updated, and modify its corresponding synchronization timestamp to the second timestamp.

[0075] In the specific implementation of this step, the following status in the fan data to be updated is changed to unfollowed, and its corresponding synchronization timestamp is changed to the second timestamp.

[0076] Since the follow status of fans whose synchronization timestamp is less than the second timestamp is changed to unfollow, if the synchronization timestamp of the fan data to be updated is less than the first timestamp, the fan data to be updated can be left unupdated, or the synchronization timestamp can be left unupdated to the second timestamp.

[0077] Step 304: Identify fan data whose synchronization timestamp is not the first timestamp as fan data to be synchronized.

[0078] In the specific implementation of this step, after completing step 303, the follower data in Redis with the first synchronization timestamp is compared with the actual follower data. Follower data with synchronization timestamps other than the first timestamp either have an unfollow status or were added to Redis after the synchronization start time. Therefore, these follower data need to be identified as the follower data to be synchronized, and then synchronization processing is performed based on these follower data.

[0079] exist Figure 2 Based on the embodiments described above, this application also provides a method for determining fan data to be synchronized. This method can determine the fan data to be synchronized based on comparison results and fan data change messages, such as... Figure 4 As shown, the specific steps include:

[0080] Step 401: When the follow status is "followed", retrieve the data of fans to be added from the WeChat Official Account platform based on the official account and username.

[0081] The message indicating changes in fan data includes at least the official account, the username, and the changed follow status. The official account is the one that has been followed / unfollowed, and the username is the one that has followed / unfollowed the official account.

[0082] In the specific implementation of this step, when the follower status in the follower data change message is "followed," it is necessary to add the follower data corresponding to that follower data change message. Therefore, it is necessary to first obtain the follower data corresponding to that follower data change message. The specific steps are as follows: first, send the official account and username from the follower data change message to the WeChat Official Account platform, so that the WeChat Official Account platform returns the follower data to be added, which includes the official account and username.

[0083] Step 402: Generate a second timestamp based on the time point of receiving the fan data change message or the time point of acquiring the fan data to be added.

[0084] In the specific implementation of this step, in step 103, in order to avoid comparing the fan data obtained in step 401 with the actual fan data, a synchronization timestamp can be set for the fan data to be added, and its synchronization timestamp is set after the synchronization starts, so as to indicate that the fan data to be added does not need to be compared with the actual fan data.

[0085] Step 403: Add the fan data to be added to Redis and set its corresponding synchronization timestamp to the second timestamp.

[0086] In the specific implementation of this step, after obtaining the fan data to be added, the fan data to be added is added to Redis, and its corresponding synchronization timestamp is set as the second timestamp.

[0087] Step 404: Identify fan data whose synchronization timestamp is not the first timestamp as fan data to be synchronized.

[0088] In the specific implementation of this step, after completing step 403, the follower data in Redis with the first synchronization timestamp is compared with the actual follower data. Follower data with synchronization timestamps other than the first timestamp either have an unfollow status or were added to Redis after the synchronization start time. Therefore, these follower data need to be identified as the follower data to be synchronized, and then synchronization processing is performed based on these follower data.

[0089] exist Figure 1-4 Based on the embodiments described above, this application also provides a method for verifying fan data to be synchronized. This method can verify the accuracy of the fan data to be synchronized, such as... Figure 5 As shown, the specific steps include:

[0090] Step 501: Based on the official account and username in the fan data to be synchronized, obtain the verified fan data in the WeChat Official Accounts Platform.

[0091] In the specific implementation of this step, the official account and username in the fan data to be synchronized are sent to the WeChat Official Account Platform, so that the WeChat Official Account Platform returns the verified fan data that includes both the official account and the username.

[0092] Step 502: Verify the fan data to be synchronized based on the verified fan data.

[0093] In this specific implementation, the verified fan data and the synchronized fan data are compared. If they match perfectly, the fan data to be synchronized is determined to be correct, and the fan data in the database is verified based on the fan data to be synchronized. If any fan data does not match, the fan data to be synchronized is modified based on the verified fan data, and then the fan data in the database is synchronized based on the modified fan data.

[0094] Furthermore, as a response to the above Figure 1-5 The implementation of the method embodiment shown in this application provides a device for synchronizing fan data in a database, which can improve the accuracy of fan data stored in the database. The embodiment of this device corresponds to the foregoing method embodiment. For ease of reading, this embodiment will not repeat the details of the foregoing method embodiment, but it should be understood that the device in this embodiment can implement all the contents of the foregoing method embodiment. Specifically, as shown... Figure 6 As shown, the device includes:

[0095] Reading unit 601 is used to read fan data from the database into Redis and obtain fan data in Redis;

[0096] The pull unit 602 is used to pull actual fan data from the WeChat Official Account platform by calling the fan data acquisition interface;

[0097] The comparison unit 603 is used to compare the fan data in Redis with the actual fan data to obtain a comparison result;

[0098] The judgment unit 604 is used to determine whether to receive the fan data change message sent by the WeChat official account platform;

[0099] The first determining unit 605 is used to determine the fan data to be synchronized based on the comparison result and the fan data change message if the condition is met.

[0100] The second determining unit 606 is used to determine the comparison result as the fan data to be synchronized if no.

[0101] Synchronization unit 607 is used to synchronize the fan data to be synchronized to the database.

[0102] Optional, such as Figure 7 As shown, each piece of fan data in the Redis database corresponds to a synchronization timestamp. The device also includes a setting unit 608.

[0103] The setting unit 608 is also used to generate a first timestamp based on the start time of data retrieval, and set the synchronization timestamp of each actual fan data as the first timestamp;

[0104] The comparison unit 603 includes:

[0105] The first comparison module 6031 is used to compare fan data with the actual fan data whose synchronization timestamp is less than the first timestamp. If the comparison is successful, the synchronization timestamp of the fan data that is compared is set to the first timestamp.

[0106] The second determining module 6032 is used to determine the fan data whose synchronization timestamp is less than the first timestamp as the comparison result.

[0107] Optional, such as Figure 7 As shown, the fan data change message includes at least the official account, username, and changed follow status. The first determining unit 605 includes:

[0108] The first generation module 6051 is used to generate a second timestamp based on the time point of receiving the fan data change message when the follow status is unfollowed.

[0109] The lookup module 6052 is used to find the follower data to be updated in the follower data in Redis based on the followed public account and the followed username. The follower data to be updated includes at least the public account, the username, and the follow status.

[0110] The update module 6053 is used to update the follow status in the follower data to be updated according to the changed follow status, and modify the corresponding synchronization timestamp to the second timestamp.

[0111] The first determining module 6054 is used to determine the fan data whose synchronization timestamp is not the first timestamp as the fan data to be synchronized.

[0112] Optionally, the fan data change message includes at least the official account, username, and changed follow status, and the first determining unit 605 includes:

[0113] The acquisition module 6055 is used to acquire the data of fans to be added in the WeChat Official Account platform based on the official account and the username when the following status is "followed".

[0114] The second generation module 6056 is used to generate a second timestamp based on the time point of receiving the fan data change message or the time point of acquiring the fan data to be added.

[0115] Setting module 6057 is used to add the fan data to be added to Redis and set its corresponding synchronization timestamp as the second timestamp;

[0116] The second comparison module 6058 is used to determine the fan data whose synchronization timestamp is not the first timestamp as the fan data to be synchronized.

[0117] Optional, such as Figure 7 As shown, the device further includes:

[0118] The calling unit 608 is used to call the WeChat Official Account platform to obtain the verification fan data based on the official account and username in the fan data to be synchronized; and to verify the fan data to be synchronized based on the verification fan data.

[0119] Furthermore, embodiments of this application also provide an electronic device, which includes at least one processor, and at least one memory and bus connected to the processor; wherein the processor and memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the above-mentioned... Figure 1-5 The method for synchronizing fan data in the database as described in the article.

[0120] Furthermore, embodiments of this application also provide a storage medium for storing a computer program, wherein the computer program, when running, controls the device where the storage medium is located to execute the above-mentioned... Figure 1-5 The method for synchronizing fan data in the database.

[0121] Figure 8 This is a block diagram of a device 80 provided in an embodiment of this application. The device 80 includes at least one processor 801, and at least one memory 802 and a bus 803 connected to the processor 801; wherein the processor 801 and the memory 802 communicate with each other via the bus 803. The processor 801 is used to call program instructions in the memory 802 to execute the aforementioned method for synchronizing fan data in a database. The device described herein can be a server (e.g., a local server or a cloud server), a smartphone, tablet computer, PDA, portable computer, or a fixed terminal such as a desktop computer.

[0122] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0123] It is understood that the relevant features in the above methods and apparatus can be referenced interchangeably. Furthermore, the terms "first," "second," etc., in the above embodiments are used to distinguish between embodiments and do not represent the superiority or inferiority of any particular embodiment.

[0124] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0125] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this application is not directed to any particular programming language. It should be understood that the content of this application described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of this application.

[0126] In addition, the memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0127] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0128] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0129] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0130] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0131] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0132] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0133] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0134] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0135] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for synchronizing fan data in a database, characterized in that, The method includes: Read the fan data from the database into Redis, and obtain the fan data in Redis; The actual fan data is retrieved from the WeChat Official Account platform by calling the fan data acquisition interface; The fan data in Redis is compared with the actual fan data to obtain the comparison results; Determine whether to receive the fan data change message sent by the WeChat Official Account platform; If so, then determine the fan data to be synchronized based on the comparison results and the fan data change message; If not, the comparison result will be determined as the fan data to be synchronized; The fan data to be synchronized is synchronized to the database.

2. The method according to claim 1, characterized in that, Each piece of fan data in Redis corresponds to a synchronization timestamp. After retrieving the actual fan data from the WeChat Official Account platform by calling the fan data retrieval interface, the method further includes: Generate a first timestamp based on the starting time of data retrieval, and set the synchronization timestamp of each actual fan data item as the first timestamp; The step of comparing the fan data in Redis with the actual fan data to obtain the comparison result includes: Compare the fan data in Redis whose synchronization timestamp is less than the first timestamp with the actual fan data. If they match, set the synchronization timestamp of the matching fan data to the first timestamp. Fan data with a synchronization timestamp less than the first timestamp are identified as comparison results.

3. The method according to claim 2, characterized in that, The fan data change message includes at least the official account, username, and changed follow status. The step of determining the fan data to be synchronized based on the comparison results and the fan data change message includes: When the follow status is unfollowed, a second timestamp is generated based on the time point when the follower data change message is received; Based on the official account and the username, find the follower data to be updated in the follower data in Redis. The follower data to be updated includes at least the official account, the username, and the follow status. Based on the changed follower status, update the follower status in the follower data to be updated, and modify its corresponding synchronization timestamp to the second timestamp. Fan data whose synchronization timestamp is not the first timestamp is identified as fan data to be synchronized.

4. The method according to claim 2, characterized in that, The fan data change message includes at least the official account, username, and changed follow status. The step of determining the fan data to be synchronized based on the comparison results and the fan data change message includes: When the following status is "followed", the data of fans to be added is obtained in the WeChat Official Accounts Platform based on the official account and the username; A second timestamp is generated based on the time point of receiving the fan data change message or the time point of acquiring the fan data to be added; Add the fan data to be added to Redis and set its corresponding synchronization timestamp to the second timestamp; Fan data whose synchronization timestamp is not the first timestamp is identified as fan data to be synchronized.

5. The method according to claim 1, characterized in that, Before synchronizing the fan data to be synchronized to the database, the method further includes: Based on the official account and username in the fan data to be synchronized, obtain the verified fan data in the WeChat Official Accounts platform; Based on the verified fan data, the fan data to be synchronized is verified.

6. A device for synchronizing fan data in a database, characterized in that, The device includes: The read unit is used to read fan data from the database into Redis, and obtain the fan data in Redis; The pull unit is used to pull actual fan data from the WeChat Official Account platform by calling the fan data acquisition interface; The comparison unit is used to compare the fan data in Redis with the actual fan data to obtain a comparison result; The judgment unit is used to determine whether to receive the fan data change message sent by the WeChat official account platform; The first determining unit is used to determine the fan data to be synchronized based on the comparison result and the fan data change message if the condition is met. The second determining unit is used to determine the comparison result as the fan data to be synchronized if no; The synchronization unit is used to synchronize the fan data to be synchronized to the database.

7. The apparatus according to claim 6, characterized in that, Each piece of fan data in the Redis repository has a corresponding synchronization timestamp. The device also includes a setting unit. The setting unit is also used to generate a first timestamp based on the start time of data retrieval, and set the synchronization timestamp of each actual fan data as the first timestamp; The comparison unit includes: The first comparison module is used to compare fan data with the actual fan data whose synchronization timestamp is less than the first timestamp. If the comparison is successful, the synchronization timestamp of the fan data that is compared is set to the first timestamp. The determination module is used to determine the fan data whose synchronization timestamp is not the first timestamp as the comparison result.

8. The apparatus according to claim 7, characterized in that, The fan data change message includes at least the official account, username, and the changed follow status. The first determining unit includes: The generation module is used to generate a second timestamp based on the time point of receiving the follower data change message when the follower status is unfollowed. The search module is used to find the follower data to be updated in the follower data in Redis based on the official account and the username. The follower data to be updated includes at least the official account, the username, and the follow status. The update module is used to update the follower status in the follower data to be updated according to the changed follower status, and modify the corresponding synchronization timestamp to the second timestamp. The determination module is used to determine the fan data whose synchronization timestamp is not the first timestamp as the fan data to be synchronized.

9. An electronic device, characterized in that, The electronic device includes at least one processor, and at least one memory and bus connected to the processor; wherein the processor and memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the fan data synchronization method in the database according to any one of claims 1-5.

10. A readable storage medium, characterized in that, The storage medium is used to store a computer program, wherein the computer program, when running, controls the device where the storage medium is located to execute the method for synchronizing fan data in a database as described in any one of claims 1-5.