Disclosure of Invention
Aiming at the technical problems, the embodiment of the specification provides a resource allocation method and a resource allocation system, wherein the technical scheme is as follows:
the resource allocation method is applied to a resource allocation system, the system comprises an allocation platform and a resource platform, the allocation platform and the resource platform agree on resource allocation time in advance, and the method comprises the following steps:
in a preset time period before the resource allocation moment, the allocation platform determines a resource allocation detail, wherein the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
before the resource allocation moment, the allocation platform sends the resource allocation details to a resource platform;
the resource platform receives the resource allocation details, locally stores the resource allocation details and monitors the current moment;
and when the current time is consistent with the resource allocation time, allocating a corresponding number of resources for each resource receiver according to the resource allocation detail.
A resource allocation method applied to an allocation platform, the method comprising:
determining a resource allocation detail in a preset time period before a resource allocation moment, wherein the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
before the resource allocation time, the resource allocation detail is sent to a resource platform, so that the resource platform receives the resource allocation detail, the resource allocation detail is stored locally, the current time is monitored, and when the current time is consistent with the resource allocation time, a corresponding number of resources are allocated to each resource receiver according to the resource allocation detail.
A resource allocation method applied to a resource platform, the method comprising:
receiving a resource allocation detail, wherein in a preset time period before a resource allocation moment, the allocation platform determines the resource allocation detail and sends the resource allocation detail to the resource platform before the resource allocation moment, and the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
storing the resource allocation details locally;
monitoring the current moment;
and when the current time is consistent with the resource allocation time, allocating a corresponding number of resources for each resource receiver according to the resource allocation detail.
A resource allocation system, the system comprising: the system comprises a distribution platform and a resource platform, wherein the distribution platform and the resource platform are both pre-agreed with resource distribution time;
in a preset time period before the resource allocation moment, the allocation platform determines a resource allocation detail, wherein the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
before the resource allocation moment, the allocation platform sends the resource allocation details to a resource platform;
the resource platform receives the resource allocation details, locally stores the resource allocation details and monitors the current moment;
and when the current time is consistent with the resource allocation time, allocating a corresponding number of resources for each resource receiver according to the resource allocation detail.
A resource allocation apparatus for use with an allocation platform, the apparatus comprising:
the system comprises a detail determining module, a resource allocation module and a resource allocation module, wherein the detail determining module is used for determining the resource allocation detail in a preset time period before the resource allocation moment, and the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
and the detail sending module is used for sending the resource allocation detail to the resource platform before the resource allocation moment so that the resource platform receives the resource allocation detail, locally storing the resource allocation detail, monitoring the current moment, and allocating a corresponding number of resources for each resource receiver according to the resource allocation detail when the current moment is consistent with the resource allocation moment.
A resource allocation apparatus for use with a resource platform, the apparatus comprising:
the system comprises a detail receiving module, a resource allocation detail processing module and a resource allocation control module, wherein the resource allocation detail is determined by an allocation platform in a preset time period before a resource allocation moment, and is sent to the resource platform before the resource allocation moment, and the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
the detail storage module is used for locally storing the resource allocation detail;
the time monitoring module is used for monitoring the current time;
and the resource allocation module is used for allocating corresponding quantity of resources to each resource receiver according to the resource allocation detail when the current moment is consistent with the resource allocation moment.
According to the technical scheme provided by the embodiment of the specification, in a preset time period before the resource allocation time, the allocation platform determines the resource allocation details and sends the resource allocation details to the resource platform before the resource allocation time, the resource platform receives the resource allocation details, monitors the current time, and allocates corresponding quantity of resources for each resource receiver according to the resource allocation details when the current time is consistent with the resource allocation time. Therefore, the resource allocation details are synchronized in advance, and the resource call is not involved any more, so that the resource allocation is only carried out in the resource platform, the time delay is greatly shortened, and the time when the resource receiver actually receives the resource is approximate to the time when the resource is allocated.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the embodiments of the disclosure.
Further, not all of the effects described above need be achieved in any of the embodiments of the present specification.
Detailed Description
In the case of allocating a resource to a plurality of resource receivers, it is required to allocate the resource to the plurality of resource receivers at a certain timing due to the allocation-existence time requirement of the resource. For example, for some enterprises and institutions, at a certain moment in spring festival, an enterprise will perform an activity of distributing red packets, and the number of red packets distributed each time is mostly in the billion level, and subsequent resource receivers (here, users) receive the red packets. In this way, since a large number of resources need to be allocated at a certain moment, the allocation platform needs to calculate the number of resource allocations of each resource receiver at the moment, that is, determine the resource allocation details, and call the corresponding resources from the resource platform according to the resource allocation details, so as to allocate the corresponding number of resources to each resource receiver, and the interaction flow diagram is shown in fig. 1.
However, in actual situations, the time when the resource receiver actually receives the resource is inconsistent with the time when the resource is allocated, for example, the time when the resource receiver actually receives the resource is 10:00, and the time when the resource receiver actually receives the resource is 10:01, and there is a time delay, which is ideal, the time when the resource receiver actually receives the resource is consistent with the time when the resource is allocated, however, the above effect cannot be achieved due to various reasons such as network delay, and only the time when the resource receiver actually receives the resource can be made to approach to the time when the resource is allocated.
Aiming at the problems, the embodiment of the specification provides a technical scheme, which synchronizes the resource allocation details in advance, does not involve resource calling any more, and only performs resource allocation in a resource platform, so that the time delay is greatly shortened, and the time when a resource receiver actually receives the resource is approximate to the time of resource allocation.
Specifically, the technical scheme provided in the embodiment of the present specification is as follows:
in a preset time period before the resource allocation moment, the allocation platform determines a resource allocation detail, wherein the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity; before the resource allocation moment, the allocation platform sends the resource allocation details to a resource platform; the resource platform receives the resource allocation details, locally stores the resource allocation details and monitors the current moment; and when the current time is consistent with the resource allocation time, allocating a corresponding number of resources for each resource receiver according to the resource allocation detail.
In this specification, a resource refers to a resource that has a requirement on time consistency (the time when a resource receiving party receives the resource coincides with the time when the resource is allocated, which may be points, red packets, limit coupons, tasks to be processed, memories, bandwidths, etc., and a corresponding resource receiving party may be a user, a server, a certain process, etc., and it should be noted that the embodiment of this specification only just exemplifies a few examples, and is not limited to the concrete representation of the resource and the resource receiving party. The allocation platform and the resource platform may be regarded as two subsystems, which respectively correspond to a specific server or a server cluster, and may implement communication connection through various types of networks, which is not limited in this specification.
In order for those skilled in the art to better understand the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described in detail below with reference to the drawings in the embodiments of the present specification, and it is apparent that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification shall fall within the scope of protection.
The following describes the resource allocation method in detail, referring to the interactive flow diagram shown in fig. 2, the method may include the following steps:
s201, in a preset time period before the resource allocation moment, the allocation platform determines a resource allocation detail, wherein the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
in the present specification, both the allocation platform and the resource platform agree on a resource allocation time in advance, for example, the resource allocation time agreed in advance by both the allocation platform and the resource platform is 10:00. In a preset time period before the resource allocation moment, the allocation platform determines the resource allocation detail, which means that the allocation platform calculates the resource allocation quantity corresponding to all resource receivers in advance, and the specific allocation platform determines the resource allocation detail by the following modes:
in a preset time period before the resource allocation moment, the allocation platform determines the number of resource receivers, allocates the corresponding resource allocation number for each resource receiver according to a preset resource allocation algorithm, so that the corresponding resource allocation number of each resource receiver can be obtained, at least the identifier of each resource receiver and the corresponding resource allocation number form a resource invention detail, so that the resource allocation detail can be determined, and the resource allocation detail at least comprises: the identity of the resource receiver and the corresponding number of resource allocations. The resource allocation algorithm may be an average allocation algorithm, or may be a random allocation algorithm, or a method for determining that a plurality of groups of different resource allocation amounts are randomly allocated to the resource receiver, and specific resource allocation algorithms are various, which are not described in detail herein, and may be selected according to actual needs.
The identification of the resource recipient, e.g., the resource recipient is a user, may be the recipient's name, nickname, personal account, etc., e.g., the resource recipient is a server, may be the recipient's number, IP address, etc., e.g., the resource recipient is a process, may be the recipient's name, i.e., any information that may be used to uniquely identify the recipient, to name a few examples, the present description embodiment is illustrative.
For example, taking the case that the resource allocation is red packet allocation, in 1 day before the resource allocation time 10:00, the allocation platform determines that the number of resource receivers is ten millions, determines that 100 groups of red packet allocation amount is 888, 100 groups of red packet allocation amount is 666, randomly selects 200 resource receivers from the ten millions of resource receivers, randomly allocates the 200 groups of red packet allocation amount to the 200 resource receivers, and randomly allocates red packet allocation amounts of the rest resource receivers to 0-2, so that red packet allocation amounts corresponding to each resource receiver can be obtained, and the red packet allocation details are formed by the identification of each resource receiver and the corresponding red packet allocation amount.
In addition, the total number of resource allocation is pre-agreed by the two parties of the allocation platform and the resource platform, and the total number of the resource allocation is consistent with the total number of the resource allocation pre-agreed by the two parties. For example, if the total number of resource allocations pre-agreed by both parties is one hundred million, the total number of participating resource allocations should also be one hundred million.
S202, before the resource allocation moment, the allocation platform sends the resource allocation details to the resource platform;
for the resource allocation details obtained in S201, the allocation platform needs to send them to the resource platform before the resource allocation time, that is, needs to synchronize them to the resource platform. For example, the resource allocation time is 10:00, and before 10:00, the resource allocation details can be synchronized to the resource platform at 09:59.
It is noted that the resource allocation time is any time between the determination of the resource detail and the resource allocation time. Preferably, the time for synchronizing the resource allocation details of the allocation platform can be specifically set according to actual needs because the time for ensuring that the resource platform receives the completed resource details is also before the resource allocation time.
S203, the resource platform receives the resource allocation details, locally stores the resource allocation details and monitors the current moment;
the allocation platform sends the resource allocation details to the resource platform before the resource allocation moment, the resource platform receives the resource allocation details, and preferably, the moment when the resource platform receives the resource allocation details is finished should be before the resource allocation moment.
The received resource allocation details are stored, where they may be stored in a local database or in a local disk, and the embodiments of the present disclosure are not limited in this regard.
Preferably, before the locally storing the resource allocation details, the method may further include: and calculating the total number of the resource allocation corresponding to the resource allocation list according to the resource allocation list, judging whether the total number of the resource allocation corresponding to the resource allocation list is consistent with the total number of the resource allocation pre-agreed by the two parties, if so, storing the resource allocation list locally, and if not, informing the allocation platform to resynchronize the resource allocation list.
For example, prior to locally storing the resource allocation details, the resource allocation details are shown in Table 1 below:
TABLE 1
The total number of resource allocations (for example, one hundred million) corresponding to the resource allocation list can be calculated from the resource allocation list, and the total number of resource allocations agreed in advance by both parties is one hundred million.
On the other hand, the resource platform needs to monitor the current time besides receiving and storing the resource allocation details, wherein the current time can be monitored in real time, whether the current time is consistent with the resource allocation time pre-agreed by both parties or not is judged, and corresponding operation is executed according to the judgment result.
And S204, when the current time is consistent with the resource allocation time, allocating corresponding quantity of resources for each resource receiver according to the resource allocation detail.
When the current time is consistent with the resource allocation time pre-agreed by both parties, namely, the resource allocation time is determined to come, the resource platform allocates the corresponding number of resources for each resource receiver according to the stored resource allocation detail, namely, allocates the corresponding number of resources to the resource receiver.
In addition, the resource allocation quantity corresponding to the resource receiver can be displayed according to the resource allocation detail, so that the resource receiver knows the obtained resource allocation quantity. For example, the resource receiver a may know that the number of resource allocations obtained by itself is 888 credits, and the resource receiver B may know that the number of resource allocations obtained by itself is 666 credits.
The resource allocation number display and the resource change operation may be performed simultaneously or sequentially, which is not limited in this specification.
For the detailed description of the scheme provided in the embodiment of the present specification, taking the application scenario of red packet distribution as an example, the distribution platform determines that the number of red packet receivers is ten millions within 1 day before the red packet distribution time of 10:00, determines that 100 groups of red packet distribution amounts are 888, 100 groups of red packet distribution amounts are 666, randomly selects 200 red packet receivers from the ten millions of red packet receivers, randomly distributes the 200 groups of red packet distribution amounts to the 200 red packet receivers, and randomly distributes the remaining red packet receivers with red packet distribution amounts between 0 and 2, so as to obtain the red packet distribution amount corresponding to each red packet receiver, and the red packet invention details are formed by the identification of each red packet receiver and the corresponding red packet distribution amount. In addition, the total amount of the red packet distribution agreed by both parties in advance is one hundred million, and the total amount of the red packet distribution participating should be one hundred million.
Before the red packet distribution time is 10:00, the distribution platform synchronizes the red packet distribution details to the resource platform, the resource platform receives the red packet distribution details, calculates one hundred million of red packet distribution total amount corresponding to the red packet distribution details according to the red packet distribution details, judges that the red packet distribution total amount is consistent with the red packet distribution total amount agreed by both sides in advance, locally stores the red packet distribution details, monitors the current time, and when the red packet distribution time is temporary, namely, the current time is consistent with the red packet distribution time, the resource platform distributes red packets with corresponding amount for each red packet receiver according to the stored red packet distribution details, namely, carries out resource change on personal accounts corresponding to each red packet receiver, and transfers the corresponding red packet distribution amount to the personal account corresponding to the red packet receiver. Meanwhile, according to the red packet distribution details, the red packet distribution amount corresponding to the red packet receiver is displayed, so that the red packet receiver knows the obtained red packet distribution amount.
Through the description of the technical scheme provided by the embodiment of the present specification, in a preset time period before the resource allocation time, the allocation platform determines the resource allocation details, and sends the resource allocation details to the resource platform before the resource allocation time, the resource platform receives and stores the resource allocation details, monitors the current time, and when the current time is consistent with the resource allocation time, allocates a corresponding number of resources for each resource receiver according to the resource allocation details. Therefore, the resource allocation details are synchronized in advance, and the resource call is not involved any more, so that the resource allocation is only carried out in the resource platform, the time delay is greatly shortened, and the time when the resource receiver actually receives the resource is approximate to the time when the resource is allocated.
In order to more clearly describe the solution of the embodiments of the present specification, the following describes the method to be executed from the single-sided point of view:
for the distribution platform, the tasks to be performed are mainly as follows:
a, determining a resource allocation detail in a preset time period before a resource allocation moment, wherein the resource allocation detail at least comprises the following steps: identification of the resource receiver and corresponding resource allocation quantity;
b, before the resource allocation moment, sending the resource allocation details to a resource platform;
for a resource platform, the tasks to be performed are mainly as follows:
a, receiving the resource allocation details, locally storing the resource allocation details, and monitoring the current moment;
b, when the current time is consistent with the resource allocation time, allocating corresponding quantity of resources for each resource receiver according to the resource allocation detail.
For details of the resource platform and the single-side execution method of the resource platform, reference may be made to the description of the foregoing embodiments, which are not repeated here.
Corresponding to the above method embodiment, the embodiment of the present disclosure further provides a resource allocation device, applied to the allocation platform, as shown in fig. 3, where the device may include: a detail determining module 310 and a detail sending module 320.
A detail determining module 310, configured to determine a resource allocation detail in a preset period of time before a resource allocation moment, where the resource allocation detail at least includes: identification of the resource receiver and corresponding resource allocation quantity;
and the detail sending module 320 is configured to send the resource allocation detail to a resource platform before the resource allocation time, so that the resource platform receives the resource allocation detail, locally stores the resource allocation detail, monitors a current time, and allocates a corresponding number of resources to each resource receiver according to the resource allocation detail when the current time is consistent with the resource allocation time.
The embodiment of the present disclosure further provides a resource allocation device, which is applied to a resource platform, and as shown in fig. 4, the device may include: a detail receiving module 410, a detail storing module 420, a time monitoring module 430 and a resource allocation module 440.
A detail receiving module 410, configured to receive a resource allocation detail, where during a preset period of time before a resource allocation time, the allocation platform determines the resource allocation detail, and sends the resource allocation detail to the resource platform before the resource allocation time, where the resource allocation detail at least includes: identification of the resource receiver and corresponding resource allocation quantity;
a detail storage module 420, configured to store the resource allocation detail locally;
a time monitoring module 430, configured to monitor a current time;
and a resource allocation module 440, configured to allocate a corresponding number of resources to each resource receiver according to the resource allocation details when the current time is consistent with the resource allocation time.
The embodiment of the specification also provides a resource allocation system, which comprises: the system comprises a distribution platform and a resource platform, wherein the distribution platform and the resource platform are both pre-agreed with resource distribution time;
in a preset time period before the resource allocation moment, the allocation platform determines a resource allocation detail, wherein the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
before the resource allocation moment, the allocation platform sends the resource allocation details to a resource platform;
the resource platform receives the resource allocation details, locally stores the resource allocation details and monitors the current moment;
and when the current time is consistent with the resource allocation time, allocating a corresponding number of resources for each resource receiver according to the resource allocation detail.
The implementation process of the functions and roles of each module in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
Through the description of the technical scheme provided by the embodiment of the present specification, in a preset time period before the resource allocation time, the allocation platform determines the resource allocation details, and sends the resource allocation details to the resource platform before the resource allocation time, the resource platform receives and stores the resource allocation details, monitors the current time, and when the current time is consistent with the resource allocation time, allocates a corresponding number of resources for each resource receiver according to the resource allocation details. Therefore, the resource allocation details are synchronized in advance, and the resource call is not involved any more, so that the resource allocation is only carried out in the resource platform, the time delay is greatly shortened, and the time when the resource receiver actually receives the resource is approximate to the time when the resource is allocated.
Embodiments of the present disclosure also provide a computer device, as shown in fig. 5, which may include: processor 510, memory 520, input/output interface 530, communication interface 540, and bus 550. Wherein processor 510, memory 520, input/output interface 530, and communication interface 540 enable a communication connection within the device between each other via bus 550.
The processor 510 may be implemented by a general-purpose CPU (Central Processing Unit ), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing relevant programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 520 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), static storage device, dynamic storage device, or the like. Memory 520 may store an operating system and other application programs, and when the embodiments of the present disclosure are implemented in software or firmware, the associated program code is stored in memory 520 and executed by processor 510.
The input/output interface 530 is used for connecting with an input/output module to realize information input and output. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide corresponding functionality. Wherein the input devices may include a keyboard, mouse, touch screen, microphone, various types of sensors, etc., and the output devices may include a display, speaker, vibrator, indicator lights, etc.
The communication interface 540 is used to connect with a communication module (not shown in the figure) to enable communication interaction between the present device and other devices. The communication module may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
Bus 550 includes a path to transfer information between elements of the device (e.g., processor 510, memory 520, input/output interface 530, and communication interface 540).
It should be noted that although the above device only shows the processor 510, the memory 520, the input/output interface 530, the communication interface 540, and the bus 550, in the implementation, the device may further include other components necessary for achieving normal operation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
The present embodiments also provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the aforementioned resource allocation method. The method at least comprises the following steps:
a resource allocation method applied to an allocation platform, the method comprising:
determining a resource allocation detail in a preset time period before a resource allocation moment, wherein the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
before the resource allocation time, the resource allocation detail is sent to a resource platform, so that the resource platform receives the resource allocation detail, the resource allocation detail is stored locally, the current time is monitored, and when the current time is consistent with the resource allocation time, a corresponding number of resources are allocated to each resource receiver according to the resource allocation detail.
The present embodiments also provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the aforementioned resource allocation method. The method at least comprises the following steps:
a resource allocation method applied to a resource platform, the method comprising:
receiving a resource allocation detail, wherein in a preset time period before a resource allocation moment, the allocation platform determines the resource allocation detail and sends the resource allocation detail to the resource platform before the resource allocation moment, and the resource allocation detail at least comprises: identification of the resource receiver and corresponding resource allocation quantity;
storing the resource allocation details locally;
monitoring the current moment;
and when the current time is consistent with the resource allocation time, allocating a corresponding number of resources for each resource receiver according to the resource allocation detail.
Computer-readable media include both permanent and non-permanent, removable and non-removable media, and information storage may be implemented by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer 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 disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
From the foregoing description of embodiments, it will be apparent to those skilled in the art that the present embodiments may be implemented in software plus a necessary general purpose hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be embodied in essence or what contributes to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present specification.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points. The apparatus embodiments described above are merely illustrative, in which the modules illustrated as separate components may or may not be physically separate, and the functions of the modules may be implemented in the same piece or pieces of software and/or hardware when implementing the embodiments of the present disclosure. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The foregoing is merely a specific implementation of the embodiments of this disclosure, and it should be noted that, for a person skilled in the art, several improvements and modifications may be made without departing from the principles of the embodiments of this disclosure, and these improvements and modifications should also be considered as protective scope of the embodiments of this disclosure.