A charging method, a charging device, an electronic device, and a computer storage medium

By initializing service quota values ​​in the billing module and utilizing the data processing mechanism of caching and storage units, the stability and accuracy issues of the billing module under high concurrency are resolved, enabling reliable billing for high-concurrency services and avoiding economic losses.

CN114022137BActive Publication Date: 2025-10-28AISINO CORPORATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111301965.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-04
Publication Date
2025-10-28
Estimated Expiration
2041-11-04

AI Technical Summary

Technical Problem

Under high concurrency conditions, existing technologies cannot guarantee the stability and accuracy of billing functions, which may lead to economic losses due to excessive deduction of users' subscription amounts.

Method used

By initializing service quota values ​​to cache and storage units, using message queues to sort and serially process service call instructions, and transferring cache unit data to storage units at fixed intervals, service calls are restricted to ensure that the service quota value does not fall below the limit.

Benefits of technology

It ensures the reliability and accuracy of billing functions under high-concurrency service, avoids economic losses caused by high concurrency, and ensures the stability and accuracy of cost statistics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114022137B_ABST
    Figure CN114022137B_ABST
Patent Text Reader

Abstract

This invention provides a billing method, billing device, electronic device, and computer storage medium. The billing method includes: determining a service quota value and initializing the service quota value to a cache unit and a storage unit; obtaining service call instructions through a data interface, sorting the service call instructions in a message queue, and processing them serially; calculating service usage and decreasing the service quota value at fixed intervals, transferring data from the cache unit to the storage unit at fixed intervals; and stopping service calls when the service quota value decreases to a limit. This achieves reliable stability, resilience, and accurate cost statistics for billing functions even with high concurrency services, and avoids economic losses caused by excessive deduction of user subscription quotas due to high concurrency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic information technology, and in particular to a billing method, a billing device, an electronic device, and a computer storage medium. Background Technology

[0002] Currently, some or all services offered by AI open platforms are chargeable, thus creating a billing module to handle this task. Simply put, the billing module is responsible for real-time cost tracking of users' subscriptions to various services. However, for popular AI services, the instantaneous call volume can be extremely high, placing a significant burden on the billing functions for these services, making it difficult to guarantee data accuracy. Summary of the Invention

[0003] In view of this, embodiments of this application provide a billing method, a billing device, an electronic device, and a computer storage medium to at least partially solve the above-mentioned problems.

[0004] In a first aspect, embodiments of this application provide a billing method, including:

[0005] Determine the service quota value and initialize the service quota value to the cache unit and storage unit;

[0006] The service call instructions are obtained through the data interface, sorted in the message queue, and processed serially.

[0007] The service quota is decremented at fixed intervals based on the service usage, and the data in the cache unit is transferred to the storage unit at fixed intervals.

[0008] Service calls will stop when the service quota value decreases to the limit.

[0009] Optionally, in one implementation, the billing method further includes:

[0010] Upon receiving a service call request, the system will determine whether to provide the service call if the service quota value in the cache unit meets the limit requirement; otherwise, it will refuse to provide the service call.

[0011] Optionally, in one implementation, before making a judgment upon receiving a service invocation instruction request, the method further includes:

[0012] A verification code mechanism for user service call requests has been added. When a user service request meets the verification code requirements, the platform will make a judgment on the received server call request.

[0013] Optionally, in one implementation, transferring data from the cache unit to the storage unit at fixed intervals further includes:

[0014] The data in the storage unit is locked using an update mechanism.

[0015] Alternatively, in one implementation, the billing method further includes:

[0016] When the service quota value decreases to the limit, the service quota value is marked. The marking is used to reject the call request of the marked service.

[0017] Secondly, embodiments of this application provide a billing device, including:

[0018] Information acquisition module; The information acquisition module is used to determine the service quota value and initialize the service quota value to the cache unit and storage unit;

[0019] Information processing module; The information processing module is used to obtain service call instructions through the data interface, sort the service call instructions in the message queue and process them in a serial manner; It calculates the service usage and decrements the service quota value at fixed intervals, and transfers the data in the cache unit to the storage unit at fixed intervals; When the service quota value is reduced to the limit, the service call is stopped.

[0020] Optionally, in one implementation, the information processing module is further configured to obtain a service call instruction request and make a judgment. If the service quota value in the cache unit meets the limit requirement, the service call is provided; otherwise, the service call is refused.

[0021] Thirdly, embodiments of this application provide an electronic device, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus;

[0022] The memory is used to store at least one executable instruction that causes the processor to perform an operation corresponding to the billing method as described in the first aspect or any implementation thereof.

[0023] Fourthly, embodiments of this application provide a computer storage medium storing a computer program that, when executed by a processor, implements the billing method as described in the first aspect or any implementation thereof.

[0024] Fifthly, embodiments of this application provide a computer program product, including computer instructions that instruct a computing device to execute a billing method as described in the first aspect or any implementation thereof.

[0025] This invention determines a service quota value and initializes it in the cache and storage units. It obtains service call instructions through a data interface, sorts these instructions in a message queue, and processes them serially. The service quota value is decremented at fixed intervals based on service usage, and data from the cache unit is transferred to the storage unit at these fixed intervals. When the service quota value reaches its limit, service calls are stopped. This ensures that the billing function maintains reliable stability, resilience, and accurate cost statistics even with high concurrency, and avoids economic losses caused by excessive deductions from user subscription quotas due to high concurrency. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0027] Figure 1 This is a flowchart illustrating the steps of a billing method according to an embodiment of this application;

[0028] Figure 2 This is a structural diagram of the billing device;

[0029] Figure 3 This is a schematic diagram of an electronic device structure according to an embodiment of this application; Detailed Implementation

[0030] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of this application.

[0031] The specific implementation of the embodiments of this application will be further described below with reference to the accompanying drawings.

[0032] Example 1

[0033] This application provides a billing method in embodiment one, referring to... Figure 1 As shown, this method can be run on a backend server and specifically includes the following steps:

[0034] Step 101: Determine the service quota value and initialize the service quota value to the cache unit and storage unit;

[0035] It should be noted that determining the service quota value here refers to identifying and associating information such as the user, the various services subscribed to by the user, the duration and data usage purchased for each service, etc. Initialization to the cache and storage units here refers to initializing the user quota value data into the database of the cache and storage units. Preferably, this can be done simultaneously through memory marking. Memory marking here refers to marking data with user service quota values ​​in memory units as having a quota.

[0036] It's important to note that the storage unit here refers to a collection of multiple storage cells. The smallest unit of information in a computer is a bit, or one binary digit. Eight bits make up a byte. One storage unit can store one byte, or eight binary digits. Computer memory capacity is calculated in bytes. A memory with 128 storage units has a capacity of 128 bytes. A 1KB memory has 1024 storage units, numbered from 0 to 1023. Memory is divided into several storage units, each numbered sequentially starting from 0. For example, a memory with 128 storage units would be numbered from 0 to 127. Memory addresses are generally represented in hexadecimal, and each memory address stores a set of binary (or hexadecimal) numbers, usually called the content at that address. It's crucial to understand that the address of a storage unit and the content at that address are different. The former is the storage unit number, representing a location in memory, while the latter represents the data stored at that location. Just as one is a room number and the other is the person living in the room, a storage unit that stores a machine word is usually called a word storage unit, and the corresponding unit address is called a word address. A storage unit that stores a byte is called a byte storage unit, and the corresponding address is called a byte address. If the smallest addressable unit in a computer is a word storage unit, then the computer is called a word-addressable computer. If the smallest addressable unit in a computer is a byte, then the computer is called a byte-addressable computer. If the machine word length is equal to the number of bits in the memory unit, a machine word can contain several bytes, so a storage unit can also contain several individually addressable byte addresses. For example, a 16-bit binary word storage unit can store two bytes and can be addressed using either word or byte addresses. When addressed using byte addresses, the 16-bit storage unit occupies two byte addresses.

[0037] It should be noted that the cache unit here can be a data storage unit of the same type as the storage unit, or it can be a cache different from the storage unit. The purpose is to save the data to the hard drive when the data saved in the memory pool reaches a certain level. This reduces actual disk operations, effectively protects the disk from damage caused by repeated read and write operations, and also reduces the time required for writing.

[0038] Step 102: Obtain service call instructions through the data interface, sort the service call instructions in the message queue, and process them serially.

[0039] It should be noted that obtaining service call instructions through the data interface here includes interacting with the server or other external information devices through the data interface to obtain the user's call instructions for this system, enqueuing the call instructions through the message queue processing tool according to the call instructions, serially processing the call instructions, and waiting for subsequent queue data operations. The data interface here is, for example, the interface that outputs data to the data connection line when transmitting data, which can be an API interface.

[0040] Optionally, in one embodiment, the method further includes, after step S102: determining the service call instruction request; if the service quota value in the cache unit meets the limit requirement, then providing the service call; otherwise, refusing to provide the service call. This step can be flexibly configured with timing according to the requirements of the application scenario.

[0041] It should be noted that the judgment here regarding obtaining service call command requests includes, for example, finding the corresponding user quota value based on the service call command after obtaining it, and judging the user quota value. The service call is only provided if the current user quota value is greater than zero. The service call command here can be an external command to use services within the platform. Therefore, this avoids the problem of platform losses caused by a user issuing multiple requests simultaneously, exceeding the user's quota for subscribed time or traffic.

[0042] Optionally, in one embodiment, before making a judgment on the service call instruction request, the method further includes: adding a user service call request verification code mechanism, and when the user service request meets the verification code verification, the platform makes a judgment on the received server call request.

[0043] It should be noted that the verification code mechanism here is preferably added before the service caller makes the request. This is to prevent users from sending multiple requests simultaneously. The verification code can be a pre-set verification program within the system, compiled based on a verification formula derived from the verification method. When a code with the verification code is entered into the system, the system uses the verification program to calculate the verification result, and then compares the result with the verification code of the entered code to check its correctness. If they match, the code is considered correct, and the system allows entry; if they do not match, the code is incorrect, the system refuses entry, and the user is required to re-enter the code.

[0044] Step 103: Decrease the service quota value according to a fixed interval by calculating the service usage, and transfer the data in the cache unit to the storage unit at fixed intervals.

[0045] It should be noted that after receiving the service call instruction, the service quota value in the cache unit is decremented based on data such as duration and traffic. If the service quota value falls below the limit during the decrement process, the user is directly returned with the specific result of insufficient duration or traffic. Preferably, the memory is marked as having no remaining quota. After the decrement process, the data in the cache unit and the storage unit are synchronized at preset intervals, and the data in the cache unit is synchronized to the storage unit. The fixed interval here can be manually set based on experience or obtained by machine learning. The purpose is to avoid the problem of excessive platform processing pressure caused by directly calling the storage server under high concurrency.

[0046] Optionally, in one embodiment, transferring data from the cache unit to the storage unit at fixed intervals further includes locking the data in the storage unit using an update mechanism to achieve the effect of serially executing updates.

[0047] It should be noted that the update mechanism locking here can be one way to lock the data in the storage unit, or it can be achieved through other data locking methods. This is used to achieve the effect of serially executing updates.

[0048] Step 104: Stop service calls when the service quota value decreases to the limit.

[0049] It should be noted that the limit here can be a service quota value set manually. When the service quota value is lower than the limit value, the service calls to the corresponding user will be stopped.

[0050] Optionally, in one embodiment, the method further includes: marking the service quota value when it decreases to a limit, the marking being used to reject the call request for the marked service. This step can be performed in step 104 or after step 104.

[0051] It's important to note that once a service quota value is marked as having no quota, all service requests from this user will directly return the result indicating insufficient time or bandwidth. Since the performance bottleneck for handling high-concurrency requests lies in the database, this solution can significantly reduce database access through caching, while also using memory marking to reduce the pressure on the cache from high-concurrency requests.

[0052] This embodiment determines a service quota value and initializes it in the cache and storage units. Service call instructions are obtained through a data interface, sorted in a message queue, and processed serially. The service quota value is decremented at fixed intervals based on service usage, and data in the cache unit is transferred to the storage unit at these fixed intervals. When the service quota value reaches its limit, service calls are stopped. This ensures reliable stability, resilience, and accurate cost statistics even with high-concurrency services, and avoids economic losses caused by excessive deductions from user subscription quotas due to high concurrency.

[0053] Example 2

[0054] Embodiment 2 of this application provides a billing device, referring to... Figure 2 As shown, it specifically includes the following modules:

[0055] Information acquisition module; The information acquisition module is used to determine the service quota value and initialize the service quota value to the cache unit and storage unit;

[0056] Information processing module; The information processing module is used to obtain service call instructions through the data interface, sort the service call instructions in the message queue and process them in a serial manner; It calculates the service usage and decrements the service quota value at fixed intervals, and transfers the data in the cache unit to the storage unit at fixed intervals; When the service quota value is reduced to the limit, the service call is stopped.

[0057] Optionally, in one embodiment, the information processing module is further configured to obtain a service call instruction request and make a judgment; if the service quota value in the cache unit meets the limit requirement, the service call is provided; otherwise, the service call is refused.

[0058] Optionally, in one implementation, the information processing module is further configured to add a user service call request verification code mechanism before making a judgment on the received service call instruction request. When the user service request meets the verification code verification, the platform makes a judgment on the received server call request.

[0059] Optionally, in one implementation, the information processing module is also used to transfer the data in the cache unit to the storage unit at fixed intervals and lock the data in the storage unit using an update mechanism.

[0060] Optionally, in one implementation, the information processing module is further configured to mark the service quota value when the service quota value decreases to the limit value, and the mark is used to reject the call request of the marked service.

[0061] Example 3

[0062] In conjunction with the communication connection monitoring method described in Embodiment 1 above, refer to Figure 3 As shown, Embodiment 2 of this application provides an electronic device, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus;

[0063] The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the communication connection monitoring method described in Embodiment 1 above.

[0064] Example 4

[0065] In conjunction with the communication connection monitoring method described in Embodiment 1 above, Embodiment 3 of this application provides a computer storage medium storing a computer program, which, when executed by a processor, is the communication connection monitoring method described in Embodiment 1 above.

[0066] Example 5

[0067] In conjunction with the communication connection monitoring method described in Embodiment 1 above, Embodiment 4 of this application provides a computer program product, including computer instructions, which instruct a computing device to perform the operation corresponding to the communication connection monitoring method described in Embodiment 1 above.

[0068] The above embodiments are only used to illustrate the embodiments of this application, and are not intended to limit the embodiments of this application. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of this application. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of this application, and the patent protection scope of the embodiments of this application should be defined by the claims.

[0069] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0070] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0071] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0072] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

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

[0074] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0075] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0076] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0077] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0078] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

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

[0080] This application can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific transactions or implement specific abstract data types. This application can also be practiced in distributed computing environments where transactions are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0081] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

Claims

1. A billing method, characterized in that, include: The service quota value is determined and initialized to the cache unit and storage unit; during the initialization, a memory marking mechanism is used to mark the service quota data in the cache in order to identify data with quota. The service call instruction is obtained through the data interface. Before judging the service call instruction request, a user service call request verification code mechanism is added. When the user service request meets the verification code, the service call instruction is sorted in the message queue and processed in a serial manner. The verification mechanism includes: calculating the verification result based on the body code of the call instruction, comparing the verification result with the verification code carried in the call instruction, and only when the comparison is consistent, sorting the service call instruction in the message queue and processing it in a serial manner; The service quota value is decreased at fixed intervals by calculating service usage. At fixed intervals, data in the cache unit is transferred to the storage unit, and the data in the storage unit is locked by an update mechanism. The process of decreasing the service quota value at fixed intervals by calculating service usage includes: calculating at least one service usage, either duration or traffic, based on the service call instruction, and decreasing the service quota value identified as "having quota" in the cache based on the calculation result. When the service quota value decreases to the limit, the service call is stopped, and the service quota value is marked and changed to the "no quota value" state to reject subsequent call requests.

2. The billing method according to claim 1, characterized in that, The method further includes: Upon receiving a service call request, the system will determine whether to provide the service call if the service quota value in the cache unit meets the limit requirement; otherwise, it will refuse to provide the service call.

3. The billing method according to claim 2, characterized in that, Before making a judgment upon receiving a service invocation instruction request, the method further includes: A verification code mechanism for user service call requests has been added. When a user service request meets the verification code requirements, the platform will make a judgment on the received server call request.

4. A billing device, characterized in that, include: Information acquisition module; the information acquisition module is used to determine the service quota value and initialize the service quota value to the cache unit and storage unit; in the initialization, a memory marking mechanism is used to mark the service quota data in the cache in order to identify data with quota; An information processing module is used to obtain service call instructions through a data interface. Before judging the service call instruction request, a user service call request verification code mechanism is added. When the user service request meets the verification code, the service call instructions are sorted in a message queue and processed serially. The service quota value is decremented at fixed intervals by calculating service usage. At fixed intervals, data in the cache unit is transferred to the storage unit, and the data in the storage unit is locked by an update mechanism. When the service quota value decreases to the limit, the service call is stopped, and the service quota value is marked and changed to the "no quota value" state to reject subsequent call requests. The verification mechanism includes: calculating a verification result based on the body code of the call instruction, comparing the verification result with the verification code carried in the call instruction, and only sorting the service call instruction in a message queue and processing it serially when the comparison is consistent; the step of decreasing the service quota value by calculating the service usage at fixed intervals includes: calculating at least one service usage, either the duration or the traffic used, based on the service call instruction, and decreasing the service quota value identified as "having quota" in the cache unit based on the calculation result.

5. An electronic device, comprising: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the method as described in any one of claims 1-3.

6. A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of claims 1-3.

7. A computer program product comprising computer instructions that instruct a computing device to perform the method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Service data processing method and device, electronic equipment and storage medium

    CN110365752A

  • Business service method and device, real-time charging method and device, edge server and charging system

    CN112738743A