Summary of the invention
The invention provides charging method and the device of a kind of power optical fiber based on REST API to the family business, can realize the unified charging to the family business to multiple power optical fiber.
The invention provides following scheme:
A kind of power optical fiber based on REST API is to the charging method of family business, and described method comprises:
Obtain charging request message from the billing of services end interface; The uniform resource position mark URL that described charging request message comprises pending business;
Determine corresponding business information according to described URL; Described business information comprises user profile and described user's business use information;
Obtain billing scheme basic data corresponding to described user according to described user profile;
According to described business, use information and billing scheme basic data corresponding to described user to generate charging single in detail.
Preferably, describedly obtain billing scheme basic data corresponding to described user according to described user profile and comprise:
Obtain billing scheme basic data corresponding to described user according to described user profile from charging basic data cache interface.
Preferably, described billing scheme basic data comprises hire charge scheme basic data, price-list scheme basic data, preference scheme basic data and/or accumulated amount scheme basic data.
Preferably, at the URL that obtains described pending business according to described charging request message, before corresponding business information, described method also comprises: the access rights to described client are verified, specifically comprise:
Determine the IP of described client according to the URL of described pending business;
Obtain pre-stored IP from IP access control cache interface;
Judge the IP that whether comprises described client in described pre-stored IP;
If comprise, be verified.
Preferably, the information format of the URL of described pending business is as follows:
Accounting request type, charging way, serial number, Customs Assigned Number, production code member, context number, described client mac address, described client ip address, business time started, service ending time, charging duration, business uplink traffic and business downlink traffic.
The embodiment of the present invention also provides the message accounting of a kind of power optical fiber based on REST API to the family business, and described device comprises:
The charging request message acquiring unit, for obtaining charging request message from the billing of services end interface; The uniform resource position mark URL that described charging request message comprises pending business;
The business information determining unit, for determining corresponding business information according to described URL; Described business information comprises user profile and described user's business use information;
Billing scheme basic data acquiring unit, for obtaining billing scheme basic data corresponding to described user;
Charging Detail Record unit, single in detail for use billing scheme basic data corresponding to information and described user to generate charging according to described business.
Preferably, described billing scheme basic data acquiring unit, specifically for obtaining billing scheme basic data corresponding to described user according to described user profile from charging basic data cache interface.
Preferably, described billing scheme basic data comprises hire charge scheme basic data, price-list scheme basic data, preference scheme basic data and/or accumulated amount scheme basic data.
Preferably, described device also comprises authentication unit, for the access rights to client, is verified, described authentication unit specifically comprises:
The client ip determining unit, determine the IP of described client for the URL according to described pending business;
Pre-stored IP acquiring unit, for obtaining pre-stored IP from IP access control cache interface;
Whether judging unit, comprise the IP of described client for judging described pre-stored IP;
The checking subelement, if during for the IP that comprises described client at described pre-stored IP, by checking.
Preferably, the information format of described URL is:
Accounting request type, charging way, serial number, Customs Assigned Number, production code member, context number, described client mac address, described client ip address, business time started, service ending time, charging duration, business uplink traffic and business downlink traffic.
According to specific embodiment provided by the invention, the invention discloses following technique effect:
The present invention is by obtain the charging request message of the uniform resource position mark URL that comprises pending business from the billing of services end interface, and determines corresponding business information according to URL; In conjunction with after the billing scheme basic data obtained to have generated charging single in detail.Above-mentioned interface has adopted the form of REST API, therefore can not distinguish various platforms, has realized the unified charging service to multiple business.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, the every other embodiment that those of ordinary skills obtain, belong to the scope of protection of the invention.
The embodiment of the present invention 1 provide a kind of based on REST API power optical fiber to the family business charging method, executive agent of the present invention is the charging end.Referring to Fig. 1, the flow chart for the method, specifically comprise the steps:
S11, from the billing of services end interface, obtain charging request message; The uniform resource position mark URL that described charging request message comprises pending business.
In the present invention, for realizing the unified charging of many services, the billing of services end interface is designed to presentation state transitions interface REST API form.
REST (Representational State Transfer, table pictureization state transitions) is a kind of mode of the design and development for network application, can reduce the complexity of exploitation, improves the scalability of system.
The characteristics of REST design be by all things on network abstract be resource, and by the corresponding unique resource identification of each resource.To resource operation the time, be to be undertaken by general attachment unit interface.
Along with the development of telecommunications industry, the business provided is various, and service platform is also different.For this reason, the present invention is when carrying out the charging of related service, the billing of services end interface that just will receive charging request message is designed to the form of REST API, and the charging request message that client is sent finally can be obtained by the charging end with the form of uniform resource position mark URL.Following is the concrete form of a kind of URL:
http://192.168.186.185:7011/billing/billingservlet?CdrType=HOT&RecordType=HIT&RunningNum=0000000002
It means that accounting request type is HOT, charging way be HIT in due order, serial number is 2.
At power optical fiber, in the business of family, charging request message generally comprises user profile and user's business and uses information.User profile is as Customs Assigned Number, user's business use information as charging way (by flow FLW, in due order HIT, by duration TIM), production code member, start and concluding time (in due order), up-downgoing flow (pressing flow) etc.In actual applications, can define as required different message formats.Fig. 2 shows the defined a kind of concrete form of the embodiment of the present invention, specifically comprises:
Accounting request type (CdrType), charging way (RecordType), serial number (RunningNum), Customs Assigned Number (SubscrGuid), production code member (ProductGuid), context number (ContentGuid), MAC Address (MacAddress), IP address (IpAddress), time started (DatBegin), concluding time (DatEnd), charging duration (Duration), uplink traffic (UpStream), downlink traffic (DownStream).Above-mentioned every character string forms that is.
Corresponding with this message format, the URL form under a kind of concrete application scenarios below is provided:
http://192.168.186.185:7011/billing/billingservlet?CdrType=HOT&RecordType=HIT&RunningNum=0000000002&SubscrGuid=SCR2012071800070&ProductGuid=1&ContentGuid=2&MacAddress=macadr&IpAddress=ipadr&DatBegin=20120724103000&DatEnd=20120724103000&Duration=0&UpStream=1073741824&DownStream=1073741824
It means that the accounting request type of this charging request message is HOT, in due order, serial number is 2 to charging way, and Customs Assigned Number is SCR201207180007, production code member is 1, context number is 2, and MAC Address is macad, and the IP address is ipadr, the business time started is 10: 30 on the 24th July in 2012, the service ending time is 10: 30 on the 24th July in 2012, and the charging duration is 0, and the up-downgoing flow is 1073741824.
It should be noted that, when concrete application, not need to fill in complete by the information of above-mentioned every.Such as being in due order the time when charging way, the charging end just only need to know that each business time started and concluding time get final product, and without knowing the information such as charging duration or up-downgoing flow.Same, when charging way is during by duration, business time started, concluding time and up-downgoing flow are just not necessarily.
For guaranteeing fail safe, the present invention can be verified the access rights of client, and whether concrete IP address that can be by judging client is that carry out the IP address of appointment.For this reason, the IP address of IP access control cache interface with pre-stored appointment can be set.When the IP of appointment has renewal, can carry out synchronously this interface, to upgrade the IP of buffer memory.
When the charging termination is received charging request message, obtain the IP of the client that the URL of pending business is corresponding.Obtain pre-stored IP from IP access control cache interface afterwards.Judge the IP that whether comprises described client in pre-stored IP, if comprise, be verified, can proceed subsequent operation.
S12, according to the URL of described pending business, determine corresponding business information; Described business information comprises user profile and described user's business use information.
As previously mentioned, comprise the design parameter of various information in URL, the charging end can determine that corresponding business information is as charging way, Customs Assigned Number etc. accordingly.
S13, according to described user profile, obtain billing scheme basic data corresponding to described user.
Different users may order different set meals, and different set meals has different billing schemes.Such as the user may order the set meal of monthly payment electricity consumption.For this reason, need to which kind of set meal and the corresponding basic datas such as billing scheme have been customized as the order relations that Customs Assigned Number obtains this user according to user's information.
Above-mentioned billing scheme basic data is stored in database, and the charging end can obtain corresponding billing scheme basic data from database after determining the business information that URL is corresponding.
For accelerating acquisition speed, in the preferred embodiment of the present invention, can be by above-mentioned charging basic data buffer memory, concrete, after charging flow starts, the charging end will be read into various billing scheme basic datas in buffer memory as required.Then the charging end obtains billing scheme basic data corresponding to user according to user profile from charging basic data cache interface.When change occurs in the relevant charging basic data in database, but the related data in the synchronous refresh buffer memory.
Charging basic data in the present invention can comprise set meal scheme basic data, price-list scheme basic data, hire charge scheme basic data and preference scheme basic data etc.
S14, according to described business, to use information and billing scheme basic data corresponding to described user to generate charging single in detail.
It is single in detail that the charging end is used information and relevant billing scheme basic data just can generate corresponding charging according to the business of obtaining.
Corresponding said method, the present invention also provides the message accounting of a kind of power optical fiber based on REST API to the family business, and referring to Fig. 3, this device comprises:
Charging request message acquiring unit 11, for obtaining charging request message from the billing of services end interface; The uniform resource position mark URL that described charging request message comprises pending business.
Business information determining unit 12, for determining corresponding business information according to described URL; Described business information comprises user profile and described user's business use information.
In the present invention, for realizing the unified charging of many services, the billing of services end interface is designed to presentation state transitions interface REST API form.The charging request message acquiring unit just can obtain from the billing of services end interface charging request message of URL form like this.Following is the concrete form of a kind of URL:
http://192.168.186.185:7011/billing/billingservlet?CdrType=HOT&RecordType=HIT&RunningNum=0000000002
It means that accounting request type is HOT, charging way be HIT in due order, serial number is 2.
At power optical fiber, in the business of family, charging request message generally comprises user profile and user's business and uses information.User profile is as Customs Assigned Number, user's business use information as charging way (by flow FLW, in due order HIT, by duration TIM), production code member, start and concluding time (in due order), up-downgoing flow (pressing flow) etc.In actual applications, can define as required different message formats.Fig. 2 shows the defined a kind of concrete form of the embodiment of the present invention, specifically comprises:
Accounting request type (CdrType), charging way (RecordType), serial number (RunningNum), Customs Assigned Number (SubscrGuid), production code member (ProductGuid), context number (ContentGuid), MAC Address (MacAddress), IP address (IpAddress), time started (DatBegin), concluding time (DatEnd), charging duration (Duration), uplink traffic (UpStream), downlink traffic (DownStream).Above-mentioned every character string forms that is.
Corresponding with this message format, the URL form under a kind of concrete application scenarios below is provided:
http://192.168.186.185:7011/billing/billingservlet?CdrType=HOT&RecordType=HIT&RunningNum=0000000002&SubscrGuid=SCR2012071800070&ProductGuid=1&ContentGuid=2&MacAddress=macadr&IpAddress=ipadr&DatBegin=20120724103000&DatEnd=20120724103000&Duration=0&UpStream=1073741824&DownStream=1073741824
Visible by above-mentioned form, carried relevant required parameter value in URL.The business information determining unit just can be determined related service information accordingly, such as just determining by above-mentioned URL: the accounting request type of this charging request message is HOT, charging way in due order, serial number is 2, Customs Assigned Number is SCR201207180007, production code member is 1, context number is 2, MAC Address is macad, the IP address is ipadr, and the business time started is 10: 30 on the 24th July in 2012, and the service ending time is 10: 30 on the 24th July in 2012, the charging duration is 0, and the up-downgoing flow is 1073741824.
It should be noted that, when concrete application, the information of above-mentioned every not all needs to fill in complete.Such as being in due order the time when charging way, the charging end just only need to know that each business time started and concluding time get final product, and without knowing the information such as charging duration or up-downgoing flow.Same, when charging way is during by duration, business time started, concluding time and up-downgoing flow are just not necessarily.
For guaranteeing fail safe, the present invention can be verified the access rights of client, and whether concrete IP address that can be by judging client is that carry out the IP address of appointment.Corresponding described device also comprises: authentication unit 15, for the access rights to client, verified.Referring to Fig. 4, authentication unit specifically comprises:
Client ip determining unit 21, determine the IP of described client for the URL according to described pending business.
Pre-stored IP acquiring unit 22, for obtaining pre-stored IP from IP access control cache interface.
Wherein, when the IP of appointment has renewal, can control cache interface to this IP and carry out synchronously, to upgrade the IP of buffer memory.
Whether judging unit 23, comprise the IP of described client for judging described pre-stored IP.
Checking subelement 24, if during for the IP that comprises described client at described pre-stored IP, by checking.
Billing scheme basic data acquiring unit 13, for obtaining billing scheme basic data corresponding to described user.
Different users may order different set meals, and different set meals has different billing schemes.Such as the user may order the set meal of monthly payment electricity consumption.For this reason, billing scheme basic data acquiring unit need to customize which kind of set meal and the corresponding basic datas such as billing scheme as the order relations that Customs Assigned Number obtains this user according to user's information.
Above-mentioned billing scheme basic data is stored in database, and billing scheme basic data acquiring unit can obtain corresponding billing scheme basic data from database after determining the business information that URL is corresponding.
For accelerating acquisition speed, in the preferred embodiment of the present invention, can be by above-mentioned charging basic data buffer memory, concrete, after charging flow starts, will as required various billing scheme basic datas be read in buffer memory.Then billing scheme basic data acquiring unit just can obtain billing scheme basic data corresponding to described user from charging basic data cache interface according to user profile.
When change occurs in the relevant charging basic data in database, but the related data in the synchronous refresh buffer memory.
It should be noted that, the charging basic data in the present invention can comprise set meal scheme basic data, price-list scheme basic data, hire charge scheme basic data and preference scheme basic data etc.
Charging Detail Record unit 14, single in detail for use billing scheme basic data corresponding to information and described user to generate charging according to described business.
It is single in detail that Charging Detail Record unit is used information and relevant billing scheme basic data just can generate corresponding charging according to the business of obtaining.
Above charging method and the device that a kind of power optical fiber based on REST API provided by the present invention is arrived to the family business, be described in detail, applied specific case herein principle of the present invention and execution mode are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications.In sum, this description should not be construed as limitation of the present invention.