Method, device, storage medium and electronic device for checking the inventory of preset objects

By dynamically obtaining and using the current value of the verification mark to determine whether to perform inventory verification, the problem of increasing response time caused by excessive inventory verification times in high concurrency scenarios is solved, and the user experience is improved.

CN114462906BActive Publication Date: 2025-01-10BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110749733.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-02
Publication Date
2025-01-10
Estimated Expiration
2041-07-02

AI Technical Summary

Technical Problem

In high concurrency scenarios, the server needs to frequently verify inventory, resulting in a significant increase in request response time, affecting the user experience, and may even cause user churn.

Method used

Through the inventory verification method of the preset object, the current values ​​of the first and second verification marks are dynamically obtained, and whether to perform inventory verification is determined based on different current values, unnecessary verification requests are reduced, and response time is optimized.

Benefits of technology

It greatly reduces the number of verification requests when displaying consuming information, shortens the interface response time, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114462906B_ABST
    Figure CN114462906B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, storage medium and electronic device for checking the inventory of a preset object. The method includes: when receiving a consumable query request for a preset object, obtaining the current value of a first check mark and the current value of a second check mark; when the current value of the first check mark and the current value of the second check mark are both the first preset value, not checking the inventory of the preset object, and feeding back the consumable display information of the preset object; when any one of the current values ​​of the first check mark and the second check mark is the second preset value, checking the inventory of the preset object, and feeding back the consumable display information of the preset object according to the verification result of the inventory check. The present disclosure greatly reduces the number of requests that need to be checked when displaying consumable information, shortens the response time of the interface, enables users to receive feedback in a short time, and has a better user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of data information processing, and in particular to a method, device, storage medium and electronic device for checking the inventory of a preset object. Background Art

[0002] In today's society, the processing of electronic data information is widely used in all walks of life. Users send various requests through interfaces to obtain the required data or physical objects. For any kind of data or physical object that can be obtained, it usually has a fixed inventory for users to obtain. If the inventory is insufficient, it cannot be obtained. With the development of the Internet and smart devices, there may be a large number of concurrent requests to request a certain amount of data or physical objects through the interface at the same time. The server background needs to verify the inventory to determine whether the request can be responded to and executed at present. Usually, the background sets the value of the inventory that needs to be verified to the database, such as the Redis database, so that a large number of read and write operations can be requested concurrently to realize the verification function. However, in high-concurrency scenarios, the number of verifications increases significantly, causing the response time of the request to increase exponentially, seriously affecting the user experience, and even causing user loss. Summary of the invention

[0003] The purpose of the embodiments of the present disclosure is to provide a method, device, storage medium and electronic device for checking the inventory of a preset object, so as to solve the problem of increased request response time caused by increased number of checks in high concurrency scenarios in the prior art.

[0004] The embodiments of the present disclosure adopt the following technical scheme: a method for checking the inventory of a preset object, comprising: when receiving a consumable query request for the preset object, obtaining the current value of a first check mark and the current value of a second check mark; when the current value of the first check mark and the current value of the second check mark are both first preset values, not performing inventory verification of the preset object, and feeding back the consumable display information of the preset object; when any one of the current value of the first check mark and the current value of the second check mark is a second preset value, performing inventory verification of the preset object, and feeding back the consumable display information of the preset object based on the verification result of the inventory verification.

[0005] In some embodiments, the method further includes: upon receiving a stock consumption request for a preset object, performing a pre-deduction stock check on the preset object stock; when the pre-deduction stock check passes, executing the stock consumption request and deducting the consumption amount requested in the stock consumption request from the preset object stock; performing a write-off stock check on the preset object stock; when the write-off stock check passes, recording the stock value of the preset object stock after deducting the consumption amount in the first stock table.

[0006] In some embodiments, the current value of the first check mark is determined based on a preset minimum consumption X and the current stock value of the preset object recorded in the first stock table; the current value of the second check mark is determined based on the actual consumption of the preset object or based on the estimated consumption and the current stock value of the preset object recorded in the second stock table.

[0007] In some embodiments, the current value of the first check mark and the first inventory table are maintained by a first process; the current value of the second check mark and the second inventory table are maintained by a second process.

[0008] In some embodiments, before obtaining the current value of the first check mark, the current value of the first check mark is determined based on the following steps: determining the first stock value M of the preset object in the first stock table cached locally; when the first stock value M is less than the preset minimum consumption X, setting the current value of the first check mark to the second preset value; when the first stock value M is greater than or equal to the preset minimum consumption X, setting the current value of the first check mark to the first preset value.

[0009] In some embodiments, before obtaining the current value of the second check mark, the current value of the second check mark is determined based on the following steps: obtaining the first actual consumption P of the preset object in the previous cycle of the current cycle, and the second actual consumption Q of the preset object in the previous cycle of the current cycle; when the product of the second actual consumption Q and the first multiple is less than or equal to the first actual consumption P, setting the second check mark to the second preset value; when the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, determining the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X; obtaining the current stock value Z of the preset object stored in the second stock table of the local cache; when the estimated consumption Y is greater than or equal to the current stock value Z, setting the second check mark to the second preset value; when the estimated consumption Y is less than the current stock value Z, setting the second check mark to the first preset value.

[0010] In some embodiments, the estimated consumption Y of the current cycle is determined based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X, including: the value of the estimated consumption Y is a larger value between the preset minimum consumption X and a third consumption; wherein the third consumption is the product of the larger value between the first actual consumption P and the second actual consumption Q and a second multiple.

[0011] In some embodiments, it also includes: determining whether the current cycle is the first cycle and the second cycle of the verification method; if the current cycle is the first cycle and the second cycle of the verification method, setting the second verification mark to the second preset value.

[0012] An embodiment of the present disclosure also provides an inventory verification device for a preset object, including: an acquisition module, used to obtain the current value of a first verification mark and the current value of a second verification mark when a consumable query request for the preset object is received; a processing module, used to not perform inventory verification when the current value of the first verification mark and the current value of the second verification mark are both first preset values, and to feedback the consumable display information of the preset object; when any one of the current values ​​of the first verification mark and the second verification mark is the second preset value, perform inventory verification of the preset object inventory, and feedback the consumable display information of the preset object based on the verification result of the inventory verification.

[0013] An embodiment of the present disclosure further provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for checking the inventory of a preset object are executed.

[0014] An embodiment of the present disclosure further provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method for checking the inventory of a preset object when executing the computer program on the memory.

[0015] The beneficial effect of the embodiment of the present disclosure is that when a consumable query request for a preset object is received, by dynamically obtaining the current values ​​of the first verification mark and the second verification mark, and determining whether verification is required based on different current values, the number of consumable query requests that need to be verified when displaying consumable information is greatly reduced, thereby shortening the response time of the interface, allowing users to receive feedback in a short time and have a better user experience. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0017] Figure 1 A timing diagram of a preferential recommendation method in the prior art;

[0018] Figure 2 This is a flow chart of a method for checking the inventory of a preset object in the first embodiment of the present disclosure;

[0019] Figure 3 A flowchart of a first verification mark determination step in the first embodiment of the present disclosure;

[0020] Figure 4 A flowchart of a second verification mark determination step in the first embodiment of the present disclosure;

[0021] Figure 5 It is a structural schematic diagram of a stock verification device for a preset object in a second embodiment of the present disclosure;

[0022] Figure 6 It is a structural schematic diagram of an electronic device in a fourth embodiment of the present disclosure;

[0023] Figure 7 This is a flowchart of a background asynchronous process in the fourth embodiment of the present disclosure;

[0024] Figure 8 It is a flowchart of the preferential cancellation process in the fourth embodiment of the present disclosure;

[0025] Fig. 9 Schematic diagram of the preferential decision-making process in the fourth embodiment of the present disclosure. DETAILED DESCRIPTION

[0026] Various aspects and features of the present disclosure are described herein with reference to the drawings.

[0027] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present disclosure will occur to those skilled in the art.

[0028] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present disclosure and, together with the general description of the present disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the present disclosure.

[0029] These and other characteristics of the present disclosure will become apparent from the following description of a preferred form of embodiment given as a non-limiting example, with reference to the accompanying drawings.

[0030] It should also be understood that, although the present disclosure has been described with reference to some specific examples, those skilled in the art will be able to realize many other equivalent forms of the present disclosure that have the features of the claims and are therefore within the scope of protection defined thereby.

[0031] The above and other aspects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.

[0032] Specific embodiments of the present disclosure are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments claimed are merely examples of the present disclosure, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid obscuring the present disclosure with unnecessary or redundant details. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present disclosure in a variety of ways with substantially any suitable detailed structure.

[0033] This specification may use the phrases "in one embodiment," "in another embodiment," "in a further embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present disclosure.

[0034] Currently, users send various requests through interfaces to obtain the required data or physical objects. For any type of data or physical object that can be obtained, it usually has a fixed inventory for users to obtain. If the inventory is insufficient, it cannot be obtained. With the development of the Internet and smart devices, there may be a large number of concurrent requests for a certain amount of data or physical objects through the interface at the same time. The server background needs to verify the inventory to determine whether the request can be responded to and executed at present. Usually, the background sets the value of the inventory that needs to be verified into the database so that a large number of read and write operations can be requested concurrently to realize the verification function. However, in high-concurrency scenarios, the number of verifications increases significantly, causing the response time of the request to increase exponentially, seriously affecting the user experience, and even causing user loss.

[0035] The data or physical object that the user wants to obtain mentioned in this embodiment may specifically be the goods that the user wants to purchase or the qualification to participate in an activity that the user wants to obtain; and the goods have inventory. When the quantity that the user wants to purchase exceeds the remaining inventory of the current goods, the user cannot perform the purchase operation, and the same is true for the qualification to participate. Therefore, it is necessary to verify the inventory of the current goods or qualification to participate before responding to the user's request, and only perform the request response operation if the verification passes.

[0036] Figure 1A timing diagram of a discount recommendation method in the prior art is shown. The user selects or requests a certain transaction through the terminal and creates a transaction order. After receiving the transaction order, the background transaction module feeds back the transaction order creation result to the terminal; when the user pays for the transaction order, the terminal can request the background discount management module to query the currently available discount information, and the discount management module will feed back the corresponding discount information to the terminal based on the current discount activities, such as the face value of the coupon currently available to the user and the remaining number of coupons of each face value, etc. The user can choose one of the coupons to use according to the face value and inventory of the coupon, and generate a payment order accordingly; after receiving the payment order created by the terminal, the transaction module requests the discount management module to deduct the consumption of this payment from the current inventory of the coupon selected by the user, and receives the inventory deduction result fed back by the discount management module. If the inventory deduction is successful, the corresponding fund transfer step between the background account is performed, and the transaction result is fed back to the terminal accordingly. It should be noted that Figure 1 Only the timing of successful inventory deduction is shown. In the case of inventory deduction failure (that is, the current inventory of the coupon selected by the user cannot meet the consumption of this request), the result of payment failure can be returned to the user and the corresponding amount paid by the user can be refunded.

[0037] based on Figure 1 The content shown in the figure includes at least two basic processes in a preferential recommendation activity, namely, the preferential decision process and the preferential verification process, wherein the preferential decision process refers to the behavior of the terminal querying the preferential management module for all currently available preferential information, wherein the preferential management module needs to perform several necessary inventory checks to determine whether a preferential activity (e.g., a coupon) is displayed to the user, such as the total budget check of the activity, the total inventory check of the activity, the daily budget check of the activity, the daily inventory check of the activity, etc., and feed back the consumable information of the current preferential activity obtained after the above verification to the terminal, which is displayed to the user by the terminal, for example, when there is a surplus in the inventory, the terminal displays a plurality of available coupons to the user. The preferential verification process is the behavior of the preferential management module deducting the corresponding consumption from the inventory corresponding to the activity after the user selects a preferential activity (e.g., the user selects a displayed coupon). Specifically, in order to avoid insufficient inventory caused by high concurrency, the transaction module will first request to deduct the corresponding preferential quota before the transaction is completed. The preferential management module will pre-deduct the corresponding budget and inventory resources, and perform preferential write-offs when the current remaining inventory is sufficient for this consumption; after the deduction is completed, in order to avoid the inventory being exhausted during the time difference between preferential decision-making and preferential write-offs, it is also necessary to verify the inventory information again to avoid deduction failure or insufficient inventory. Therefore, in the prior art, three verifications are generated for a preferential recommendation activity, namely, preferential decision verification, information verification before preferential write-off deduction of inventory, and information verification after preferential write-off deduction of inventory.

[0038] In actual implementation, considering that the inventory of the same activity is affected by the interface QPS (query rate per second), it may be consumed by a large number of concurrent requests. Therefore, the usual practice is to set the values ​​that need to be verified for the activity to Redis so that concurrent requests can read and write a large number of times. For the current activity A selected by the user, the values ​​that need to be verified are the total inventory, total budget, daily inventory, and daily budget of activity A, that is, 4 Redis keys that need to be verified. When there are B activities at the same time and the QPS is C, the value that the request interface needs to verify per second is K = 4*B*C. If B = 23, C = 20000, then K = 1840000. At this time, the high number of concurrent requests will increase the time consumption of Redis in the preferential decision, which will cause the request interface to be unable to feedback the request results in time, affecting the user experience.

[0039] In order to solve the above problems, the first embodiment of the present disclosure provides a method for checking the inventory of a preset object, which is mainly applied to a background server or background device that receives a request, and its flow chart is as follows: Figure 2 As shown, it mainly includes steps S10 to S30:

[0040] S10, when receiving a consumable query request for a preset object, obtaining a current value of the first verification mark and a current value of the second verification mark.

[0041] The preset object in this embodiment mainly refers to a certain item or activity qualification that the user actually wants to obtain. The consumable query request is a query request for the current consumable information of the preset object received by the background when the user enters the corresponding display page of the preset object. The consumable display information requested can be whether to display the relevant information of the preset object, or the total inventory currently remaining of the preset object, or the inventory remaining on the day, or the current remaining total budget, etc., or based on these inventory information, the information of the preset object that the user can use can be displayed. The user can only decide whether to request the consumption of the preset object after the terminal obtains the queried consumable display and displays it to the user. Therefore, when the consumable query request for the preset object is received in the background, it is necessary to determine whether the verification operation of the preset object inventory is required based on the current values ​​of the first check mark and the second check mark, and display the consumable display information of different contents according to the determination result.

[0042] Specifically, the first check mark and the second check mark are used to indicate whether the background preferential decision logic needs to perform inventory check of the preset object when receiving the consumable query request of the preset object. Among them, the first check mark is maintained by the first process, which can be a preferential write-off process, used to perform inventory deduction and write-off operations of the preset object inventory consumption request, and it also maintains a first inventory table, which is used to record the current inventory of the preset object locally as the actual inventory deduction operation is performed, and the current value of the first check mark is determined according to the preset minimum consumption and the current inventory value of the preset object recorded in the first inventory table. The second check mark is maintained by the second process, which can be a background asynchronous process independent of the preferential decision process and the preferential write-off process. The second process is used to periodically count the actual inventory consumption of the preset object, and it also maintains a second inventory table. The current inventory of the preset object recorded in the second inventory table is adjusted according to the actual inventory consumption counted periodically, and the current value of the second check mark is determined according to the actual consumption of the preset object or based on the estimated consumption and the current inventory value of the preset object recorded in the second inventory table.

[0043] It should be understood that the inventory consumption request is a request by the user to obtain a preset object, and obtaining the preset object will inevitably affect its inventory value. The first process can maintain the first inventory table according to the consumption amount requested by the inventory consumption request. At the same time, the actual inventory of the preset object recorded in the database will also be deducted accordingly due to the execution of the inventory consumption request.

[0044] In some embodiments, before obtaining the current value of the first check mark, based on Figure 3 The steps shown determine the current value of the first check mark:

[0045] S21, determining a first stock value M of a preset object in a first stock table in a locally cached first stock table.

[0046] Among them, the first inventory value M recorded in the first inventory table is deducted in real time as the consumption amount of the inventory consumption request of the current preset object increases; it should be understood that since the preferential redemption occurs after the user decides to obtain the preset object (for example, purchase a certain product, or participate in a certain activity), and the actual deduction of the inventory also occurs after the inventory consumption request of the preset object is responded to, therefore, at the same time, the first inventory value M recorded in the first inventory table is usually the same as the value of the current remaining inventory of the preset object stored in the database. This embodiment realizes real-time monitoring of the inventory status by setting a locally cached first inventory table, which can reduce the number of times the inventory status stored in the database is called through the interface, and facilitates the determination of whether verification is currently required.

[0047] S22, when the first stock value M is less than the preset minimum consumption X, setting the current value of the first check mark to a second preset value.

[0048] S23, when the first stock value M is greater than or equal to the preset minimum consumption X, setting the current value of the first check mark to a first preset value.

[0049] The preset minimum consumption X is the minimum consumption X within a preset period set by the background. It indicates the critical value at which the inventory is at risk of depletion. When the inventory is reduced to X, a verification value of a corresponding activity needs to be changed to full verification. Generally, the value of the preset minimum consumption X for all current activities is the same. In actual implementation, you can also set a unique minimum consumption X for each activity based on the consumption of the activity.

[0050] After obtaining the first inventory value M, M is compared with the value of X. When M is less than X, it means that within the preset period, the remaining inventory is close to the minimum consumption, and there is a risk of inventory depletion within the next period. Therefore, when M is less than X, it is necessary to fully verify the inventory of the preset object when receiving the consumable query request to ensure that the consumable display information presented to the user can correctly feedback the actual inventory of the preset object, and avoid feedback to the user that the preset object still has sufficient inventory when there is a risk of inventory depletion, which affects the user's judgment and request for the preset object demand, and prevents a large number of users from consuming inventory but the actual inventory cannot support it. Therefore, the value of the first verification mark is set to the second preset value to inform the background that it is currently necessary to respond to the consumable query request through verification. When M is greater than or equal to X, it means that within the preset period, the remaining inventory is greater than the minimum consumption, and there is no risk of inventory depletion in the next period. At this time, the inventory check of the preset object is not required, and the consumable query request is directly responded to and the consumable display information of the current preset object is fed back, which reduces the number of consumable query requests that need to be verified. Therefore, the value of the first verification mark is set to the first preset value to inform the background that there is no need for verification at present and the inventory consumption request can be directly responded to.

[0051] In some embodiments, the first check mark may be a check bit stored in a preset position in the background. The first preset value and the second preset value to which the current value of the first check mark may correspond may be represented by strings with different contents, for example: the first preset value is represented by the number 0 and the second preset value is represented by the number 1, or the first preset value is represented by the string false and the second preset value is represented by the string true. Other numbers or characters may also be used to represent it, which is not limited in this embodiment.

[0052] It should be noted that the value of the first verification mark may change after each execution of the inventory consumption request due to the influence of the change of the first inventory value stored in the first inventory table. Therefore, it can monitor the inventory depletion risk existing at the time of the request in real time to ensure the accuracy of the activity verification.

[0053] In some embodiments, before obtaining the current value of the second check mark, based on Figure 4 The steps shown determine the current value of the second check mark:

[0054] S31, obtaining a first actual consumption P of a preset object in a cycle before the current cycle, and a second actual consumption Q of a preset object in a cycle before the current cycle.

[0055] Specifically, the actual consumption is determined in cycles, which records the actual inventory deducted from the preset object within a preset cycle. Taking the preset cycle interval as 5 seconds as an example, when the current cycle has not started and the previous cycle of the current cycle has ended, the background can directly obtain the inventory consumption within the cycle for the ended cycle. Therefore, the background can obtain the first actual consumption P of the preset object in its previous cycle, and the second actual consumption Q of the preset object in the previous cycle of the current cycle.

[0056] S32: When the product of the second actual consumption Q and the first multiple is less than or equal to the first actual consumption P, the second check mark is set to a second preset value.

[0057] The consumption in the subsequent time period can be estimated based on the first actual consumption P and the second actual consumption Q. First, the relationship between the product of the second actual consumption Q and the first multiple and the first actual consumption P is determined, wherein the first multiple can be determined by the background or management personnel based on the inventory situation or the nature of the activity (flash sale activity, stable consumption activity, low consumption activity, etc.). Usually, the first multiple can be set to 2, that is, the relationship between P and 2Q is determined.

[0058] When the product of Q and the first multiple is less than or equal to P, it means that the memory consumption in the preset period corresponding to P exceeds the first multiple of the memory consumption in the previous preset period. Corresponding to the next upcoming period, the inventory consumption level in this period may continue to increase. In order to prevent the problem of insufficient inventory caused by a surge in inventory consumption in a short period of time, starting from the next period, regardless of the remaining inventory, a mandatory check is required, that is, the current value of the second check mark is set to the second preset value.

[0059] S33, when the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, determine the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X.

[0060] When the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, it means that there is no surge in inventory consumption in a short period of time. At this time, by estimating the inventory that may be consumed in the current cycle, it is dynamically determined whether verification is needed. Specifically, the estimated consumption Y of the current cycle is mainly determined based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X. It is necessary to make the estimated consumption Y as large as possible as possible. The actual consumption in the current cycle is to avoid the possible risk of inventory depletion.

[0061] In some embodiments, a third consumption value may be first determined based on the product of the larger value between the first actual consumption P and the second actual consumption Q and the second multiple, and then the larger value between the third consumption value and the preset minimum consumption X may be used as the value of the estimated consumption Y. Specifically, since there may be a period of no consumption or low consumption during the activity execution period, which causes the calculated Y value to be infinitely close to 0, it is impossible to normally detect the possible depletion risk. Therefore, it is necessary to ensure that the Y value is at least greater than or equal to the preset minimum consumption X to ensure that the estimated consumption Y is not lower than the value of X. Further, in order to make the Y value as close as possible to the actual consumption value of the activity in the next preset period, and greater than the actual consumption value of the activity in the next preset period within a certain range, when determining the Y value, it can be assumed that the consumption value in the next period is greater than the actual consumption value in the previous two periods, that is, Y>P, and Y>Q. At the same time, in order to adapt to inventory verification with high consumption in a short time such as flash sales activities, this embodiment sets the actual consumption in the next period to not exceed the second multiple of the larger value of the consumption value in the previous period and the consumption value in the previous period, wherein the second multiple can be the same as the first multiple, both set to 2, that is, the actual consumption in the next period is limited to not more than twice the consumption in the previous period or the previous period, to prevent forced verification due to excessively high Y value, thereby affecting the interface response speed.

[0062] S34, obtaining the current stock value Z of the preset object in the second stock table of the local cache.

[0063] The current inventory value Z refers to the original total inventory of the preset object stored in the second inventory table before the start of the current cycle, and the remaining inventory after the corresponding amount is deducted by continuously executing inventory consumption requests.

[0064] S35: When the estimated consumption Y is greater than or equal to the current inventory value Z, the second verification mark is set to a second preset value.

[0065] S36. When the estimated consumption quantity Y is less than the current stock quantity value Z, set the second verification flag to the first preset value.

[0066] After determining the value of Y and obtaining the value of Z, based on the comparison result between Y and Z, assign values to the second verification flag periodically. Specifically, when Y≥Z, it means that the estimated consumption quantity in the current cycle is greater than or equal to the current stock quantity value, and there may be a risk of inventory depletion within the cycle. Therefore, the current value of the second verification flag needs to be set to the second preset value to inform the background that a response to the consumable query request needs to be made through verification at present. When Y<Z, it indicates that the estimated consumption value in the current cycle is less than the current stock quantity value, and there is no depletion risk within the cycle. At this time, the current value of the second verification flag can be set to the first preset value to inform the background that no verification is required at present and the response to the consumable query request can be made directly.

[0067] In some embodiments, when a certain commodity has just started to be sold or a certain activity has just started to be participated in, for the first two cycles after its start, it is impossible to calculate the estimated consumption quantity Y. Therefore, when it is determined that the current cycle is the first cycle and the second cycle, the second verification flag can be set to the second preset value, that is, force the background to perform verification of stock consumption within the first cycle and the second cycle to ensure the accuracy of subsequent decisions.

[0068] In this embodiment, the second verification flag is also a verification bit stored at a certain preset position in the background, and its storage position is different from that of the first verification flag. The first preset value and the second preset value that the current value of the second verification flag may correspond to are preferably the same as the first preset value and the second preset value of the first verification flag, or in different cases, ensure that the first preset values of the first verification flag and the second verification flag are both used to indicate that the background does not need to perform verification, and their second preset values are both used to indicate that the background needs to perform verification. This embodiment does not make restrictions. Further, the second verification flag is adjusted periodically based on the change of the consumption quantity within the next unit time, while the first verification flag is adjusted in real time according to the first stock quantity value cached locally. Using the first verification flag and the second verification flag jointly can avoid the situation of inventory depletion caused by the actual consumption being greater than the estimated value when the second verification flag cannot be updated within the cycle, and make up for the possible risk of inventory depletion.

[0069] S20. When the current values of both the first verification flag and the second verification flag are the first preset value, do not perform the stock verification of the preset object's inventory, and feedback the consumable display information of the preset object.

[0070] After obtaining the current values ​​of the first check mark and the second check mark, it is determined whether the current values ​​of the first check mark and the second check mark are the first preset value or the second preset value. Different current values ​​of the two correspond to different processing methods of the consumable query request.

[0071] Specifically, when the current value of the first check mark and the current value of the second check mark are both the first preset value, it means that the estimated consumption Y determined based on the dynamic consumption situation does not exceed the current inventory value Z, and at the same time, the remaining inventory counted in the background is also greater than the minimum consumption in the cycle, that is, there is no risk of inventory depletion, and the preset object inventory can be verified without verification, and the consumable display information of the preset object can be directly fed back. Specifically, since the inventory is sufficient or there is no risk of inventory depletion at this time, the relevant information of the preset object can be displayed (for example, information about the availability of a certain coupon can be displayed on the page), or the total inventory of the preset object that has not been consumed, or the remaining inventory of the preset object when the last inventory verification passed, etc. can be displayed as consumable display information, as long as it can be guaranteed that the user knows that the current discount is available when the consumable display information is obtained. Through the above judgment, the number of requests that need to be verified can be reduced under limited database interface resources, the response speed of the interface is improved, and the user experience is guaranteed.

[0072] S30, when any one of the current values ​​of the first check mark and the current value of the second check mark is the second preset value, the inventory of the preset object is checked, and the consumable display information of the preset object is fed back according to the check result of the inventory check.

[0073] In the case where any one of the current values ​​of the first check mark and the current value of the second check mark is the second preset value, it means that the estimated consumption Y determined based on the dynamic consumption situation is greater than the current remaining stock Z, or the consumption of the previous cycle is a certain multiple of the consumption of the previous cycle, or the remaining stock of the local cache is less than the minimum consumption in the cycle. At this time, in order to avoid the risk of inventory exhaustion, it is necessary to perform a separate check for each consumable query request to obtain the actual inventory situation of the current preset object, and feedback the consumable display information of the preset object based on the actual inventory situation. For example, when receiving a consumable query request and obtaining the actual inventory of the preset object accordingly, if the actual inventory of the current preset object has been exhausted, the relevant information of the preset object may not be displayed directly on the page, and the user cannot request the inventory consumption of the preset object at this time. If the current preset object still has a trace amount of inventory, the current remaining inventory value may be fed back to the user as consumable display information to inform the user that the inventory is tight and to select or remind the user to select other preset objects as soon as possible.

[0074] When receiving a consumable query request for a preset object, this embodiment dynamically obtains the current values ​​of the first verification mark and the second verification mark, and determines whether verification is required based on different current values. This greatly reduces the number of consumable query requests that need to be verified when displaying consumable information, thereby shortening the response time of the interface, allowing users to receive feedback in a short time and have a better user experience.

[0075] In some embodiments, the method provided in this embodiment may further include the following steps when the background receives a request to consume the inventory of the preset object, if the preset object still has inventory that can be consumed:

[0076] S40, upon receiving a stock consumption request for a preset object, performing a pre-deduction stock check on the preset object inventory, and when the pre-deduction stock check passes, executing the stock consumption request and deducting the consumption amount requested in the stock consumption request from the preset object inventory;

[0077] S50, performing a write-off stock check on the preset object inventory. When the write-off stock check passes, the stock value of the preset object inventory after deducting the consumption amount is recorded in the first stock table.

[0078] An inventory consumption request is a request by a user to obtain a preset object. When the user learns from the consumable display information that the preset object currently has a certain amount of inventory or sufficient inventory, the user can send a consumption request for the preset object to the background, such as when using a certain coupon for payment; when the first process in the background receives the inventory consumption request, it first performs a pre-deduction inventory check on the preset object inventory, that is, determines whether the current inventory of the preset object is sufficient for the consumption amount requested by this inventory consumption request; when the pre-deduction inventory check passes, that is, it is determined that the current inventory of the preset object is sufficient for the deduction of the consumption amount requested by this inventory consumption request, the inventory consumption request is executed and the consumption amount requested in the inventory consumption request is deducted from the preset object inventory.

[0079] After the inventory consumption request is executed and the corresponding amount is deducted, the inventory verification of the preset object inventory is carried out to avoid the depletion of inventory during the time difference between the preferential decision and the preferential verification, resulting in deduction failure or insufficient inventory. When the inventory verification is passed, the inventory value of the preset object inventory after deducting the consumption amount is recorded in the first inventory table to ensure the accuracy when assigning the first verification mark.

[0080] The second embodiment of the present disclosure provides a stock verification device for a preset object, which is mainly installed in a background server or background device that receives a request, and its structural diagram is shown as follows: Figure 5As shown, it mainly includes: an acquisition module 10 and a processing module 20, wherein the acquisition module 10 is used to obtain the current value of the first check mark and the current value of the second check mark when receiving a consumable query request for the preset object; the processing module 20 is used to, when the current value of the first check mark and the current value of the second check mark are both the first preset value, not perform inventory verification of the preset object inventory, and feedback the consumable display information of the preset object; when any one of the current value of the first check mark and the current value of the second check mark is the second preset value, perform inventory verification of the preset object inventory, and feedback the consumable display information of the preset object according to the verification result of the inventory verification.

[0081] Furthermore, the processing module 20 is also used to perform a pre-deduction inventory check on the preset object inventory when receiving a stock consumption request for a preset object; when the pre-deduction inventory check passes, execute the inventory consumption request and deduct the consumption amount requested in the inventory consumption request from the preset object inventory; perform a write-off inventory check on the preset object inventory; when the write-off inventory check passes, record the inventory value of the preset object inventory after deducting the consumption amount in the first inventory table.

[0082] Furthermore, the inventory verification device also includes a first determination module ( Figure 5 (not shown), mainly used to determine the current value of the first check mark based on the preset minimum consumption X and the current stock value of the preset object recorded in the first stock table. Specifically, the first determination module determines the current value of the first check mark based on the following steps: determine the first stock value M of the preset object in the first stock table cached locally; when the first stock value M is less than the preset minimum consumption X, set the current value of the first check mark to the second preset value; when the first stock value M is greater than or equal to the preset minimum consumption X, set the current value of the first check mark to the first preset value. In some embodiments, the current value of the first check mark and the first stock table are maintained by the first process, and the first stock value M is adjusted in real time based on the consumption amount of the executed stock consumption request.

[0083] Furthermore, the verification device further includes a second determination module ( Figure 5), which is mainly used to determine the current value of the second check mark based on the actual consumption of the preset object or based on the estimated consumption and the current stock value of the preset object recorded in the second stock table. Specifically, the second determination module determines the current value of the second check mark based on the following steps: obtaining the first actual consumption P of the preset object in the previous cycle of the current cycle, and the second actual consumption Q of the preset object in the previous cycle of the current cycle; when the product of the second actual consumption Q and the first multiple is less than or equal to the first actual consumption P, the second check mark is set to the second preset value; when the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, the estimated consumption Y of the current cycle is determined based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X; obtaining the current stock value Z of the preset object stored in the second stock table of the local cache; when the estimated consumption Y is greater than or equal to the current stock value Z, the second check mark is set to the second preset value; when the estimated consumption Y is less than the current stock value Z, the second check mark is set to the first preset value. In some embodiments, the current value of the second check flag and the second inventory table are maintained by a second process.

[0084] In some embodiments, the second determination module determines the estimated consumption Y specifically in the following manner: the value of the estimated consumption Y is a larger value between the preset minimum consumption X and the third consumption; wherein the third consumption is the product of the larger value between the first actual consumption P and the second actual consumption Q and the second multiple.

[0085] In some embodiments, the second determination module is further used to determine whether the current cycle is the first cycle and the second cycle of the verification execution; if the current cycle is the first cycle and the second cycle of the verification method execution, the second verification mark is set to a second preset value.

[0086] When receiving a consumable query request for a preset object, this embodiment dynamically obtains the current values ​​of the first verification mark and the second verification mark, and determines whether verification is required based on different current values. This greatly reduces the number of consumable query requests that need to be verified when displaying consumable information, thereby shortening the response time of the interface, allowing users to receive feedback in a short time and have a better user experience.

[0087] The third embodiment of the present disclosure provides a storage medium, which can be installed in a background server or a background device, and is specifically a computer-readable medium, storing a computer program, and when the computer program is executed by a processor, the method provided by any embodiment of the present disclosure is implemented, including the following steps S301 to S303:

[0088] S301, upon receiving a consumable query request for a preset object, obtaining a current value of a first check mark and a current value of a second check mark;

[0089] S302: When the current value of the first check mark and the current value of the second check mark are both the first preset value, the inventory check of the preset object is not performed, and the consumable display information of the preset object is fed back;

[0090] S303, when any one of the current values ​​of the first check mark and the current value of the second check mark is the second preset value, perform inventory verification of the preset object inventory, and feedback the consumable display information of the preset object based on the verification result of the inventory verification.

[0091] The computer program is also executed by the processor to perform the following steps: when receiving a stock consumption request for a preset object, performing a pre-deduction stock check on the preset object stock; when the pre-deduction stock check passes, executing the stock consumption request and deducting the consumption amount requested in the stock consumption request from the preset object stock; performing a write-off stock check on the preset object stock; when the write-off stock check passes, recording the stock value of the preset object stock after deducting the consumption amount in the first stock table.

[0092] Specifically, the current value of the first check mark is determined based on the preset minimum consumption X and the current stock value of the preset object recorded in the first stock table; the current value of the second check mark is determined based on the actual consumption of the preset object or based on the estimated consumption and the current stock value of the preset object recorded in the second stock table. The current value of the first check mark and the first stock table are maintained by the first process; the current value of the second check mark and the second stock table are maintained by the second process.

[0093] Before the computer program is executed by the processor to obtain the current value of the first check mark, the processor also executes the following steps: determining the first stock value M of the preset object in the first stock table cached locally; when the first stock value M is less than the preset minimum consumption X, setting the current value of the first check mark to the second preset value; when the first stock value M is greater than or equal to the preset minimum consumption X, setting the current value of the first check mark to the first preset value. Specifically, the first stock value M is adjusted in real time based on the consumption amount of the executed stock consumption request.

[0094] Before the computer program is executed by the processor to obtain the current value of the second check mark, the processor also executes the following steps: obtaining the first actual consumption P of the preset object in the previous cycle of the current cycle, and the second actual consumption Q of the preset object in the previous cycle of the current cycle; when the product of the second actual consumption Q and the first multiple is less than or equal to the first actual consumption P, setting the second check mark to the second preset value; when the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, determining the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X; obtaining the current stock value Z of the preset object stored in the second stock table of the local cache; when the estimated consumption Y is greater than or equal to the current stock value Z, setting the second check mark to the second preset value; when the estimated consumption Y is less than the current stock value Z, setting the second check mark to the first preset value.

[0095] When the computer program is executed by the processor to determine the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X, the processor specifically executes the following steps: the value of the estimated consumption Y is the larger value between the preset minimum consumption X and the third consumption; wherein the third consumption is the product of the larger value between the first actual consumption P and the second actual consumption Q and the second multiple.

[0096] The computer program is also executed by the processor to perform the following steps: determine whether the current cycle is the first cycle and the second cycle of the verification method; if the current cycle is the first cycle and the second cycle of the verification method, set the second verification mark to a second preset value.

[0097] When receiving a consumable query request for a preset object, this embodiment dynamically obtains the current values ​​of the first verification mark and the second verification mark, and determines whether verification is required based on different current values. This greatly reduces the number of consumable query requests that need to be verified when displaying consumable information, thereby shortening the response time of the interface, allowing users to receive feedback in a short time and have a better user experience.

[0098] A fourth embodiment of the present disclosure provides an electronic device, which can be used as a background server or background device, and its structural diagram is shown in FIG. Figure 6 As shown, at least a memory 100 and a processor 200 are included. The memory 100 stores a computer program. The processor 200 implements the method provided by any embodiment of the present disclosure when executing the computer program on the memory 100. Exemplarily, the steps of the electronic device computer program are as follows S401 to S403:

[0099] S401, upon receiving a consumable query request for a preset object, obtaining a current value of a first check mark and a current value of a second check mark;

[0100] S402: When the current value of the first check mark and the current value of the second check mark are both the first preset value, the inventory check of the preset object is not performed, and the consumable display information of the preset object is fed back;

[0101] S403, when any one of the current values ​​of the first check mark and the current value of the second check mark is the second preset value, perform inventory verification of the preset object inventory, and feed back the consumable display information of the preset object according to the verification result of the inventory verification.

[0102] The processor also executes the following computer program stored in the memory: when receiving a stock consumption request for a preset object, performing a pre-deduction stock check on the preset object stock; when the pre-deduction stock check passes, executing the stock consumption request and deducting the consumption amount requested in the stock consumption request from the preset object stock; performing a write-off stock check on the preset object stock; when the write-off stock check passes, recording the stock value of the preset object stock after deducting the consumption amount in the first stock table.

[0103] Specifically, the current value of the first check mark is determined based on the preset minimum consumption X and the current stock value of the preset object recorded in the first stock table; the current value of the second check mark is determined based on the actual consumption of the preset object or based on the estimated consumption and the current stock value of the preset object recorded in the second stock table. The current value of the first check mark and the first stock table are maintained by the first process; the current value of the second check mark and the second stock table are maintained by the second process.

[0104] Before executing the acquisition of the current value of the first check mark stored in the memory, the processor further executes the following computer program: determining the first stock value M of the preset object in the first stock table cached locally; when the first stock value M is less than the preset minimum consumption X, setting the current value of the first check mark to the second preset value; when the first stock value M is greater than or equal to the preset minimum consumption X, setting the current value of the first check mark to the first preset value. Specifically, the first stock value M is adjusted in real time based on the consumption amount of the executed stock consumption request.

[0105] Before executing the current value of the second check mark stored in the memory, the processor also executes the following computer program: obtaining the first actual consumption P of the preset object in the previous cycle of the current cycle, and the second actual consumption Q of the preset object in the previous cycle of the current cycle; when the product of the second actual consumption Q and the first multiple is less than or equal to the first actual consumption P, setting the second check mark to the second preset value; when the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, determining the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X; obtaining the current stock value Z of the preset object stored in the second stock table of the local cache; when the estimated consumption Y is greater than or equal to the current stock value Z, setting the second check mark to the second preset value; when the estimated consumption Y is less than the current stock value Z, setting the second check mark to the first preset value.

[0106] When the processor determines the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X stored in the execution memory, it specifically executes the following computer program: the value of the estimated consumption Y is the larger value between the preset minimum consumption X and the third consumption; wherein the third consumption is the product of the larger value between the first actual consumption P and the second actual consumption Q and the second multiple.

[0107] The processor also executes the following computer program stored in the memory: determining whether the current cycle is the first cycle and the second cycle of the verification method; if the current cycle is the first cycle and the second cycle of the verification method, setting the second verification mark to a second preset value.

[0108] When receiving a consumable query request for a preset object, this embodiment dynamically obtains the current values ​​of the first verification mark and the second verification mark, and determines whether verification is required based on different current values. This greatly reduces the number of consumable query requests that need to be verified when displaying consumable information, thereby shortening the response time of the interface, allowing users to receive feedback in a short time and have a better user experience.

[0109] Combine the following Figures 7 to 9 The specific examples shown illustrate the present disclosure in detail.

[0110] Assume that activity A is an optional full-discount activity when making a payment. Before activity A starts, the total budget, daily budget, total inventory and daily inventory of activity A are set. Taking the total inventory verification of activity A as an example, the processing process of the user's request to participate in activity A is divided into three parts, namely the background asynchronous process (i.e., the second process), the preferential decision process and the preferential verification process (i.e., the first process). Among them, the preferential verification process maintains a system cache, which records the inventory value of the total inventory of activity A (the first inventory value in the first inventory table) and the verification mark (first verification mark G1) of whether verification is currently being performed. The background asynchronous process maintains another system cache, which periodically records the inventory value of the total inventory of activity A (the current inventory value in the second inventory table) and the verification mark (second verification mark G2) of whether verification is currently being performed.

[0111] First, configure the minimum consumption of activity A in a 5-second period, X, which represents the critical value of the risk of inventory depletion. When the inventory is reduced to X, the request for activity A needs to be fully verified. At the same time, set the first multiple and the second multiple to 2.

[0112] Specifically, Figure 7 As shown, the background asynchronous process mainly maintains five variables: the minimum consumption X of the total inventory of activity A, the estimated consumption Y of the total inventory of activity A, the total inventory consumption Q of activity A within the last 5 seconds, and the total inventory consumption P of activity A within the last 5 seconds. In the process of maintaining variables, this embodiment divides it into two parts, the first is the initialization part when the server is started, and the second is the refresh part after the server runs smoothly.

[0113] In the initialization part, the process will first read the minimum consumption X of the total inventory of activity A in the configuration platform, and then run the process for 10 seconds. During these 10 seconds, there is no estimated consumption Y. The background asynchronous process sets the value of the second verification mark to the second preset value, that is, forcibly verifying the inventory status of activity A.

[0114] In the refresh part, the background asynchronous process reads the minimum consumption X every 5 seconds, queries the current inventory value Z recorded in the second inventory table, and records the total inventory consumption P of activity A in the previous 5 seconds and the total inventory consumption Q of activity A in the previous 5 seconds. If P≥2×Q, the total inventory of A needs to be verified during the preferential decision-making process; if P<2×Q, the estimated consumption Y is calculated by the following formula Y=Max(X,2×Max(Q,P)); if the current inventory value Z is less than or equal to the estimated consumption Y, it means that there is a risk of inventory depletion in the next refresh time period (5s), and the total inventory of A needs to be verified during the preferential decision-making process, otherwise the total inventory of A does not need to be verified.

[0115] The main working principle of the background asynchronous process is to predict the consumption change in the next unit time. Through analysis, it can be seen that such an estimate will inevitably deviate from the actual situation. In actual use, an estimated consumption value greater than the actual situation can be tolerated, while an estimated value less than the actual situation will cause certain risks. Therefore, the first check mark maintained by the preferential verification process is jointly managed with the second check mark.

[0116] like Figure 8 As shown, the preferential write-off process mainly involves two variables, the first variable is the minimum consumption X, and the second is the first inventory value M in the first inventory table independently maintained by the preferential write-off process; when the first inventory value M is less than the minimum consumption X, it means that within the unit time (5s), the remaining inventory is close to the minimum consumption and there is a risk of depletion. Therefore, the preferential write-off link determines that the total inventory of A needs to be verified at this time, and the value of the first verification value is set to the second preset value accordingly, otherwise the value of the first verification value can be set to the first preset value.

[0117] like Fig. 9 As shown, when the preferential decision process receives the consumable query request sent by the requester, it obtains the current value of the first verification mark G1 and the second verification mark G2. When the current value of at least one of the two verification marks is the second preset value, it indicates that the inventory verification and budget verification of activity A are required. If the verification passes, it indicates to the user that activity A is available. Otherwise, the consumable display information can be directly fed back without the need for verification operation.

[0118] Furthermore, when the solution provided by the embodiment of the present disclosure is not used for optimization, assuming that each activity originally has 4 check values ​​that need to be verified, and there are B activities at the same time, and the QPS of the interface is C, the number of checks that the preferential decision process needs to make per second is K=4*B*C; based on the traffic calculation of a large festival, assuming that there are 23 activities online, and the interface has a request volume of 20,000QPS, the number of checks that need to be made per second is K=4*23*20000=1840000.

[0119] After optimization using the solution provided by the embodiment of the present disclosure, the corresponding check value will only be checked when there is a risk of exhaustion, that is, in more than 90% of the scenarios, the corresponding total budget, total inventory, daily budget, and daily inventory do not need to be checked. When there are D servers, B activities, and QPS is C, the number of checks required by the background every 5 seconds is K = 4*B*D. When there are 40 servers, the number required to be checked within 5 seconds is K = 4*23*40 = 3680, corresponding to only 736 check values ​​that need to be checked within 1 second. On the basis of ensuring the security of funds and the availability of services, the amount of information that needs to be checked for online services is greatly reduced, the interface time consumption is greatly reduced, and the service can be accessed by scenarios with higher traffic.

[0120] Multiple embodiments of the present disclosure are described in detail above, but the present disclosure is not limited to these specific embodiments. Those skilled in the art can make various variations and modifications to the embodiments based on the concepts of the present disclosure, and these variations and modifications should all fall within the scope of protection required by the present disclosure.

Claims

1. A method for checking the inventory of a preset object, characterized in that: include: Upon receiving a consumable query request for a preset object, obtaining a current value of the first check mark and a current value of the second check mark; When the current value of the first verification mark and the current value of the second verification mark are both the first preset value, the inventory verification of the preset object is not performed, and the consumable display information of the preset object is fed back; When any one of the current value of the first verification mark and the current value of the second verification mark is a second preset value, performing inventory verification of the preset object inventory, and feeding back the consumable display information of the preset object according to the verification result of the inventory verification; Before obtaining the current value of the first check mark, the current value of the first check mark is determined based on the following steps: determining the first stock value M of the preset object in the first stock table cached locally; when the first stock value M is less than the preset minimum consumption X, setting the current value of the first check mark to the second preset value; when the first stock value M is greater than or equal to the preset minimum consumption X, setting the current value of the first check mark to the first preset value; Before obtaining the current value of the second verification mark, the current value of the second verification mark is determined based on the following steps: obtaining a first actual consumption P of the preset object in a cycle before the current cycle, and a second actual consumption Q of the preset object in a cycle before the current cycle; When the product of the second actual consumption Q and the first multiple is less than or equal to the first actual consumption P, the second check mark is set to the second preset value; When the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, determining the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X; Obtain the current stock value Z of the preset object stored in the second stock table of the local cache; when the estimated consumption Y is greater than or equal to the current stock value Z, set the second check mark to the second preset value; when the estimated consumption Y is less than the current stock value Z, set the second check mark to the first preset value.

2. The inventory verification method according to claim 1, characterized in that: The method further comprises: Upon receiving a stock consumption request for a preset object, performing a pre-deduction stock check on the preset object inventory, and when the pre-deduction stock check passes, executing the stock consumption request and deducting the consumption amount requested in the stock consumption request from the preset object inventory; A write-off stock check is performed on the preset object inventory. When the write-off stock check passes, the stock value of the preset object inventory after deducting the consumption amount is recorded in the first stock table.

3. The inventory verification method according to claim 2, characterized in that: The current value of the first verification mark is determined based on a preset minimum consumption X and a current stock value of a preset object recorded in the first stock table; The current value of the second check mark is determined based on the actual consumption of the preset object or based on the estimated consumption and the current stock value of the preset object recorded in the second stock table.

4. The inventory verification method according to claim 3, characterized in that: The current value of the first check mark and the first inventory table are maintained by a first process; The current value of the second check mark and the second inventory table are maintained by a second process.

5. The inventory verification method according to claim 1, characterized in that: The determining the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X includes: The value of the estimated consumption Y is a larger value between the preset minimum consumption X and a third consumption; wherein the third consumption is a product of a larger value between the first actual consumption P and the second actual consumption Q and a second multiple.

6. The inventory verification method according to claim 1 or 5, characterized in that: Also includes: Determine whether the current cycle is the first cycle and the second cycle of the verification method; In a case where the current cycle is the first cycle and the second cycle of the verification method, the second verification mark is set to the second preset value.

7. A device for checking the inventory of a preset object, characterized in that: include: An acquisition module, configured to acquire a current value of the first verification mark and a current value of the second verification mark when receiving a consumable query request of a preset object; a processing module, configured to, when the current value of the first verification mark and the current value of the second verification mark are both first preset values, not perform inventory verification and feedback consumable display information of the preset object; When any one of the current value of the first verification mark and the current value of the second verification mark is a second preset value, performing inventory verification of the preset object inventory, and feeding back the consumable display information of the preset object according to the verification result of the inventory verification; Before acquiring the current value of the first verification mark, the acquisition module determines the current value of the first verification mark based on the following steps: Determine a first stock value M of the preset object in a first stock table cached locally; When the first stock value M is less than the preset minimum consumption X, the current value of the first check mark is set to the second preset value; When the first stock value M is greater than or equal to the preset minimum consumption X, setting the current value of the first check mark to the first preset value; Before acquiring the current value of the second verification mark, the acquisition module determines the current value of the second verification mark based on the following steps: Acquire a first actual consumption P of the preset object in a cycle before the current cycle, and a second actual consumption Q of the preset object in a cycle before the current cycle; When the product of the second actual consumption Q and the first multiple is less than or equal to the first actual consumption P, the second check mark is set to the second preset value; When the product of the second actual consumption Q and the first multiple is greater than the first actual consumption P, determining the estimated consumption Y of the current cycle based on the first actual consumption P, the second actual consumption Q and the preset minimum consumption X; Obtaining a current stock value Z of the preset object stored in a second stock table of the local cache; When the estimated consumption Y is greater than or equal to the current stock value Z, the second check mark is set to the second preset value; When the estimated consumption Y is less than the current stock value Z, the second check mark is set to the first preset value.

8. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the inventory verification method for a preset object described in any one of claims 1 to 6 are implemented.

9. An electronic device, comprising at least a memory and a processor, wherein a computer program is stored in the memory, wherein: The processor implements the steps of the inventory verification method for a preset object described in any one of claims 1 to 6 when executing the computer program on the memory.

Citation Information

Patent Citations

  • Verification method and system of merchandise inventory

    CN106056329A

  • Inventory deduction method and device

    CN110599277A