A charging method and device based on array structure
By using an array structure-based method in cloud service billing, querying its status through the unique number of billing indicators, the problem of inaccurate judgment of billing completion in the existing technology is solved, and fast and accurate billing status query is achieved , improves the efficiency of the billing process.
Patent Information
- Application Number
- CN202410198130.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-22
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2044-02-22
AI Technical Summary
During the cloud service billing process, the prior art cannot accurately determine whether the billing of the billing account is completed, especially in the case of a large number of billing indicators, it is impossible to determine which billing indicators are calculated and which have not been completed.
Using an array structure method, by setting a unique number for each billing indicator and storing its billing status identifier in the preset storage array, querying its status by the billing indicator number to determine whether the billing status is the preset The completion flag is consistent and determines that the billing status is completed or not completed.
It realizes the rapid judgment of the billing status of each billing indicator, improves the efficiency of state query in the billing process, and avoids the tedious process of traversing one by one, especially in a large number of billing indicator scenarios, which can quickly understand the billing status.
Smart Images

Figure CN118138384B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a charging method and device based on array structure. Background Art
[0002] In the cloud service billing calculation process, the billing of each account will split the billing indicators into different calculation units for independent calculation. Since the calculation time of each calculation unit is not completely consistent, the calculation time of each billing indicator is not completely consistent. In this case, if a billing account involves a large number of billing indicators, it is extremely important to accurately determine whether the billing of the billing account has been calculated.
[0003] At present, the main method used is to determine whether the billing calculation is completed by counting the value of the identification bit equal to the number of billing indicators. However, this method has certain limitations, that is, during the calculation process, it is impossible to know which billing indicators have been calculated and which have not been calculated. Summary of the invention
[0004] In view of the above problems, the present invention provides a billing method and device based on an array structure, the main purpose of which is to be able to determine the billing status of each billing indicator.
[0005] In order to solve the above technical problems, the present invention proposes the following solutions:
[0006] In a first aspect, the present invention provides a billing method based on an array structure, the method comprising:
[0007] Obtaining a billing indicator to be determined; wherein the billing indicator is provided with a unique number;
[0008] Based on the unique number of the billing indicator, query the preset storage array to obtain the corresponding billing status identifier; wherein the billing status identifier of the billing indicator is stored in the storage position of the preset storage array;
[0009] If the billing status identifier is consistent with the pre-designed billing completion identifier, determining the billing status of the billing indicator as billing completion;
[0010] If the billing status identifier is inconsistent with the pre-designed billing completion identifier, the billing status of the billing indicator is determined to be incomplete billing. In a second aspect, the present invention provides a billing device based on an array structure, the device comprising:
[0011] A first acquisition unit is used to acquire a billing indicator to be determined; wherein the billing indicator is provided with a unique number;
[0012] A query unit, used to query a preset storage array based on the unique number of the billing indicator to obtain a corresponding billing status identifier; wherein the billing status identifier of the billing indicator is stored in the storage position of the preset storage array;
[0013] A first determining unit, configured to determine that the billing status of the billing indicator is billing completed if the billing status identifier is consistent with the pre-designed billing completion identifier;
[0014] The second determining unit is configured to determine that the billing status of the billing indicator is incomplete billing if the billing status identifier is inconsistent with the pre-designed billing completion identifier. In order to achieve the above object, according to a third aspect of the present invention, a storage medium is provided, the storage medium includes a stored program, wherein when the program is run, the device where the storage medium is located is controlled to execute the array structure-based billing method described in the first aspect.
[0015] In order to achieve the above-mentioned purpose, according to the fourth aspect of the present invention, there is provided an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, all or part of the steps of the array-structure-based billing device as described in the second aspect are implemented.
[0016] In order to achieve the above-mentioned purpose, according to a fifth aspect of the present invention, there is provided a computer program product, comprising a computer program / instructions, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0017] Due to the current counting method, it is impossible to know which billing indicators have been calculated and which billing indicators have not been calculated. To this end, the present invention obtains a billing indicator to be judged with a unique number; based on the unique number, a preset storage array is queried to obtain a corresponding billing status identifier; wherein the billing status identifier of the billing indicator is stored in the storable position of the preset storage array; if the billing status identifier is consistent with the pre-designed billing completion identifier, the billing status of the billing indicator is determined to be billing completed; if the billing status identifier is inconsistent with the pre-designed billing completion identifier, the billing status of the billing indicator is determined to be billing incomplete. In this way, the billing status of a specified billing indicator can be quickly determined.
[0018] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0020] Figure 1 A flowchart of a charging method based on an array structure provided by an embodiment of the present invention is shown;
[0021] Figure 2 A flowchart of another billing method based on an array structure provided by an embodiment of the present invention is shown;
[0022] Figure 3 A schematic diagram of the structure of a preset storage array provided by an embodiment of the present invention is shown;
[0023] Figure 4 A schematic diagram showing the structure of another preset storage array provided by an embodiment of the present invention is shown;
[0024] Figure 5 A schematic diagram showing the structure of another preset storage array provided by an embodiment of the present invention is shown;
[0025] Figure 6 A block diagram showing a charging device based on an array structure provided by an embodiment of the present invention;
[0026] Figure 7 A composition block diagram of another array-structure-based charging device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0027] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0028] The current problem of using the counting method to determine the billing status is that during the calculation process, it is impossible to know which billing indicators have been calculated and which have not been calculated. The inventor has come up with a method of using the storage bits of an array to store the billing status of the billing indicators one-to-one, and setting a unique identity for each billing indicator to solve the above technical problem.
[0029] To this end, the embodiment of the present invention provides a billing method based on an array structure, through which the billing status of each billing indicator can be determined. The specific execution steps are as follows: Figure 1 As shown, the execution subject is an electronic device and an electronic device cluster, and the electronic device calls the billing system to execute the following steps, including S100-S400. S100, obtaining a billing indicator to be determined.
[0030] The billing indicator is provided with a unique number.
[0031] The unique number of the billing indicator to be determined is input through the client operation interface, which is not specifically limited in this embodiment. The billing system at the server receives the unique number of the billing indicator.
[0032] S200: Based on the unique number of the billing indicator, query the preset storage array to obtain the corresponding billing status identifier.
[0033] The billing status identifier of the billing indicator is stored in the storage bit of the preset storage array. The type of the preset storage array can be a long array or an int array, which is not specifically limited in this embodiment. It should be noted that one storage bit stores the billing status identifier of one billing indicator.
[0034] After obtaining the billing indicator with a unique number from step S100, the corresponding storable position on the preset storage array is found through the unique number of the billing indicator, and the billing status identifier stored in the storable position is the billing status identifier of the billing indicator.
[0035] S300: If the billing status identifier is consistent with the pre-designed billing completion identifier, the billing status of the billing indicator is determined to be billing completion.
[0036] The billing status flags of the billing indicators are divided into billing completion flags and billing incomplete flags.
[0037] In this embodiment, a pre-designed billing completion flag is first set to determine whether the billing status represented by the billing status flag obtained in step S200 is billing completed or incomplete.
[0038] Specifically, the billing status identifier obtained from step S200 is matched with the pre-designed fee completion identifier. If the match is complete, it means that the billing status identifier is a billing completion identifier, indicating that the billing status of the billing indicator is billing completion. If the match is not complete, it means that the billing status identifier is not a billing completion identifier, that is, a billing incomplete identifier, indicating that the billing status of the billing indicator is billing incomplete. This step is to determine that the billing status of the billing indicator is billing completion when the billing status identifier is consistent with the pre-designed fee completion identifier.
[0039] S400: If the billing status identifier is inconsistent with the pre-designed billing completion identifier, the billing status of the billing indicator is determined to be billing incomplete.
[0040] Based on the above Figure 1 It can be seen from the implementation of the embodiment that the present invention provides a billing method based on an array structure, which adopts the method of storing the billing status identifier of the billing indicator in the storable position of the preset storage array, and then querying the preset storage array through the unique number of the billing indicator to obtain the corresponding billing status identifier; further determine whether the billing status identifier is consistent with the pre-designed billing completion identifier; if so, determine that the billing status of the billing indicator is billing completed; if not, determine that the billing status of the billing indicator is billing incomplete. In this way, the billing status of a specified billing indicator can be quickly determined. Especially in the scenario of a large number of billing indicators, the execution status of each billing indicator can be quickly queried during the calculation process, and whether a billing indicator of a certain item has been calculated can be quickly obtained according to the number of the billing indicator.
[0041] In order to quickly determine whether the billing process is completed, Figure 2 As shown, the method steps provided in the embodiment of the present application also include S500-S800. S500, obtaining all charging status identifiers stored in the lowest level array of the preset storage array.
[0042] The preset storage array is a one-level or multi-level array, each level of the array includes one or more arrays, any two adjacent levels of arrays include an upper array and a lower array, and in any two adjacent levels of arrays, a storage bit in the lower array stores a billing status identifier representing the overall billing status of a single array in the upper array. The billing status identifier is a binary value, 1 indicates that the billing is completed, and 0 indicates that the billing is not completed.
[0043] For example:
[0044] like Figure 3 As shown, the preset storage array is a long type array including M levels, the first level long type array is named Array-1, the next level array, i.e. the second level array, is named Array-2, and so on, the lowest level array, i.e. the Mth level array, is named Array-M; each level array before the Mth level includes at least 2 array items, and only the Mth level array has only one array item; the storage bit of each level array stores the corresponding binary value 0 or 1. Figure 3 In the array structure shown, any adjacent array includes a lower-level array and an upper-level array. A storable bit in the lower-level array stores a billing status identifier representing the overall billing status of a single item array in the upper-level array. For example, the 6th storable bit of Array-1 (lower-level array) stores the billing status identifier of the overall (64-bit) billing status of a single item array in Array-2 (upper-level array).
[0045] This step of obtaining all the billing status identifiers stored in the lowest level array of the preset storage array refers to reading all the binary values stored in Array-M.
[0046] S600. Convert all billing status identifiers into decimal values.
[0047] After all the "binary values" of the charging status identifiers are obtained from step S500, they are converted into decimal values. For example, if all the binary values stored in the lowest level array are 11, then the converted decimal value is 3.
[0048] S700: If the decimal value is consistent with the preset decimal value, it is determined that the billing process is completed.
[0049] Among them, the preset decimal value is set according to the number of storable bits for storing the billing status of billing indicators set on the lowest level array of the preset storage array, and the storable bits are all 1; for example: all binary values stored on the lowest level array are 11, then the converted decimal value is 3, then a preset decimal value "3" is set in advance, which is used as an indicator to determine whether the billing process is completed.
[0050] After the decimal value is obtained from step S600, it is determined whether it is consistent with the preset decimal value. If so, it is determined that the billing process is completed; if not, it is determined that the billing process is not completed.
[0051] In this step, if the decimal value is consistent with the preset decimal value, it is determined that the billing process is completed.
[0052] S800: If the decimal value is inconsistent with the preset decimal value, it is determined that the billing process is not completed.
[0053] Based on the above Figure 2 It can be seen from the implementation of the embodiment that the present invention provides a billing method based on an array structure, which adopts the form of a multi-level array, and uses the storable bits of each level array to record the overall billing status of the upper level single item array, that is, only when all the single item arrays are billed, the corresponding storable bits in the lower level array can record the billing completion mark "1", otherwise it is the billing incomplete mark "0"; therefore, this embodiment only needs to determine whether the binary values recorded in the storable bits of the lowest level array are all 1 to determine whether the billing execution is completed, which overcomes the cumbersome process of determining the billing status of the billing indicators one by one in the prior art, and improves the judgment speed. In particular, in the scenario of a large number of billing indicators, the billing status can be quickly obtained, avoiding traversing each billing indicator, and only needs to query the first array data in the lowest level array.
[0054] The inventors also found that: by judging the binary value of each storable bit of the lowest level array, although the cumbersome process of determining the billing status of the billing indicator one by one can be avoided, if the storable bits of the lowest level array are all used, the judgment process of judging each storable bit of the lowest level array one by one is still somewhat cumbersome, and there is room for improvement. To this end, the embodiment of the present invention adopts a method of converting binary to decimal and comparing it with a preset decimal value to determine whether the execution of the billing process is completed. The advantage of this is that there is no need to judge the billing status of each storable bit of the lowest level array one by one, which further improves the judgment speed.
[0055] In order to realize the construction of the preset storage array for storing the billing status of the billing indicators, the method provided in the embodiment of the present application also includes S900-S1100. S900, based on the number of pre-designed billing indicators and the number of storage bits of a single-item array, determine the number of levels of the preset storage array, the number of items in each level of the array, and the length of the last item in each level of the array.
[0056] The number of pre-designed billing indicators refers to the number of all billing indicators that need to be billed for the customer account. For example: Customer account A needs to calculate 4,000 billing indicators.
[0057] The number of storage bits of a single-item array refers to the number of locations that the array itself can use to store data. For example, a long array is 8 bytes, 64 bits, of which 1 is a sign bit and the remaining 63 are storage bits that can be used to store actual data. Therefore, the number of storage bits of a single-item long array is 63.
[0058] The storage bit of the single-item array can be used to store the billing status of the pre-designed billing indicator in this embodiment. The billing status is represented by a billing status flag, for example: binary 1 is a billing completion flag, indicating that the billing is completed; binary 0 is a billing incomplete flag, indicating that the billing is not completed.
[0059] In some embodiments, the number of pre-design fee indicators and the number of storage bits of the single-item array can be used to determine the number of items in the single-item array required to store all pre-design fee indicators, that is, the number of items in the first-level array. Taking the long type array as an example, the number of items in the single-item array required is as follows (1)-(3).
[0060] (1) When the number of pre-design fee indicators is less than the number of storage bits, one array is required to store all pre-design fee indicators.
[0061] For example: the number of pre-design fee indicators is 60, and the number of storage bits in the long type array itself is 63. Since 60 is less than 63, the preset storage array requires 1 long type array, and only 60 of the storage bits are needed. This long type array is the only array, and its length is 60.
[0062] (2) When the number of pre-design fee indicators is equal to the number of storage bits, one array is required to store all pre-design fee indicators.
[0063] For example: the number of pre-designed cost indicators is 63, and the number of storage bits that a long array can store is 63. Since 63 is equal to 63, the preset storage array requires 1 long array, and only the 63 storage bits are needed. This long array is the only array, and its length is 63.
[0064] (3) When the number of pre-designed fee indicators is greater than or equal to the number of storable bits, n arrays are required to store all pre-designed fee indicators, where: the storable bits of the first n-1 arrays are all used to store the billing status of the billing indicators, the nth array is the last array, and part of the storable bits of the nth array are used to store the billing status of the billing indicators. n is a positive integer greater than 1.
[0065] For example: the number of pre-design fee indicators is 4000, the number of storage bits of the long type array itself is 63, 4000 / 63=63 remainder 31, that is, 64 long type arrays are needed, including 63 long type arrays (the number of storage bits for storing data is 63) and 1 long type array (the number of storage bits for storing data is 31), that is, the total number of items is 64; among them, the long type array (the number of storage bits for storing data is 31) is the last array length. That is, the number of storage bits for storing data in the first n-1 long type arrays is 63, and the number of storage bits for storing data in the nth long type array is no more than 63 and is the last array.
[0066] In certain embodiments, the number of levels of data is determined according to the number of single-item arrays in the aforementioned embodiments, that is, the number of levels is determined according to the number of items in the single-item arrays required to store all the pre-design fee indicators, and each level of the array is set to include one or more arrays, and any two adjacent levels of arrays include an upper-level array and a lower-level array. In any two adjacent levels of arrays, a storable bit in the lower-level array stores a billing status identifier representing the overall billing status of the single-item array in the upper-level array.
[0067] Taking a long array as an example, the specific levels of the array structure are as follows (4)-(6).
[0068] (4) When the number of pre-design fee indicators is less than the number of storage bits, one array is required to store all pre-design fee indicators, and the level of the preset storage array is 1.
[0069] (5) When the number of pre-design fee indicators is equal to the number of storable bits, one array is required to store all pre-design fee indicators, and the number of levels of the preset storage array can be set to 1. In order to improve the judgment speed, in some embodiments, it can also be 2 levels.
[0070] For example, if the number of pre-design fee indicators is 63, and the 63 storage positions of a long type array are used to store the 63 pre-design fee indicators, the level of the preset storage array is set to 1. That is, a level 1 array A is used to store 63 billing indicators, and the array A includes a long type array, and the long type array stores 63 billing indicators.
[0071] For another example, if the number of pre-designed billing indicators is 63, and one long type array includes 63 storage positions, then the number of levels of the preset storage array is set to 2. That is, a 2-level array B is used to store 63 billing indicators, and the array B includes one first-level long type array A1 and one second-level long type array A2. The first-level long type array A1 stores 63 billing indicators, and the second-level long type array A2 stores the billing status identifier of the overall billing status of the first-level long type array A1.
[0072] Assuming that all 63 storable bits on the first-level long array A1 store binary "1", indicating that all calculation indicators stored in the first-level long array A1 have been charged, then the first storage bit on the second-level long array A2 stores a charging status of binary "1", indicating that all charging indicators on the first-level long array A1 have been charged;
[0073] Assuming that at least one binary "0" is stored in the 63 storable bits on the first-level long type array A1, it means that at least one of the calculation indicators stored in the first-level long type array A1 has not completed the billing. Then the billing status stored in the first storage bit on the second-level long type array A2 is binary "0", which is used to indicate that there are billing indicators that have not completed the billing on the first-level long type array A1;
[0074] By using the "1" or "0" stored in the second-level long array A2 in the array B, it is possible to directly determine whether the billing has been completed, thereby improving the determination speed.
[0075] (6) When the number of pre-design fee indicators is greater than or equal to the number of storable bits, a multi-array is required to store all pre-design fee indicators. In order to increase the judgment speed, the number of levels of the preset storage array can be set to multiple levels.
[0076] In some embodiments: when the number of pre-design fee indicators is greater than or equal to the number of storable bits, and the number of array items required to store all pre-design fee indicators is less than or equal to the number of storable bits, the number of levels of the preset storage array is set to 2. For example, if the number of long-type array items n required to store all pre-design fee indicators is "1<n≤63", the number of levels of the preset storage array can be set to 2, and the second-level array contains only one long-type array, and the number of storable bits for storing data in the second-level array is equal to n.
[0077] For another example: when the first-level array of the preset storage array includes 60 long-type arrays, the level of the preset storage array is set to 2; the second-level array includes a long-type array C, and the number of storable bits of array C for storing data is 60, that is, the 60 storable bits on the long-type array C respectively store the billing status identifier of the overall billing status of each long-type array in the first-level array.
[0078] In some other embodiments: when the number of pre-design fee indicators is greater than or equal to the number of available storage bits, and the number of array items required to store all pre-design fee indicators is greater than the number of available storage bits, the number of levels of the preset storage array is set to at least 3, and the lowest level array includes only one array item. For example, when the number of long-type array items n required to store all pre-design fee indicators is "n>63", the number of levels of the preset storage array can be set to at least 3, and it should be noted that the lowest level array is required to include only one long-type array item.
[0079] For another example: when the first-level array of the preset storage array includes 67 long-type arrays, the level of the preset storage array can be set to 3 levels; the second-level array includes two long-type arrays: array D (the number of storable bits for storing data is 63) and array E (the number of storable bits for storing data is 4), each storable bit in arrays D and E is used to store the billing status identifier of the overall billing status of a single long-type array in the first-level array, that is, the 63 storable bits of array D are respectively used to store the billing status identifier of the overall billing status of the 1st-63rd array items of the first-level array, and the 4 storable bits of array E are respectively used to store the billing status identifier of the overall billing status of the 64th-67th array items of the first-level array; the third-level array includes a long-type array F (the number of storable bits for storing data is 2), each storable bit of array F is used to store the billing status identifier of the overall billing status of a single long-type array in the second-level array, that is, the 2 storable bits of array F are respectively used to store the billing status identifier of the overall billing status of arrays D and E of the second-level array.
[0080] S1000, construct a preset storage array based on the number of levels, the number of items in each level of array, and the length of the last array item in each level of array.
[0081] Wherein, the number of levels of the preset storage array is at least one.
[0082] After obtaining the number of levels, the number of items in each level array, and the length of the last item in each level array from S900, a preset storage array is constructed based on this, such as Figure 3 shown.
[0083] S1100, using the number of the pre-design fee indicator, establish a corresponding relationship between the storable bits of the first-level array in the preset storage array and the pre-design fee indicator, and establish a corresponding relationship between the storable bits in the lower-level array and the single-item array in the upper-level array.
[0084] The storable bits of the first-level array are used to store the billing status identifier of the pre-designed fee indicator.
[0085] In this step, the numbering method for all pre-design fee indicators is customized according to business needs, and this embodiment does not make specific limitations. For example: a certain billing information contains 4000 billing indicators, and these billing indicators are numbered from 1 to 4000 in sequence. The storable bits of the first-level array in the preset storage array are used to establish a one-to-one correspondence with the pre-design fee indicators in the order from small to large or from large to small. For example: the 63 storable bits of the first item array in the first-level array are respectively set to store the billing status identifiers 1 or 0 of the pre-design fee indicators numbered from 1 to 63 in sequence.
[0086] For example:
[0087] Assume that there are 4000 pre-design fee indicators, numbered from 1 to 4000, and a long array is used to construct a preset storage structure. The preset storage structure includes three levels of arrays, namely:
[0088] The first-level array is a 64-item long-type array used to store the billing status identifiers of the 4,000 pre-design fee indicators in ascending order. The first 63 long-type arrays have 63 storage bits for storing data, and the 64th long-type array has 31 storage bits for storing data.
[0089] The second-level array is a 2-item long-type array, wherein the first long-type array is used to store data with a storage bit number of 63, and the second long-type array is used to store data with a storage bit number of 1; wherein the first long-type array is used to store the billing status identifier of the overall billing status of the 1-63 long-type arrays in the first-level array; the second long-type array is used to store the billing status identifier of the overall billing status of the 64th long-type array in the first-level array;
[0090] The third-level array is a 1-item long-type array, and the number of storage bits for storing data is 2, which is used to store the billing status identifier of the overall billing status of the 1-2-item long-type array in the second-level array. This embodiment can realize the construction of the preset storage array for storing the billing status of the billing indicator, so as to quickly determine whether the billing is completed, improve the judgment speed, and can quickly determine the billing status of a certain billing indicator.
[0091] In order to obtain the number of levels for constructing a preset storage array, the method step S900 provided in the embodiment of the present application includes S901-S902. S901, when the number of pre-design fee indicators is not greater than the number of storage bits of a single-item array, determine that the number of levels of the preset storage array is one.
[0092] For example: using a long array to construct a preset storage array, 62 billing indicators are known, and the number of storage bits of a long array is 63, 62 is less than 63, that is, a long array can store all the billing status of these 62 billing indicators. Therefore, the level of the preset storage array is determined to be one level.
[0093] This embodiment may also determine that the level of the preset storage array is two-level when the number of preset charging indicators is equal to the number of storage positions of the single-item array, so as to improve the speed of determining the charging status.
[0094] For example: a preset storage array is constructed using a long array. If 63 billing indicators are known, the number of storage bits of a long array is 63, and 63 is equal to 63. Since all the storage bits of a long array are used for storage, a second-level array can be established. The first storage bit of a long array in the second-level array can be used to indicate whether all the 63 billing indicators have been billed. Therefore, in order to improve the judgment speed, this embodiment determines that the level of the preset storage array can be two levels.
[0095] S902: When the number of pre-design fee indicators is greater than the number of storage bits of the single-item array, the number of levels of the pre-designed storage array is calculated using a preset calculation rule based on the number of pre-design fee indicators and the number of storage bits of the single-item array.
[0096] The preset calculation rule includes that the number of items of the lowest level array of the preset storage array meets the preset condition, that is, the lowest level array can only have one array item.
[0097] For example: using a long array to construct a preset storage array, given 4000 billing indicators, the number of storage bits of a long array is 63, and 4000 / 63 needs to be rounded up to a 64-item long array, that is, a 64-item long array can store all the billing status of these 4000 billing indicators. Since it is stipulated that the lowest level array can only have one array, it is necessary to increase the level of array, that is, the second level array is required; second level array: 64 / 63 is rounded up to a 2-item long array, similarly, it is necessary to increase the level of array, that is, the third level array is required; 2 / 63 is rounded up to a 1-item long array, similarly, it is not necessary to increase the level of array, so it can be determined that the level is 3. It should be noted that some embodiments use formula 63 n-1 ≤Number of pre-design fee indicators≤63 n Perform series calculation, where n is the series, for example: 4000 pre-design fee indicators, then 63 3-1 ≤4000≤63 3 , the series is 3, which is the same as the result in the previous example.
[0098] This embodiment constructs the preset storage array by calculating the number of levels of the preset storage array.
[0099] In order to obtain the number of items in each level of array used to construct a preset storage array and the length of the last array item in each level of array, the method step S900 provided in the embodiment of the present application also includes S903-S906.
[0100] S903: When the number of pre-set design fee indicators is not greater than the number of storage locations of the single-item array, the number of items in the pre-set storage array is 1.
[0101] When the level of the preset storage array is one, the number of items of the preset storage array is calculated using a first calculation formula.
[0102] Wherein, the first calculation formula is:
[0103] L1=[N / A]+1
[0104] Wherein, L1 is the number of items in the preset storage array, N is the number of the preset design fee indicators, and A is the number of storage bits in a single-item array.
[0105] For example: the default storage array is level one, and the number of storage bits of a single-item array is 63. If there are 62 billing indicators, L1=[N / A]+1=L1=[62 / 63]+1=1; if there are 65 billing indicators, L1=[N / A]+1=L1=[65 / 63]+1=2.
[0106] S904. When the number of pre-design fee indicators is greater than the number of storage positions of the single-item array, the number of first single-item arrays required to store the billing status of all pre-design fee indicators is calculated, and the number of second single-item arrays required to store the overall billing status of each array in the upper-level array is calculated.
[0107] Among them, the number of the first single-item arrays is the number of items of the first-level array in the preset storage array, and the number of the second single-item arrays is the number of items of the lower-level array in the preset storage array.
[0108] The first calculation formula in step S903 is used to calculate the number of items in the first level array in the preset storage array.
[0109] The second calculation formula is used to calculate the number of items of the lower-level array in the preset storage array.
[0110] Wherein, the second calculation formula is:
[0111] L M =[L M-1 / A]+1
[0112] Where, L M is the number of items in the M-th level array in the preset storage array, L M-1 is the number of items in the M-1th level array in the preset storage array, and A is the number of storage bits that can be stored in a single-item array.
[0113] For example: the default storage array is level 2, the number of storage locations of a single-item array is 63, and there are 68 billing indicators, then L1 = [N / A] + 1 = L1 = [68 / 63] + 1 = 2; L2 = [L1 / A] + 1 = [2 / 63] + 1 = 1.
[0114] S905: When the number of pre-design fee indicators is not greater than the number of storage positions of a single-item array, the number of pre-design fee indicators is used as the last item array length of the preset storage array.
[0115] The third calculation formula is used to calculate the last array length of the preset storage array.
[0116] Wherein, the third calculation formula is:
[0117] l1=N%A
[0118] Wherein, l1 is the length of the last item of the preset storage array, N is the number of the preset design fee indicators, and A is the number of storage bits of a single-item array.
[0119] For example: the storage array is preset to level one, the number of storage bits of the single-item array is 63, if there are 62 pre-designed fee indicators, then l1=N%A=l1=62%63=62.
[0120] S906. When the number of billing indicators is greater than the number of storage bits of the single-item array, the first remainder of the number of billing indicators and the number of storage bits of the single-item array is calculated as the last array length of the first-level array in the pre-storage array, and the second remainder of the number of items of the single-item array contained in the upper-level array in the two adjacent levels of arrays and the number of storage bits contained in the single-item array is calculated.
[0121] The second remainder is used as the last array length of the corresponding lower-level array.
[0122] The third calculation formula in step S905 is used to calculate the last array length of the first level array in the pre-stored array.
[0123] The fourth calculation formula is used to calculate the last array length of other level arrays in the preset storage array.
[0124] Wherein, the fourth calculation formula is:
[0125] l M =L M-1 %A
[0126] In the formula, l M is the length of the last array item of the M-th level array in the preset storage array, L M-1 is the number of items in the M-1th level array in the preset storage array, and A is the number of storage bits that can be stored in a single-item array.
[0127] For example: the preset storage array is two-level, and the number of storage bits for a single-item array is 63. If there are 128 billing indicators, L1=3, indicating that the number of items in the first-level array in the preset storage array is 3, then l1=N%A=l1=128%63=2, 2 is the first remainder, which is the array length of the last item of the first-level array in the pre-storage array, that is, the array length of the third item is 2; l2=L1%A=3%63=3, 3 is the second remainder, which is the array length of the last item of the second-level array, that is, the only array length is 3.
[0128] This embodiment constructs the preset storage array by calculating the number of items in each level of array and the length of the lowest level of array.
[0129] In order to flexibly adjust the billing status of the billing indicator, the method provided in the embodiment of the present application further includes S1200-S1500 after completing S900-S1100.
[0130] S1200. When the billing of the billing indicator is completed, the billing indicator is stored as a billing completion mark in the corresponding storable position in the preset storage array.
[0131] During the calculation process, if a billing indicator is calculated, the value of the corresponding storable bit in the preset storage array needs to be changed from "0" representing the billing incomplete mark to "1" representing the billing complete mark, using the OR operation (|). The calculation rule of the OR operation (|) is that if two binary values in the same position have 1, the result is 1, otherwise it is 0.
[0132] The specific process is: when the calculation of the x-th billing indicator A is completed, the steps of changing the billing unfinished mark "0" on the corresponding storable position to the billing completed mark "1" are as follows:
[0133] (1) Through I x = x / 63 rounded up to get the long array in Array-1 where the billing index A is located;
[0134] (2) Through Ii x = x%63 calculates the storage position of the long array where the billing indicator A is located;
[0135] (3) Get the first x Item long array previous Ii x The billing status flags on all storable bits of the item form M 初始值 ;
[0136] (4) 2 x%63-1 Convert to binary value;
[0137] (5) Through the OR operation formula M 最终结果 =M 初始值 |2 x%63-1 M 初始值 with 2 x%63-1 The binary value is ORed to obtain the calculation result M 最终结果 , complete the first x Item Ii in long array x The unbilled completion flag "0" on the storable position of the item is changed to the billed completion flag "1".
[0138] For example:
[0139] (1) x is 67, I 124=67 / 63 is approximately equal to 1.06, rounded up to 2, which is I 67 =2, indicating that the 67th billing indicator is in the second long array in Array-1;
[0140] (2)Ii 67 =67%63=4, indicating that the 67th billing indicator is in the 4th storable position of the second long array in Array-1;
[0141] (3) Figure 4 As shown, obtain the billing status identifiers of all storable bits of the first 4 items in the second long array to form M 初始值 is: 10101;
[0142] (4) Figure 4 As shown, 2 x%63-1 =2 3 =8, the binary value of 8: 1000;
[0143] (5) Figure 4 As shown, through M 最终结果 =M 初始值 |2 x%63-1 =M 初始值 |8=11101, the 4th storable bit is changed from "0" to "1".
[0144] S1300. In any two adjacent arrays in the preset storage array, when all storable bits of the upper array store the billing completion mark, the billing mark on the corresponding storable bit in the lower array is changed from the billing incomplete mark to the billing completion mark.
[0145] In any two adjacent levels of arrays in the preset storage array, after step S1200, if all storable bits of the upper array store the billing completion mark, the billing mark on the corresponding storable bit in the lower array is changed from the billing incomplete mark to the billing completed mark.
[0146] For example: Figure 3 As shown, Array-1 and Array-2 of the preset storage arrays are adjacent upper and lower arrays. When all 63 storable bits in the first long array item in Array-1 are stored as "1", it means that the billing indicators corresponding to the first long array item have been billed. Then the first storable bit of the first long array item in Array-2 is modified from the billing incomplete flag "0" to the billing completed flag "1".
[0147] S1400. When the billing status of the billing indicator needs to be changed from billing completed to billing incomplete, the billing completed flag stored in the corresponding storage position of the billing indicator in the preset storage array is modified to a billing incomplete flag.
[0148] After step S1200 or S1300, when an abnormality occurs in the calculation process, for example, in a cluster environment, a node crash occurs in the calculation link corresponding to a billing indicator, resulting in the loss of data executed in this state, or due to a network failure, the node data corresponding to a billing indicator is inconsistent, etc., the billing status identifier stored in the storable position of the preset storage array will not match the actual billing status of the corresponding billing indicator, and the billing status identifier needs to be modified. The trigger condition can be set in advance, and when the trigger condition is met, the billing completion identifier stored in the storage position corresponding to the billing indicator in the preset storage array is modified to a billing incomplete identifier; wherein, the trigger condition at least includes a sudden crash of the computing node, a network failure, a program bug, etc., which are not specifically limited in this embodiment.
[0149] In this embodiment, when the billing status of a billing indicator needs to be changed from billing completed to billing incomplete, the AND operation (&) is used for calculation to change the billing status of the corresponding position from 1 to 0. The calculation rule of the AND operation (&): the result is 1 if the same bit of the two calculated binary numbers is 1, otherwise it is 0.
[0150] The specific process is: the steps of changing the billing completion mark "1" on the storage position corresponding to the x-th billing indicator A to the billing incomplete mark "0" are as follows:
[0151] (1) Through I x = x / 63 rounded up to get the long array in Array-1 where the billing index A is located;
[0152] (2) Through Ii x = x%63 calculates the storage position of the long array where the billing indicator A is located;
[0153] (3) Get the first x Item long array previous Ii x The billing status flags on all storable bits of the item form M 初始值 ;
[0154] (4) Will-(2 x%63-1 +1) is converted to binary value;
[0155] (5) Taking advantage of the fact that negative numbers are stored in two's complement in computers, the AND operation formula M 最终结果 =M 初始值 &(-(2x%63-1 +1)) M 初始值 With -(2 x%63-1 +1) and the binary value to obtain the calculation result M 最终结果 , complete the first x Item Ii on the long array x The billing completion mark "1" on the storable position of the item is changed to the billing incomplete mark "0".
[0156] For example:
[0157] (1) x is 67, I 124 =67 / 63 is approximately equal to 1.06, rounded up to 2, which is I 67 =2, indicating that the 67th billing indicator is in the second long array in Array-1;
[0158] (2)Ii 67 =67%63=4, indicating that the 67th billing indicator is in the 4th storable position of the second long array in Array-1;
[0159] (3) Figure 5 As shown, obtain the billing status identifiers of all storable bits of the first 4 items in the second long array to form M 初始值 is: 11101;
[0160] (4) Figure 5 As shown, -(2 x%63-1 +1) = -9, the binary value of -9 is 11110111;
[0161] (5) Figure 5 As shown, through M 最终结果 =M 初始值 &(-(2 x%63-1 +1))=M 初始值 &(-9)=10101, completing the modification of the 4th storable bit from "1" to "0".
[0162] S1500. In any two adjacent levels of arrays in the preset storage array, when the storable positions of a single-item array in the upper-level array are changed from all billing completion marks to at least one billing incomplete mark, the billing mark on the corresponding storable position in the lower-level array is changed from a billing completion mark to an incomplete billing mark.
[0163] In any adjacent two-level arrays in the preset storage array, after step S1400, if the storable bits of the single-item array in the upper-level array are changed from all billing completion marks to at least one billing incomplete mark, the billing mark on the corresponding storable bit in the lower-level array is changed from a billing completion mark to an incomplete billing mark.
[0164] For example: Figure 3 As shown, Array-1 and Array-2 of the preset storage arrays are adjacent upper and lower arrays. When all 63 storable bits in the first long type array in Array-1 are stored as "1", if at least one of the 63 storable bits is modified to "0", then the overall billing status corresponding to the first long type array item changes from billing completed to billing incomplete. Then, the first storable bit of the first long type array item in Array-2 changes from the billing completed mark "1" to the billing incomplete mark "0".
[0165] In order to better explain the solution provided in the embodiments of the present application, the following examples are given.
[0166] (1) The construction process of the preset storage array:
[0167] Assuming that the pre-design fee index is 4000, a long array is used for storage, which requires 64 long arrays. The calculation method is 4000 / 63=63 plus 31, which is rounded up to 64. Among them, the number of storage bits for the first 63 long arrays used to store data is 63, and the number of storage bits for the 64th long array used to store data is 31. The 64 long arrays are used as the first-level array;
[0168] To set up the second-level array, two long arrays are needed. The calculation method is 64 / 63=1 remainder 1, rounded up to 1. The first long array has 63 available bits for storing data, and the second long array has 1 available bits for storing data.
[0169] To set up the third-level array, one long array is needed, and the calculation method is 2 / 63 rounded up to 1, that is, the number of storage bits that can be used to store data in this long array is 2.
[0170] It should be noted that the initial value of each storable bit is "0", which means that the billing is not completed.
[0171] (2) Array status storage process:
[0172] The 4000 pre-design fee indicators are numbered from 1 to 4000, and a one-to-one correspondence is established between the pre-design fee indicators and all storable bits of all long type arrays in the first-level array in ascending order, specifically:
[0173] The pre-design fee indicators numbered 1-63 correspond to the 63 storable bits on the first long array of the first-level array in ascending order;
[0174] The pre-design fee indicators numbered 64-126 correspond to the 63 storable bits on the second long array of the first-level array in ascending order;
[0175] …
[0176] The pre-design fee indicators numbered 3907-3969 correspond to the 63 storable bits on the 63rd long array of the first-level array in ascending order;
[0177] The pre-design fee indicators numbered 3970-4000 correspond to the 31 storable bits on the 64th long array of the first-level array in ascending order.
[0178] It should be noted that: the billing status modification rule of the first-level array is that when a certain pre-designed billing indicator is completed, the initial value "0" is modified to "1" in the corresponding storable position;
[0179] A one-to-one correspondence is suggested for all storable bits of the 64-item long array of the first-level array and the 2-item long array of the second-level array, specifically:
[0180] The overall billing status of the long array items 1-63 of the first-level array corresponds to the 63 storable bits on the first long array item of the second-level array;
[0181] The overall billing status of the 64th long array item of the first-level array corresponds to one storable bit on the 2nd long array item of the second-level array.
[0182] It should be noted that the billing status storage rule of the second-level array is that only when all the storable bits on a long array item in the first-level array are 1, the corresponding storable bit of the second-level array is changed from the initial value "0" to "1", and no modification is made in other cases.
[0183] A one-to-one correspondence is suggested between the two long arrays of the second-level array and the two storable bits of the one long array of the third-level array, specifically:
[0184] The overall billing status of the two long array items in the second-level array corresponds to one storable bit in the only long array item in the third-level array.
[0185] It should be noted that the billing status storage rule of the third-level array is that only when all the storable bits on a long array item in the second-level array are 1, the corresponding storable bit of the third-level array is changed from the initial value "0" to "1", and no modification is made in other cases.
[0186] (3) Array status query process: When querying whether the 4000 pre-designed fee indicators have all been billed, first obtain the binary value of the two storable bits of the only long array in the third group. Assuming it is "11", convert 11 to decimal "3". Since the preset decimal value is also "3", it is determined that the billing process is completed; assuming it is "10", convert 10 to decimal "2", which is different from the preset decimal value "3", it is determined that the billing process is not completed.
[0187] It should be noted that the preset decimal value is set to 3 because the binary value stored in both storable bits when billing is completed is 1, so 11 is obtained, and the corresponding decimal value is 3. Therefore, the preset decimal value 3 in this embodiment represents the completion of billing execution.
[0188] When querying whether a pre-design fee indicator has been billed, first obtain the number of the pre-design fee indicator, assuming it is 2, and then based on the number 2, using the corresponding relationship, the corresponding position is the second storable bit of the first item of the long array of the first array, and then obtain the billing identifier stored in the storable bit. If it is 1, it means that the billing of the billing indicator numbered 2 is completed; if it is 0, it means that the billing of the billing indicator numbered 2 is not completed.
[0189] The method provided by the embodiment of the present application is to solve the problem that it is impossible to know which billing indicators have been calculated and which have not been calculated during the calculation process, and the problem that it is slow to judge whether the billing process is completed. The present invention calculates the number of levels of the preset storage array, the total length of each level of the array, and the length of the lowest level array to construct the preset storage array; each billing indicator is set with a number, and corresponds to the storable bit on the preset storage array, so as to be used to store the billing status of each billing indicator. In the calculation process, the bit operation is used to greatly improve the calculation efficiency; the preset storage array can be queried by the number of the billing indicator to obtain its billing status, which solves the problem that it is impossible to know which billing indicators have been calculated and which billing indicators have not been calculated. And the binary value stored on the lowest level array can be converted into a decimal system, and the billing status represented by the decimal value can be judged quickly to determine whether the billing process is completed, thereby improving the judgment speed. Moreover, the storage relationship between the upper and lower level arrays can realize that when a billing indicator result is rolled back, only the corresponding storable bit and the corresponding storable bit of the linked array need to be modified for the billing status, which will not affect the calculation results of other storable bits.
[0190] Furthermore, as a response to the above Figure 1 In order to realize the method shown in the figure, the embodiment of the present invention also provides a charging device based on an array structure, which is used to Figure 1 The device embodiment corresponds to the aforementioned method embodiment. For ease of reading, this device embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. Figure 6 As shown, the device comprises:
[0191] The first acquisition unit 31 is used to acquire the billing indicator to be determined; wherein the billing indicator is set with a unique number;
[0192] A query unit 32, configured to query a preset storage array based on the unique number of the billing indicator obtained from the first acquisition unit 31 to obtain a corresponding billing status identifier; wherein the billing status identifier of the billing indicator is stored in a storable position of the preset storage array;
[0193] A first determining unit 33 is configured to determine that the billing status of the billing indicator is billing completed if the billing status identifier obtained from the query unit 32 is consistent with the pre-designed billing completion identifier;
[0194] The second determining unit 34 is configured to determine that the billing status of the billing indicator is billing incomplete if the billing status identifier obtained from the querying unit 32 is inconsistent with the pre-designed billing completion identifier.
[0195] Furthermore, as a response to the above Figure 3 In order to realize the method shown in the figure, the embodiment of the present invention also provides another charging device based on the array structure, which is used to Figure 3 The device embodiment corresponds to the aforementioned method embodiment. For ease of reading, this device embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the device in this embodiment can correspond to all the contents of the aforementioned method embodiment. Figure 7 As shown, the device comprises:
[0196] The first acquisition unit 31 is used to acquire the billing indicator to be determined; wherein the billing indicator is set with a unique number;
[0197] A query unit 32, configured to query a preset storage array based on the unique number of the billing indicator obtained from the first acquisition unit 31 to obtain a corresponding billing status identifier; wherein the billing status identifier of the billing indicator is stored in a storable position of the preset storage array;
[0198] A first determining unit 33 is configured to determine that the billing status of the billing indicator is billing completed if the billing status identifier obtained from the query unit 32 is consistent with the pre-designed billing completion identifier;
[0199] The second determining unit 34 is configured to determine that the billing status of the billing indicator is billing incomplete if the billing status identifier obtained from the querying unit 32 is inconsistent with the pre-designed billing completion identifier.
[0200] The second acquisition unit 35 is used to acquire all billing status identifiers stored in the lowest level array of the preset storage array;
[0201] A conversion unit 36, configured to convert all the charging status identifiers obtained from the second acquisition unit 35 into decimal values;
[0202] A third determining unit 37, configured to determine that the charging process is completed if the decimal value obtained from the converting unit 36 is consistent with a preset decimal value;
[0203] A fourth determining unit 38, configured to determine that the billing process is not completed if the decimal value obtained from the converting unit 36 is inconsistent with a preset decimal value;
[0204] The third acquisition unit 39 is used to determine the number of levels of the preset storage array, the number of items in each level of the array, and the length of the last array item in each level of the array based on the number of the billing indicators and the number of storage bits of the single-item array; the construction unit 40 is used to construct the preset storage array based on the number of levels, the number of items in each level of the array, and the length of the last array item in each level of the array obtained from the third acquisition unit 39; wherein the number of levels of the preset storage array is at least one level;
[0205] The establishment unit 41 is used to establish the correspondence between the storable bits of the first-level array in the preset storage array obtained from the construction unit 40 and the pre-design fee indicator by using the serial number of the pre-design fee indicator, and to establish the correspondence between the storable bits in the lower-level array and the single-item array in the upper-level array, wherein the storable bits of the first-level array are used to store the billing status mark of the pre-design fee indicator. The storage unit 42 is used to store the billing completion mark of the pre-design fee indicator in the corresponding storable bits in the preset storage array obtained from the establishment unit 41 when the billing of the billing indicator is completed;
[0206] The modification unit 43 is used to modify the billing flag on the corresponding storable bit in the lower-level array from a billing incomplete flag to a billing completed flag in any two adjacent arrays in the preset storage array obtained from the storage unit 42 when all the storable bits in the upper-level array store a billing completed flag.
[0207] Further, the third acquisition unit 39 includes: a first determination module 391, which is used to determine that the level of the preset storage array is one level when the number of the preset design fee indicators is not greater than the number of storage positions of the single-item array;
[0208] The second determination module 392 is used to calculate the number of levels of the preset storage array using a preset calculation rule based on the number of the pre-design fee indicators and the number of storage bits of the single-item array when the number of the pre-design fee indicators is greater than the number of storage bits of the single-item array; wherein the preset calculation rule includes that the number of items of the lowest level array of the preset storage array meets a preset condition;
[0209] Furthermore, the third obtaining unit 39 further includes:
[0210] The third determining module 393 is used for, when the number of the pre-set design fee indicators is not greater than the number of storage positions of the single-item array, the number of items of the pre-set storage array is 1;
[0211] The fourth determination module 394, when the number of the pre-design fee indicators is greater than the number of storage positions of the single-item array, calculates the number of first single-item arrays required to store the billing status of all the pre-design fee indicators, and calculates the number of second single-item arrays required to store the overall billing status of each array in the upper array, the first single-item array number is the number of items in the first-level array in the preset storage array, and the second single-item array number is the number of items in the lower-level array in the preset storage array.
[0212] Furthermore, the third obtaining unit 39 further includes:
[0213] A fifth determining module 395, configured to use the number of the pre-design fee indicators as the last array length of the preset storage array when the number of the pre-design fee indicators is not greater than the number of storage positions of the single-item array;
[0214] The sixth determination module 396 is used to calculate the first remainder of the number of billing indicators and the number of storage bits of the single-item array as the last array length of the first-level array in the pre-stored array when the number of the billing indicators is greater than the number of storage bits of the single-item array, and calculate the second remainder of the number of items of the single-item array contained in the upper-level array in the two adjacent levels of arrays and the number of storage bits contained in the single-item array, and the second remainder is used as the last array length of the corresponding lower-level array.
[0215] Furthermore, an embodiment of the present invention further provides a processor, the processor is used to run a program, wherein the program executes the above Figure 1-2 The array structure-based billing method described in .
[0216] Furthermore, an embodiment of the present invention further provides a storage medium, wherein the storage medium is used to store a computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the above Figure 1-2 The array structure-based billing method described in .
[0217] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0218] It is understandable that the related features in the above methods and devices can be referenced to each other. In addition, the "first", "second" and the like in the above embodiments are used to distinguish the embodiments, and do not represent the advantages and disadvantages of the embodiments.
[0219] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0220] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description of the above specific languages is for disclosing the best mode of the present invention.
[0221] In addition, the memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0222] 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 adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0223] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0224] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate 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 A function specified in one or more boxes.
[0225] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0226] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0227] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0228] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. 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 disk read-only memory (CD-ROM), digital versatile disk (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 temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0229] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0230] 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 adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0231] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A billing method based on an array structure, characterized in that: The method comprises: Obtaining a billing indicator to be determined; wherein the billing indicator is provided with a unique number; Based on the unique number of the billing indicator, query the preset storage array to obtain the corresponding billing status identifier; wherein the billing status identifier of the billing indicator is stored in the storable position of the preset storage array, the preset storage array is a one-level or multi-level array, each level of the array includes one or more array items, and any two adjacent levels of arrays include an upper-level array and a lower-level array. In the any two adjacent levels of arrays, a storable position in the lower-level array stores a billing status identifier representing the overall billing status of a single array item in the upper-level array; If the billing status identifier is consistent with the pre-designed billing completion identifier, determining the billing status of the billing indicator as billing completion; If the billing status identifier is inconsistent with the pre-designed billing completion identifier, determining the billing status of the billing indicator as billing incomplete; The method comprises: obtaining all charging status identifiers stored in the lowest level array of the preset storage array; Convert all the billing status identifiers into decimal values; If the decimal value is consistent with the preset decimal value, it is determined that the billing process is completed; If the decimal value is inconsistent with the preset decimal value, it is determined that the billing process is not completed.
2. The method according to claim 1, characterized in that The method further comprises: Determine the number of levels of the preset storage array, the number of items in each level of the array, and the length of the last item in each level of the array based on the number of preset design fee indicators and the number of storage bits of the single-item array; Based on the number of levels, the number of items in each level of the array and the length of the last item in each level of the array, construct the preset storage array; wherein the number of levels of the preset storage array is at least one level; By using the number of the pre-design fee indicator, a correspondence is established between the storable bits of the first-level array in the preset storage array and the pre-design fee indicator, and a correspondence is established between the storable bits in the lower-level array and the single-item array in the upper-level array, wherein the storable bits of the first-level array are used to store the billing status identifier of the pre-design fee indicator.
3. The method according to claim 2, characterized in that The step of obtaining the number of levels of the preset storage array based on the number of the preset design fee indicators and the number of storage bits of the single-item array includes: When the number of the pre-design fee indicators is not greater than the number of storage positions of the single-item array, it is determined that the level of the preset storage array is one level; When the number of the pre-design fee indicators is greater than the number of storage bits of the single-item array, the number of levels of the preset storage array is calculated based on the number of the pre-design fee indicators and the number of storage bits of the single-item array using a preset calculation rule; wherein the preset calculation rule includes that the number of items in the lowest level array of the preset storage array meets a preset condition.
4. The method according to claim 3, characterized in that The obtaining the number of items of each level of the preset storage array based on the number of the preset design fee indicators and the number of storage bits of the single-item array comprises: When the number of the pre-set design fee indicators is not greater than the number of storage locations of the single-item array, the number of items in the pre-set storage array is 1; When the number of pre-design fee indicators is greater than the number of storage positions of the single-item array, the number of first single-item arrays required to store the billing status of all the pre-design fee indicators is calculated, and the number of second single-item arrays required to store the overall billing status of each array in the upper array is calculated, the first single-item array number is the number of items in the first-level array in the preset storage array, and the second single-item array number is the number of items in the lower-level array in the preset storage array.
5. The method according to claim 4, characterized in that The obtaining, based on the number of the preset design fee indicators and the number of storage bits of the single-item array, the length of the last array item in each level of the preset storage array comprises: When the number of the pre-design fee indicators is not greater than the number of storage bits of the single-item array, the number of the pre-design fee indicators is used as the last item array length of the preset storage array; When the number of the billing indicators is greater than the number of storage bits of the single-item array, the first remainder of the number of the billing indicators and the number of storage bits of the single-item array is calculated as the last array length of the first-level array in the preset storage array, and the second remainder of the number of items of the single-item array contained in the upper-level array in the two adjacent levels of arrays and the number of storage bits contained in the single-item array is calculated, and the second remainder is used as the last array length of the corresponding lower-level array.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When the billing of the billing indicator is completed, the billing indicator is stored as a billing completion mark in the corresponding storable position in the preset storage array; In any two adjacent levels of arrays in the preset storage array, when all the storable bits of the upper level array store a billing completion mark, the billing mark on the corresponding storable bit in the lower level array is modified from a billing incomplete mark to a billing completion mark.
7. The method according to claim 6, characterized in that The method further comprises: When the billing status of the billing indicator needs to be changed from billing completed to billing incomplete, the billing completed flag stored in the corresponding storage position of the billing indicator in the preset storage array is modified to a billing incomplete flag; In any adjacent two-level arrays in the preset storage array, when the storable positions of the single-item array in the upper-level array are changed from all billing completion marks to at least one billing incomplete mark, the billing mark on the corresponding storable position in the lower-level array is changed from a billing completion mark to an incomplete billing mark.
8. A charging device based on an array structure, characterized in that: include: A first acquisition unit is used to acquire a billing indicator to be determined; wherein the billing indicator is provided with a unique number; A query unit, used to query a preset storage array based on the unique number of the billing indicator to obtain a corresponding billing status identifier; wherein the billing status identifier of the billing indicator is stored in a storable position of the preset storage array, the preset storage array is a one-level or multi-level array, each level of the array includes one or more arrays, any two adjacent levels of arrays include an upper level array and a lower level array, and in the any two adjacent levels of arrays, a storable position in the lower level array stores a billing status identifier representing the overall billing status of a single array in the upper level array; A first determining unit, configured to determine that the billing status of the billing indicator is billing completed if the billing status identifier is consistent with the pre-designed billing completion identifier; A second determining unit is used to determine that the billing status of the billing indicator is billing incomplete if the billing status identifier is inconsistent with the pre-designed billing completion identifier; The device comprises: a second acquisition unit, used to acquire all billing status identifiers stored in the lowest level array of the preset storage array; A conversion unit, used for converting all the billing status identifiers obtained from the second acquisition unit into decimal values; A third determining unit, configured to determine that the billing process is completed if the decimal value obtained from the conversion unit is consistent with a preset decimal value; The fourth determining unit is configured to determine that the billing process is not completed if the decimal value obtained from the converting unit is inconsistent with a preset decimal value.
9. A storage medium comprising a stored program, characterized in that: When the program is running, the device where the storage medium is located is controlled to execute the array structure-based billing method described in any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the array structure-based billing method as described in any one of claims 1 to 7.
11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.