CN112130989A - Two-dimensional code application method and device - Google Patents

Two-dimensional code application method and device Download PDF

Info

Publication number
CN112130989A
CN112130989A CN202010832765.7A CN202010832765A CN112130989A CN 112130989 A CN112130989 A CN 112130989A CN 202010832765 A CN202010832765 A CN 202010832765A CN 112130989 A CN112130989 A CN 112130989A
Authority
CN
China
Prior art keywords
dimensional code
time
value
application
historical
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010832765.7A
Other languages
Chinese (zh)
Inventor
吴强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beike Technology Co Ltd
Original Assignee
Beike Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beike Technology Co Ltd filed Critical Beike Technology Co Ltd
Priority to CN202010832765.7A priority Critical patent/CN112130989A/en
Publication of CN112130989A publication Critical patent/CN112130989A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K17/00Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention provides a two-dimension code application method and a two-dimension code application device, wherein firstly, for a time period with preset duration, the time period is divided into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code; then for each time segment, acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and if the difference value and the historical excess value are judged to be larger than 0, supplementing the two-dimensional code generation server with the application to generate the two-dimensional code in the time segment; and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value. The supplementary application and the real-time application are combined, so that the resources of the two-dimensional code generation server can be fully utilized, and the utilization rate of the resources is greatly improved.

Description

Two-dimensional code application method and device
Technical Field
The invention relates to the technical field of computer software application, in particular to a two-dimensional code application method and device.
Background
With the wide application of the two-dimensional code in the scenes of payment, friend relationship establishment and the like, it is important to respond to a two-dimensional code application request of a user and quickly generate and feed back the two-dimensional code to the user.
Taking a WeChat applet as an example, the two-dimensional code corresponding to the WeChat applet is an applet code, and a user sends an applet code application request to a two-dimensional code generation server to request the two-dimensional code generation server to return the applet code. The two-dimensional code generation server usually generates the applet code in real time, namely when receiving an applet code application request sent by a user, the two-dimensional code generation server pulls the micro-message interface in real time to generate the applet code.
Because the small program codes which can be generated by the two-dimensional code generation server per minute have quantity limitation, when the small program codes are generated in real time, the small program codes cannot be provided for users in time at the peak period of small program code application, and the resources of the two-dimensional code generation server are idle and wasted at the valley period of small program code application.
Disclosure of Invention
The embodiment of the invention provides a two-dimensional code application method and a two-dimensional code application device, which are used for overcoming the defects in the prior art.
The embodiment of the invention provides a two-dimensional code application method, which comprises the following steps:
for a time period with preset duration, dividing the time period into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code;
acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code if the difference value is judged to be larger than 0;
and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
According to one embodiment of the invention, the two-dimensional code application method further comprises:
if the difference between the difference value and the historical excess value is smaller than 0, keeping the absolute value two-dimensional codes of the difference value and the historical excess value until the next time segment of the time segment is applied after the theoretical request quantity two-dimensional codes are applied in the time segment in real time.
According to the two-dimensional code application method of an embodiment of the present invention, if it is determined that the difference between the difference value and the historical excess value is smaller than 0, the method further includes:
updating the historical excess value to an absolute value of a difference between the difference value and the historical excess value.
According to one embodiment of the invention, the two-dimensional code application method further comprises:
and if the difference between the difference value and the historical excess value is judged and obtained to be equal to 0, continuously obtaining the difference value between the theoretical request quantity and the actual request quantity of the real-time two-dimensional code application received in the next time segment of the time segments.
The two-dimensional code application method according to one embodiment of the invention further comprises the following steps: storing the two-dimensional code generated by the supplementary application;
and when a result corresponding to the real-time two-dimensional code application request returned by the two-dimensional code generation server is empty, returning the stored two-dimensional code to the client.
According to the two-dimensional code application method of one embodiment of the present invention, the theoretical requested quantity is specifically a ratio of the limited quantity of the two-dimensional codes generated in the limited period to the specified quantity.
The embodiment of the present invention further provides a two-dimensional code application apparatus, including:
the device comprises a dividing module, a judging module and a judging module, wherein the dividing module is used for dividing a time period with preset duration into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code;
the supplementary application module is used for acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code if the difference value is judged to be larger than 0 with the historical excess value;
and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
The two-dimensional code application device according to an embodiment of the present invention further includes:
and the reserving module is used for reserving the absolute value two-dimensional codes of the difference value and the historical excess value to the next time segment application of the time segment after the theoretical request quantity two-dimensional codes are applied in real time in the time segment if the difference value and the historical excess value is judged and obtained to be smaller than 0.
The embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements any of the steps of the two-dimensional code application method when executing the program.
Embodiments of the present invention further provide a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of any one of the two-dimensional code application methods described above.
According to the two-dimension code application method and device provided by the embodiment of the invention, firstly, for a time period with preset duration, the time period is divided into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code; then obtaining a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimension code application received in a time segment, and if the difference value is judged to be larger than 0 with respect to a historical excess value, supplementing the two-dimension code generation server with the application to generate the two-dimension code in the time segment; and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value. The supplementary application and the real-time application are combined, so that the resources of the two-dimensional code generation server can be fully utilized, and the utilization rate of the resources is greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating a change of an actual request quantity of a service party requesting a two-dimensional code in the prior art;
fig. 2 is a schematic flow chart of a two-dimensional code application method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a two-dimensional code application apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, a service party periodically requests a two-dimensional code every day:
at the time of T00, the actual request quantity of the two-dimensional code application is small, the two-dimensional code application belongs to the service valley period, and the typical value is 100 requests per minute at 0 point in the morning;
at the time of T01, the actual request volume of the two-dimensional code application is large, and belongs to the peak period of the service, and typical values are as 4000 per minute at 9 am;
at time T10, a trough phase on the next day was entered, similar to time T00;
different transition change modes are provided between the valley period and the peak period along with different service scenes; the data trend reciprocates so periodically each day.
When the limited number of the two-dimensional code generation server generating the two-dimensional code, that is, the maximum generatable amount Max is 5000, the two-dimensional code generation server will generate a large amount of resource waste, and the resource will not be fully utilized. Therefore, the embodiment of the invention provides a two-dimensional code application method.
As shown in fig. 2, the two-dimensional code application method provided in the embodiment of the present invention includes:
s1, for a time period with preset duration, dividing the time period into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code;
s2, obtaining a difference value between a theoretical request quantity and an actual request quantity of the real-time two-dimensional code application received in the time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code if the difference value and the historical excess value are judged to be larger than 0;
and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
Specifically, in the two-dimensional code application method provided in the embodiment of the present invention, the execution main body is a target server, the target server may be a local server or a cloud server, and the local server may be a computer, a tablet computer, a smart phone, and the like. The target server can serve a certain unit or company, the target server can be in communication connection with a client and a two-dimensional code generation server which are held by a user, the client is used for sending a two-dimensional code application request to the two-dimensional code generation server through the target server, and the two-dimensional code generation server is used for generating a two-dimensional code in real time through the two-dimensional code application request sent by the target server. It should be noted that the two-dimensional code in the embodiment of the present invention may be a generalized two-dimensional code, and may include an applet two-dimensional code, where the applet two-dimensional code may be a square two-dimensional code or a circular two-dimensional code, and this is not specifically limited in the embodiment of the present invention. In the embodiment of the invention, the small program two-dimensional code can be a WeChat small program two-dimensional code, correspondingly, the two-dimensional code generating server can be a WeChat server, and a certain number of two-dimensional codes are generated within a preset time length by recording time of the two-dimensional code generating server.
Step S1 is performed first. The preset time duration refers to a limit period for the two-dimensional code generation server to generate the two-dimensional codes, for example, if the wechat server generates 5000 two-dimensional codes at most every minute, the limit period is 1 minute, that is, 60 seconds. The limit number is 5000. For a time period with a duration of 1 minute, the time period may be first divided into a specified number of time segments, and the specified number may be set as required, specifically may be greater than or equal to 2, and is preferably 10. The dividing mode may be an average dividing mode, that is, 1 minute may be divided into 10 time segments on average.
Then, step S2 is executed. The time period is set to be M0-M1, x time segments are divided between M0-M1, and the value of x is greater than or equal to 2. For each time segment mi(i is more than or equal to 1 and less than or equal to x), and acquiring a time segment miThe theoretical request quantity D and the actual request quantity s of the received real-time two-dimension code applicationi. The theoretical request quantity D refers to the set time segment miThe maximum number of the generated two-dimensional codes can be applied to a two-dimensional code generation server in real time. The value of the theoretical request quantity D may correspond to the preset time length one to one, that is, different theoretical request quantities D are provided for different preset time lengths, and different time segments within the same preset time length correspond to the same theoretical request quantity D. Calculating theoretical request quantity D and actual request quantity siHas a difference of di=D-si. On the basis, in order to consider the influence of the actual request quantity of the time segment which is earlier in time in each preset time length on the quantity (namely the supplement request quantity) of the supplement application generation two-dimensional codes of the time segment which is later in time, mutually independent historical excess quantity values S are respectively introduced into each preset time length. Historical excess value S at each time segment miThere is a corresponding value, and the corresponding values may be the same or different. The historical excess value refers to a time segment m in each preset time lengthiAnd the sum of the absolute values of the differences between the theoretical requested quantity and the actual requested quantity of each previous time segment is used for representing the absolute deviation of the theoretical requested quantity and the actual requested quantity in all the time segments which have passed in each preset time length. In each preset time length, the initial value of the historical excess value S is 0, and the history can be carried out according to the absolute value of the difference between the theoretical request quantity and the actual request quantity of different time segmentsAnd adjusting the value of the history excess value S.
Judging the difference diThe difference Diff between the historical excess value S and the positive or negative value of Diff, if Diff is greater than 0, the time segment m is describediThe total amount of the two-dimension codes applied in the internal application is insufficient, and m can be segmented in time at the momentiAnd when the two-dimensional code generation is finished, continuing to supplement the two-dimensional code generation server for generating the two-dimensional code, wherein the supplement application amount is equal to Diff. That is, if Diff is greater than 0, time segment m is now presentiThe surplus of the requested amount of the inner two-dimensional code is Diff, and a supplement application can be carried out. The resource of the two-dimensional code generation server can be fully utilized, and the utilization rate of the resource is greatly improved. It should be noted that the time segment miThe total amount of the two-dimension code of the internal application is time segmentation miActual request quantity s of inner two-dimension codeiAnd time segment miThe sum of the historical excess values S.
The two-dimension code application method provided by the embodiment of the invention comprises the steps of firstly dividing a time period with preset duration into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code; then obtaining a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in each time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code in the time segment if the difference value is judged to be larger than 0 with the historical excess value; and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value. The supplementary application and the real-time application are combined, so that the resources of the two-dimensional code generation server can be fully utilized, and the utilization rate of the resources is greatly improved.
On the basis of the above embodiment, after the supplementary application, the historical excess value S needs to be set to 0, so as to illustrate that the time slice m is divided into time slicesiThe resource of the two-dimensional code generation server is fully utilized, and the resource waste is avoided.
On the basis of the above embodiment, the two-dimensional code application method provided in the embodiment of the present invention further includes:
if the difference between the difference value and the historical excess value is smaller than 0, keeping the absolute value two-dimensional codes of the difference value and the historical excess value until the next time segment of the time segment is applied after the theoretical request quantity two-dimensional codes are applied in the time segment in real time.
Specifically, in the embodiment of the present invention, since a maximum number of two-dimensional codes of theoretical request amount can be applied in real time in each time segment, when Diff is smaller than 0, it is described that the time segment m isiThe total amount of the two-dimension codes applied in the internal application is too much, and the time segment m is divided intoiThere is no surplus limit for supplement application, not only, time segment miThe theoretical amount of requests in is not sufficient to satisfy the time segment miThe actual request amount and the history excess amount in the time slice miNext time segment m ofi+1In time division miThe request quantity which is not applied in the middle is continuously applied, and the time is segmented miThe requested quantity is the difference diThe absolute value of the difference from the historical excess value S. Therefore, in the embodiment of the present invention, m is time-segmentediAfter internal real-time application of theoretical request quantity of two-dimensional codes, difference value d is obtainediThe absolute value of the difference from the historical excess value S is retained until the time segment miNext time segment m ofi+1And (6) applying.
In the embodiment of the invention, after the two-dimension codes with the theoretical request quantity applied in each time segment in real time are limited, the rest two-dimension codes are reserved to the next time segment for application, so that the two-dimension code request quantity in the time segment with the preset time length can be more average in each time segment.
On the basis of the above embodiment, the two-dimensional code application method provided in the embodiment of the present invention further includes: and if the difference between the difference value and the historical excess value is judged and obtained to be smaller than 0, updating the historical excess value to be the absolute value of the difference between the difference value and the historical excess value.
Specifically, in the embodiment of the present invention, when Diff is smaller than 0, m needs to be segmented in timeiNext time segment m ofi+1In time division miThe requested amount that has not been applied for is applied for further, specifically, the following steps are followedA time segment mi+1Is updated to diThe absolute value of the difference from the historical excess value S, in time segments miNext time segment m ofi+1Continuously judging the actual request quantity di+1Plus or minus the difference with the updated historical excess value S.
On the basis of the above embodiment, the two-dimensional code application method provided in the embodiment of the present invention further includes: and if the difference between the difference value and the historical excess value is judged and obtained to be equal to 0, continuously obtaining the difference value between the theoretical request quantity and the actual request quantity of the real-time two-dimensional code application received in the next time segment of the time segments.
Specifically, in the embodiment of the present invention, when the difference d is smaller than the predetermined valueiThe difference between the historical excess value S and the historical excess value S is equal to 0, which indicates the actual request quantity S of the two-dimensional code applied in real timeiThe two-dimensional code generating server can just meet the requirement, and no residual resource is left for performing supplementary application to generate the two-dimensional code.
On the basis of the above embodiment, the two-dimensional code application method provided in the embodiment of the present invention further includes: storing the two-dimensional code generated by the supplementary application;
and when a result corresponding to the real-time two-dimensional code application request returned by the two-dimensional code generation server is empty, returning the stored two-dimensional code to the client.
Specifically, in the embodiment of the present invention, the two-dimensional code generated by the supplement application is stored. When the actual request quantity of the real-time application of the two-dimensional code is larger than the limited quantity of the two-dimensional code generation server, namely, a result corresponding to the real-time two-dimensional code application request returned by the two-dimensional code generation server is empty, namely, the two-dimensional code generation server fails to generate the two-dimensional code, the stored two-dimensional code can be directly returned to the client.
In the embodiment of the invention, the two-dimensional code obtained by the supplement application can be fully utilized on the basis of fully utilizing the resources of the two-dimensional code generation server.
On the basis of the foregoing embodiment, in the two-dimensional code application method provided in the embodiment of the present invention, the theoretical requested quantity is specifically a ratio of the limited quantity of the two-dimensional codes generated in the limited period to the specified quantity.
Specifically, in the embodiment of the present invention, the theoretical requested quantity is specifically a ratio of a limited quantity of the two-dimensional codes generated in the limited period to the specified quantity. For example, if the limited number is 5000 and the specified number is x, the theoretical request amount is 5000/x, which is an average value of two-dimensional code application amounts in a time period, and it is ensured that resources of the two-dimensional code generation server are fully utilized. At most 5000/x two-dimensional code missing applications exist per minute. If x is divided into a plurality of sections, the missing two-dimensional codes are fewer, the overall application rate is closer to 100%, and finally the sum of magnitude of real-time application and supplementary application per minute can be close to or equal to 5000.
As shown in fig. 3, on the basis of the above embodiment, an embodiment of the present invention provides a two-dimensional code application apparatus, including: a partitioning module 31 and a complementary application module 32. Wherein the content of the first and second substances,
the dividing module 31 is configured to divide a time period of a preset duration into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code;
the supplement application module 32 is configured to obtain a difference between a theoretical request amount and an actual request amount of a real-time two-dimensional code application received in the time segment, and if it is determined that the difference between the difference and the historical excess value is greater than 0, supplement the two-dimensional code application to the two-dimensional code generation server to generate a two-dimensional code;
and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
Specifically, the functions of the modules in the two-dimensional code application apparatus provided in the embodiment of the present invention correspond to the operation flows of the steps in the above method embodiments one to one, and the implementation effects are also consistent, which is not described again in the embodiment of the present invention.
On the basis of the above embodiment, the two-dimensional code application apparatus provided in the embodiment of the present invention further includes:
and the reserving module is used for reserving the absolute value two-dimensional codes of the difference value and the historical excess value to the next time segment application of the time segment after the theoretical request quantity two-dimensional codes are applied in real time in the time segment if the difference value and the historical excess value is judged and obtained to be smaller than 0.
On the basis of the above embodiment, the two-dimensional code application apparatus provided in the embodiment of the present invention further includes:
and the updating module is used for updating the historical excess value into the absolute value of the difference between the difference value and the historical excess value if the difference between the difference value and the historical excess value is judged and obtained to be less than 0.
On the basis of the above embodiment, the two-dimensional code application apparatus provided in the embodiment of the present invention further includes: the device comprises a storage module and a return module;
the storage module is used for storing the two-dimensional code generated by the supplement application;
and the returning module is used for returning the stored two-dimension code to the client when a result corresponding to the real-time two-dimension code application request returned by the two-dimension code generating server is empty.
On the basis of the foregoing embodiment, the two-dimensional code application device provided in the embodiment of the present invention is further configured to, if it is determined that the difference between the difference and the historical excess value is equal to 0, continue to obtain the difference between the theoretical request amount and the actual request amount of the real-time two-dimensional code application received in the next time segment of the time segment.
On the basis of the foregoing embodiment, in the two-dimensional code application apparatus provided in the embodiment of the present invention, the theoretical requested quantity is specifically a ratio of a limited quantity of the two-dimensional codes generated in the limited period to the specified quantity.
Fig. 4 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 4: a processor (processor)410, a communication Interface 420, a memory (memory)430 and a communication bus 440, wherein the processor 410, the communication Interface 420 and the memory 430 are communicated with each other via the communication bus 440. The processor 410 may call logic instructions in the memory 430 to perform a two-dimensional code application method, the method comprising: for a time period with preset duration, dividing the time period into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code; for each time segment, acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code if the difference value is judged to be larger than 0 with respect to the historical excess value; and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
In addition, the logic instructions in the memory 430 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions are executed by a computer, the computer can perform the two-dimensional code application method provided by the above-mentioned method embodiments, where the method includes: for a time period with preset duration, dividing the time period into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code; acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code in the time segment if the difference value is judged to be larger than 0; and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
In another aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the two-dimensional code application method provided in the foregoing embodiments when executed by a processor, where the method includes: for a time period with preset duration, dividing the time period into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code; for each time segment, acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and if the difference value and the historical excess value are judged to be larger than 0, supplementing the two-dimensional code generation server with the application to generate the two-dimensional code in the time segment; and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device to perform the methods described in the embodiments or some portions of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A two-dimensional code application method is characterized by comprising the following steps:
for a time period with preset duration, dividing the time period into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code;
acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code if the difference value is judged to be larger than 0;
and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
2. The two-dimensional code application method according to claim 1, further comprising:
if the difference between the difference value and the historical excess value is smaller than 0, keeping the absolute value two-dimensional codes of the difference value and the historical excess value until the next time segment of the time segment is applied after the theoretical request quantity two-dimensional codes are applied in the time segment in real time.
3. The two-dimensional code application method according to claim 2, wherein if it is determined that the difference between the difference value and the historical excess value is smaller than 0, the method further comprises:
updating the historical excess value to an absolute value of a difference between the difference value and the historical excess value.
4. The two-dimensional code application method according to claim 2, further comprising:
and if the difference between the difference value and the historical excess value is judged and obtained to be equal to 0, continuously obtaining the difference value between the theoretical request quantity and the actual request quantity of the real-time two-dimensional code application received in the next time segment of the time segments.
5. The two-dimensional code application method according to any one of claims 1 to 4, further comprising: storing the two-dimensional code generated by the supplementary application;
and when a result corresponding to the real-time two-dimensional code application request returned by the two-dimensional code generation server is empty, returning the stored two-dimensional code to the client.
6. The two-dimensional code application method according to any one of claims 1 to 4, wherein the theoretical requested quantity is specifically a ratio of a limited quantity of the two-dimensional codes generated in the limited period to the specified quantity.
7. The utility model provides a two-dimensional code application apparatus which characterized in that includes:
the device comprises a dividing module, a judging module and a judging module, wherein the dividing module is used for dividing a time period with preset duration into a specified number of time segments; the preset time length is equal to a limit period of the two-dimensional code generation server for generating the two-dimensional code;
the supplementary application module is used for acquiring a difference value between a theoretical request quantity and an actual request quantity of a real-time two-dimensional code application received in the time segment, and supplementing the two-dimensional code generation server with the application to generate the two-dimensional code if the difference value is judged to be larger than 0 with the historical excess value;
and the number of the two-dimensional codes generated by the supplementary application is equal to the difference between the difference value and the historical excess value, and the historical excess value is used for representing the absolute deviation between the theoretical request quantity and the actual request quantity in all the time segments before the time segment in the preset time length.
8. The two-dimensional code application device according to claim 7, further comprising:
and the reserving module is used for reserving the absolute value two-dimensional codes of the difference value and the historical excess value to the next time segment application of the time segment after the theoretical request quantity two-dimensional codes are applied in real time in the time segment if the difference value and the historical excess value is judged and obtained to be smaller than 0.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the two-dimensional code application method according to any one of claims 1 to 6 when executing the program.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the two-dimensional code application method according to any one of claims 1 to 6.
CN202010832765.7A 2020-08-18 2020-08-18 Two-dimensional code application method and device Pending CN112130989A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010832765.7A CN112130989A (en) 2020-08-18 2020-08-18 Two-dimensional code application method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010832765.7A CN112130989A (en) 2020-08-18 2020-08-18 Two-dimensional code application method and device

Publications (1)

Publication Number Publication Date
CN112130989A true CN112130989A (en) 2020-12-25

Family

ID=73850322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010832765.7A Pending CN112130989A (en) 2020-08-18 2020-08-18 Two-dimensional code application method and device

Country Status (1)

Country Link
CN (1) CN112130989A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914720A (en) * 2013-01-08 2014-07-09 广州宽度信息技术有限公司 Two-dimension code image encryption system and two-dimension code image generation method
CN107231496A (en) * 2017-06-07 2017-10-03 阿里巴巴集团控股有限公司 Traffic handling, service processing method, device and server
CN108092797A (en) * 2017-11-21 2018-05-29 北京奇艺世纪科技有限公司 A kind of Container Management method and device
CN111224806A (en) * 2018-11-27 2020-06-02 华为技术有限公司 Resource allocation method and server
CN111401490A (en) * 2020-02-17 2020-07-10 上海博泰悦臻电子设备制造有限公司 Two-dimensional code obtaining method and related device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914720A (en) * 2013-01-08 2014-07-09 广州宽度信息技术有限公司 Two-dimension code image encryption system and two-dimension code image generation method
CN107231496A (en) * 2017-06-07 2017-10-03 阿里巴巴集团控股有限公司 Traffic handling, service processing method, device and server
CN108092797A (en) * 2017-11-21 2018-05-29 北京奇艺世纪科技有限公司 A kind of Container Management method and device
CN111224806A (en) * 2018-11-27 2020-06-02 华为技术有限公司 Resource allocation method and server
CN111401490A (en) * 2020-02-17 2020-07-10 上海博泰悦臻电子设备制造有限公司 Two-dimensional code obtaining method and related device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
高聪;双锴;苏森;: "支持客户预约的媒体服务器资源分配算法", 北京邮电大学学报, no. 05, 15 October 2008 (2008-10-15) *

Similar Documents

Publication Publication Date Title
CN105912397A (en) Resources management method and device
US10652360B2 (en) Access scheduling method and apparatus for terminal, and computer storage medium
CN110138883B (en) Hybrid cloud resource allocation method and device
CN110413396B (en) Resource scheduling method, device and equipment and readable storage medium
CN112714029B (en) Method, device and equipment for scheduling content distribution network bandwidth
CN103679497A (en) Trial commodity distributing method and device
CN104333600A (en) Cloud computing based resource managing method and system
CN112130989A (en) Two-dimensional code application method and device
CN114095444A (en) Current limiting method and device and electronic equipment
CN112286623A (en) Information processing method and device and storage medium
CN116226178A (en) Data query method and device, storage medium and electronic device
CN108228334B (en) Container cluster expansion method and device
CN113691587B (en) Virtual resource processing method and device, electronic equipment and storage medium
CN113076406A (en) Information processing method and device
CN115168302A (en) Business data export method and device and electronic equipment
CN112435021A (en) Transaction request processing method, device, equipment and medium based on artificial intelligence
CN105939227B (en) Service configuration method, system and server based on CMDB
CN115278558B (en) Message sending method and device
CN112492047B (en) Cloud computing call optimization method and device and electronic equipment
CN113364863B (en) Method, system and equipment for distributing behavior data session ID
CN113296745B (en) Data processing method and device, computer readable storage medium and processor
CN112037019B (en) Method and device for allocating self-service equipment of banking outlets
CN106095565A (en) Cloud computing system resource distribution backward inference system based on BSDE and collocation method
CN117539611A (en) Resource calculation method, resource calculation device, and computer storage medium
CN116414524A (en) Data processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination