Method and device for synchronizing fan data in database

By reading the data into Redis for comparison when synchronizing the fan data in the database, and updating the database according to the fan data change message, the accuracy problem during data synchronization is solved and the accuracy of fan data in the database is improved.

CN119003537AActive Publication Date: 2024-11-22BEIJING GRIDSUM TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202310573543.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-19
Publication Date
2024-11-22
Estimated Expiration
2043-05-19

AI Technical Summary

Technical Problem

When synchronizing fan data in the database, due to the huge amount of fan data in WeChat, the data extraction time may be long, which may cause the database to receive fan data change messages during data synchronization, resulting in inaccurate fan data stored in the database.

Method used

By reading the fan data in the database into Redis, comparing it with the actual fan data in the WeChat public account platform, we will determine whether the fan data change message has been received. If it is received, it will determine the synchronization based on the comparison result and the change message. and synchronize the fan data to ensure that the data modification is only once during the synchronization period.

Benefits of technology

Improve the accuracy of fan data stored in the database, avoid data inconsistency caused by data changes, and ensure the accuracy of the synchronization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003537A_ABST
    Figure CN119003537A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for synchronizing fan data 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 the Redis; pulling actual fan data in the WeChat official account platform by calling a fan data acquisition interface; 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 official account platform is received or not; if yes, determining fan data to be synchronized according to the comparison result and the fan data change message; if not, determining the comparison result as fan data to be synchronized; and synchronizing the fan data to be synchronized to a database. The accuracy of fan data stored in the database can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method and device for synchronizing fan data in a database. Background Art

[0002] Some third-party companies are often commissioned to provide feedback on the fan data of certain public accounts. In order to quickly and accurately obtain the fan data of public accounts, third parties often create a database to store the fan data of each public account. However, since the fan data in the database may be inaccurate, it is necessary to regularly check the fan data in the database to check the fan data of those who are not actually following but are following in the database.

[0003] When checking the fan data in the database, first read the fan data in the database into Redis. Then, call the WeChat fan acquisition interface, and pull 100 fan messages that have been followed and store them in the cache each time until all the actual fan data in WeChat is pulled into the cache. Finally, compare the fan data in Redis with the actual fan data pulled through the WeChat fan acquisition interface, find the fan data that is actually not followed but is followed in the database, and synchronize this data to the database.

[0004] Since there are more than one million followers in WeChat, it often takes a long time to pull the follower data. If the database receives a follower data change message sent by the WeChat official account platform during this period, such as a cancel follow event, the fan data in the database will be modified based on the cancel follow event, but the fan data in the database may also be modified when the database is synchronized later, which ultimately leads to inaccurate fan data stored in the database. Summary of the invention

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

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

[0007] In a first aspect, the present application provides a method for synchronizing fan data in a database, the method comprising:

[0008] Read the fan data in the database to Redis and obtain the fan data in Redis;

[0009] Pull the actual fan data in the WeChat official account platform by calling the fan data acquisition interface;

[0010] Compare the fan data in the Redis with the actual fan data to obtain a comparison result;

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

[0012] If yes, determining the fan data to be synchronized according to the comparison result and the fan data change message;

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

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

[0015] In a second aspect, the present application provides a device for synchronizing fan data in a database, the device comprising:

[0016] A reading unit is used to read the fan data in the database into Redis to obtain the fan data in Redis;

[0017] A pulling unit, used to pull actual fan data in the WeChat public account platform by calling a fan data acquisition interface;

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

[0019] A judgment unit, used to judge whether to receive the fan data change message sent by the WeChat public account platform;

[0020] A first determining unit, configured to determine the fan data to be synchronized according to the comparison result and the fan data change message if yes;

[0021] A second determining unit, configured to determine the comparison result as fan data to be synchronized if no;

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

[0023] In a third aspect, the present application also provides an electronic device, comprising at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute the fan data synchronization method in the database of the first aspect mentioned above.

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

[0025] By means of the above technical scheme, the present application provides a method and device for synchronizing fan data in a database, which reads fan data in the database into Redis to obtain fan data in Redis; pulls actual fan data in the WeChat public account platform by calling the fan data acquisition interface; compares the fan data in Redis with the actual fan data to obtain a comparison result; determines whether to receive a fan data change message sent by the WeChat public account platform; if so, determines the fan data to be synchronized based on the comparison result and the fan data change message; if not, determines the comparison result as the fan data to be synchronized; synchronizes the fan data to be synchronized to the database. In the present 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, so that during synchronization of the database, only one modification of the fan data in the database is required, thereby improving the accuracy of the fan data stored in the database.

[0026] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0028] Figure 1 A flowchart of a method for synchronizing fan data in a database disclosed in the present application;

[0029] Figure 2 A schematic diagram of a flow chart of a method for determining a comparison result disclosed in the present application;

[0030] Figure 3 A flowchart of a method for synchronizing fan data in a database disclosed in the present application;

[0031] Figure 4 A flowchart of another method for determining fan data to be synchronized disclosed in the present application;

[0032] Figure 5 A flowchart of a method for verifying fan data to be synchronized disclosed in this application;

[0033] Figure 6 A schematic diagram of the structure of a fan data synchronization device in a database disclosed in the present application;

[0034] Figure 7 This is a schematic diagram of the structure of another device for synchronizing fan data in a database disclosed in the present application;

[0035] Figure 8 It is a block diagram of a device disclosed in the present application. DETAILED DESCRIPTION

[0036] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0037] Some third-party companies are often commissioned to provide feedback on the fan data of certain public accounts. In order to quickly and accurately obtain the fan data of public accounts, third parties often create a database to store the fan data of each public account. However, since the fan data in the database may be inaccurate, it is necessary to regularly check the fan data in the database to check the fan data of those who are not actually following but are following in the database.

[0038] When checking the fan data in the database, first read the fan data in the database into Redis. Then, call the WeChat fan acquisition interface, and pull 100 fan messages that have been followed and store them in the cache each time until all the actual fan data in WeChat is pulled into the cache. Finally, compare the fan data in Redis with the actual fan data pulled through the WeChat fan acquisition interface, find the fan data that is actually not followed but is followed in the database, and synchronize this data to the database.

[0039] Since there are more than one million followers in WeChat, it often takes a long time to pull the follower data. If the database receives a follower data change message sent by the WeChat official account platform during this period, such as a cancel follow event, the fan data in the database will be modified based on the cancel follow event, but the fan data in the database may also be modified when the database is synchronized later, which ultimately leads to inaccurate fan data stored in the database.

[0040] In order to solve the above problems, the embodiment of the present 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, including:

[0041] Step 101, read the fan data in the database into Redis, and obtain the fan data in Redis.

[0042] The fan data in Redis at least includes the public account being followed, the user name being followed, and the following status. The following status is already followed. Of course, the fan data in Redis also includes other information, such as the time of following, the address where the user name is located, etc., which is not limited in this step.

[0043] The database involved in this step is a database based on hardware, and Redis is a database set in memory. Therefore, this step is essentially to read the fan data stored in the hardware into the memory. During the reading process, since the database includes millions of fan data, in order to reduce the reading pressure of the device, it can be read in multiple times. For example, 1,000 fan data are read into Redis each time.

[0044] Step 102, pull the actual fan data in the WeChat public account platform by calling the fan data acquisition interface.

[0045] The actual fan data includes at least the public account being followed and the user name being followed. Of course, the actual fan data also includes the following status, user name information and other data, which are not limited here.

[0046] In the specific implementation of this step, some interfaces can only pull a specific fan data, and some interfaces can pull a preset number of fan data in the WeChat public account platform until all fan data in the WeChat public account platform is pulled. In order to obtain all the actual fan data in the WeChat public account platform, this step can use the fan data acquisition interface to batch pull a preset number of actual fan data until all the actual fan data in the WeChat public account platform is pulled. For example, use the fan data acquisition interface to batch pull 1,000 actual fan data until all the actual fan data in the WeChat public account platform is pulled.

[0047] Step 103, compare the fan data in Redis with the actual fan data to obtain a comparison result.

[0048] In the specific implementation of this step, the official account and user name are obtained from the actual fan data, and the fan data corresponding to the official account and user name are searched in the fan data in Redis. If found, the fan data can be deleted in Redis. If not found, the fan data is re-obtained from the WeChat official account platform based on the official account and user name, and the fan data is added to the comparison result. If fan data still exists in Redis after searching with all the actual fan data, the follow status of these fan data is changed to unfollow, and it is added to the comparison result. Or you can use Figure 2 The method described above for determining the comparison result is not limited herein.

[0049] Step 104, determining whether to receive the fan data change message sent by the WeChat public account platform.

[0050] Since the database often stores millions of actual fan data, and each pull process can only pull 1,000 actual fan data, it takes a long time to pull all the actual fan data in the WeChat official account platform. If during this period, the user name clicks the unfollow button or the follow button on WeChat, the user name's follow status in the database needs to change, so the WeChat official account platform will send a fan data change message to the current electronic device. If during this period, no user name clicks the unfollow button or the follow button on WeChat, the WeChat official account platform will not send a fan data change message to the current electronic device.

[0051] Step 105: If yes, determine the fan data to be synchronized according to the comparison result and the fan data change message.

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

[0053] The fan data change message in this step includes at least a public account, a user name, and a follow status. When the follow status in the fan data change message is already followed, it can be determined whether there is fan data corresponding to the public account and user name in the comparison result according to the public account and user name in the fan data change message. If yes, when the follow status in the fan data is already followed, the comparison result is not modified. When the follow status in the fan data is unfollowed, the follow status of the fan data in the comparison result is modified based on the follow status in the fan data change message. If not, the fan data is reacquired in the WeChat public account platform, and then the fan data and the fan data in the comparison result are determined as the fan data to be synchronized. When the follow status in the fan data change message is unfollowed, it can be determined whether the fan data corresponding to the public account and user name in the fan data change message is in the comparison result. If yes, when the follow status in the fan data is unfollowed, the comparison result is not modified. When the follow status in the fan data is already followed, the follow status of the fan data in the comparison result is modified based on the follow status in the fan data change message. If not, the fan data is reacquired in the WeChat official account platform, and then the fan data and the fan data in the comparison result are determined as the fan data to be synchronized.

[0054] Step 106: If not, the comparison result is determined as the fan data to be synchronized.

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

[0056] Step 107, synchronizing the fan data to be synchronized into the database.

[0057] In the specific implementation of this step, the follow status corresponding to the public account and user name in the fan data to be synchronized is found in the database, and the found follow status is modified according to the follow status in the fan data to be synchronized, thereby realizing synchronization of the fan data to be synchronized into the database.

[0058] Furthermore, since the following status in the fan data stored in the database is all followed, when the following status in a certain fan data is unfollowed, the fan data can be deleted to avoid the fan data occupying the storage space of the database.

[0059] In an embodiment of the present application, the fan data in the database is read into Redis to obtain the fan data in Redis; the actual fan data in the WeChat public account platform is pulled by calling the fan data acquisition interface; the fan data in Redis and the actual fan data are compared to obtain a comparison result; it is determined whether the fan data change message sent by the WeChat public account platform is 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 determined as the fan data to be synchronized; the fan data to be synchronized is synchronized to the database. In the present 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, so that during synchronization of the database, the fan data in the database only needs to be modified once, thereby improving the accuracy of the fan data stored in the database.

[0060] The embodiment of the present application provides a method for determining a comparison result. In this method, each fan data in Redis corresponds to a synchronization timestamp, and then the comparison result is determined according to the synchronization timestamp corresponding to each fan data. Specifically, Figure 2 As shown, including:

[0061] Step 201, generating a first timestamp according to the starting time point of pulling data, and setting the synchronization timestamp of each actual fan data as the first timestamp.

[0062] In the specific method of this step, the starting time point of pulling data is used as the synchronization start time point. In this way, a first timestamp can be generated according to the starting time point of pulling data, and the synchronization timestamp of each actual fan data is set as the first timestamp to indicate the actual fan data used for the current synchronization.

[0063] Step 202, compare the fan data in Redis whose synchronization timestamp is less than the first timestamp with the actual fan data, and if they match, set the synchronization timestamp of the compared fan data as the first timestamp.

[0064] Among them, each fan data in Redis corresponds to a synchronization timestamp, which is determined by the last synchronization time or the time of writing to Redis.

[0065] In the specific implementation of this step, since the fan data in Redis with a synchronization timestamp greater than or equal to the first timestamp is written into Redis only after synchronization, such data will be processed later. Therefore, this step only compares the fan data in Redis with a synchronization timestamp less than the first timestamp 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: determine the fan data whose synchronization timestamp is smaller than the first timestamp as the comparison result.

[0067] In a specific implementation of this step, fan data whose synchronization timestamp is smaller than the first timestamp is screened out and determined as the comparison result.

[0068] exist Figure 2 Based on the above embodiment, the present application provides a method for determining fan data to be synchronized, which can determine the fan data to be synchronized according to the comparison result and the fan data change message, such as Figure 3 As shown, the specific steps include:

[0069] Step 301: When the follow status is unfollow, a second timestamp is generated based on the time point of receiving the fan data change message.

[0070] The fan data change message at least includes the public account being followed, the user name being followed, and the changed follow status being unfollowed. The fan data change message is essentially a follow event or unfollow event sent by the WeChat public account platform. For example, when the changed follow status in the fan data change message is unfollowed, the fan data change message is essentially a unfollow event. When the changed follow status in the fan data change message is followed, the fan data change message is essentially a follow event.

[0071] Step 302: Find the fan data to be updated in the fan data in Redis according to the public account and user name.

[0072] The fan data to be updated includes at least the public account, user name and follow status.

[0073] In the specific implementation of this step, when the follow status in the fan data change message is unfollowed, the corresponding fan data should be stored in Redis. Therefore, it is necessary to find the corresponding fan data to be updated in Redis according to the public account and user name in the fan data change message, so as to change the follow status in the fan data to be updated to unfollowed. If the fan data corresponding to the fan data change message is not stored in Redis, the fan data in Redis will not be updated.

[0074] Step 303: update the attention status in the fan data to be updated according to the changed attention status, and modify the corresponding synchronization timestamp to the second timestamp.

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

[0076] Since the follow status in the fan data whose synchronization timestamp is less than the second timestamp is changed to unfollow, if it is detected that the synchronization timestamp of the fan data to be updated is less than the first timestamp, the fan data to be updated may not be updated, and the synchronization timestamp may not be changed to the second timestamp.

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

[0078] In the specific implementation of this step, after completing step 303, the fan data with the synchronization timestamp of the first timestamp in Redis are compared with the actual fan data. The fan data with the synchronization timestamp not being the first timestamp either has the follow status of unfollowed or is added to Redis after the synchronization start time, so it is necessary to determine these fan data as the fan data to be synchronized, and then perform synchronization processing based on these fan data.

[0079] exist Figure 2 Based on the above embodiment, the present application also provides a method for determining fan data to be synchronized, which can determine the fan data to be synchronized according to the comparison result and the fan data change message, such as Figure 4 As shown, the specific steps include:

[0080] Step 401, when the following status is already followed, the fan data to be added is obtained in the WeChat official account platform according to the official account and the user name.

[0081] The fan data change message includes at least a public account, a user name, and a changed follow status, wherein the public account is the public account being followed / unfollowed, and the user name is the user name that follows / unfollows the public account.

[0082] In the specific implementation of this step, when the follow status in the fan data change message is already followed, the fan data corresponding to the fan data change message needs to be added. Therefore, the fan data corresponding to the fan data change message needs to be obtained first, and the specific steps are: first send the official account and user name in the fan data change message to the WeChat official account platform, and then make the WeChat official account platform return the fan data to be added, and the fan data to be added includes the official account and user name.

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

[0084] In a 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 can be set after the synchronization starts 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 as the second timestamp.

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

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

[0088] In the specific implementation of this step, after completing step 403, the fan data with the synchronization timestamp of the first timestamp in Redis are compared with the actual fan data. The fan data with the synchronization timestamp not being the first timestamp either has the follow status of unfollowed or is added to Redis after the synchronization start time, so it is necessary to determine these fan data as the fan data to be synchronized, and then perform synchronization processing based on these fan data.

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

[0090] Step 501, obtain and verify fan data in the WeChat public account platform according to the public account and user name in the fan data to be synchronized.

[0091] In a specific implementation of this step, the public account and user name in the fan data to be synchronized are sent to the WeChat public account platform, so that the WeChat public account platform returns the verified fan data corresponding to the public account and the user name.

[0092] Step 502: Based on the verification fan data, verify the fan data to be synchronized.

[0093] In the specific implementation of this step, the verified fan data is compared with the synchronized fan data. If they are completely matched, it is determined that the fan data to be synchronized is correct, and the fan data in the database is verified based on the fan data to be synchronized. If there is a fan data that 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 the figure, the embodiment of the present 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 the device corresponds to the aforementioned method embodiment. For ease of reading, this embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. Specifically, Figure 6 As shown, the device comprises:

[0095] A reading unit 601 is used to read the fan data in the database into Redis to obtain the fan data in Redis;

[0096] The pulling unit 602 is used to pull the actual fan data in the WeChat public account platform by calling the fan data acquisition interface;

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

[0098] A judgment unit 604 is used to judge whether to receive a fan data change message sent by the WeChat public account platform;

[0099] A first determining unit 605, configured to determine the fan data to be synchronized according to the comparison result and the fan data change message if yes;

[0100] A second determining unit 606, configured to determine the comparison result as fan data to be synchronized if no;

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

[0102] Optional, such as Figure 7 As shown, each fan data in the Redis corresponds to a synchronization timestamp, and the device further includes a setting unit 608,

[0103] The setting unit 608 is further used to generate a first timestamp according to the start time of pulling data, and set the synchronization timestamp of each actual fan data to the first timestamp;

[0104] The comparison unit 603 includes:

[0105] A first comparison module 6031 is used to compare the fan data whose synchronization timestamp is smaller than the first timestamp with the actual fan data, and if the comparison is successful, set the synchronization timestamp of the compared fan data as the first timestamp;

[0106] The second determining module 6032 is used to determine the fan data whose synchronization timestamp is smaller 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 public account, the user name and the changed attention status, and the first determination unit 605 includes:

[0108] A first generating module 6051 is used to generate a second timestamp based on a receiving time point of the fan data change message when the following status is unfollowing;

[0109] A search module 6052 is used to find the fan data to be updated in the fan data in Redis according to the public account and the user name, where the fan data to be updated at least includes the public account, the user name and the follow status;

[0110] An updating module 6053 is used to update the attention status in the fan data to be updated according to the changed attention status, and modify the corresponding synchronization timestamp to a second timestamp;

[0111] The first determining module 6054 is configured 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 a public account, a user name, and a changed follow status, and the first determining unit 605 includes:

[0113] The acquisition module 6055 is used to acquire the fan data to be added in the WeChat public account platform according to the public account and the user name when the following status is already followed;

[0114] A second generating module 6056, configured to generate a second timestamp based on a time point of receiving the fan data change message or a time point of obtaining the fan data to be added;

[0115] A setting module 6057, used to add the fan data to be added to Redis, and set the corresponding synchronization timestamp to 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 also includes:

[0118] The calling unit 608 is used to call the WeChat public account platform according to the public account and user name in the fan data to be synchronized, and obtain the verification fan data; based on the verification fan data, the fan data to be synchronized is verified.

[0119] Furthermore, an embodiment of the present application also provides an electronic device, the electronic device comprising at least one processor, and 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 above Figure 1-5 The method for synchronizing fan data in the database as described in .

[0120] Furthermore, the embodiment of the present application also provides a storage medium, the storage medium is used to store a computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the above Figure 1-5 The fan data method in the synchronization database.

[0121] Figure 8 80 is a block diagram of a device 80 provided in an embodiment of the present 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 through the bus 803. The processor 801 is used to call the program instructions in the memory 802 to execute the above-mentioned method for synchronizing fan data in the database. The device in this article can be a server (for example: a local server or a cloud server), a smart phone, a tablet computer, a PDA, a portable computer, or a fixed terminal such as a desktop computer.

[0122] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0123] It is understandable that the related features in the above methods and devices can be referenced to each other. In addition, the "first", "second" and the like in the above embodiments are used to distinguish the various embodiments, and do not represent the advantages and disadvantages of the various embodiments.

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

[0125] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings herein. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the application is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the application described herein, and the description of the specific language above is for the purpose of disclosing the best mode of implementation of the application.

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

[0127] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions 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] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0132] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0133] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0134] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0135] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for synchronizing fan data in a database, characterized in that: The method comprises: Read the fan data in the database to Redis and obtain the fan data in Redis; Pull the actual fan data in the WeChat official account platform by calling the fan data acquisition interface; Compare the fan data in the Redis with the actual fan data to obtain a comparison result; Determine whether to receive the fan data change message sent by the WeChat public account platform; If yes, determining the fan data to be synchronized according to the comparison result and the fan data change message; If not, determining the comparison result as the fan data to be synchronized; The fan data to be synchronized is synchronized into the database.

2. The method according to claim 1, characterized in that Each fan data in the Redis corresponds to a synchronization timestamp. After the actual fan data in the WeChat public account platform is pulled by calling the fan data acquisition interface, the method further includes: Generate a first timestamp according to the starting time point of pulling data, and set the synchronization timestamp of each actual fan data to the first timestamp; The comparing the fan data in the Redis with the actual fan data to obtain a comparison result includes: Compare the fan data in the Redis whose synchronization timestamp is less than the first timestamp with the actual fan data, and if the comparison is successful, set the synchronization timestamp of the compared fan data to the first timestamp; The fan data whose synchronization timestamp is smaller than the first timestamp is determined as the comparison result.

3. The method according to claim 2, characterized in that The fan data change message includes at least a public account, a user name, and a changed attention status, and determining the fan data to be synchronized according to the comparison result and the fan data change message includes: When the following status is unfollowing, generating a second timestamp based on the receiving time point of the fan data change message; According to the official account and the user name, find the fan data to be updated in the fan data in Redis, where the fan data to be updated at least includes the official account, the user name and the follow status; According to the changed attention status, the attention status in the fan data to be updated is updated, and the corresponding synchronization timestamp is modified to the second timestamp; The fan data whose synchronization timestamp is not the first timestamp is determined as the fan data to be synchronized.

4. The method according to claim 2, characterized in that: The fan data change message includes at least a public account, a user name, and a changed attention status, and determining the fan data to be synchronized according to the comparison result and the fan data change message includes: When the following status is already followed, obtaining the fan data to be added in the WeChat official account platform according to the official account and the user name; Generate a second timestamp based on the time point of receiving the fan data change message or the time point of obtaining 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; The fan data whose synchronization timestamp is not the first timestamp is determined as the fan data to be synchronized.

5. The method according to claim 1, characterized in that Before synchronizing the fan data to be synchronized into the database, the method further includes: According to the official account and user name in the fan data to be synchronized, obtain and verify the fan data in the WeChat official account 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 comprises: A reading unit is used to read the fan data in the database into Redis to obtain the fan data in Redis; A pulling unit, used to pull actual fan data in the WeChat public account platform by calling a fan data acquisition interface; A comparison unit, used to compare the fan data in the Redis with the actual fan data to obtain a comparison result; A judgment unit, used to judge whether to receive the fan data change message sent by the WeChat public account platform; A first determining unit, configured to determine the fan data to be synchronized according to the comparison result and the fan data change message if yes; A second determining unit, configured to determine the comparison result as fan data to be synchronized if no; The synchronization unit is used to synchronize the fan data to be synchronized into the database.

7. The device according to claim 6, characterized in that Each fan data in the Redis corresponds to a synchronization timestamp, and the device also includes a setting unit. The setting unit is further used to generate a first timestamp according to the starting time point of pulling data, and set the synchronization timestamp of each actual fan data to the first timestamp; The comparison unit comprises: A first comparison module, configured to compare the fan data whose synchronization timestamp is smaller than the first timestamp with the actual fan data, and if the comparison is successful, setting the synchronization timestamp of the compared fan data as 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 device according to claim 7, characterized in that The fan data change message includes at least a public account, a user name, and a changed attention status, and the first determining unit includes: A generating module, configured to generate a second timestamp based on a time point of receiving the fan data change message when the following status is canceling following; A search module, used to find the fan data to be updated in the fan data in Redis according to the official account and the user name, wherein the fan data to be updated includes at least the official account, the user name and the follow-up status; An updating module, configured to update the attention status in the fan data to be updated according to the changed attention status, and modify the corresponding synchronization timestamp to a 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 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 the program instructions in the memory to execute the fan data synchronization method in the database described in 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 when the computer program is running, the device where the storage medium is located is controlled to execute the fan data synchronization method in a database as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data synchronization method, synchronization end, to-be-synchronized end, equipment and storage medium

    CN110674146A

  • Official account user tag management system and method

    CN112000492A

  • Data synchronization method and device and medium

    CN115357662A

  • Data Management System

    US20120117098A1

  • Data synchronization method and apparatus, server, and storage medium

    WO2018219178A1