Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached in the embodiment of the present inventionFigure, the technical scheme in the embodiment of the present invention is explicitly described, it is clear that described embodiment is a part of the inventionEmbodiment, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not making woundThe every other embodiment obtained under the premise of the property made work, belongs to the scope of protection of the invention.
In the present invention, based on Web technologies, the fee deduction treatment method of API service provided by the invention is deployed in Web and heldIn device, especially deploy the API service for needing to pay and provide a user in the Web container of API service calling.The WebContainer can use the Web container run in JAVA virtual machine.User can be by client such as mobile phone or computer, with carryingFor being communicated between the server of the API service, the API service is called.The API service can include identity real nameAuthentication service, mobile telephone real-name authentication service etc..Because the fee deduction treatment method of API service provided by the invention is based on Web technologies,Can with above-mentioned API service one is logical is deployed in the Web container, it is possible to increase the accuracy of charging and ageing, furtherGround, due to independent of special accounting server and device, there is portable and reusability, API service can be reduced and carriedFor the cost of business.
Fig. 1 is the schematic flow sheet of the fee deduction treatment method of one embodiment of the invention API service, as shown in figure 1, of the inventionThe fee deduction treatment method of the API service of offer, including:
S101, API service call request is received, the API service call request includes user's mark and service identifiers;
Specifically, the user end to server sends API service call request, and the server can receive the callingRequest, the call request include user's mark and service identifiers;Wherein, API service call request is used to call corresponding APIService;User's mark is corresponded with user account, and the user account can be inquired by user mark;InstituteState service identifiers to be used to distinguish various API services, every kind of API service there are unique corresponding service identifiers.It is intelligibleIt is that the server can receive the API service call request of multiple clients simultaneously.
S102, generation withholding fee gold corresponding with user mark is identified according to the service identifiers and the userVolume;
Specifically, the server determines that this API takes after the call request is received according to the service identifiersThe expense of business, i.e. the withholding fee amount of money, and the withholding fee amount of money is corresponding with user mark.Because the server canIt is to handle multiple API service call requests simultaneously, the withholding fee amount of money is corresponding with user's mark, ensure data of deducting feesAccuracy.It will be appreciated that every kind of API service has corresponding expense, the expense can pass through the service identifiersInquiry obtains.
If S103, judgement know that service result meets requirement of deducting fees, mark of deducting fees is generated;Wherein, the service resultIt is in response to the API service call request and carries out what is returned after API service calling, mark and the user mark phase of deducting feesIt is corresponding;
Specifically, the server calls corresponding API service and run, in institute according to the API service call requestAfter the completion of stating API service operation, corresponding service result can be returned to, the service knot that the service result is deducted fees with needsFruit compares, if the service result is consistent with the service result for needing to be deducted fees, then the service result meets buttonExpense requires that the server can generate button corresponding with user mark, it is necessary to be charged to the calling of the API serviceTake mark.
For example, it is necessary to which the service result paid is in identity real name authentication service:Successful inquiring, name and bodyPart results card is consistent;Successful inquiring, name and ID card verification are inconsistent;The service result that need not be paid is:Inquiry failure.If the user is identified as 65c55123 user after the identity real name authentication service is carried out, the service result is to look intoAsk successfully, name and ID card verification are inconsistent, then need to be paid, and the server generation is corresponding with 65c55123 to detainTake mark.
S104, deducted fees according to mark, the withholding fee amount of money and user mark progress fee deduction treatment.
Specifically, the server can obtain institute corresponding with the mark of deducting fees after mark of being deducted fees described in acquisitionState user mark, by the user identify inquiry obtain with the corresponding user account of user mark, i.e., confirmation need intoThe user account that row is deducted fees, according to the withholding fee amount of money corresponding to user mark, you can confirm that the user account needsThe expense for this time API service to be deducted, the server deduct the withholding fee amount of money from the user account, andThe data syn-chronization of the user account after deducting fees is into customer data base, so as to complete fee deduction treatment.It will be appreciated that instituteState customer data base to pre-establish, the data of the user account can be included, the server can pass through the useFamily identifier lookup user account corresponding to.
The fee deduction treatment method of API service provided by the invention, due to API service call request can be received, according to APIThe service identifiers and user that service invocation request includes, which identify, generates the withholding fee amount of money corresponding with user's mark, is judging to knowService result satisfaction is deducted fees after requirement, generates mark of deducting fees, and call according to deduct fees mark, the withholding fee amount of money and API serviceThe user for asking to include, which identifies, carries out fee deduction treatment, improves the charging efficiency of API service.
Fig. 2 is the schematic flow sheet of the fee deduction treatment method of another embodiment of the present invention API service, as shown in Fig. 2 upperOn the basis of stating embodiment, further, mark of being deducted fees described in the basis, the withholding fee amount of money and the user identify intoRow fee deduction treatment includes:
S1041, the user account that mark determines to be deducted fees of being deducted fees according to;Wherein, the user account with it is describedUser, which identifies, to be corresponded;
Specifically, the server can obtain institute corresponding with the mark of deducting fees after mark of being deducted fees described in acquisitionUser's mark is stated, identify inquiry acquisition by the user identifies one-to-one user account with the user, you can it is determined thatNeed the user account deducted fees.
S1042, the withholding fee amount of money is deducted from the user account.
Specifically, the server identifies after the user account for needing to be deducted fees is obtained according to the userThe withholding fee amount of money corresponding with user mark can be obtained, the withholding fee is then deducted from the user accountThe amount of money.It will be appreciated that the server will can deduct fees after the user account data syn-chronization into customer data base,To ensure to upgrade to the user account data in time.
On the basis of the various embodiments described above, further, generation is being identified according to the service identifiers and the userAfter the withholding fee amount of money corresponding with user mark, in addition to:Caching is described corresponding described pre- with user markDeduct fees the amount of money.
Specifically, because the server can receive the API service call request of multiple clients simultaneously, right, it is necessary to certain stand-by period when the API service call request is handled, the server can by described in generation withThe withholding fee amount of money corresponding to user's mark is cached, and is detained again after waiting corresponding mark of deducting fees to be obtainedTake processing, the treatment effeciency to the API service call request can be improved.
On the basis of the various embodiments described above, further, identified described according to the service identifiers and the userAfter the generation withholding fee amount of money corresponding with user mark, in addition to:
If judge to know the type of user account corresponding to user's mark as prepaid account, according to the userThe remaining sum of mark inquiry user account;
If judgement knows that the remaining sum is less than the withholding fee data, the API service is interrupted.
Specifically, the type of the user account includes prepaid account, and the user of the prepaid account type is enteringThe row API service needs to confirm the expense for having the enough amount of money to pay this API service in the user account before calling.InstituteStating server can inquire and the corresponding user of user mark according to user mark in the customer data baseThe type of account, if the type of the user account is prepaid account, then can be inquired about and obtained according to user markObtain the remaining sum of the user account corresponding with user mark;The server by the user identify corresponding to withholding feeThe amount of money and the remaining sum are contrasted, if the remaining sum is less than the withholding fee data, illustrate the user account without footThe enough amount of money pays the expense of this API service, and the server interrupts the calling of the API service.The server can be withWhile the API service is interrupted, the account prompt message that Sorry, your ticket has not enough value is returned to the client, to remind the useFamily is supplemented with money by its user account.If it will be appreciated that the remaining sum is more than or equal to the withholding fee data, the serviceDevice continues the API service.
Fig. 3 is the structural representation of one embodiment of the invention server, as shown in figure 3, server bag provided by the inventionService receiving unit 301, computing unit 302 of deducting fees, deduct fees confirmation unit 303 and fee deduction treatment unit 304 are included, wherein:
Service receiving unit 301 is used to receive API service call request, and the API service call request is marked including userKnowledge and service identifiers;Computing unit 302 of deducting fees is used to identify generation and the user according to the service identifiers and the userThe withholding fee amount of money corresponding to mark;If confirmation unit 303 of deducting fees is used to judge to know that service result meets requirement of deducting fees, generateDeduct fees mark;Wherein, the service result is in response to the API service call request and carries out what is returned after API service calling, instituteIt is corresponding with user mark to state mark of deducting fees;Fee deduction treatment unit 304 is used for deducted fees according to mark, the withholding feeThe amount of money and the user, which identify, carries out fee deduction treatment.
Specifically, the user end to server sends API service call request, and service receiving unit 301 can receive instituteCall request is stated, the call request includes user's mark and service identifiers;Wherein, API service call request is used to call phaseThe API service answered;User's mark is corresponded with user account, and the user can be inquired by user markAccount;The service identifiers are used to distinguish various API services, and every kind of API service has unique corresponding service identifiers.CanUnderstand, service receiving unit 301 can receive the API service call request of multiple clients simultaneously.
After the call request is received, computing unit 302 of deducting fees determines this API service according to the service identifiersExpense, i.e. the withholding fee amount of money, and the withholding fee amount of money is corresponding with user mark.Because the server can be withMultiple API service call requests are handled simultaneously, the withholding fee amount of money is corresponding with user's mark, and guarantee is deducted fees the standards of dataTrue property.It will be appreciated that every kind of API service has corresponding expense, the expense can be looked into by the service identifiersAsk and obtain.
The server calls corresponding API service and run, taken in the API according to the API service call requestAfter the completion of business operation, corresponding service result can be returned to, confirmation unit 303 of deducting fees is deducted fees the service result with needsService result compare, if the service result is consistent with needing the service result deducted fees, then the service knotFruit meets to deduct fees requirement, it is necessary to be charged to the calling of the API service, and confirmation unit 303 of deducting fees can generate and the useDeducted fees mark corresponding to the mark of family.
Fee deduction treatment unit 304 can obtain corresponding with the mark of deducting fees described after mark of being deducted fees described in acquisitionUser identifies, and identify inquiry by the user and obtain needs to carry out with the corresponding user account of user mark, i.e. confirmationThe user account deducted fees, according to the withholding fee amount of money corresponding to user mark, you can confirm the user account needsThe expense of this time API service deducted, fee deduction treatment unit 304 deduct the withholding fee gold from the user accountVolume, and the data syn-chronization of the user account after deducting fees is into customer data base, so as to complete fee deduction treatment.It is intelligibleIt is that the customer data base pre-establishes, the data of the user account can be included, the server can passes through instituteState user's identifier lookup user account corresponding to.
Server provided by the invention, due to API service call request can be received, according to API service call request bagThe service identifiers included and user, which identify, generates the withholding fee amount of money corresponding with user's mark, is judging to know that service result meets buttonAfter taking requirement, mark of deducting fees, and the user included according to deduct fees mark, the withholding fee amount of money and API service call request are generatedMark carries out fee deduction treatment, improves the charging efficiency of API service.
Fig. 4 is the structural representation of another embodiment of the present invention server, as shown in figure 4, fee deduction treatment unit 304 includesSubelement 3041 and subelement 3042 of deducting fees are obtained, wherein:
Obtain subelement 3041 and be used for the user account that mark determines to be deducted fees of being deducted fees according to;Wherein, the useFamily account is identified with the user and corresponded;Subelement 3042 of deducting fees is used to deduct the withholding fee from the user accountThe amount of money.
Specifically, subelement 3041 is obtained after mark of being deducted fees described in acquisition, can be obtained corresponding with the mark of deducting feesUser mark, pass through the user and identify inquiry and obtain and identify one-to-one user account with the user, you canIt is determined that need the user account deducted fees.
Subelement 3042 deduct fees after obtaining and needing the user account deducted fees, can be with according to user markThe withholding fee amount of money corresponding with user mark is obtained, the withholding fee gold is then deducted from the user accountVolume.It will be appreciated that subelement 3042 of deducting fees will can deduct fees after the user account data syn-chronization to customer data baseIn, to ensure to upgrade to the user account data in time.
Fig. 5 is the structural representation of further embodiment of this invention server, as shown in figure 5, server provided by the inventionAlso include:
Buffer unit 305 is used to cache the withholding fee amount of money corresponding with user mark.
Specifically, because the server can receive the API service call request of multiple clients simultaneously, right, it is necessary to which certain stand-by period, buffer unit 305 can be by described in generations when the API service call request is handledThe withholding fee amount of money corresponding with user mark is cached, after the corresponding mark of deducting fees to be obtained such as described serverFee deduction treatment is carried out again, can improve the treatment effeciency to the API service call request.
Fig. 6 is the structural representation of further embodiment of this invention server, as shown in fig. 6, server provided by the inventionAlso include the first judging unit 306 and the second judging unit 307, wherein:
If the first judging unit 306 be used to judging to know the user identify corresponding to user account type as pre-paymentAccount, then obtain the remaining sum of the user account;If the second judging unit 307 is used to judge to know that if the remaining sum is known in judgementLess than the withholding fee amount of money, then the API service is interrupted.
Specifically, the type of the user account includes prepaid account, and the user of the prepaid account type is enteringThe row API service needs to confirm the expense for having the enough amount of money to pay this API service in the user account before calling.TheOne judging unit 306 can inquire corresponding with user mark according to user mark in the customer data baseThe type of user account, if the type of the user account is prepaid account, then can be looked into according to user markAsk the remaining sum for obtaining the user account corresponding with user mark;
Second judging unit 307 is contrasted the withholding fee amount of money and the remaining sum corresponding to user mark, ifThe remaining sum is less than the withholding fee data, illustrates the expense that the user account does not have the enough amount of money to pay this API serviceWith the second judging unit 307 interrupts the calling of the API service.Second judging unit 307 can interrupt the API serviceWhile, the account prompt message that Sorry, your ticket has not enough value is returned to the client, to remind the user to enter its user accountRow is supplemented with money.If it will be appreciated that the remaining sum is more than or equal to the withholding fee data, the server continues describedAPI service.
The embodiment of server provided by the invention specifically can be used for the handling process for performing above-mentioned each method embodiment,Its function will not be repeated here, and be referred to the detailed description of above method embodiment.
Fig. 7 is one embodiment of the invention electronic equipment entity structure schematic diagram, as shown in fig. 7, the electronic equipment includesProcessor (processor) 701, memory (memory) 702 and communication bus 703;
Wherein, processor 701, memory 702 complete mutual communication by communication bus 703;
Processor 701 is used to call programmed instruction in memory 702, is provided with to perform above-mentioned each method embodimentMethod, such as including:API service call request is received, the API service call request includes user's mark and service identifiers;Identified according to the service identifiers and the user and generate the withholding fee amount of money corresponding with user mark;If clothes are known in judgementBusiness result meets requirement of deducting fees, then generates mark of deducting fees;Wherein, the service result is in response to the API service call requestReturned after progress API service calling, the mark of deducting fees is corresponding with user mark;According to the mark of deducting fees, instituteState the withholding fee amount of money and the user identifies and carries out fee deduction treatment.
The present embodiment discloses a kind of computer program product, and the computer program product includes being stored in non-transient calculatingComputer program on machine readable storage medium storing program for executing, the computer program include programmed instruction, when described program instruction is calculatedWhen machine performs, computer is able to carry out the method that above-mentioned each method embodiment is provided, such as including:API service is received to callRequest, the API service call request include user's mark and service identifiers;Identified according to the service identifiers and the userThe generation withholding fee amount of money corresponding with user mark;If judgement knows that service result meets requirement of deducting fees, generation is deducted feesMark;Wherein, the service result is in response to the API service call request and carries out what is returned after API service calling, the buttonIt is corresponding with user mark to take mark;Identified and carried out according to the mark of deducting fees, the withholding fee amount of money and the userFee deduction treatment.
The present embodiment provides a kind of non-transient computer readable storage medium storing program for executing, the non-transient computer readable storage medium storing program for executingComputer instruction is stored, the computer instruction makes the computer perform the method that above-mentioned each method embodiment is provided, exampleSuch as include:API service call request is received, the API service call request includes user's mark and service identifiers;According to describedService identifiers and the user, which identify, generates the withholding fee amount of money corresponding with user mark;If judgement knows that service result expiresFoot is deducted fees requirements, then generates mark of deducting fees;Wherein, the service result is in response to the API service call request and carries out API clothesWhat business returned after calling, the mark of deducting fees is corresponding with user mark;According to the mark of deducting fees, withholding fee goldVolume and the user, which identify, carries out fee deduction treatment.
In addition, the logical order in above-mentioned memory can be realized by the form of SFU software functional unit and is used as independentProduction marketing or in use, can be stored in a computer read/write memory medium.Based on such understanding, the present inventionThe part that is substantially contributed in other words to prior art of technical scheme or the part of the technical scheme can be with softwareThe form of product is embodied, and the computer software product is stored in a storage medium, including some instructions are causingOne computer equipment (can be personal computer, device, or network equipment etc.) is performed described in each embodiment of the present inventionThe all or part of step of method.And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can be withThe medium of store program codes.
Device embodiment described above is only schematical, wherein the unit illustrated as separating component canTo be or may not be physically separate, it can be as the part that unit is shown or may not be physics listMember, you can with positioned at a place, or can also be distributed on multiple NEs.It can be selected according to the actual needsIn some or all of module realize the purpose of this embodiment scheme.Those of ordinary skill in the art are not paying creativenessWork in the case of, you can to understand and implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment canRealized by the mode of software plus required general hardware platform, naturally it is also possible to pass through hardware.Based on such understanding, onThe part that technical scheme substantially in other words contributes to prior art is stated to embody in the form of software product, shouldComputer software product can store in a computer-readable storage medium, such as ROM/RAM, magnetic disc, CD, including some fingersMake to cause a computer equipment (can be personal computer, server, or network equipment etc.) to perform each implementationMethod described in some parts of example or embodiment.
Finally it should be noted that:The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;AlthoughThe present invention is described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be usedTo be modified to the technical scheme described in foregoing embodiments, or equivalent substitution is carried out to which part technical characteristic;And these modification or replace, do not make appropriate technical solution essence depart from various embodiments of the present invention technical scheme spirit andScope.