Installation package acquisition method, device, equipment and storage medium
By monitoring the trigger event of obtaining the installation package in the Android system, automatically obtaining the installation package to obtain parameters and calling the installation package to obtain the installation package to obtain the function, solving the problem of inefficient installation package acquisition in the existing technology, and realizing automatic and rapid acquisition of the installation package.
Patent Information
- Application Number
- CN202010582394.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-23
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2040-06-23
AI Technical Summary
In Android systems, the prior art requires users to manually find the installation package of installed applications, resulting in low acquisition efficiency.
By monitoring the trigger event of obtaining the installation package, obtain the corresponding installation package acquisition parameters, including the installation package query parameters and object signature parameters. Then, call the built installation package acquisition function, perform decryption, signature checksum query, and automatically obtain the installation package to be obtained.
It realizes automatic and fast acquisition of installation packages, improves acquisition efficiency, and solves the inefficiency problem caused by manual search.
Smart Images

Figure CN113835717B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer application technology, and in particular to a method, device, equipment and storage medium for obtaining an installation package. Background Art
[0002] In an Android system, all installed installation packages of an application are usually stored in a local folder. When a specific installation package needs to be obtained, the prior art requires the user to manually search in the folder, and the efficiency of obtaining the installation package is relatively low. Summary of the invention
[0003] The embodiments of the present invention provide a method, apparatus, device and storage medium for obtaining an installation package, which solve the problem of low efficiency in obtaining the installation package.
[0004] In a first aspect, an embodiment of the present invention provides a method for obtaining an installation package, which may include:
[0005] When a triggering event for obtaining an installation package is detected, obtaining installation package obtaining parameters corresponding to the triggering event, wherein the installation package obtaining parameters include installation package query parameters of the installation package to be obtained and object signature parameters of the installation package obtaining object;
[0006] The installation package acquisition parameter is used as an input parameter, and the constructed installation package acquisition function is called. According to the output result of the installation package acquisition function, the installation package to be acquired is obtained;
[0007] The installation package acquisition function implements the installation package acquisition function through the following steps:
[0008] Decrypt the installation package query parameters, and update the installation package query parameters according to the decryption result;
[0009] Pass the installation package acquisition parameters to the built signature verification function, and determine whether the signature verification is successful based on the output result of the signature verification function;
[0010] If so, the constructed installation package query function is called with the installation package query parameter as the input parameter, and the installation package to be obtained is obtained according to the output result of the installation package query function.
[0011] In a second aspect, an embodiment of the present invention further provides an installation package acquisition device, which may include:
[0012] An installation package acquisition parameter acquisition module, used to acquire installation package acquisition parameters corresponding to the triggering event when a triggering event for acquiring the installation package is detected, wherein the installation package acquisition parameters include installation package query parameters of the installation package to be acquired and object signature parameters of the installation package acquisition object;
[0013] The module for obtaining the installation package to be obtained is used to call the constructed installation package obtaining function with the installation package obtaining parameter as the input parameter, and obtain the installation package to be obtained according to the output result of the installation package obtaining function;
[0014] The installation package acquisition function implements the installation package acquisition function through the following units:
[0015] An installation package query parameter decryption unit, used to obtain access token information, decrypt the installation package query parameter based on the access token information, and update the installation package query parameter according to the decryption result;
[0016] The signature verification judgment unit is used to pass the installation package acquisition parameters to the constructed signature verification function, and judge whether the signature verification is successful according to the output result of the signature verification function;
[0017] The installation package obtaining unit to be obtained is used to, if yes, take the installation package query parameter as the input parameter, call the constructed installation package query function, and obtain the installation package to be obtained according to the output result of the installation package query function.
[0018] In a third aspect, an embodiment of the present invention further provides a device, which may include:
[0019] one or more processors;
[0020] A memory for storing one or more programs;
[0021] When one or more programs are executed by one or more processors, the one or more processors implement the installation package acquisition method provided by any embodiment of the present invention.
[0022] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for obtaining the installation package provided by any embodiment of the present invention is implemented.
[0023] The technical solution of the embodiment of the present invention, when a triggering event for obtaining an installation package is detected, the installation package acquisition function that has been constructed is called by taking the installation package acquisition parameters corresponding to the triggering event as input parameters, so that the installation package acquisition function decrypts the installation package query parameters, updates the installation package query parameters according to the decryption results, and then passes the installation package acquisition parameters to the signature verification function that has been constructed, and when the signature verification is determined to be successful according to the output result of the signature verification function, the installation package query parameters are passed to the constructed installation package query function, at this time, the output result of the installation package query function is the output result of the installation package acquisition function; thus, according to the output result of the installation package acquisition function, the corresponding installation package to be obtained can be obtained. The above technical solution, based on the installation package acquisition function, automatically obtains the installation package to be obtained that matches the installation package acquisition parameters, solves the problem of low efficiency in obtaining the installation package, and achieves the effect of automatic and rapid acquisition of the installation package. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flow chart of a method for obtaining an installation package in Embodiment 1 of the present invention;
[0025] Figure 2 is a flow chart of a method for obtaining an installation package in Embodiment 2 of the present invention;
[0026] Figure 3 is a flow chart of a method for obtaining an installation package in Embodiment 3 of the present invention;
[0027] Figure 4 This is a structural block diagram of an installation package acquisition device in Embodiment 4 of the present invention;
[0028] Figure 5 It is a structural schematic diagram of a device in Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0029] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It is also necessary to explain that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0030] Embodiment 1
[0031] Figure 1This is a flowchart of a method for obtaining an installation package provided in the first embodiment of the present invention. This embodiment is applicable to the case of obtaining an installation package, and is particularly applicable to the case of obtaining an installation package that matches an installation package query parameter from all installed installation packages of a certain application. The method can be executed by the installation package obtaining device provided in the embodiment of the present invention, which can be implemented by software and / or hardware, and can be integrated in various user terminals or servers.
[0032] See also Figure 1 The method of the embodiment of the present invention specifically includes the following steps:
[0033] S110. When a triggering event for obtaining an installation package is monitored, obtain installation package obtaining parameters corresponding to the triggering event, wherein the installation package obtaining parameters include installation package query parameters of the installation package to be obtained and object signature parameters of the installation package obtaining object.
[0034] Among them, the triggering event can be an event triggered by a certain installation package acquisition object for obtaining a certain installation package to be obtained. The installation package acquisition object can be an object that pre-acquires the installation package to be obtained. The installation package to be obtained can be an installation package among all the installation packages that have been installed of a certain application. Each installation package in all the installation packages may have a different version number, may come from different channels, etc. Such an installation package to be obtained can be called a historical installation package.
[0035] The installation package acquisition parameters may include the installation package query parameters of the installation package to be acquired and the object signature parameters of the installation package acquisition object. Specifically, the installation package query parameters may be the query conditions that the installation package to be acquired needs to meet, which may be at least one of the application name, application version number, and application channel, or may be the rest of the application information, which is not specifically limited here. For example, the installation package query parameters may be the application name + application version number, the application name + application channel, or the application name + application version number + application channel, and so on. The object signature parameter is the signature provided by the installation package acquisition object when pre-acquiring the installation package, which can prove whether the installation package acquisition object is a legal object or an illegal object.
[0036] In practical applications, optionally, the type of the object signature parameter may be a String type, and the type of the installation package query parameter may be a PageParam type, wherein PageParam is a custom type, and its description information may include at least one of the number of database pages, the number of entries per page, and a database paging parameter. Exemplarily, the description information of PageParam is as follows:
[0037]
[0038] S120. Taking the installation package acquisition parameter as an input parameter, calling the constructed installation package acquisition function, so that the installation package acquisition function executes S130-S150 according to the installation package acquisition parameter.
[0039] The installation package acquisition function takes the installation package acquisition parameter as an input parameter, and the corresponding installation package to be acquired can be obtained according to the installation package acquisition parameter. In actual applications, the output parameter type of the installation package acquisition function can be CommonResult. <ListRes <apppagevo>>Type, where ListRes <apppagevo>It is a generic parameter of CommonResult, and AppPageVo is a generic parameter of ListRes. The combination of multi-level generalization can return multiple data in one result set, which greatly improves the capacity of data return. It should be noted that AppPageVo is a custom type, and its description information may include at least one of identity information, title, package name, supported platform, creation time, update time, tag number and operator, and may also include other information, which is not specifically limited here. Exemplarily, the description information of AppPageVo is as follows:
[0040]
[0041] On this basis, the specific form of the installation package acquisition function is shown below: publicCommonResult <ListRes <apppagevo>>pagelist(PageParam appQueryReq,String sign)throws VenusException, where pagelist is the function name of the installation package acquisition function, appQueryReq is the installation package query parameter, and sign is the object signature parameter. The installation package acquisition function can throw a custom exception named VenusException, which can be further thrown externally by throws VenusException.
[0042] Optionally, a preset request annotation @RequestMapping(value=" / applist",method={RequestMethod.POST}) can be set in the installation package acquisition function, which describes the request method of the installation package acquisition function, which means that the request method can only be a POST request and the request path must be " / applist". Of course, this setting is optional and not a specific limitation.
[0043] Optionally, a preset serialization annotation can be set in the installation package acquisition function, and the preset serialization annotation can be @ResponseBody. @ResponseBody can realize the automatic serialization function of the output result of the installation package acquisition function, which can automatically serialize the output result into data in a preset format, which can be JSON format, thereby improving the convenience of data transmission and the efficiency of front-end data parsing. In practical applications, optionally, the preset serialization annotation can be set in the installation package query function in the installation package acquisition function.
[0044] S130: decrypt the installation package query parameter, and update the installation package query parameter according to the decryption result.
[0045] The installation package query parameter can be considered as a string of garbled characters after encryption, and thus it can be decrypted based on the verification key, which can be a key held by the front-end and the back-end. That is to say, the front-end encrypts the installation package query parameter based on the verification key and sends the encrypted installation package query parameter to the back-end; then, the back-end decrypts it based on the verification key and updates the installation package query parameter according to the decryption result. At this time, the installation package query parameter is no longer a string of garbled characters, but a string of characters with substantial meaning.
[0046] S140: Pass the installation package acquisition parameters to the constructed signature verification function, and determine whether the signature verification is successful based on the output result of the signature verification function.
[0047] Among them, the installation package acquisition parameters may include installation package query parameters and object signature parameters. The signature verification function can generate a signature verification result based on the installation package query parameters. When the signature verification result is consistent with the object signature parameters, this indicates that the installation package acquisition object is a legal object and the signature verification is successful; otherwise, the installation package acquisition object is an illegal object and the signature verification fails. At this time, an error code can be returned to inform the installation package that this is an illegal request to obtain the object.
[0048] On this basis, optionally, the signature verification function can also verify whether the installation package query parameters are abnormal data before verifying whether the installation package acquisition object is a legal object. Normally, if the installation package query parameters only include the application version number and / or application channel, but do not include the application name, it is impossible to accurately locate the installation package to be acquired that matches the installation package query parameters.
[0049] S150: If yes, then the constructed installation package query function is called with the installation package query parameter as an input parameter, and the installation package to be obtained is obtained according to the output result of the installation package query function.
[0050] Among them, after the signature verification is successful, the installation package query parameter is passed to the constructed installation package query function, and the installation package query function can query the installation package to be obtained that matches the installation package query parameter. In actual applications, optionally, the storage paths of all the installation packages that have been installed for each application can be stored in a created list, and the storage paths of each installation package can be the same or different, which is not specifically limited here. Therefore, according to the installation package query parameter, the application entry that matches it can be searched from the created list, and then, according to the storage path in the application entry, the installation package to be obtained that matches the installation package query parameter can be obtained.
[0051] S160: Obtain the installation package to be obtained according to the output result of the installation package obtaining function.
[0052] The technical solution of the embodiment of the present invention, when a triggering event for obtaining an installation package is detected, the installation package acquisition function that has been constructed is called by taking the installation package acquisition parameters corresponding to the triggering event as input parameters, so that the installation package acquisition function decrypts the installation package query parameters, updates the installation package query parameters according to the decryption results, and then passes the installation package acquisition parameters to the signature verification function that has been constructed, and when the signature verification is determined to be successful according to the output result of the signature verification function, the installation package query parameters are passed to the constructed installation package query function, at this time, the output result of the installation package query function is the output result of the installation package acquisition function; thus, according to the output result of the installation package acquisition function, the corresponding installation package to be obtained can be obtained. The above technical solution, based on the installation package acquisition function, automatically obtains the installation package to be obtained that matches the installation package acquisition parameters, solves the problem of low efficiency in obtaining the installation package, and achieves the effect of automatic and rapid acquisition of the installation package.
[0053] On this basis, an optional technical solution is that the installation package acquisition function can be set in the installation package acquisition class, which is a custom class, in which at least one of the following preset annotations can be set: a first preset annotation for indicating that the installation package acquisition class is a control class, a second preset annotation for indicating the path information for accessing the installation package acquisition class, a third preset annotation for indicating that the installation package acquisition class implements log injection at a preset speed, and a fourth preset annotation for indicating that the installation package acquisition class implements cross-service access. These preset annotations are functional annotations that can automatically enhance the function of the installation package acquisition class. Exemplarily, the specific form of the installation acquisition class is as follows:
[0054] @RestController
[0055] @Slf4j
[0056] @RequestMapping(" / venus / luban / android / pkg")
[0057] @NotValid
[0058] public class AppPkgController{}
[0059] Among them, AppPkgController is the class name of the installation package acquisition class; @RestController is the first preset annotation, which indicates that the installation package acquisition class is a class used to implement specific business logic; RequestMapping(" / venus / luban / android / pkg") is the second preset annotation, which indicates the path information of the business function of the installation package acquisition class; @Slf4j is the third preset annotation, which indicates that the installation package acquisition class can quickly implement log injection, thereby improving the efficiency of log input; @NotValid is the fourth preset annotation, which indicates that the installation package acquisition class can implement cross-service calls between multiple servers, thereby improving the efficiency of obtaining the installation package to be obtained.
[0060] Embodiment 2
[0061] Figure 2 It is a flow chart of a method for obtaining an installation package provided in the second embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, the installation package query function implements the installation package query function through the following steps: determining the number of installation packages to be obtained according to the installation package query parameters, and filtering out application entries that match the installation package query parameters from the created list, wherein the storage path and configuration information of the installation package to be obtained are recorded in the application entries; if the number of application entries is consistent with the number of installation packages, the identity information of the installation package to be obtained is obtained from the application entries; the installation package query information is determined according to the identity information, and the configuration information and storage path are obtained from the application entries according to the installation package query information; the installation package to be obtained is obtained from the database based on the storage path, the installation package to be obtained and the configuration information are converted, and the conversion results are packaged. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0062] See also Figure 2 The method of this embodiment may specifically include the following steps:
[0063] S210: When a triggering event for obtaining an installation package is monitored, obtain installation package obtaining parameters corresponding to the triggering event, wherein the installation package obtaining parameters include installation package query parameters of the installation package to be obtained and object signature parameters of the installation package obtaining object.
[0064] S220. Taking the installation package acquisition parameter as an input parameter, calling the constructed installation package acquisition function, so that the installation package acquisition function executes S230-S270 according to the installation package acquisition parameter.
[0065] S230: decrypt the installation package query parameter, and update the installation package query parameter according to the decryption result.
[0066] S240: Pass the installation package acquisition parameters to the constructed signature verification function, and determine whether the signature verification is successful based on the output result of the signature verification function.
[0067] S250: If yes, determine the number of installation packages to be obtained according to the installation package query parameter, and filter out application entries matching the installation package query parameter from the created list, wherein the application entries record the storage path and configuration information of the installation package to be obtained.
[0068] Among them, the number of installation packages to be obtained can be obtained according to the installation package query parameters. In actual applications, optionally, the installation package query parameters after decryption processing are strings with substantial meanings. Then, the number of strings is the number of installation packages to be obtained. The number of installation packages can be one, two or more, which is not specifically limited here.
[0069] The created list is a pre-created application list. Each application entry in the application list records the storage path and configuration information of a certain installation package of a certain application program that has been installed. The configuration information may be the package name, application name, current version number, etc. Therefore, according to the installation package query parameter, the application entries that match it can be filtered out from the created list. Such application entries record the storage path and configuration information of the installation package to be obtained. For example, if the installation package query parameter is XX application + XX version number + XX channel, the configuration information corresponding to the installation package query parameter can be searched from a created list, and the application entry where the configuration information is located is the application entry corresponding to the installation package query parameter.
[0070] S260: If the number of application entries is consistent with the number of installation packages, the identity information of the installation package to be obtained is obtained from the application entry, and the installation package query information is determined according to the identity information, and the configuration information and storage path are obtained from the application entry according to the installation package query information.
[0071] Among them, if the number of application entries and the number of installation packages are consistent, this indicates that the installation package query parameter at this time is a valid parameter. Therefore, the identity information (identification, id) of the installation package to be obtained can be obtained from the filtered application entries, and the installation package query information can be constructed based on the identity information, so as to obtain the configuration information and storage path of the installation package to be obtained from the application entries that meet the query conditions (i.e., the installation package query parameters) according to the constructed installation package query information.
[0072] S270: Acquire the installation package to be acquired from the database based on the storage path, convert the installation package to be acquired and the configuration information, and encapsulate the conversion result.
[0073] Among them, after obtaining the storage path of the installation package to be obtained, the installation package to be obtained can be obtained from the database according to the storage path. On this basis, the installation package to be obtained and its configuration information can be converted, and the conversion result can be packaged and output. On this basis, optionally, after the conversion result is packaged, the encapsulation result can also be automatically serialized into JSON format data based on the preset serialization annotation set in the installation package query function, and then the JSON format data is output.
[0074] S280. Obtain the installation package to be obtained according to the output result of the installation package obtaining function.
[0075] The technical solution of the embodiment of the present invention determines the number of installation packages to be obtained through installation package query parameters, and filters out application entries that match the installation package query parameters from a created list; when the number of application entries is consistent with the number of installation packages, this indicates that the installation package query parameter is a valid parameter, and identity information of the installation package to be obtained can be obtained from the application entry, so as to determine the installation package query information according to the identity information, and obtain configuration information and a storage path from the application entry according to the installation package query information; thereby, the installation package to be obtained can be obtained from the database based on the storage path, the installation package to be obtained and the configuration information are converted, and the conversion result is encapsulated, thereby achieving the effect of effective query of the installation package to be obtained that matches the installation package query parameter.
[0076] Embodiment 3
[0077] Figure 3 It is a flowchart of a method for obtaining an installation package provided in Embodiment 3 of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, the signature verification function implements the signature verification function through the following steps: converting the installation package query parameter into a first query parameter, and converting the first query parameter into a second query parameter, wherein the type of the installation package query parameter is Object, the type of the first query parameter is Map, and the type of the second query parameter is List <string>; Sort the second query parameter based on a preset sorting function, and encapsulate the sorting result into a preset encapsulation object, wherein the type of the preset encapsulation object includes StringBuilder; Generate a signature verification result based on the preset encapsulation object through a message digest algorithm, and determine whether the signature verification result is consistent with the object signature parameter; if so, the signature verification succeeds; otherwise, the signature verification fails. The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.
[0078] See also Figure 3 The method of this embodiment may specifically include the following steps:
[0079] S310: When a triggering event for obtaining an installation package is monitored, obtain installation package obtaining parameters corresponding to the triggering event, wherein the installation package obtaining parameters include installation package query parameters of the installation package to be obtained and object signature parameters of the installation package obtaining object.
[0080] S320. Taking the installation package acquisition parameter as an input parameter, the constructed installation package acquisition function is called, so that the installation package acquisition function executes S330-S360 according to the installation package acquisition parameter.
[0081] S330: decrypt the installation package query parameter, and update the installation package query parameter according to the decryption result.
[0082] S340: Convert the installation package query parameter into a first query parameter, convert the first query parameter into a second query parameter, sort the second query parameter based on a preset sorting function, and encapsulate the sorting result into a preset encapsulation object.
[0083] Among them, the type of the installation package query parameter is Object, and the type of the first query parameter is Map. The purpose of converting the installation package query parameter into the first query parameter is that the first query parameter of Map type has a higher efficiency in removing data, which can effectively improve the execution efficiency of the program. On this basis, optionally, considering that the installation package query parameter may involve some parameters to be removed that are not related to signature verification, the parameters to be removed in the first query parameter can be removed. The effective removal of the parameters to be removed improves the accuracy of subsequent signature verification, and then the first query parameter is updated according to the removal result.
[0084] Further, convert the first query parameter into a List type <string>The second query parameter of the Map type is used because data sorting is a necessary step before signature verification. The sorting efficiency of the first query parameter of the List type is very low. <string>The second query parameter of type can effectively improve the sorting efficiency and prepare for the subsequent signature verification. On this basis, optionally, the second query parameter is emptied based on the preset emptying processing function, and the second query parameter is updated according to the emptying processing result. The accuracy of the subsequent signature verification is improved by the emptying of the second query parameter. Further, the sorting result is encapsulated into a preset encapsulation object of type StringBuilder.
[0085] S350. Generate a signature verification result based on a preset encapsulated object through a message digest algorithm. When the signature verification result is consistent with the object signature parameter, the signature verification succeeds, otherwise the signature verification fails.
[0086] The preset encapsulated object is calculated based on the message digest algorithm (MD), a signature verification result is generated, and whether the signature verification is successful is determined based on whether the signature verification result is consistent with the object signature parameter. On this basis, the message digest algorithm can be optionally the message digest algorithm version 5 (MD5).
[0087] S360: If the signature verification is successful, the constructed installation package query function is called with the installation package query parameter as an input parameter, and the installation package to be obtained is obtained according to the output result of the installation package query function.
[0088] S370: Obtain the installation package to be obtained according to the output result of the installation package obtaining function.
[0089] The technical solution of the embodiment of the present invention converts the installation package query parameter of type Object into the first query parameter of type Map, and then converts the first query parameter into the type List <string>The second query parameter can be sorted based on the preset sorting function, and the sorting result can be encapsulated into a preset encapsulation object of type StringBuilder; further, through the message digest algorithm, a signature verification result can be generated based on the preset encapsulation object, and whether the signature verification is successful can be determined based on whether the signature verification result and the object signature parameter are consistent, thereby achieving the effect of accurate signature verification.
[0090] In order to better understand the specific implementation process of the above steps, the following is an exemplary description of the installation package acquisition method of this embodiment in combination with a specific example. For example, the specific form of the installation package acquisition function is as follows: publicCommonResult <ListRes <apppagevo>>pagelist(PageParam appQueryReq,String sign) throws VenusException, where pagelist is the name of the installation package acquisition function, appQueryReq is the installation package query parameter, and sign is the object signature parameter. The internal implementation process of pagelist is as follows:
[0091] Before implementing the installation package acquisition function, first customize the legal signature verification of both parties on the caller (that is, the installation package acquisition object), which can effectively ensure the security of the data. Specifically, in order to implement signature verification, you can customize a signature verification function as follows: private boolean checkAuth(Object dto,Stringsecret,String accessToken)throws VenusException, where dto is the installation package acquisition object to be verified, secret is the verification key, accessToken is the token data carried by the installation package acquisition object, and the return value of the signature verification function is a boolean type variable, true indicates that the verification is successful, and false indicates that the verification fails. The specific implementation process of the signature verification function is as follows:
[0092] First define a Map<String,String> params; object to receive the installation package acquisition parameters, and then convert the dto object into a params object by calling params = org.apache.commons.beanutils.BeanUtils.describe(dto);. Considering that the installation package acquisition parameters may carry some parameters to be removed that are not related to signature verification, these parameters to be removed can be removed. The removal logic is as follows:
[0093] params.remove("access_token");
[0094] params.remove("class");
[0095] params.remove("operatorId");
[0096] params.remove("operatorName");
[0097] params.remove("sign");
[0098] params.remove("page");
[0099] params.remove("numPerPage");
[0100] params.remove("pageStartNum");
[0101] params.remove("accessDataSql");
[0102] Next, by calling List <string>signParams=params.entrySet().stream().filter(e->Objects.nonNull(e.getKey())&&Objects.nonNull(e.getValue()))
[0103] .map(e->e.getKey()).collect(Collectors.toList()); Empty the objects in params and convert them into a List by calling Collectors.toList() <string>signParams object. The advantage of this setting is that params is a map type object, which is more efficient in removing data; the main goal of converting the param object to a signParams object is to remove all empty data and prepare the conditions for sorting for subsequent signature verification. The sorting efficiency of Map is very low, so converting it to signParams can effectively improve the sorting efficiency.
[0104] Next, call signParams.sort(Comparator.naturalOrder()); to sort the signParams collection in alphabetical order.
[0105]
[0106] Encapsulate the sorted data into a stringBuilder object, which will not cause additional memory overhead.
[0107] Next, by calling String realAuth=DigestUtils.md5Hex(stringBuilder.toString()).toLowerCase();calculate the MD5 information and generate the final signature verification result realAuth. By calling return StringUtils.equals(realAuth.toLowerCase(),accessToken.toLowerCase();to determine whether realAuth and accessToken are equal. If they are equal, the verification succeeds, otherwise the verification fails.
[0108] Back to the implementation of the pagelist function, first, we call the custom signature verification function booleansignResult = checkAuth(appQueryReq, SIGN_KEY, sign); to implement the legitimacy check, and then judge the test result through the following function: if(!signResult){throw new VenusException(ERROR_SIGN_ERROR,"Signature failed");}If it fails, an exception is thrown and the subsequent process ends; if it succeeds, the subsequent process is executed.
[0109] Next, the installation package to be obtained is obtained by calling the installation package query function. The specific form of the installation package query function is ListRes <apppagevo>res = appService.pageList (appQueryReq); wherein, the specific implementation process of appService.pageList (appQueryReq) is as follows: first, by calling int count = appMapper.count (appQueryReq); the number of installation packages to be obtained is obtained; then by calling List <app>apps = appMapper.pageList (appQueryReq); Get all application entries apps; By calling if (CollectionUtils.isEmpty (apps)) {
[0110] return new ListRes(appQueryReq,count,Lists.newArrayList());
[0111] }Determine whether the installation package query parameters are abnormal data. Then call List <integer>ids = apps.stream().map(x->{return x.getId();}).collect(Collectors.toList()); Get all the identity information (id) in the app, and then construct the installation package query information through the following content:
[0112] Map<String,Object> params = new HashMap<>();
[0113] params.put("ids",ids);
[0114] params.put("confKey",
[0115] AppConfKeyEnum.SILENCE_UPGRADE.getKey());
[0116] Then by calling List <appconf>appConfs = appConfMapper.selectByAppIds(params); Get the configuration information of the app, such as obtaining the rest of the configuration information through the id). By calling
[0117] List <apppagevo>appVos=apps.stream().map(x->{
[0118] return convert2Vo(x,appConfs);
[0119] }).collect(Collectors.toList())
[0120] Implement data conversion, and then call return new ListRes(appQueryReq, count, appVos); to encapsulate and return the converted data. Finally, call return new CommonResult<>(Constant.SUC_CODE, Constant.SUC_MSG, res); to encapsulate and return the data output by the installation package query function.
[0121] Embodiment 4
[0122] Figure 4 This is a structural block diagram of the installation package acquisition device provided in the fourth embodiment of the present invention, and the device is used to execute the installation package acquisition method provided in any of the above embodiments. The device and the installation package acquisition method of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the installation package acquisition device, please refer to the embodiment of the above installation package acquisition method. Figure 4 The device may specifically include: an installation package acquisition parameter acquisition module 410 and a to-be-acquired installation package acquisition module 420.
[0123] The installation package acquisition parameter acquisition module 410 is used to acquire the installation package acquisition parameters corresponding to the trigger event when a trigger event for acquiring the installation package is detected, wherein the installation package acquisition parameters include the installation package query parameters of the installation package to be acquired and the object signature parameters of the installation package acquisition object;
[0124] The module 420 for obtaining the installation package to be obtained is used to call the constructed installation package obtaining function with the installation package obtaining parameter as the input parameter, and obtain the installation package to be obtained according to the output result of the installation package obtaining function; wherein the installation package obtaining function implements the installation package obtaining function through the following submodules:
[0125] The installation package query parameter decryption submodule 4201 is used to obtain access token information, decrypt the installation package query parameter based on the access token information, and update the installation package query parameter according to the decryption result;
[0126] The signature verification judgment submodule 4202 is used to pass the installation package acquisition parameters to the constructed signature verification function, and determine whether the signature verification is successful based on the output result of the signature verification function;
[0127] The submodule 4203 for obtaining the installation package to be obtained is used to, if yes, call the constructed installation package query function with the installation package query parameter as the input parameter, and obtain the installation package to be obtained according to the output result of the installation package query function.
[0128] Optionally, the installation package query function implements the installation package query function through the following units:
[0129] An application entry screening unit, used to determine the number of installation packages to be obtained according to the installation package query parameter, and screen out application entries matching the installation package query parameter from the created list, wherein the application entries record the storage path and configuration information of the installation package to be obtained;
[0130] An identity information acquisition unit, configured to acquire identity information of the installation package to be acquired from the application entry if the number of application entries is consistent with the number of installation packages;
[0131] A storage path acquisition unit, used to determine the installation package query information according to the identity information, and acquire the configuration information and the storage path from the application entry according to the installation package query information;
[0132] The first encapsulation unit is used to obtain the installation package to be obtained from the database based on the storage path, convert the installation package to be obtained and the configuration information, and encapsulate the conversion result.
[0133] Optionally, the above installation package query function can also implement the installation package query function through the following units:
[0134] The serialization unit is used to automatically serialize the encapsulation result into data in a preset format based on a preset serialization annotation set in the installation package query function, wherein the preset format includes a JSON format.
[0135] Optionally, the signature verification function can be implemented by the following units:
[0136] A parameter conversion unit, used to convert the installation package query parameter into a first query parameter, and convert the first query parameter into a second query parameter, wherein the type of the installation package query parameter is an Object type, the type of the first query parameter is a Map type, and the type of the second query parameter is a List <string>type;
[0137] A second encapsulation unit is used to sort the second query parameter based on a preset sorting function, and encapsulate the sorting result into a preset encapsulation object, where the type of the preset encapsulation object includes a StringBuilder type;
[0138] The signature verification unit is used to generate a signature verification result based on a preset encapsulated object through a message digest algorithm, and determine whether the signature verification result is consistent with the object signature parameter; if so, the signature verification is successful; otherwise, the signature verification fails.
[0139] Optionally, the above signature verification function can implement the signature verification function through the following units:
[0140] A removing unit, configured to remove a parameter to be removed from the first query parameter, and update the first query parameter according to the removal result, wherein the parameter to be removed is a parameter unrelated to the message digest algorithm;
[0141] The emptying unit is used to perform an emptying process on the second query parameter based on a preset emptying process function, and update the second query parameter according to the emptying process result.
[0142] Optionally, the type of the installation package query parameter includes the PageParam type, wherein the description information of PageParam includes at least one of the number of database pages, the number of entries per page, and the database paging parameter; and / or, the installation package query parameter includes the application name, and the application channel and / or the application version number; and / or, the type of the output parameter of the installation package acquisition function includes CommonResult <ListRes <apppagevo>>Type, where ListRes <apppagevo>It is a generic parameter of CommonResult, and AppPageVo is a generic parameter of ListRes.
[0143] Optionally, the installation package acquisition function may be set in an installation package acquisition class, and the installation package acquisition class may be set with at least one of the following preset annotations:
[0144] Used to indicate that the installation package acquisition class is the first preset annotation of the control class;
[0145] A second preset annotation for indicating path information for accessing the installation package acquisition class;
[0146] A third preset annotation for indicating that the installation package acquisition class implements log injection at a preset speed; and
[0147] The fourth preset annotation used to indicate that the installation package acquisition class implements cross-service access.
[0148] The installation package acquisition device provided in the fourth embodiment of the present invention, when a triggering event for acquiring the installation package is detected, cooperates with the installation package acquisition parameter acquisition module and the installation package acquisition module to be acquired, takes the installation package acquisition parameter corresponding to the triggering event as the input parameter, calls the constructed installation package acquisition function, so that the installation package acquisition function decrypts the installation package query parameter, updates the installation package query parameter according to the decryption result, and then passes the installation package acquisition parameter to the constructed signature verification function, and when the signature verification is determined to be successful according to the output result of the signature verification function, passes the installation package query parameter to the constructed installation package query function, at this time, the output result of the installation package query function is the output result of the installation package acquisition function; thus, according to the output result of the installation package acquisition function, the corresponding installation package to be acquired can be obtained. The above device automatically acquires the installation package to be acquired that matches the installation package acquisition parameter based on the installation package acquisition function, solves the problem of low efficiency in acquiring the installation package, and achieves the effect of automatic and rapid acquisition of the installation package.
[0149] The installation package acquisition device provided in the embodiment of the present invention can execute the installation package acquisition method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0150] It is worth noting that in the embodiment of the above-mentioned installation package acquisition device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0151] Embodiment 5
[0152] Figure 5 A schematic diagram of a device provided in Embodiment 5 of the present invention is shown in FIG. Figure 5 As shown, the device includes a memory 510, a processor 520, an input device 530, and an output device 540. The number of processors 520 in the device can be one or more. Figure 5 A processor 520 is used as an example; the memory 510, the processor 520, the input device 530 and the output device 540 in the device can be connected via a bus or other means. Figure 5 The connection via bus 550 is taken as an example.
[0153] The memory 510, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the installation package acquisition method in the embodiment of the present invention (for example, the installation package acquisition parameter acquisition module 410 and the installation package to be acquired module 420 in the installation package acquisition device). The processor 520 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 510, that is, implements the above-mentioned installation package acquisition method.
[0154] The memory 510 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 510 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 510 may further include a memory remotely arranged relative to the processor 520, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0155] The input device 530 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 540 may include a display device such as a display screen.
[0156] Embodiment 6
[0157] Embodiment 6 of the present invention provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a method for obtaining an installation package when executed by a computer processor, including:
[0158] When a triggering event for obtaining an installation package is detected, obtaining installation package obtaining parameters corresponding to the triggering event, wherein the installation package obtaining parameters include installation package query parameters of the installation package to be obtained and object signature parameters of the installation package obtaining object;
[0159] The installation package acquisition parameter is used as an input parameter, and the constructed installation package acquisition function is called. According to the output result of the installation package acquisition function, the installation package to be acquired is obtained;
[0160] The installation package acquisition function implements the installation package acquisition function through the following steps:
[0161] Decrypt the installation package query parameters, and update the installation package query parameters according to the decryption result;
[0162] Pass the installation package acquisition parameters to the built signature verification function, and determine whether the signature verification is successful based on the output result of the signature verification function;
[0163] If so, the constructed installation package query function is called with the installation package query parameter as the input parameter, and the installation package to be obtained is obtained according to the output result of the installation package query function.
[0164] Of course, the computer executable instructions of a storage medium including computer executable instructions provided in an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the installation package acquisition method provided in any embodiment of the present invention.
[0165] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0166] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.< / apppagevo> < / apppagevo> < / string> < / apppagevo> < / appconf> < / integer> < / app> < / apppagevo> < / string> < / string> < / apppagevo> < / string> < / string> < / string> < / string> < / apppagevo> < / apppagevo> < / apppagevo>
Claims
1. A method for obtaining an installation package, characterized in that: include: When a triggering event for obtaining an installation package is detected, obtaining installation package obtaining parameters corresponding to the triggering event, wherein the installation package obtaining parameters include installation package query parameters of the installation package to be obtained and object signature parameters of the installation package obtaining object; Taking the installation package acquisition parameter as an input parameter, calling the constructed installation package acquisition function, and obtaining the installation package to be obtained according to the output result of the installation package acquisition function; The installation package acquisition function implements the installation package acquisition function through the following steps: Decrypting the installation package query parameter, and updating the installation package query parameter according to the decryption result; Pass the installation package acquisition parameters to the constructed signature verification function, and determine whether the signature verification is successful based on the output result of the signature verification function; If so, the installation package query parameter is used as an input parameter to call the constructed installation package query function, and the installation package to be obtained is obtained according to the output result of the installation package query function; The installation package query function implements the installation package query function through the following steps: Determine the number of installation packages of the installation packages to be obtained according to the installation package query parameter, and filter out application entries matching the installation package query parameter from the created list, wherein the application entry records the storage path and configuration information of the installation package to be obtained; the installation package query parameter after decryption is a character string with substantial meaning, and the number of strings in the character string is the number of installation packages of the installation packages to be obtained; If the number of the application entries is consistent with the number of the installation packages, obtaining the identity information of the installation package to be obtained from the application entries; Determine the installation package query information according to the identity information, and obtain the configuration information and the storage path from the application entry according to the installation package query information; The installation package to be obtained is obtained from a database based on the storage path, the installation package to be obtained and the configuration information are converted, and the conversion result is packaged.
2. The method according to claim 1, characterized in that Also includes: Based on a preset serialization annotation set in the installation package query function, the encapsulation result is automatically serialized into data in a preset format, wherein the preset format includes a JSON format.
3. The method according to claim 1, characterized in that The signature verification function implements the signature verification function through the following steps: Convert the installation package query parameter into a first query parameter, and convert the first query parameter into a second query parameter, wherein the type of the installation package query parameter is Object type, the type of the first query parameter is Map type, and the type of the second query parameter is List <string> type;< / string> Sorting the second query parameter based on a preset sorting function, and encapsulating the sorting result into a preset encapsulation object, wherein the type of the preset encapsulation object includes a StringBuilder type; Generate a signature verification result based on the preset encapsulated object through a message digest algorithm, and determine whether the signature verification result is consistent with the object signature parameter; If yes, the signature verification succeeds; otherwise, the signature verification fails.
4. The method according to claim 3, characterized in that After converting the installation package query parameter into a first query parameter, the method further includes: Removing the parameters to be removed from the first query parameters, and updating the first query parameters according to the removal result, wherein the parameters to be removed are parameters unrelated to the message digest algorithm; The second query parameter is emptied based on a preset emptying processing function, and the second query parameter is updated according to the emptying processing result.
5. The method according to claim 1, characterized in that The type of the installation package query parameter includes a PageParam type, wherein the description information of the PageParam includes at least one of the number of database pages, the number of entries per page, and a database paging parameter; and / or, The types of the output parameters of the installation package acquisition function include CommonResult <ListRes <apppagevo>>Type, where ListRes <apppagevo> is a generic parameter of CommonResult, AppPageVo is a generic parameter of ListRes; and / or,< / apppagevo> < / apppagevo> The installation package query parameters include the application name, application channel and / or application version number.
6. The method according to claim 1, characterized in that The installation package acquisition function is set in the installation package acquisition class, and at least one of the following preset annotations is set on the installation package acquisition class: A first preset annotation for indicating that the installation package acquisition class is a control class; A second preset annotation for indicating path information for accessing the installation package acquisition class; A third preset annotation for indicating that the installation package acquisition class implements log injection at a preset speed; and A fourth preset annotation used to indicate that the installation package acquisition class implements cross-service access.
7. An installation package acquisition device, characterized in that: include: An installation package acquisition parameter acquisition module, used to acquire installation package acquisition parameters corresponding to the trigger event when a trigger event for acquiring the installation package is detected, wherein the installation package acquisition parameters include installation package query parameters of the installation package to be acquired and object signature parameters of the installation package acquisition object; The module for obtaining the installation package to be obtained is used to call the constructed installation package obtaining function with the installation package obtaining parameter as an input parameter, and obtain the installation package to be obtained according to the output result of the installation package obtaining function; The installation package acquisition function implements the installation package acquisition function through the following submodules: An installation package query parameter decryption submodule, used to obtain access token information, decrypt the installation package query parameter based on the access token information, and update the installation package query parameter according to the decryption result; The signature verification judgment submodule is used to pass the installation package acquisition parameters to the constructed signature verification function, and judge whether the signature verification is successful according to the output result of the signature verification function; The submodule for obtaining the installation package to be obtained is used for, if yes, calling the constructed installation package query function with the installation package query parameter as an input parameter, and obtaining the installation package to be obtained according to the output result of the installation package query function; The installation package query function implements the installation package query function through the following units: an application entry screening unit, configured to determine the number of installation packages to be obtained according to the installation package query parameter, and screen application entries matching the installation package query parameter from the created list, wherein the application entry records the storage path and configuration information of the installation package to be obtained; the decrypted installation package query parameter is a character string with substantial meaning, and the number of strings in the character string is the number of installation packages to be obtained; An identity information acquisition unit, configured to acquire identity information of the installation package to be acquired from the application entry if the number of application entries is consistent with the number of installation packages; A storage path acquisition unit, used to determine the installation package query information according to the identity information, and acquire the configuration information and the storage path from the application entry according to the installation package query information; The first encapsulation unit is used to obtain the installation package to be obtained from the database based on the storage path, convert the installation package to be obtained and the configuration information, and encapsulate the conversion result.
8. A device, characterized in that include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the installation package acquisition method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the installation package acquisition method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Method for downloading target file and device thereof
CN106453448A