Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, completeSite preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hairEmbodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative effortsExample, shall fall within the protection scope of the present invention.
Interface allocation method provided in an embodiment of the present invention, the interface allocation method can apply ring using as shown in Figure 1In border.Specifically, which applies in interface configuration system, and it includes as shown in Figure 1 which, which configures system,Client and server-side, client are communicated with server-side by network, and the allocative efficiency for solving interface function is low to askTopic.Wherein, client is also known as user terminal, refers to corresponding with server-side, provides the program of local service for client.ClientIt is mountable but be not limited to various personal computers, laptop, smart phone, tablet computer and portable wearable deviceOn.Server-side can be realized with the server cluster of the either multiple server compositions of independent server.
In one embodiment, as shown in Fig. 2, providing a kind of interface allocation method, the service in Fig. 1 is applied in this wayIt is illustrated, includes the following steps: for end
S10: obtaining interface configuring request, and interface configuring request includes at least two interface identifier.
Wherein, interface configuring request refers to trigger request when configuring to several preset interfaces.Interface configuring request packetAt least two interface identifier are included, that is, the preset interface at least two configured.Interface refers to application programming interface, also referred to asFor API (Application Programming Interface).Preset interface refers to several interfaces of pending configuration.InterfaceMark refers to identification number corresponding to the preset interface of pending configuration, and interface identifier corresponding to distinct interface is different, i.e., eachInterface identifier corresponding to interface uniquely determines, according to interface identifier you can learn that corresponding interface.Specifically, interfaceMark can be made of at least one in number, letter, text or symbol.Optionally, as corresponding to distinct interfaceInterface IP address uniquely determines, therefore interface IP address can be used as interface identifier corresponding to each interface.Specifically, it usesFamily executes the operation behavior of interface configuration in customer terminal webpage to preset interface, and after generating interface configuring request, server is from visitorFamily end obtains corresponding interface configuring request.
S20: the corresponding original configuration function of each interface is obtained according to each interface identifier.
Wherein, original configuration function refers to realize to execute each preset interface and calling compiled code.Distinct interfaceCorresponding original configuration function is different, that is, calls different interfaces that need to go to realize using different original configuration functions, eachInterface has the original configuration function being associated.Specifically, the corresponding original configuration of each interface is obtained according to interface identifierFunction includes: the preset interface that pending configuration is first determined according to each interface identifier, is then obtained and each preset interface phaseAssociated original configuration function.
S30: comparing and analyzing original configuration function, obtains original public function and original differences function.
Wherein, original public function refers to each original configuration function is compared and analyzed after, at least two obtained are formerThe public function that beginning configuration function all includes.Original differences function refers to original configuration function is compared and analyzed after, obtainCertain distinctive difference functions of original configuration function.Specifically, original configuration function is compared and analyzed and is referred to originalAll subfunctions that configuration function is included carry out Functional Analysis comparison, and original public function is extracted from original configuration functionWith the process of original differences function.Optionally, comparing and analyzing to original configuration function can be by obtaining original configuration letterSeveral included sub- configuration functions, and function name corresponding to the sub- configuration function that will acquire is matched one by one, then by letterSeveral quantity to match are greater than or equal to the sub- configuration function of preset threshold as original public function, and by function famous prime ministerThe quantity matched is less than the sub- configuration function of preset threshold as original differences function.Wherein, preset threshold refers to for judging that son is matchedSet the value whether function belongs to original public function.Such as: preset threshold can be 2,5 or 7 etc..User can basisThe size of preset threshold is arranged from justice surely for actual conditions.Additionally, also function comparative analysis request can be sent to client in advance,Obtain the function comparative analysis rule that client returns, and according to the function comparative analysis rule to the raw interface function intoRow comparative analysis obtains original public function and original differences function.Wherein, function processing rule refers to judgement raw interface functionThe subfunction for being included is a kind of rule for belonging to original public function or belonging to original differences function.Illustratively, functionHandling rule can be with are as follows: using function code matching rate be greater than 80 percent corresponding to sub- configuration function as original public letterNumber, by function code matching rate less than 10 corresponding to sub- configuration function be considered as original differences function.
Illustratively, if according to interface identifier get three interfaces corresponding to original configuration function be respectively as follows: interface ACorresponding original configuration function A, the corresponding original configuration function C of interface B corresponding original configuration function B and interface C;And it is originalConfiguration function A includes transferring url function and Certificate Authority function;Original configuration function B includes transferring url function, and formerBeginning configuration function C includes transferring url function;To original configuration function A, original configuration function B and original configuration function C intoAfter row comparative analysis, the transferring url function of original configuration function A, the transferring url function of original configuration function B and original are obtainedThe function name of the transferring url function of configuration function C is identical, then extracts transferring url function as original public function;It is formerThe Certificate Authority function of beginning configuration function A is the distinctive difference function of original configuration function A, then extracts Certificate Authority functionAs original differences function.
S40: unified configuration is carried out to original public function and original differences function, obtains common configuration function.
Wherein, common configuration function refers to carries out unifying to match postponing resulting match to original public function and original differences functionSet function.In the present embodiment, each original configuration function is compared and analyzed according to step S30, obtained original public affairsFunction and original differences function are existed in the form of key-value pair (key-value) altogether.Specifically, to original public function andOriginal differences function carries out unified configure and refers mainly to the unified key for being included to original public function and original differences function againAssign the process of corresponding formal parameter value.Carrying out unified configure to original public function and original differences function can pass throughThe mode of Python function parameter transmitting every key into original public function and original differences function transmits corresponding form ginsengNumerical value.Preferably, corresponding formal parameter value is assigned again in the key for being included to original public function and original differences functionBefore, the key that can also included to original public function and original differences function in advance is renamed, and can be facilitated subsequent straightIt connects according to function name you can learn that perhaps function in corresponding sub- configuration function.Additionally, to original public function and original differenceDifferent function carries out unified configure can also obtain the function that client returns and configure rule by sending function configuring request to clientThen, then original public function and original differences function are configured respectively according to the function configuration rule, obtains public matchSet function.Wherein, function configuration rule refers to the preset all key assigned in original public function and original differences functionThe rule of corresponding formal parameter value.
Illustratively, if obtain original public function include: public transferring url function pad.life.out.system andCommon request mode function pad.life.out.methed and original differences function: Certificate Authority functionpad.life.out.authorization;It is assigned corresponding to the key of public transferring url function respectively by function configuration ruleFormal parameter value, common request mode function key corresponding to formal parameter value and Certificate Authority function key corresponding toFormal parameter value after obtain common configuration function are as follows: it is public transferring url function pad.life.out.system { a, b, c }, publicRequest method function pad.life.out.methed { a, b, c, } and Certificate Authority function altogetherpad.life.out.authorization{a,\0,\0}.It is to be appreciated that since Certificate Authority function belongs to original differences letterNumber, i.e. only special interface just distinctive function, thus it is other there is no the key of the functional interface after assign corresponding formParameter value is sky.
Preferably, in order to the common configuration function that expands it is subsequent interface is called when applicability, the public affairsConfiguration function further includes several reserved functions altogether.Wherein, reserved function refers to preconfigured temporarily without any functionalFunction.If being not configured when interface is not configured in subsequent calls and occurring what the configured common configuration function was not present in interfaceWhen peculiar function, function can be reserved by using this and realizes corresponding function.
S50: common configuration function is packaged, and obtains common interface function.
Wherein, common interface function, which refers to, externally only provides the function of an interface called directly.It specifically, will be publicConfiguration function, which is packaged, to be referred to and is encapsulated common configuration function by way of function, class, and a letter is externally only providedThe process of single function interface.Optionally, an empty object can be constructed by first passing through var o={ } in advance, it is then that this is publicConfiguration function is put into the empty object of the construction and is packaged, and can be obtained and externally only provides the public affairs of a simple function interfaceInterface function altogether.
In the present embodiment, by obtaining interface configuring request, interface configuring request includes at least two interface identifier, soThe corresponding original configuration function of each interface is obtained according to each interface identifier afterwards, original configuration function is compared and analyzed,Original public function and original differences function are obtained, then unified configuration is carried out to original public function and original differences function, is obtainedTo common configuration function, finally common configuration function is packaged, obtains common interface function, by being connect to distinct interfaceMouth function carries out unified configuration, to improve the allocative efficiency of interface function.
In one embodiment, as shown in figure 3, comparing and analyzing to each original configuration function, original public letter is obtainedSeveral and original differences function, specifically comprises the following steps:
S301: obtaining the sub- configuration function in each original configuration function, and sub- configuration function includes function name.
Wherein, sub- configuration function refers to the subfunction that original configuration function is included, and each original configuration function is all by severalA sub- configuration function composition, each sub- configuration function includes function name.Function name refer to the function of embodying each sub- configuration function orProperty and customized function name.Specifically, corresponding original according to each interface of each interface identifier acquisition in step S20After configuration function, corresponding sub- configuration function can be obtained from each original configuration function.
S302: the function name of sub- configuration function is matched one by one.
Specifically, function name corresponding to all sub- configuration functions got from each original configuration function is carried outIt matches one by one, judges whether the function name of sub- configuration function matches.Specifically, judge sub- configuration function function name whether phaseMatching can be by presetting a matching threshold, if matching degree is greater than or equal to matching threshold between the function name of two sub- configuration functionsValue, then it represents that the function name of the two sub- configuration function matches;If between the function name of two sub- configuration functions matching degree be less thanWith threshold value, then it represents that the function name of the two sub- configuration function does not match that.Wherein, matching threshold refers to the letter for judging sub- configuration functionSeveral matching values whether to match.Optionally, matching threshold can be 90%, 95%, 98% or 100% etc..Optionally,String matching method can be used to be matched the function name of sub- configuration function one by one, it can also will will be sub using canonical matching methodThe function name of configuration function is matched one by one, and user can customized selection according to the actual situation.
S303: the quantity that function name is matched is greater than or equal to the sub- configuration function of preset threshold as original public letterNumber, the quantity that function name is matched are less than the sub- configuration function of preset threshold as original differences function.
Wherein, preset threshold refer to it is preset be used to judge whether corresponding sub- configuration function belongs to original public functionValue.Optionally, preset threshold can be 2, i.e., carry out in matching process one by one by the function name of each sub- configuration function, willSub- configuration function is as original public function corresponding to the function name to match there are at least two;Preset threshold may be5, i.e., the function name of each sub- configuration function is being carried out the function name that at least five matches will be present in matching process one by oneCorresponding sub- configuration function is as original public function.User can be corresponding pre- according to the customized setting of quantity of preset interfaceIf threshold value.
Illustratively, if having obtained the corresponding 3 original configuration functions of 3 interfaces is respectively the corresponding original configuration of interface AThe corresponding original configuration function C of function A, interface B corresponding original configuration function B and interface C, and each original configuration function is allIt include that 3 sub- configuration functions are respectively, original configuration function A={ a1,a2,a3, a is sub- configuration function;Original configuration functionB={ b1,b2,b3, b is sub- configuration function;Original configuration function C={ c1,c2,c3, c is sub- configuration function;And preset thresholdIt is 2, then after match one by one by the function name of each sub- configuration function according to S302, obtains a1、b1And c1Match, i.e.,a1、b1And c1Belong to identical sub- configuration function, a2And b2Match, i.e. a2And b2Belong to identical sub- configuration function, then by a1、b1Orc1In any one and a2And b2In any one extract as original public function, and by a3、b3、c2Distinguish with c3It extracts and is used as original differences function.
In the present embodiment, by obtaining the sub- configuration function in each original configuration function, sub- configuration function includes letterIt is several, then the function name of sub- configuration function is matched one by one, the quantity that function name is matched is greater than preset thresholdSub- configuration function as original public function, and quantity that function name is matched be less than the sub- configuration function of preset threshold asOriginal differences function further ensures the original public function of acquisition and the accuracy of original differences function.
In one embodiment, as shown in figure 4, being packaged by common configuration function, after obtaining common interface function,Interface allocation method further include:
S51: interface parameters modification request is obtained, interface parameters modification request includes configuration path and parameter information.
Wherein, interface parameters modification request refers to the trigger request when the corresponding interface parameters of a certain interface needs to modify.Interface parameters is a specific actual parameter, and interface parameters corresponding to distinct interface is different.Interface parameters modification is requestedConfiguration path and parameter information;Configuration path refers to the modification path modified to interface parameters.Parameter information refers to be modifiedInformation corresponding to interface parameters, including parameter identification and corresponding target component.Parameter identification refers to interface parameters to be modifiedCorresponding identifier;Optionally, the name that interface parameters can be used is referred to as the parameter identification of the interface parameters.Target component packetInclude the interface parameters by interface parameters to be modified and after modifying.
S52: according to configuration path, initial parameter allocation list is obtained.
Wherein, initial parameter allocation list refers to the allocation list established according to the interface parameters of several preset interfaces.Specifically,In this way of example, the interface parameters of each preset interface is all made of several field sequences, and each field is all to useKey-value indicate, therefore initial parameter allocation list be by several key-value represented by field form.Preferably, byThere may be same or similar situations by key in the interface parameters corresponding to the identical distinct interface of function, therefore are buildingBefore vertical initial parameter allocation list, the same or similar key in the interface parameters corresponding to distinct interface need to be concluded,It is unified to be indicated with an identical public key, then different value primary system one corresponding to distinct interface is assigned in corresponding public affairsAfter total key, i.e., in initial parameter allocation list, the public subsequent value of key includes corresponding to one or more distinct interfacesvalue。
In the present embodiment, initial parameter allocation list is configured good in advance and is stored in oracle database.Oracle database is a kind of relational database management system, is mainly used to store parameter configuration table;In addition oracle databaseWith complete data management function and distributed processing power.It is to be appreciated that it is oracle that initial parameter allocation list, which belongs to,Object inside database.Specifically, according to configuration path is stated, obtain initial parameter allocation list i.e. according to configuration path fromThe process of initial parameter allocation list configured in advance is obtained in oracle database.
S53: according to parameter information, modifying to initial parameter allocation list, and re-reads described modified originalParameter configuration table.
Specifically, according to parameter information, modifying to initial parameter allocation list includes: to be determined first according to parameter identificationThe field that initial parameter allocation list need to modify determines the key value in initial parameter allocation list, is then matched according to canonicalThe field that interface parameters to be modified entrained by target component and initial parameter allocation list need to modify included by methodValue is matched one by one, will be determined as the parameter that need to be modified with the value of interface parameters successful match to be modified,The parameter finally modified interface parameters entrained by target component carried out with the parameter that need to be modified one by one is replaced, and is obtainedTo modified initial parameter allocation list, and reappears and read modified initial parameter allocation list.
Specifically, since initial parameter allocation list is what the interface parameters according to corresponding to several preset interfaces was established, becauseThis initial parameter allocation list and corresponding each preset interface are associated, i.e., each preset interface need to initial parameter allocation list intoRow timing is read, and timely update corresponding interface parameters.Optionally, the time interval being read out to initial parameter allocation list canCustomized setting is carried out according to the actual situation, can be half an hour, one hour or two hours etc..Interface is adjusted in order to preventThere is the mistake of interface parameters in used time, it is preferable that each preset interface every half an hour to corresponding initial parameter allocation list intoRow is re-read.
It preferably, can also be to established parameter in order to which the parameter in timely learning initial parameter allocation list is changedAllocation list is monitored in real time, and whether each parameter monitored in initial parameter allocation list is changed;If it was found that original ginsengCorresponding a certain parameter has found variation in number allocation list, then issues parameter variations prompt information to the corresponding interface of the parameter,The interface carries out the reading again of parameter according to the parameter variations prompt information of acquisition to the initial parameter allocation list after variation immediatelyIt takes.
In the present embodiment, by obtain interface parameters modification request, interface parameters modification request include configuration path andParameter information obtains initial parameter allocation list then according to configuration path, finally according to parameter information, configures to initial parameterTable is modified, and re-reads the modified initial parameter allocation list;It, only need to be to original when interface parameters needs to modifyInformation in beginning parameter configuration table, which is modified, can be realized, without being repaired again to the corresponding text codes of the interfaceChange, improves the efficiency modified to interface parameters.
In one embodiment, as shown in figure 5, according to configuration path, before obtaining initial parameter allocation list, the interface letterNumber configuration method further include:
S521: obtaining interface parameters configuring request, and interface parameters configuring request includes at least two interface identifier.
Wherein, interface parameters configuring request refers to trigger request when establishing parameter configuration table.Parameter-configuring request includes extremelyThe preset interface of few two interface identifier, i.e. progress interface parameters configuration is no less than two.Interface identifier refers to that pending parameter is matchedMark corresponding to the preset interface set, interface identifier corresponding to distinct interface are different.
S522: the corresponding clean interface parameter of each interface is obtained according to each interface identifier.
Wherein, interface parameters corresponding to the interface of clean interface parameter fingering line interface parameter configuration.In the present embodimentIn, the corresponding clean interface parameter of each interface is existed by the form of key-value pair (key-value), i.e., each clean interfaceParameter all includes several key-value pairs (key-value), and the value in each key-value pair (key-value) is one specific realBorder parameter value.Specifically, obtaining the corresponding clean interface parameter of each interface according to each interface identifier includes: that basis first connectsMouth mark determination need to carry out the interface of interface parameters configuration, and corresponding clean interface parameter is then obtained from corresponding interface.
S523: according to each clean interface parameter, initial parameter allocation list is established.
Wherein, initial parameter allocation list refers to the parameter configuration table established by several clean interface parameters.Specifically, according to everyOne clean interface parameter, establish initial parameter allocation list include: extracted from each clean interface parameter first it is corresponding solelyVertical parameter and independent variable, i.e., extract corresponding key and value from each clean interface parameter, then will extractIndependent parameter and independent variable are uniformly added in parameter configuration table.Optionally, initial parameter configuration can be established in SAP platformTable, by using SAP platform TcodeSM30 tool by each clean interface parameter independent parameter and independent variable transmitInto in parameter configuration table.Preferably, parameter configuration table can be excel table, can be listed in this way by using excel tableWith each interface related all parameters and variable in program, of parameter and variable is conveniently freely set in parameter configuration tableNumber is to be suitable for different types of field.Additionally, one can also be arranged to each parameter or variable when settingDefault value and corresponding parameter selection range, in order to avoid parameter or variable that setting is unreasonable.It should be noted that giving hereParametric variable out had both included current existing relevant parameter and variable, was also possible to subsequent newly-increased parameter and variable.
S524: initial parameter allocation list is associated with each interface identifier.
Specifically, after establishing initial parameter allocation list according to step S523, which is connect with eachMouth mark is associated.In this step, initial parameter allocation list is associated with each interface identifier not only convenient for direct basisInterface identifier obtains corresponding initial parameter allocation list, is also convenient for subsequent carrying out parameter reading to the initial parameter allocation list and settingIt sets, and accesses each parameter and variable information of the initial parameter allocation list.
Preferably, in order to improve the data reading performance using redundancy to initial parameter allocation list, for different preset interfaces in the originalCorresponding parameter and variable difference, can be respectively set different access authority in beginning parameter configuration table;I.e. each preset interfaceOnly allow to read or be arranged parameter corresponding with this interface and variable when initial parameter allocation list is read out or is arrangedThe parameter for accessing or viewing when information, i.e. distinct interface are read out initial parameter allocation list and variable information difference,And then the case where reading data fault can also be avoided the occurrence of.
In the present embodiment, by obtaining interface parameters configuring request, interface parameters configuring request connects including at least twoThen mouth mark obtains the corresponding clean interface parameter of each interface according to each interface identifier, further according to each clean interfaceParameter establishes initial parameter allocation list, finally that initial parameter allocation list is associated with each interface identifier;Convenient for subsequent directThe modification to interface configuration parameter corresponding to each interface can be realized by modifying clean interface parameter list.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each processExecution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limitIt is fixed.
In one embodiment, a kind of interface configuration apparatus is provided, which matches with interface in above-described embodimentSet method one-to-one correspondence.As shown in fig. 6, the interface configuration apparatus includes that interface configuring request obtains module 10, original configuration letterNumber obtains module 20, comparative analysis module 30, unified configuration module 40 and common configuration function package module 50.Each functional moduleDetailed description are as follows:
Interface configuring request obtains module 10, and for obtaining interface configuring request, interface configuring request includes at least twoInterface identifier;
Original configuration function obtains module 20, for obtaining the corresponding original configuration of each interface according to each interface identifierFunction;
Comparative analysis module 30 obtains original public function and original for comparing and analyzing to original configuration functionDifference function;
Unified configuration module 40 obtains public for carrying out unified configuration to original public function and original differences functionConfiguration function;
Common configuration function package module 50 obtains common interface function for common configuration function to be packaged.
Preferably, comparative analysis module 30 includes:
Sub- configuration function acquiring unit, for obtaining the sub- configuration function in each original configuration function, sub- configuration functionIncluding function name;
Matching unit, for being matched the function name of sub- configuration function one by one;
Judging unit, the quantity for function name to match are greater than or equal to the sub- configuration function of preset threshold as originalBeginning public function, the quantity that function name is matched are less than the sub- configuration function of preset threshold as original differences function.
Preferably, interface configuration apparatus further include:
Request module is modified, for obtaining interface parameters modification request, interface parameters modification request includes configuration roadDiameter and parameter information;
Initial parameter allocation list obtains module, for obtaining initial parameter allocation list according to configuration path;
Modified module, for modifying to initial parameter allocation list, and re-read the modification according to parameter informationInitial parameter allocation list afterwards.
Preferably, interface configuration apparatus further include:
Parameter-configuring request obtains module, and for obtaining interface parameters configuring request, interface parameters configuring request includes extremelyFew two interface identifier;
Clean interface parameter acquisition module is joined for obtaining the corresponding clean interface of each interface according to each interface identifierNumber;
Initial parameter allocation list establishes module, for establishing initial parameter allocation list according to each clean interface parameter;
Relating module, for initial parameter allocation list is associated with each interface identifier.
Specific about interface configuration apparatus limits the restriction that may refer to above for interface allocation method, herein notIt repeats again.Modules in above-mentioned interface configuration apparatus can be realized fully or partially through software, hardware and combinations thereof.OnStating each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also store in a software formIn memory in computer equipment, the corresponding operation of the above modules is executed in order to which processor calls.
Interface call method provided in an embodiment of the present invention, the interface call method can apply ring using as shown in Figure 1In border.Specifically, which applies in interface calling system, which includes as shown in Figure 1Client and server-side, client are communicated with server-side by network, and the allocative efficiency for solving interface function is low to askTopic.Wherein, client is also known as user terminal, refers to corresponding with server-side, provides the program of local service for client.ClientIt is mountable but be not limited to various personal computers, laptop, smart phone, tablet computer and portable wearable deviceOn.Server-side can be realized with the server cluster of the either multiple server compositions of independent server.
In one embodiment, as shown in fig. 7, providing a kind of interface call method, the service in Fig. 1 is applied in this wayIt is illustrated, includes the following steps: for end
S100: obtaining interface call request, and interface call request includes target interface mark and target interface parameter.
Wherein, interface call request refers to that a certain interface calls equipment or platform to call and triggers when the interface of another platformRequest.Interface call request includes target interface mark and target interface parameter.Target interface refers to called interface.Target connectsMouth mark refers to identification number corresponding to called interface, and target interface mark is used for unique identification target interface.Optionally, due toInterface IP address corresponding to distinct interface uniquely determines, therefore interface IP address conduct corresponding to the target interface can be usedTarget interface mark.Target interface parameter refers to that interface parameters corresponding to called interface, target interface parameter are one specificActual parameter value.
Specifically, the operation of a certain interface of calling is clicked in user, after triggering interface call request, server-side can be from visitorFamily end obtains the interface call request being called to the interface.Such as: in an application scenarios, the operation of this method is based onOn the page on user's smart phone or computer, a certain interface calling platform user, which need to execute, calls OCR in Baidu API StoreThe OCR Text region is clicked or touched to the api interface of Text region, the page where entering Baidu API Store in userApi interface interface IP address, generate corresponding interface call request, the interface call request is sent server-side by clientAfterwards, server-side can obtain the interface call request.
S110: judge that target interface identifies whether to meet default mark.
Wherein, default mark refers to has carried out identification number corresponding to the interface of interface configuration in advance.In the present embodiment, it takesThe database at business end is previously stored with interface identifier corresponding to the interface for having carried out interface configuration.Specifically, judge that target connectsMouth identifies whether that target entrained by interface call request can be connect by using string matching method in advance by meeting default markMouth mark is matched one by one with the default mark stored in database;If target interface entrained by interface call request identifiesWith any one default mark successful match stored in database, then it represents that target interface mark meets default mark;If connecingAll default marks stored in target interface mark and database entrained by mouth call request all do not match that, then it represents that shouldTarget interface mark is unsatisfactory for default mark.
S120: if target interface mark meets default mark, common interface function is obtained, wherein common interface functionIt is obtained using interface allocation method.
Wherein, common interface function refers to configuration function at least associated with two interfaces, that is, passes through the common interface letterNumber can be achieved to execute calling at least two interfaces.In the present embodiment, common interface function is according in above-described embodimentWhat interface allocation method obtained.Therefore, the common interface function is associated with the corresponding interface of default mark, and passes through the public affairsInterface function, which can be realized, altogether executes calling to several interfaces corresponding to default mark.Specifically, since common interface class isDatabase that is pre-configured and being stored in server-side, therefore, if according to step S12 judge outgoing interface call request is takenThe target interface mark of band meets default mark, then directly can obtain preset common interface function from database.
S130: using target interface parameter as the input parameter of common interface function, and common interface function is called to realizeInterface calls.
Since target interface parameter is a specific actual parameter value, using target interface parameter as common configuration letterSeveral input parameters, which refers to, carries out the actual parameter in target interface parameter with formal parameter corresponding in common configuration functionThe process of parameter replacement one by one.Specifically, target interface parameter is parsed first, is obtained corresponding to target interface parameterField sequence, then according to the corresponding relationship of key-value in field sequence by every key in the target interface parameter and publicKey included in configuration function is matched one by one altogether, finally will be corresponding to every key in target interface parameterValue passes to the key in matching common configuration function, thus realize by target interface parameter actual parameter withCorresponding formal parameter carries out the process of parameter replacement one by one in common configuration function.Finally using parameter, replaced this is publicConfiguration function executes interface and calls.
In the present embodiment, by obtaining interface call request, interface call request includes target interface mark and targetThen interface parameters judges that target interface identifies whether to meet default mark, if target interface mark meets default mark, obtainTake common interface function, wherein common interface function is obtained using above-mentioned interface function configuration method, finally connects targetInput parameter of the mouth parameter as common interface function, and common interface function is called to realize that interface calls;For distinct interfaceUnified interface configuration function can be used to be called, not only solve process excessively complexity when being called to distinct interfaceProblem further improves the efficiency of interface calling.
In one embodiment, as shown in figure 8, after judging that target interface identifies whether to meet default mark, the interfaceCall method further include:
S121: if target interface mark is unsatisfactory for default mark, transmission interface configuring request to client.
Wherein, interface configuring request refers to trigger request when need to carry out Configuration Online to target interface.Specifically, if according toStep S110 show that target interface mark is unsatisfactory for default mark, i.e. target interface mark and any one interface in default markMark does not all match that, then issues interface configuring request to client.
S122: the target configuration parameter that client is returned according to interface configuring request is obtained.
Wherein, target configuration parameter refers to interface parameters corresponding to the target interface of pending configuration.In present embodimentIn, target configuration parameter is existed in the form of key-value pair (key-value), i.e., target configuration parameter includes several key-value pairs(key-value).Specifically, client is after the interface configuring request for receiving server-side return;User can pass through clientThe page obtains target configuration parameter corresponding to the interface online, and the target configuration parameter that then will acquire is sent by clientTo server-side, server-side can obtain the target configuration parameter of client return.
S123: common interface function is obtained, and common interface function is reconfigured according to target configuration parameter, is obtainedTo target common interface function.
Wherein, target common interface function refers to according to target configuration parameter, has re-started interface and has matched public connecing of postponingMouth function.Specifically, it is made of due to target configuration parameter several key-value pairs (key-value), is matched according to targetSetting parameter and reconfigure to common interface function includes: first by each key-value pair (key- in target configuration parameterValue the key for including in key) and common interface function is matched one by one;If the key-value pair in target configuration parameter(key-value) the wherein key successful match for including in key and common interface function, then in the common interface functionAgain a new formal parameter value is assigned after corresponding key, if the key of the key-value pair (key-value) in target configuration parameterIt is not all matched that with any one key for including in common interface function, then calls the reserved function in common configuration function, and rightThe reserved function is configured, to realize corresponding function.Specifically, according to target configuration parameter to common interface functionThe method reconfigured carries out the method phase of unified configuration with step S40 to original public function and original differences functionTogether, redundancy is not done herein to repeat.
S124: using target interface parameter as the input parameter of target common interface function, and invocation target common interfaceFunction realizes that interface calls.
Specifically, using target interface parameter as the input parameter of target common interface function, and invocation target is public connectsMouth function realizes the specific method and detailed process that interface calls, with step S130 using target interface parameter as common interface letterSeveral input parameters, and the method and process for calling common interface function to realize that interface calls are identical, do not do redundancy herein and repeat.
In this step, if target interface, which identifies, is unsatisfactory for default mark, transmission interface configuring request to client, andThe target configuration parameter that client is returned according to interface configuring request is obtained, then obtains common interface function, and according to targetConfiguration parameter reconfigures common interface function, obtains target common interface function, finally makees target interface parameterFor the input parameter of target common interface function, and invocation target common interface function realizes that interface calls;To not connecingWhen the interface of mouth configuration is called, directly common interface function can be reconfigured, and realize that interface calls, furtherIt improves interface and calls efficiency.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each processExecution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limitIt is fixed.
In one embodiment, a kind of interface calling device is provided, interface tune in the interface calling device and above-described embodimentIt is corresponded with method.As shown in figure 9, the interface calling device includes that interface call request obtains module 100, mark judges mouldBlock 110, common interface function obtain module 120 and interface calling module 130.Detailed description are as follows for each functional module:
Interface call request obtains module 100, and for obtaining interface call request, interface call request includes target interfaceMark and target interface parameter;
Judgment module 110 is identified, for judging that target interface identifies whether to meet default mark;
Common interface function obtains module 120, for obtaining common interface when target interface mark meets default markFunction, wherein common interface function is obtained according to above-mentioned interface allocation method;
Common interface function call module 130, for using target interface parameter as the input parameter of common interface function,And common interface function is called to realize that interface calls.
Preferably, interface calling device further include:
Interface configuring request sending module, for when target interface mark is unsatisfactory for default mark, transmission interface to be configuredIt requests to client;
Target configuration parameter obtains module, the target configuration ginseng returned for obtaining client according to interface configuring requestNumber;
Reconfigure module, for obtaining common interface function, and according to target configuration parameter to common interface function intoRow reconfigures, and obtains target common interface function;
Target common interface function call module, for using target interface parameter as the input of target common interface functionParameter, and invocation target common interface function realizes that interface calls.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junctionComposition can be as shown in Figure 10.The computer equipment include by system bus connect processor, memory, network interface andDatabase.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipmentInclude non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and dataLibrary.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculatingData of the database of machine equipment for being used in above-described embodiment interface allocation method and interface call method.The computerThe network interface of equipment is used to communicate with external terminal by network connection.The computer program is executed by processor Shi YishiTo realize a kind of interface call method when a kind of existing interface allocation method or the computer program are executed by processor.
In one embodiment, a kind of computer equipment is provided, including memory, processor and storage are on a memoryAnd the computer program that can be run on a processor, processor realize that interface configures in above-described embodiment when executing computer programMethod or processor realize interface call method in above-described embodiment when executing computer program.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculatedMachine program realizes that interface allocation method or computer program are executed by processor in above-described embodiment when being executed by processor whenRealize interface call method in above-described embodiment.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be withRelevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computerIn read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein,To any reference of memory, storage, database or other media used in each embodiment provided herein,Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM(PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may includeRandom access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms,Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancingType SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM(RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each functionCan unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by differentFunctional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completingThe all or part of function of description.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned realityApplying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned eachTechnical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modifiedOr replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should allIt is included within protection scope of the present invention.