Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to set a reasonable and reliable accounting mode switching threshold, the specification provides an accounting method and device. The main body of the accounting method provided in this specification may be a server or a terminal, for example. In addition, the accounting method, the accounting device and the electronic device provided by the specification are suitable for accounting scenes of the streaming accounts in various fields. An outgoing account number generally refers to an account that is charged for a large amount of money at a certain time and then used for constantly and frequently making bill payments. As an example, the outgoing account may also be a hotspot account with higher concurrency.
A detailed description will be given below of a billing method provided in an embodiment of the present specification with reference to fig. 1 to 3.
As shown in fig. 1, in one embodiment, the present specification provides a billing method, which may include the following steps:
and 102, under the condition that the balance of the target account is greater than or equal to the accounting mode switching threshold value, determining that the accounting mode of the target account is a buffering accounting mode.
The target account may be an account that needs to be billed. The balance of the target account may be the total amount of funds in the target account that can be used for payment.
In this embodiment, the billing mode may include a buffered billing mode and a limited-flow billing mode. A billing mode switching threshold for determining a billing mode for the target account.
Generally, when the balance of the target account is greater than or equal to the accounting mode switching threshold, the accounting mode of the target account is determined to be the buffering accounting mode, and when the balance of the target account is less than the accounting mode switching threshold, the accounting mode of the target account is determined to be the current-limiting accounting mode. That is, in another embodiment, the accounting method provided in this specification embodiment may further include: and switching to a current-limiting accounting mode when the balance of the target account is less than the accounting mode switching threshold value.
And 104, updating the accounting mode switching threshold value based on the unrefined transaction details of the target account in the buffer accounting mode.
When the accounting mode is determined to be the buffering mode, under the conditions that the target account is not locked and the balance of the target account is not updated, recording the unrefined transaction details in real time, and accumulating the amount of money in the unrefined transaction details in real time; the billing mode switching threshold is then updated in real time based on the amount of funds in the unsettled transaction detail accumulated in real time. The real-time recording, real-time accumulation and real-time update may be understood as time synchronization recording, synchronization accumulation and synchronization update generated according to transaction details (of course, synchronization is not understood as precise synchronization in time), or may be understood as continuous recording, accumulation and update according to a relatively short preset time interval.
In this embodiment, a method of recording the unsettled transaction details in real time and accumulating the amount of money in the unsettled transaction details in real time may be regarded as a streaming processing method.
The transaction specification may include, but is not limited to, the following: identification of the target account, amount, inflow/outflow, opposite account identification, etc.
As a detailed example, step 104 may include: and updating the accounting mode switching threshold value based on the amount of the target account in the unsettled transaction detail in the buffer accounting mode according to a preset time interval.
In the buffering accounting mode, the accounting process is generally divided into two stages, and in the first stage, the unrefined transaction details are recorded; and in the second stage, the balance of the account is updated according to the amount of the transaction detail medium which is not subjected to reimbursement when the preset reimbursement time is reached. The predetermined reimbursement time is usually determined according to the reimbursement period, but may be determined in other manners. Moreover, since the updating of the accounting mode switching threshold is performed in relatively real time, the preset time interval is smaller than the accounting period. For example, if the reconciliation period is 1 day, the predetermined time interval may be 1ms or 1 min.
As another detailed example, step 104 may include: and updating the accounting mode switching threshold value based on the amount of the target account in the unsettled transaction detail in the buffer accounting mode according to the time generated by the unsettled transaction detail.
This example may be understood as the case where, in the buffered accounting mode, each time an outstanding transaction detail is generated for the target account, the accounting mode switching threshold is updated based on the amount in that transaction detail and the amounts in the remaining outstanding transaction details previously recorded. I.e. the accounting mode switching threshold is updated in real time.
And in one embodiment of the two examples above, the accounting mode switching threshold may be directly updated to the sum of the amounts in the accumulated unsettled transaction details.
In another specific implementation manner of the two examples, the updating the accounting mode switching threshold value based on the amount of the target account in the unsettled transaction details in the buffered accounting mode includes: and updating the accounting mode switching threshold value based on the amount of the target account in the unsettled transaction detail in the buffered accounting mode and a preset value. More specifically, the sum of the amounts of the target account in the non-reimbursement transaction details in the buffered accounting mode may be determined; and updating the accounting mode switching threshold value to be the sum of the sum and the preset value.
The preset value can be regarded as a reserved value (buffer) for making more reasonable adjustment on the accounting mode switching threshold. For example, the method is used for adjusting the accounting mode switching threshold value of the target account in special cases that the sum of the amounts of the unsettled transaction details in the buffered accounting mode is zero, and the updated accounting mode switching threshold value is prevented from being equal to zero. It is understood that when the billing mode switching threshold is equal to zero, it is unreasonable to select only the current limiting mode for the target account, but not the buffering mode, and this is to be avoided.
The size of the preset value can be set according to practical experience, and the specific size of the preset value is not limited herein. When the preset value is larger, the method means that a buffering accounting mode is not selected but a current-limiting accounting mode is selected, so that overdraft risks of the account can be avoided, the security of the account is high, and the accounting efficiency is low; when the preset value is smaller, the account security requirement (or the accounting accuracy requirement) can be properly lowered, and the accounting efficiency is improved.
And 106, after the preset reimbursement time is reached, updating the balance of the target account based on the unreleased transaction details of the target account in the buffer accounting mode.
As above, the scheduled reconnaissance time may be determined based on a reconnaissance period. The reimbursement period can be determined according to actual needs, for example, the reimbursement period can be one day or one week, and the like.
Specifically, after the predetermined reimbursement period is reached, the balance of the target account may be updated based on the sum of the amounts of the outstanding transactions of the target account in the buffered accounting mode.
The embodiment shown in fig. 1 provides an accounting method, which can continuously update the accounting mode switching threshold according to the unrefined transaction details of the target account in the buffer mode, rather than calculating a fixed accounting mode switching threshold based on the historical accounting flow. Therefore, the problem that a reasonable accounting mode switching threshold value is set for the outflow type account can be well solved, and the purpose of providing the reasonable and reliable accounting mode switching threshold value for the outflow type account is achieved. Therefore, the situation that the accounting service fails due to the fact that the accounting mode switching threshold value is set too high can be avoided, and the risk that the account balance is overdrawn due to the fact that the accounting mode switching threshold value is set too low can be avoided.
In addition, the accounting mode switching threshold in the accounting method provided by the embodiment of the present specification is continuously updated, and in the buffered accounting mode, there is no need to lock the target account, so the accounting method provided by the example of the present specification may be regarded as a "quasi real-time accounting" method that does not need to lock the target account.
Optionally, in another embodiment, as shown in fig. 2, after the balance of the target account is updated in step 106, the billing method provided in this embodiment of the present specification may further include:
and 108, clearing the amount of the unsettled transaction details of the target account in the buffer accounting mode.
After the balance of the target account is updated based on the unsettled transaction details of the target account in the buffered accounting mode, it is indicated that the amount of money in the unsettled transaction details has been completed for accounting, and the amount may be cleared.
On this basis, the updating the accounting mode switching threshold value based on the amount of the target account in the unsettled transaction details in the buffered accounting mode and the preset value may include: and updating the accounting mode switching threshold value based on the preset value. It can be understood that, because the reimbursement of the unsettled transaction details is completed, the target account does not have the unsettled transaction details in the buffered accounting mode, or the unsettled amount of money is equal to zero, at this time, the accounting mode switching threshold may be updated according to the preset value (buffer).
For ease of understanding, the billing method provided by the embodiment shown in fig. 2 is described below by way of an example. Assuming that the balance of the target account is determined to be 500 and the billing mode switching threshold is 300 at step 102, the billing mode of the target account is determined to be the buffered billing mode since the balance is greater than the billing mode switching threshold; at step 104, accumulating the sum of the amounts of the target account in the buffered accounting mode unsettled transaction details to be 300, and assuming that the preset value (buffer) is 100, updating the accounting mode switching threshold to be 400(300+100 ═ 400); at step 106, when the preset reimbursement time is reached, determining that the sum of the amount in the unsettled transaction details of the target account in the buffer mode is also 300, and updating the balance of the target account to 200 based on the sum of the amount (500-300-200); at step 108, clearing the outstanding transaction details of the target account in the buffer mode such that the sum of the amounts in the outstanding transaction details equals 0; at this point, step 104 is executed again, and the billing mode switching threshold may be updated to 100(0+100 ═ 100). Therefore, the method and the device are repeated in a circulating mode, the accounting mode switching threshold value is continuously updated according to the unreleased transaction details of the target account in the buffer accounting mode, so that the accounting mode switching threshold value is adaptive to the real-time balance of the target account, the accounting efficiency is improved, and the accounting accuracy is guaranteed.
To generally understand a billing method provided in this specification, a more detailed example of the billing method provided in this specification is illustrated below with reference to fig. 3.
As shown in fig. 3, an accounting method provided in an embodiment of this specification may include:
step 301, judging whether the balance 31 of the target account is greater than or equal to the accounting mode switching threshold value 32, if so, executing step 303; otherwise, step 305 is performed.
Step 303, switching to a buffered billing mode.
The specific step 303 may include: substep 3032, on the premise that the target account is not locked and the balance of the target account is not updated, storing the non-reimbursement transaction details in the first database 33; substep 3034, fetching the unrefined transaction detail from the first database 33, converting the unrefined transaction detail into buffer detail, and storing the buffer detail into the second database 34, wherein the buffer detail can be an accumulation result of the sum of money in the transaction detail; and a substep 3036, after the preset reimbursement time is reached, fetching the buffer details from the second database, and updating the balance 31. Step 303 may be divided into two stages, wherein the first stage includes sub-step 3032 and the second stage includes sub-steps 3034 and 3036.
Step 305, switching to a current limited billing mode.
Step 307, updating the accounting mode switching threshold 32 based on the amount of the target account in the unsettled transaction detail in the buffered accounting mode and a preset value. And step 307 may be performed during the first phase of buffered billing or during the second phase of buffered billing.
The embodiment shown in fig. 3 provides an accounting method, which can continuously update the accounting mode switching threshold according to the unrefined transaction details of the target account in the buffer mode, instead of calculating a fixed accounting mode switching threshold based on the historical accounting flow. Therefore, the problem that a reasonable accounting mode switching threshold value is set for the outflow type account can be well solved, and the purpose of providing the reasonable and reliable accounting mode switching threshold value for the outflow type account is achieved. Therefore, the situation that the accounting service fails due to the fact that the accounting mode switching threshold value is set too high can be avoided, and the risk that the account balance is overdrawn due to the fact that the accounting mode switching threshold value is set too low can be avoided.
The above is a description of a billing method provided in this specification, and the electronic device provided in this specification is described below.
Fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification. Referring to fig. 4, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 4, but that does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the accounting device on the logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
determining that the accounting mode of the target account is a buffering accounting mode when the balance of the target account is greater than or equal to the accounting mode switching threshold;
updating the accounting mode switching threshold value based on the unreleased transaction details of the target account in the buffered accounting mode;
and after the preset reimbursement time is reached, updating the balance of the target account based on the unreleased transaction details of the target account in the buffer accounting mode.
The accounting method disclosed in the embodiment of fig. 1 in this specification may be implemented in or by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in one or more embodiments of the present specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with one or more embodiments of the present disclosure may be embodied directly in hardware, in a software module executed by a hardware decoding processor, or in a combination of the hardware and software modules executed by a hardware decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may also perform the accounting method of fig. 1, which is not described herein again.
Of course, besides the software implementation, the electronic device in this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Embodiments of the present specification also propose a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, are capable of causing the portable electronic device to perform the method of the embodiment shown in fig. 1, and in particular to perform the following:
determining that the accounting mode of the target account is a buffering accounting mode when the balance of the target account is greater than or equal to the accounting mode switching threshold;
updating the accounting mode switching threshold value based on the unreleased transaction details of the target account in the buffered accounting mode;
and after the preset reimbursement time is reached, updating the balance of the target account based on the unreleased transaction details of the target account in the buffer accounting mode.
The following describes an accounting device provided in this specification.
Fig. 5 is a schematic structural diagram of accounting device 500 provided in this specification. Referring to fig. 5, in one software implementation, accounting device 500 may include: a determination module 501, a first update module 502, and a second update module 503.
A determining module 501, configured to determine that the billing mode of the target account is the buffered billing mode when the balance of the target account is greater than or equal to the billing mode switching threshold.
Optionally, the determining module 501 is further configured to determine that the billing mode of the target account is the current-limited billing mode when the balance of the target account is less than the billing mode switching threshold.
A first updating module 502, configured to update the accounting mode switching threshold based on the unreleased transaction details of the target account in the buffered accounting mode.
Optionally, in an example, the first updating module 502 is configured to update the accounting mode switching threshold according to a preset time interval based on an amount of the target account in the outstanding transaction details in the buffered accounting mode. The preset accounting time is determined based on the accounting period of the buffered accounting mode, and the preset time interval is smaller than the accounting period.
Optionally, in another example, the first updating module 502 is configured to update the accounting mode switching threshold according to a time when the unsettled transaction details are generated, based on an amount of the target account in the unsettled transaction details in the buffered accounting mode.
Optionally, in yet another example, the first updating module 502 is configured to update the accounting mode switching threshold based on an amount of the target account in the unsettled transaction details in the buffered accounting mode and a preset value.
More specifically, in this further example, the first update module 502 is operable to determine a sum of amounts in the outstanding transaction details of the target account in the buffered billing mode; and updating the accounting mode switching threshold value to be the sum of the sum and the preset value.
And a second updating module 503, configured to update the balance of the target account based on the unrefined transaction details of the target account in the buffered billing mode after the predetermined reimbursement time is reached.
In the accounting device 500 according to this embodiment, the accounting mode switching threshold can be continuously updated according to the unrefined transaction details of the target account in the buffer mode, instead of calculating a fixed accounting mode switching threshold based on the historical accounting flow. Therefore, the problem that a reasonable accounting mode switching threshold value is set for the outflow type account can be well solved, and the purpose of providing the reasonable and reliable accounting mode switching threshold value for the outflow type account is achieved. Therefore, the situation that the accounting service fails due to the fact that the accounting mode switching threshold value is set too high can be avoided, and the risk that the account balance is overdrawn due to the fact that the accounting mode switching threshold value is set too low can be avoided.
Fig. 6 is a schematic structural diagram of accounting device 500 provided in another embodiment of this specification, and as shown in fig. 5, accounting device 500 includes, in addition: the determining module 501, the first updating module 502 and the second updating module 503 may further include a zero module 504.
The clearing module 504 is configured to clear the amount of money in the unsettled transaction details of the target account in the buffered billing mode after the balance of the target account is updated by the second updating module 503, and trigger the first updating module 502. At this time, the first updating module 502 can be configured to update the accounting mode switching threshold based on a preset value. Wherein the preset value is the reserved value (buffer) in the above.
It should be noted that, the accounting device 500 can implement the method in the embodiment of the method in fig. 1, and specific reference may be made to the accounting method in the embodiment shown in fig. 1, which is not described again.
In short, the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present disclosure should be included in the scope of protection of one or more embodiments of the present disclosure.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, 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 Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.