Data processing method, device, equipment and storage medium

Through task batch processing and account splitting, transaction messages are used to transfer red envelopes between the male and user accounts, solving the problems of low efficiency and concurrency bottleneck in the existing technology of red envelope issuance tasks, and achieving rapid red envelopes Distributed.

CN112905310BActive Publication Date: 2025-02-14CHINA CONSTRUCTION BANK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110341398.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-30
Publication Date
2025-02-14
Estimated Expiration
2041-03-30

AI Technical Summary

Technical Problem

The prior art is inefficient in handling tasks with large amounts of red envelopes, and concurrency bottlenecks are caused due to transaction control and lock resource occupation.

Method used

Through task batch processing and account splitting methods, obtain the real-time red envelope issuance task and add it to the list of tasks to be distributed. In response to the batch task trigger operation, a preset number of red envelope issuing tasks is obtained from the list of tasks to be issued, and a pair of children accounts matching each red envelope issuing tasks are determined. Use transaction messages to transfer red envelopes between the male account and the user account that matches the red envelope issuance task.

Benefits of technology

The concurrent processing efficiency of a large number of red envelope is improved, the rapid distribution of electronic red envelopes is realized, and the problems of low processing efficiency and concurrency bottlenecks in the existing technology are solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112905310B_ABST
    Figure CN112905310B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a data processing method, device, equipment and storage medium, which relates to the field of big data. The method includes: obtaining a red envelope distribution task generated in real time, and adding the red envelope distribution task to a list of tasks to be distributed; in response to a batch task trigger operation, obtaining a preset number of red envelope distribution tasks from the list of tasks to be distributed, and determining the public sub-accounts that match each of the red envelope distribution tasks; for each of the red envelope distribution tasks, using transaction messages to transfer red envelopes between the public sub-accounts that match the red envelope distribution tasks and user accounts. The technical solution of the embodiment of the present invention improves the concurrent processing efficiency of a large number of red envelope distribution tasks through task batch processing and account splitting, and realizes the rapid distribution of electronic red envelopes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of big data, and in particular to a data processing method, device, equipment and storage medium. Background Art

[0002] With the mature development of e-commerce, issuing electronic currency red envelopes to users in various forms has become a common marketing method. For example, store red envelopes or coupons are issued to users through lotteries, which will result in a large number of users winning at the same time, and multiple winning red envelopes need to be issued in parallel.

[0003] In the prior art, for a large number of red envelope distribution tasks, the red envelope distribution tasks are usually scanned one by one at a time, which wastes performance and cannot guarantee the distribution efficiency. Using the database as a red envelope deduction for the public account requires frequent modifications to the database while ensuring transaction security, so the amount deduction for the public account will become the biggest performance problem of the entire link. In addition, when transferring money between public and private accounts, the overall operation must be subject to transaction control, which will increase the overall time consumption and the occupation of lock resources, leading to concurrency bottlenecks. Summary of the invention

[0004] The embodiments of the present invention provide a data processing method, apparatus, device and storage medium to improve the concurrent processing efficiency of a large number of red envelope distribution tasks through task batch processing and account splitting, and realize the rapid distribution of electronic red envelopes.

[0005] In a first aspect, an embodiment of the present invention provides a data processing method, including:

[0006] Obtain the red envelope distribution task generated in real time, and add the red envelope distribution task to the list of tasks to be distributed;

[0007] In response to the batch task triggering operation, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed, and a public sub-account matching each red envelope distribution task is determined;

[0008] For each red envelope distribution task, transaction messages are used to transfer red envelopes between the public account and the user account that matches the red envelope distribution task.

[0009] Optionally, before obtaining the red envelope distribution task generated in real time, it also includes:

[0010] Split the corporate account into multiple corporate sub-accounts, and store the balance of each corporate sub-account in the corresponding Redis database for management;

[0011] Among them, a unified balance threshold is set for each pair of son-in-law accounts, and the balance of each pair of son-in-law accounts is greater than or equal to the balance threshold.

[0012] Optionally, in response to a batch task triggering operation, a preset number of red envelope distribution tasks are obtained from a list of tasks to be distributed, and a public sub-account matching each red envelope distribution task is determined, including:

[0013] When it is detected that the timer's timing meets the trigger time condition, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed;

[0014] Use the first routing algorithm to distribute each red envelope distribution task to the corresponding server;

[0015] Instruct each server to use the second routing algorithm to determine the public sub-account that matches each red envelope distribution task.

[0016] Optionally, instructing each server to use a second routing algorithm to determine a public sub-account that matches each red envelope distribution task, including:

[0017] For each red envelope distribution task, instruct the server corresponding to the red envelope distribution task to use the consistent hashing algorithm to perform a modulo operation on the serial number of the red envelope distribution task and the total number of sub-accounts, and use the operation result as the serial number of the public sub-account matching the red envelope distribution task.

[0018] Optionally, for each red envelope distribution task, a transaction message is used to transfer red envelopes between the corresponding sub-account and the user account that matches the red envelope distribution task, including:

[0019] For each red envelope distribution task, obtain the red envelope amount and user account of the red envelope distribution task;

[0020] Using transaction messages, the red envelope amount is deducted from the public account that matches the red envelope distribution task, and the red envelope amount is increased in the user account.

[0021] Optionally, after using the transaction message to transfer the red envelope between the public sub-account and the user account that matches the red envelope distribution task, it also includes:

[0022] Compare the balance of each pair of sons' accounts with the balance threshold;

[0023] If there is a target sub-account with a balance less than the balance threshold, the target sub-account will be recovered and the balance of the target sub-account will be allocated to other sub-accounts.

[0024] Optionally, also include:

[0025] Calculate the processing speed of the red envelope distribution task within a preset time length;

[0026] If the processing speed is less than the task processing speed threshold, the processing priority of the red envelope distribution task will be increased, or the number of public sub-accounts will be increased.

[0027] Optionally, for each red envelope distribution task, after the red envelope transfer is performed between the public sub-account and the user account matched with the red envelope distribution task by using the transaction message, the following is further included:

[0028] Write the deduction amount of each pair of sons' accounts into the list of issued tasks, and compare the list of tasks to be issued with the list of issued tasks;

[0029] If the two are inconsistent, the task correction action is triggered.

[0030] Optionally, also include:

[0031] When the message of opening each user account is monitored, an initial red envelope distribution task corresponding to each user account is generated;

[0032] Using the first routing algorithm, each initial red envelope distribution task is synchronously distributed to the corresponding server;

[0033] Instruct each server to use the second routing algorithm to determine the public sub-account that matches each initial red envelope distribution task;

[0034] For each initial red envelope distribution task, the initial red envelope transfer is performed between the public sub-account and the user account that matches the initial red envelope distribution task using transaction messages.

[0035] In a second aspect, an embodiment of the present invention further provides a data processing device, including:

[0036] The task acquisition module is used to acquire the red envelope distribution task generated in real time and add the red envelope distribution task to the list of tasks to be distributed;

[0037] The batch processing module is used to obtain a preset number of red envelope distribution tasks from the list of tasks to be distributed in response to the batch processing task triggering operation, and determine the public sub-accounts that match each red envelope distribution task;

[0038] The red envelope distribution module is used to transfer red envelopes between the public sub-account and the user account that match the red envelope distribution task by using transaction messages for each red envelope distribution task.

[0039] In a third aspect, an embodiment of the present invention further provides an electronic device, the device comprising:

[0040] one or more processors;

[0041] a storage device for storing one or more programs,

[0042] When one or more programs are executed by one or more processors, the one or more processors implement the data processing method provided by any embodiment of the present invention.

[0043] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data processing method provided by any embodiment of the present invention.

[0044] In an embodiment of the present invention, by obtaining red envelope issuance tasks generated in real time, and adding the red envelope issuance tasks to a list of tasks to be issued; in response to a batch task trigger operation, a preset number of red envelope issuance tasks are obtained from the list of tasks to be issued, and a public sub-account matching each red envelope issuance task is determined; for each red envelope issuance task, a transaction message is used to transfer red envelopes between the public sub-account matching the red envelope issuance task and the user account, thereby solving the problem of low processing efficiency of a large number of red envelope issuance tasks in the prior art, and improving the concurrent processing efficiency of a large number of red envelope issuance tasks through task batch processing and account splitting, thereby realizing the rapid issuance of electronic red envelopes. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1a is a flow chart of a data processing method in Embodiment 1 of the present invention;

[0046] Figure 1b This is a flow chart of issuing an electronic red envelope in Embodiment 1 of the present invention;

[0047] Figure 2 is a structural schematic diagram of a data processing device in Embodiment 2 of the present invention;

[0048] Figure 3 It is a structural schematic diagram of an electronic device in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0049] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0050] Embodiment 1

[0051] Figure 1a This is a flow chart of a data processing method in the first embodiment of the present invention. This embodiment is applicable to the case of concurrently processing a large number of red envelope distribution tasks. The method can be executed by a data processing device, which can be implemented by hardware and / or software and can generally be integrated in an electronic device that provides concurrent task processing services. Figure 1a As shown, the method includes:

[0052] Step 110: Obtain the red envelope distribution task generated in real time, and add the red envelope distribution task to the list of tasks to be distributed.

[0053] In this embodiment, when a user wins a prize, a red envelope distribution task including the user account and the prize drawn will be generated in real time. When the red envelope distribution service detects that a new red envelope distribution task has been generated, it will obtain the newly generated red envelope distribution task and add it to the list of tasks to be distributed, waiting for the red envelope to be distributed. Figure 1b shown.

[0054] Optionally, before obtaining the red envelope distribution task generated in real time, it can also include: splitting the total corporate account into multiple corporate sub-accounts, and storing the account balance of each corporate sub-account in a corresponding Redis database for management; wherein a unified balance threshold is set for each corporate sub-account, and the balance of each corporate sub-account is greater than or equal to the balance threshold.

[0055] In this embodiment, in order to process multiple red envelope distribution tasks concurrently and ensure the transaction security of each task, before starting the red envelope distribution, the public account is first split into multiple public sub-accounts, such as Figure 1b shown.

[0056] For example, the amount of the total public account is 10,000 yuan. According to the red envelope distribution request, the total public account can be divided into 10 sub-accounts, each with 1,000 yuan. Among them, each public sub-account is also set with a balance threshold. The balance of each public sub-account must be greater than or equal to the balance threshold to ensure that there will be no insufficient balance when the red envelope is distributed. It should be noted that the balance threshold of each public sub-account can be modified separately according to business needs.

[0057] In this embodiment, a Redis database is associated with each sub-account, and the Redis database is used to manage the balance of the sub-account. The reason for this is that, on the one hand, Redis is a memory storage that can ensure high-speed writing and reading of data; on the other hand, considering that Redis's single-threaded model can ensure the concurrent safety of deducting red envelopes from sub-accounts and the atomicity of transactions, that is, even if a sub-account executes multiple red envelope distribution tasks at the same time, the red envelope amount of each task can be correctly deducted, which can solve the concurrent safety performance problem.

[0058] Step 120: In response to the batch task triggering operation, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed, and a public sub-account matching each red envelope distribution task is determined.

[0059] In this embodiment, batch processing tasks can be triggered regularly by a timer, and the task distribution mechanism of the distributed batch processing engine can be used to slice and distribute multiple red envelope distribution tasks, so that batch processing tasks can be executed simultaneously by multiple batch processing servers, and distributed batch processing can be used to solve the problem of big data processing efficiency at the application level.

[0060] Optionally, in response to a batch task trigger operation, a preset number of red envelope issuance tasks are obtained from a list of tasks to be issued, and a corporate sub-account that matches each red envelope issuance task is determined, which may include: when it is detected that the timing of the timer meets the trigger time condition, obtaining a preset number of red envelope issuance tasks from the list of tasks to be issued; using a first routing algorithm to distribute each red envelope issuance task to a corresponding server; instructing each server to use a second routing algorithm to determine a corporate sub-account that matches each red envelope issuance task.

[0061] In this embodiment, batch processing is triggered by a timer. For example, a timer can be set to trigger a batch processing task every one second, and a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed. And according to the first routing algorithm, such as the consistent hashing algorithm, etc., the batch processing server corresponding to each red envelope distribution task is calculated, and each red envelope distribution task is distributed to the corresponding server. Then, each server is instructed to use the second routing algorithm to calculate the public sub-account that matches the local red envelope distribution task, so as to facilitate the red envelope distribution, such as Figure 1b shown.

[0062] Optionally, instructing each server to use a second routing algorithm to determine a corporate sub-account that matches each red envelope distribution task may include: for each red envelope distribution task, instructing the server corresponding to the red envelope distribution task to use a consistent hashing algorithm to perform a modulo operation on the serial number of the red envelope distribution task and the total number of sub-accounts, and using the operation result as the serial number of the corporate sub-account that matches the red envelope distribution task.

[0063] For example, assuming that there are a total of 10 sub-accounts for different companies, and the serial number of the red envelope distribution task is 3, the server corresponding to the red envelope distribution task calculates the value of 3mod 10 as 3 based on the consistent hashing algorithm. Therefore, the serial number of the sub-account for different companies that matches the red envelope distribution task is 3, that is, the red envelope amount of the red envelope distribution task will be deducted from the third sub-account for different companies and added to the corresponding user account.

[0064] In the prior art, in order to ensure the safety of funds during the process of transferring electronic red envelopes from public accounts to private accounts, it is necessary to lock the public account transactions, which will become a performance bottleneck. This embodiment uses a routing algorithm to split the public account into multiple sub-accounts, which can support parallel deductions from the accounts that distribute red envelopes. At the same time, the Redis database is used to manage the funds of the public sub-accounts, and the transaction atomicity and fast memory reading characteristics of Redis are used to improve the efficiency and security of red envelope distribution in public accounts.

[0065] Step 130: For each red envelope distribution task, use transaction messages to transfer red envelopes between the public account and the user account that matches the red envelope distribution task.

[0066] In the prior art, the red envelope distribution task requires deducting the corresponding red envelope amount from the public account before distributing it to the corresponding private red envelope account. The performance bottleneck of the entire process lies in the safe deduction of the amount in the public account and the concurrent writing of the private account and the distribution flow. This embodiment solves the transaction bottleneck problem of changing the public account and the private account at the same time through transaction messages.

[0067] Optionally, for each red envelope distribution task, transaction messages are used to transfer red envelopes between the sub-account of the partner that matches the red envelope distribution task and the user account, which may include: for each red envelope distribution task, obtaining the red envelope amount and user account of the red envelope distribution task; using transaction messages to deduct the red envelope amount from the sub-account of the partner that matches the red envelope distribution task, and at the same time increase the red envelope amount in the user account.

[0068] For example, assuming that the red envelope distribution task is to distribute a 20 yuan red envelope to user account A, you can first determine the Redis database B of the sub-account that matches the red envelope distribution task, and then use the transaction message to deduct 20 yuan from the sub-account balance in Redis database B, and add 20 yuan to user account A.

[0069] In this embodiment, by utilizing the atomicity of Redis transactions and the fast memory reading characteristics, even if the red envelope amounts of multiple tasks are deducted from the son's account at the same time, the red envelope deductions of the son's account for each task will be correctly recorded, thereby improving the efficiency of red envelope issuance and account security of the public account. After the red envelope is deducted from the son's account, it needs to be transferred to the corresponding user red envelope account. At this time, the transaction message can be used to ensure that the transaction message arrives and is executed, and at the same time, the transaction message and the red envelope deduction transaction consistency of the son's account can be ensured. The transaction message is used to solve the time-consuming writing problem, and the red envelope amount of the user account is increased by asynchronous processing.

[0070] Optionally, after utilizing transaction messages to transfer red envelopes between the corporate sub-accounts and user accounts that match the red envelope distribution task, it may also include: comparing the balance of each corporate sub-account with a balance threshold; if there is a target corporate sub-account whose balance is less than the balance threshold, recovering the target corporate sub-account and allocating the balance of the target corporate sub-account to other corporate sub-accounts.

[0071] In this embodiment, in order to ensure that there will be no insufficient balance in the sub-account when issuing red envelopes, after the general public account is split into multiple public sub-accounts, and after the public sub-accounts complete the red envelope issuance, it is necessary to compare the balance of each public sub-account with the corresponding balance threshold to find the target public sub-account with insufficient balance. If there is a target public sub-account, the Redis database corresponding to the target public sub-account is recovered, and the balance of the target public sub-account is allocated to the balance of other public sub-accounts to reduce the probability of insufficient balances in other public sub-accounts. Finally, after all red envelope issuance tasks are completed, all public sub-accounts should be recovered.

[0072] Optionally, it may also include: calculating the processing speed of the red envelope distribution task within a preset time length; if the processing speed is less than the task processing speed threshold, increasing the processing priority of the red envelope distribution task, or increasing the number of public accounts.

[0073] In this embodiment, in order to ensure the concurrent processing efficiency of a large number of red envelope distribution tasks, a task processing speed threshold can be set. The processing speed of the red envelope distribution task within the time period is calculated at each interval. If it is found that the processing speed within the time period is less than the task processing speed threshold, it is considered that the concurrent processing efficiency of the task is low. At this time, the processing priority of the red envelope distribution task can be increased, and the processing priority of other tasks can be lowered. Alternatively, the number of public accounts can be increased to increase the concurrency of task processing.

[0074] Optionally, for each red envelope distribution task, after the red envelope transfer is performed between the sub-accounts of the partners that match the red envelope distribution task and the user account using transaction messages, it may also include: writing the deduction amount of each sub-account of the partners into the list of distributed tasks, and comparing the list of tasks to be distributed with the list of distributed tasks; if the two are inconsistent, triggering a task correction operation.

[0075] In this embodiment, in order to further verify the correctness of the red envelope issuance, timely discover the wrong red envelope issuance or the error in the red envelope issuance flow, each red envelope amount deducted from each pair of sons' accounts can be written into the issued task list. Then the red envelope issuance flow recorded in the issued task list is compared one by one with the red envelope tasks to be issued in the tasks to be issued. If it is found that the red envelope is sent to the wrong user account, or the red envelope amount sent to a user account is recorded incorrectly, or a red envelope issuance task is omitted, etc., then the task correction operation is triggered to correct the error.

[0076] Optionally, it may also include: when the message of opening each user account is monitored, generating an initial red envelope issuance task corresponding to each user account; using the first routing algorithm to synchronously distribute each initial red envelope issuance task to the corresponding server; instructing each server to use the second routing algorithm to determine the public sub-account matching each initial red envelope issuance task; for each initial red envelope issuance task, using transaction messages to perform initial red envelope transfers between the public sub-account matching the initial red envelope issuance task and the user account.

[0077] In this embodiment, in addition to asynchronously issuing winning red envelopes to winning user accounts, initial red envelopes can also be issued to multiple user accounts simultaneously when creating user accounts. The user account opening event can be monitored through a message monitoring mechanism. When the creation message of the user account is monitored, an initial red envelope issuance task corresponding to the user account is generated, such as issuing a red envelope of 100 yuan. The consistent hashing algorithm is used to determine the server corresponding to each initial red envelope issuance task. For each initial red envelope issuance task, the corresponding server is indicated, and the consistent hashing algorithm is used to perform a modulo operation on the sequence number of the initial red envelope issuance task and the total number of sub-accounts, and the operation result is used as the sequence number of the public sub-account that matches the initial red envelope issuance task. Furthermore, the initial red envelope amount is deducted from the public sub-account that matches the initial red envelope issuance task using a transaction message, and the initial red envelope amount is added to the user account at the same time.

[0078] In an embodiment of the present invention, by obtaining red envelope issuance tasks generated in real time, and adding the red envelope issuance tasks to a list of tasks to be issued; in response to a batch task trigger operation, a preset number of red envelope issuance tasks are obtained from the list of tasks to be issued, and a public sub-account matching each red envelope issuance task is determined; for each red envelope issuance task, a transaction message is used to transfer red envelopes between the public sub-account matching the red envelope issuance task and the user account, thereby solving the problem of low processing efficiency of a large number of red envelope issuance tasks in the prior art, and improving the concurrent processing efficiency of a large number of red envelope issuance tasks through task batch processing and account splitting, thereby realizing the rapid issuance of electronic red envelopes.

[0079] Embodiment 2

[0080] Figure 2 This is a schematic diagram of the structure of a data processing device in the second embodiment of the present invention. This embodiment is applicable to the case of concurrently processing a large number of red envelope distribution tasks. The device can be implemented by hardware and / or software and can generally be integrated into an electronic device that provides concurrent task processing services. Figure 2 As shown, the device comprises:

[0081] The task acquisition module 210 is used to acquire the red envelope distribution task generated in real time and add the red envelope distribution task to the list of tasks to be distributed;

[0082] The batch processing module 220 is used to obtain a preset number of red envelope distribution tasks from the list of tasks to be distributed in response to the batch processing task triggering operation, and determine the public sub-accounts that match each red envelope distribution task;

[0083] The red envelope issuing module 230 is used to transfer red envelopes between the public sub-account and the user account that match the red envelope issuing task by using transaction messages for each red envelope issuing task.

[0084] In an embodiment of the present invention, by obtaining red envelope issuance tasks generated in real time, and adding the red envelope issuance tasks to a list of tasks to be issued; in response to a batch task trigger operation, a preset number of red envelope issuance tasks are obtained from the list of tasks to be issued, and a public sub-account matching each red envelope issuance task is determined; for each red envelope issuance task, a transaction message is used to transfer red envelopes between the public sub-account matching the red envelope issuance task and the user account, thereby solving the problem of low processing efficiency of a large number of red envelope issuance tasks in the prior art, and improving the concurrent processing efficiency of a large number of red envelope issuance tasks through task batch processing and account splitting, thereby realizing the rapid issuance of electronic red envelopes.

[0085] Optionally, it also includes: an account splitting module, which is used to split the corporate account into multiple corporate sub-accounts before obtaining the red envelope distribution task generated in real time, and store the account balance of each corporate sub-account in the corresponding Redis database for management;

[0086] Among them, a unified balance threshold is set for each pair of son-in-law accounts, and the balance of each pair of son-in-law accounts is greater than or equal to the balance threshold.

[0087] Optionally, the batch processing module 220 is used to:

[0088] When it is detected that the timer's timing meets the trigger time condition, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed;

[0089] Use the first routing algorithm to distribute each red envelope distribution task to the corresponding server;

[0090] Instruct each server to use the second routing algorithm to determine the public sub-account that matches each red envelope distribution task.

[0091] Optionally, the batch processing module 220 is used to:

[0092] For each red envelope distribution task, instruct the server corresponding to the red envelope distribution task to use the consistent hashing algorithm to perform a modulo operation on the serial number of the red envelope distribution task and the total number of sub-accounts, and use the operation result as the serial number of the public sub-account matching the red envelope distribution task.

[0093] Optionally, the red envelope distribution module 230 is used to:

[0094] For each red envelope distribution task, obtain the red envelope amount and user account of the red envelope distribution task;

[0095] Using transaction messages, the red envelope amount is deducted from the public account that matches the red envelope distribution task, and the red envelope amount is increased in the user account.

[0096] Optionally, also include:

[0097] The account recovery module is used to compare the balance of each duigong account with the balance threshold after transferring the red envelope between the duigong account and the user account that matches the red envelope distribution task by using the transaction message;

[0098] If there is a target sub-account with a balance less than the balance threshold, the target sub-account will be recovered and the balance of the target sub-account will be allocated to other sub-accounts.

[0099] Optionally, also include:

[0100] An adjustment module is used to calculate the processing speed of the red envelope distribution task within a preset time length;

[0101] If the processing speed is less than the task processing speed threshold, the processing priority of the red envelope distribution task will be increased, or the number of public sub-accounts will be increased.

[0102] Optionally, also include:

[0103] The task correction module is used to transfer red envelopes between the public account and the user account that matches the red envelope distribution task using transaction messages for each red envelope distribution task.

[0104] Write the deduction amount of each pair of sons' accounts into the list of issued tasks, and compare the list of tasks to be issued with the list of issued tasks;

[0105] If the two are inconsistent, the task correction action is triggered.

[0106] Optionally, also include:

[0107] The initial red envelope distribution module is used to generate the initial red envelope distribution task corresponding to each user account when monitoring the message of opening each user account;

[0108] Using the first routing algorithm, each initial red envelope distribution task is synchronously distributed to the corresponding server;

[0109] Instruct each server to use the second routing algorithm to determine the public sub-account that matches each initial red envelope distribution task;

[0110] For each initial red envelope distribution task, the initial red envelope transfer is performed between the public sub-account and the user account that matches the initial red envelope distribution task using transaction messages.

[0111] The data processing device provided in the embodiment of the present invention can execute the data processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0112] Embodiment 3

[0113] Figure 3 It is a structural schematic diagram of an electronic device in Embodiment 3 of the present invention. Figure 3 A block diagram of an exemplary device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 3 The device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0114] like Figure 3 As shown, device 12 is in the form of a general purpose computing device. Components of device 12 may include, but are not limited to, one or more processors or processing units 16, system memory 28, and bus 18 that connects various system components (including system memory 28 and processing unit 16).

[0115] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0116] Device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by device 12, including volatile and non-volatile media, removable and non-removable media.

[0117] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 3 not shown, usually called a "hard drive"). Although Figure 3 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0118] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0119] The device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the device 12, and / or may communicate with any device that enables the device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the device 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0120] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the data processing method provided by the embodiment of the present invention.

[0121] That is: implement a data processing method, including:

[0122] Obtain the red envelope distribution task generated in real time, and add the red envelope distribution task to the list of tasks to be distributed;

[0123] In response to the batch task triggering operation, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed, and a public sub-account matching each red envelope distribution task is determined;

[0124] For each red envelope distribution task, transaction messages are used to transfer red envelopes between the public account and the user account that matches the red envelope distribution task.

[0125] Embodiment 4

[0126] Embodiment 4 of the present invention further discloses a computer storage medium, on which a computer program is stored. When the program is executed by a processor, a data processing method is implemented, including:

[0127] Obtain the red envelope distribution task generated in real time, and add the red envelope distribution task to the list of tasks to be distributed;

[0128] In response to the batch task triggering operation, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed, and a public sub-account matching each red envelope distribution task is determined;

[0129] For each red envelope distribution task, transaction messages are used to transfer red envelopes between the public account and the user account that matches the red envelope distribution task.

[0130] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0131] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0132] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0133] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0134] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A data processing method, characterized in that: include: Obtain the red envelope distribution task generated in real time, and add the red envelope distribution task to the list of tasks to be distributed; In response to a batch task triggering operation, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed, and a corporate sub-account matching each of the red envelope distribution tasks is determined; wherein each of the corporate sub-accounts is respectively associated with a Redis database, and the Redis database is used to manage the balance of the corporate sub-account; For each of the red envelope distribution tasks, a red envelope transfer is performed between the public sub-account and the user account that matches the red envelope distribution task using a transaction message; Wherein, in response to the batch task triggering operation, obtaining a preset number of red envelope issuance tasks from the to-be-issued task list, and determining the public sub-accounts that match each of the red envelope issuance tasks, includes: When it is detected that the timing of the timer meets the trigger time condition, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed; Using a first routing algorithm, determining a batch processing server corresponding to each of the red envelope distribution tasks, and distributing each of the red envelope distribution tasks to a corresponding server; wherein the first routing algorithm includes a consistent hashing algorithm; Instructing each of the servers to use a second routing algorithm to determine a public sub-account that matches each of the red envelope distribution tasks; The instructing each of the servers to use a second routing algorithm to determine a public sub-account that matches each of the red envelope distribution tasks includes: For each of the red envelope distribution tasks, instruct the server corresponding to the red envelope distribution task to use a consistent hashing algorithm to perform a modulo operation on the serial number of the red envelope distribution task and the total number of sub-accounts, and use the operation result as the serial number of the public sub-account matching the red envelope distribution task; Wherein, for each of the red envelope distribution tasks, using transaction messages, red envelope transfers are performed between the public sub-account and the user account that match the red envelope distribution task, including: For each of the red envelope distribution tasks, obtain the red envelope amount and user account of the red envelope distribution task; By using the transaction message, the red envelope amount is deducted from the sub-account of the partner that matches the red envelope distribution task, and the red envelope amount is increased in the user account.

2. The method according to claim 1, characterized in that Before obtaining the red envelope distribution task generated in real time, it also includes: Split the corporate account into multiple corporate sub-accounts, and store the account balances of each corporate sub-account in a corresponding Redis database for management; Among them, a unified balance threshold is set for each of the sub-accounts, and the balance of each of the sub-accounts is greater than or equal to the balance threshold.

3. The method according to claim 1, characterized in that After the red envelope is transferred between the public sub-account and the user account matched with the red envelope distribution task by using the transaction message, the method further includes: Comparing the balance of each of the sub-accounts with the balance threshold respectively; If there is a target interbank sub-account whose balance is less than the balance threshold, the target interbank sub-account is recovered and the balance of the target interbank sub-account is allocated to other interbank sub-accounts.

4. The method according to claim 1, characterized in that Also includes: Calculate the processing speed of the red envelope distribution task within a preset time length; If the processing speed is less than the task processing speed threshold, the processing priority of the red envelope distribution task is increased, or the number of sub-accounts is increased.

5. The method according to claim 1, characterized in that After performing a red envelope transfer between the public sub-account and the user account matched with the red envelope distribution task by using a transaction message for each red envelope distribution task, the method further includes: The deduction amount of each of the sub-accounts is written into the issued task list, and the to-be-issued task list is compared with the issued task list; If the two are inconsistent, the task correction action is triggered.

6. The method according to claim 1, characterized in that Also includes: When the message of opening each user account is monitored, an initial red envelope distribution task corresponding to each user account is generated; Using a first routing algorithm, synchronously distributing each of the initial red envelope distribution tasks to a corresponding server; Instructing each of the servers to use a second routing algorithm to determine a public sub-account that matches each of the initial red envelope distribution tasks; For each of the initial red envelope distribution tasks, an initial red envelope transfer is performed between the sub-account and the user account that matches the initial red envelope distribution task using a transaction message.

7. A data processing device, characterized in that: include: A task acquisition module is used to acquire the red envelope distribution task generated in real time and add the red envelope distribution task to the list of tasks to be distributed; A batch processing module, for obtaining a preset number of red envelope distribution tasks from the list of tasks to be distributed in response to a batch processing task trigger operation, and determining a corporate sub-account that matches each of the red envelope distribution tasks; wherein each of the corporate sub-accounts is respectively associated with a Redis database, and the Redis database is used to manage the balance of the corporate sub-account; A red envelope distribution module, for each red envelope distribution task, using a transaction message to transfer red envelopes between a sub-account and a user account that matches the red envelope distribution task; Wherein, the batch processing module is used to: When it is detected that the timing of the timer meets the trigger time condition, a preset number of red envelope distribution tasks are obtained from the list of tasks to be distributed; Using a first routing algorithm, determining a batch processing server corresponding to each of the red envelope distribution tasks, and distributing each of the red envelope distribution tasks to a corresponding server; wherein the first routing algorithm includes a consistent hashing algorithm; Instructing each of the servers to use a second routing algorithm to determine a public sub-account that matches each of the red envelope distribution tasks; The instructing each of the servers to use a second routing algorithm to determine a public sub-account that matches each of the red envelope distribution tasks includes: For each of the red envelope distribution tasks, instruct the server corresponding to the red envelope distribution task to use a consistent hashing algorithm to perform a modulo operation on the serial number of the red envelope distribution task and the total number of sub-accounts, and use the operation result as the serial number of the public sub-account matching the red envelope distribution task; The red envelope distribution module is used to: For each of the red envelope distribution tasks, obtain the red envelope amount and user account of the red envelope distribution task; By using the transaction message, the red envelope amount is deducted from the sub-account of the partner that matches the red envelope distribution task, and the red envelope amount is increased in the user account.

8. An electronic device, characterized in that: The device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the data processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data processing method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Information processing method and device

    CN105991571A