Version update method and device

By configuring the mapping relationship between the client version number and the version number to be updated by the configuration center, the logic on the server is simplified, the problems of high code complexity and error rate in the existing technology are solved, and simpler maintenance and more efficient versions are achieved. renew.

CN113448602BActive Publication Date: 2025-01-14BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010229564.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-27
Publication Date
2025-01-14
Estimated Expiration
2040-03-27

AI Technical Summary

Technical Problem

In the prior art, there are a large number of branch statements in the code used by the server to update the client application version, which is complex in logic and difficult to maintain, resulting in high error rates and high testing and maintenance costs.

Method used

Configure the mapping relationship between the client version number and the version number to be updated through the configuration center, intercept update requests, avoid traversing the server logical code, and use the basic methods and branch methods of the parent class and child class to update, reducing code complexity.

Benefits of technology

Simplifies code logic, reduces error rate and maintenance costs, improves version update efficiency, hides the details of client version updates, and reduces the workload of testers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113448602B_ABST
    Figure CN113448602B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for version updating, and relates to the field of computer technology. A specific implementation of the method includes: intercepting a request to update an application version; wherein the request includes the version number of the client that issued the request; using a mapping relationship configured by a configuration center to determine a version number to be updated that matches the client version number; and updating the application to be updated according to the version number to be updated. This implementation avoids the technical defect of the prior art that a large amount of logic code in the server side needs to be traversed to obtain whether the version can be updated when the version is updated, thereby achieving the technical effect of making the code logic simpler and easier to maintain compared to the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a version update. Background Art

[0002] When the product requirements corresponding to the application change, or there are vulnerabilities in the code corresponding to the application, the server needs to update the version of the application in the client.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] 1. The code used to update the client application version on the server contains a large number of branch statements, which makes the logic confusing and difficult to maintain;

[0005] 2. When requirements change, it may involve modifying multiple branches of code, which may result in a high error rate;

[0006] 3. High testing cost and high maintenance cost. Summary of the invention

[0007] In view of this, an embodiment of the present invention provides a method and device for version updating, which can avoid the technical defect of the prior art that a large amount of logic code in the server needs to be traversed to obtain whether the version can be updated when updating, thereby achieving the technical effect of making the code logic simpler and easier to maintain compared with the prior art.

[0008] To achieve the above object, according to one aspect of an embodiment of the present invention, a version update method is provided, comprising:

[0009] Intercepting a request to update an application version; wherein the request includes a version number of a client issuing the request;

[0010] Using the mapping relationship configured in the configuration center, determine the version number to be updated that matches the client version number;

[0011] The application to be updated is updated according to the version number to be updated.

[0012] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0013] Configure the mapping relationship between each version number to be updated and each client version number in the configuration center;

[0014] Or, configure the mapping relationship between each client version number, each version number to be updated, and the branch method corresponding to the version number to be updated in the configuration center.

[0015] Optionally, updating the application to be updated according to the version number to be updated includes:

[0016] Determine the parent class corresponding to the version number to be updated;

[0017] According to the parent class, determine the subclass corresponding to the version number to be updated;

[0018] The application to be updated is updated using the basic method in the parent class and the branch method in the child class.

[0019] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0020] Establish a parent class corresponding to each version number to be updated;

[0021] Write the basic methods corresponding to the version numbers to be updated in the parent class;

[0022] Based on the parent class, subclasses corresponding to the version numbers to be updated are established respectively;

[0023] Write the branch method corresponding to each version number to be updated in each subclass;

[0024] Configure the mapping relationship between each version number to be updated and the branch method.

[0025] Optionally, updating the application to be updated according to the version number to be updated includes:

[0026] Determine the class corresponding to the version number to be updated;

[0027] Determine whether there is a branch method corresponding to the version number to be updated in the class;

[0028] If it does not exist, then update the application to be updated according to the basic method in the class;

[0029] If it exists, the application to be updated is updated according to the branch method corresponding to the version number to be updated.

[0030] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0031] Establish a class corresponding to each version number to be updated;

[0032] Write the branch method corresponding to each version number to be updated in the class respectively;

[0033] Write the basic method in the class;

[0034] Configure the mapping relationship between each version number to be updated and the branch method and basic method.

[0035] According to another aspect of an embodiment of the present invention, there is provided a version updating device, comprising:

[0036] A request interception module, used to intercept a request to update an application version; wherein the request includes a version number of a client issuing the request;

[0037] A judgment module, used to determine the version number to be updated that matches the client version number by using the mapping relationship configured by the configuration center;

[0038] An updating module is used to update the application to be updated according to the version number to be updated.

[0039] Optionally, the method comprises: a configuration module configured to determine, before using the mapping relationship configured in the configuration center to determine the version number to be updated that matches the client version number,

[0040] Configure the mapping relationship between each version number to be updated and each client version number in the configuration center;

[0041] Or, configure the mapping relationship between each client version number, each version number to be updated, and the branch method corresponding to the version number to be updated in the configuration center.

[0042] According to another aspect of an embodiment of the present invention, there is provided a version updating electronic device, comprising:

[0043] one or more processors;

[0044] a storage device for storing one or more programs,

[0045] When the one or more programs are executed by the one or more processors, the one or more processors implement the version updating method provided by the present invention.

[0046] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the version updating method provided by the present invention is implemented.

[0047] One embodiment of the above invention has the following advantages or beneficial effects:

[0048] This application uses the technical means of configuring the version number to be updated corresponding to the client version number in the configuration center, avoiding the technical defect of the prior art that a large amount of logic code in the server needs to be traversed to obtain whether the version can be updated when the version is updated, thereby achieving the technical effect of making the code logic simpler and easier to maintain than the prior art.

[0049] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0051] Figure 1 is a schematic diagram of the main process of a version update method according to an embodiment of the present invention;

[0052] Figure 2 It is a schematic diagram of the structure of the server used to update the client version;

[0053] Figure 3 It is a flow chart of a client for updating the client version;

[0054] Figure 4 is a schematic diagram of main modules of a version update apparatus 400 according to an embodiment of the present invention;

[0055] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0056] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0057] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0058] Figure 1 is a schematic diagram of the main process of a version update method according to an embodiment of the present invention, such as Figure 1 As shown, including:

[0059] Step S101, intercepting a request to update an application version; wherein the request includes a version number of a client issuing the request;

[0060] Step S102: using the mapping relationship configured by the configuration center, determine the version number to be updated that matches the client version number;

[0061] Step S103: Update the application to be updated according to the version number to be updated.

[0062] When the server updates the version of the application, it needs to first obtain a request sent by the application to be updated. The server updates the application of the server through the information contained in the request.

[0063] By configuring the version number to be updated corresponding to the client version number in the configuration center, the technical defect of the prior art that a large amount of logic code in the server needs to be traversed to obtain whether the version can be updated when the version is updated is avoided, thereby achieving the technical effect of making the code logic simpler and easier to maintain than the prior art.

[0064] When it is determined that the configuration center has a version number to be updated that matches the client version number, a subsequent version update operation can be performed.

[0065] In the present application, the configuration center at least stores the mapping relationship between the client version number and the version number to be updated. The configuration center can also store the mapping relationship between the version number to be updated and the corresponding class and each method in the class. In an optional embodiment of the present application, the configuration center can be replaced by a configuration file.

[0066] By setting up the configuration center, when the updated version needs to be maintained, only the mapping relationship needs to be changed in the configuration center, which reduces the maintenance cost. At the same time, the configuration center can be tested separately during testing, avoiding the technical defect of the prior art that the entire code of the updated version needs to be tested, thereby achieving the purpose of reducing the testing cost.

[0067] The present application uses the above steps S101-S103 to determine the version number to be updated that matches the client version number through the configuration center, and then updates the application to be updated according to the version number to be updated. This technical means solves the technical defects of the prior art that the code used to update the client application version in the server contains a large number of branch statements, the logic is relatively chaotic, and it is difficult to maintain, thereby achieving the technical effect of reducing testing costs, reducing maintenance costs, and improving the efficiency of updating application versions.

[0068] The embodiments of the present application can achieve hiding the call details from the client when performing code updates, so that the client does not need to consider the problem of multiple versions when performing version updates. It can directly modify the business logic of a version to be updated based on the version number to be updated determined in the configuration center without affecting the business logic of other versions, thereby achieving the technical effect of reducing the workload of testers.

[0069] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0070] Configure the mapping relationship between each version number to be updated and each client version number in the configuration center;

[0071] Or, configure the mapping relationship between each client version number, each version number to be updated, and the branch method corresponding to the version number to be updated in the configuration center.

[0072] The configuration center may be zookeeper, Spring Cloud Eureka, Consul, etc., which are not listed here one by one.

[0073] When the configuration center adopts Zookeeper, real-time dynamic version control adjustment can be achieved without restarting the server.

[0074] Optionally, updating the application to be updated according to the version number to be updated includes:

[0075] Determine the parent class corresponding to the version number to be updated;

[0076] According to the parent class, determine the subclass corresponding to the version number to be updated;

[0077] The application to be updated is updated using the basic method in the parent class and the branch method in the child class.

[0078] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0079] Establish a parent class corresponding to each version number to be updated;

[0080] Write the basic methods corresponding to the version numbers to be updated in the parent class;

[0081] Based on the parent class, subclasses corresponding to the version numbers to be updated are established respectively;

[0082] Write the branch method corresponding to each version number to be updated in each subclass;

[0083] Configure the mapping relationship between each version number to be updated and the branch method.

[0084] Specifically, the basic method can be placed in a parent class, and each method to be called by the updated version can be placed in a different subclass, and the method in the parent class can be overwritten. The configuration in the configuration center can be a mapping between the client version number and the corresponding subclass.

[0085] In an optional embodiment of the present application, each version to be updated corresponding to an application can be written in a parent class, in which basic methods and branch methods are defined. In this example, the basic method refers to the method common to each version to be updated, that is, no matter which version to be updated is used, the basic method needs to be called. Then, the application to be updated is updated through the preset method corresponding to the version number to be updated in the parent class.

[0086] In an optional embodiment of the present application, updating the application to be updated according to the version number to be updated includes:

[0087] Determine the class corresponding to the version number to be updated;

[0088] Determine whether there is a branch method corresponding to the version number to be updated in the class;

[0089] If it does not exist, then update the application to be updated according to the basic method in the class;

[0090] If it exists, the application to be updated is updated according to the branch method corresponding to the version number to be updated.

[0091] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0092] Establish a class corresponding to each version number to be updated;

[0093] Write the branch method corresponding to each version number to be updated in the class respectively;

[0094] Write the basic method in the class;

[0095] Configure the mapping relationship between each version number to be updated and the branch method and basic method.

[0096] By configuring methods corresponding to different version numbers to be updated in the class, the technical defect that when the requirements change, it may involve modifying multiple branches of code, resulting in a high error rate, is solved.

[0097] When updating the application to be updated, it can be first determined whether the application to be updated has a corresponding branch method according to the mapping relationship, and then the application is updated according to the branch method.

[0098] In an optional embodiment of the present application, different methods corresponding to the client can be set in a class. When the application needs to be updated, the different methods corresponding to the client are called to the class, and then the application is updated.

[0099] Specifically, in a class, define methods such as a1, a2, a3, etc. that need to be called by different client versions, and then set up a proxy in the server that is transparent to the client. The proxy first determines whether there is a method corresponding to the client in the configuration center; if there is, use the method corresponding to the client to update the application.

[0100] The pseudo-code of the class is as follows:

[0101]

[0102]

[0103] Based on the pseudo-code of the above class, the mapping relationship between the version number to be updated configured in the configuration center and the client version number can be:

[0104] Class for updating the application version. Base method: {"=android_3.0.1": "Branch method 1", "<android_3.0.1": "Branch method 2", "<ios_3.0.1": "Branch method 3"}

[0105] The above mapping relationship means that for clients with Android 3.0.1, call Branch method 1; for clients with a version number less than Android 3.0.1, call Branch method 2; for clients with a version number less than <ios_3.0.1, call Branch method 3. If there is no matching version in the configuration center, call the base method.

[0106] Next, the relationship between the configuration center and the version to be updated will be described in detail with another embodiment.

[0107] Figure 2 It is a schematic structural diagram of the server for updating the client version.

[0108] As Figure 2 shown, there is a server entry in the server for receiving requests from the client to update the server version.

[0109] Set up a proxy in the server that is transparent to the client to determine whether there is a method corresponding to the client in the configuration center; if there is, use the method corresponding to the client to update the application;

[0110] The server also includes a configuration center, a base method A, a branch method B, a branch method C, and a branch method D.

[0111] Optionally, configure the mapping relationship between the version number to be updated and the corresponding preset method in the configuration center, then the preset method corresponding to the version number to be updated can be directly determined through the configuration center, and then the preset method can be called to directly update the application.

[0112] The optional embodiment of the present application uses the technical means of dynamic proxy to hide the version calling details from the caller (that is, the client), so that business personnel do not need to be overly concerned about the issue of version branch control when developing programs, and do not need to write any if else branch statements in the calling code. This solves the technical defects of the prior art that the code for updating the client application version on the server side contains a large number of branch statements, the logic is relatively chaotic, and it is difficult to maintain.

[0113] This application uses the form of a configuration center to flexibly call different client versions, reduce testing costs and maintenance costs, reduce the complexity of modifying branches, and thus achieve the technical effect of reducing the error rate.

[0114] The following is a detailed description of the steps for client version update using a specific implementation.

[0115] Figure 3 It is a flowchart of a client for updating the client version.

[0116] Step S301: intercept the update request using aspect-oriented programming (AOP);

[0117] Step S302, receiving whether the mapping relationship between each to-be-updated version number of the client and each client version number is configured in the configuration center zookeeper; if so, executing step S303; if not, executing step S305;

[0118] Step S303: accept and determine whether the client version number has a corresponding version number to be updated; if so, execute step S304; if not, execute step S305;

[0119] Step S304: updating the client according to the version number to be updated corresponding to the client version number;

[0120] Step S305: Receive information indicating that the client cannot be updated.

[0121] Figure 4 4 is a schematic diagram of main modules of a version update device 400 according to an embodiment of the present invention; Figure 4 As shown, including:

[0122] The request interception module 401 is used to intercept the request for updating the application version; wherein the request includes the version number of the client issuing the request;

[0123] The judgment module 402 is used to judge whether there is a version number to be updated that matches the client version number in the configuration center;

[0124] The updating module 403 is configured to update the application to be updated according to the version number to be updated.

[0125] Optionally, the method comprises: a configuration module configured to determine, before using the mapping relationship configured in the configuration center to determine the version number to be updated that matches the client version number,

[0126] Configure the mapping relationship between each version number to be updated and each client version number in the configuration center;

[0127] Or, configure the mapping relationship between each client version number, each version number to be updated, and the branch method corresponding to the version number to be updated in the configuration center.

[0128] Optionally, updating the application to be updated according to the version number to be updated includes:

[0129] Determine the parent class corresponding to the version number to be updated;

[0130] According to the parent class, determine the subclass corresponding to the version number to be updated;

[0131] The application to be updated is updated using the basic method in the parent class and the branch method in the child class.

[0132] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0133] Establish a parent class corresponding to each version number to be updated;

[0134] Write the basic methods corresponding to the version numbers to be updated in the parent class;

[0135] Based on the parent class, subclasses corresponding to the version numbers to be updated are established respectively;

[0136] Write the branch method corresponding to each version number to be updated in each subclass;

[0137] Configure the mapping relationship between each version number to be updated and the branch method.

[0138] Optionally, updating the application to be updated according to the version number to be updated includes:

[0139] Determine the class corresponding to the version number to be updated;

[0140] Determine whether there is a branch method corresponding to the version number to be updated in the class;

[0141] If it does not exist, then update the application to be updated according to the basic method in the class;

[0142] If it exists, the application to be updated is updated according to the branch method corresponding to the version number to be updated.

[0143] Optionally, before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included:

[0144] Establish a class corresponding to each version number to be updated;

[0145] Write the branch method corresponding to each version number to be updated in the class respectively;

[0146] Write the basic method in the class;

[0147] Configure the mapping relationship between each version number to be updated and the branch method and basic method.

[0148] Figure 5 An exemplary system architecture 500 is shown to which the version updating method or version updating apparatus according to the embodiment of the present invention can be applied.

[0149] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0150] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0151] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0152] The server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0153] It should be noted that the version updating method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the version updating device is generally disposed in the server 505 .

[0154] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0155] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0156] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0157] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0158] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0159] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0160] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0161] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the sending module may also be described as a "module for sending a picture acquisition request to the connected server."

[0162] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0163] Intercepting a request to update an application version; wherein the request includes a version number of a client issuing the request;

[0164] Using the mapping relationship configured in the configuration center, determine the version number to be updated that matches the client version number;

[0165] The application to be updated is updated according to the version number to be updated.

[0166] According to the technical solution of the embodiment of the present invention, the following beneficial effects can be achieved:

[0167] This application uses the technical means of configuring the version number to be updated corresponding to the client version number in the configuration center, avoiding the technical defect of the prior art that a large amount of logic code in the server needs to be traversed to obtain whether the version can be updated when the version is updated, thereby achieving the technical effect of making the code logic simpler and easier to maintain than the prior art.

[0168] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A version update method, characterized in that: include: Intercepting a request to update an application version; wherein the request includes a version number of a client issuing the request; Using the mapping relationship configured in the configuration center, determine the version number to be updated that matches the client version number; The application to be updated is updated according to the version number to be updated, including: determining the parent class corresponding to the version number to be updated; determining the subclass corresponding to the version number to be updated according to the parent class; and updating the application to be updated using the basic method in the parent class and the branch method in the subclass.

2. The method according to claim 1, characterized in that: Before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included: Configure the mapping relationship between each version number to be updated and each client version number in the configuration center; Or, configure the mapping relationship between each client version number, each version number to be updated, and the branch method corresponding to the version number to be updated in the configuration center.

3. The method according to claim 1, characterized in that Before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included: Establish a parent class corresponding to each version number to be updated; Write the basic methods corresponding to the version numbers to be updated in the parent class; Based on the parent class, subclasses corresponding to the version numbers to be updated are established respectively; Write the branch method corresponding to each version number to be updated in each subclass; Configure the mapping relationship between each version number to be updated and the branch method.

4. The method according to claim 2, characterized in that: Updating the application to be updated according to the version number to be updated includes: Determine the class corresponding to the version number to be updated; Determine whether there is a branch method corresponding to the version number to be updated in the class; If it does not exist, then update the application to be updated according to the basic method in the class; If it exists, the application to be updated is updated according to the branch method corresponding to the version number to be updated.

5. The method according to claim 4, characterized in that Before determining the version number to be updated that matches the client version number by using the mapping relationship configured in the configuration center, the following steps are included: Establish a class corresponding to each version number to be updated; Write the branch method corresponding to each version number to be updated in the class respectively; Write the basic method in the class; Configure the mapping relationship between each version number to be updated and the branch method and basic method.

6. A version update device, characterized in that: include: A request interception module, used to intercept a request to update an application version; wherein the request includes a version number of a client issuing the request; A judgment module, used to determine the version number to be updated that matches the client version number by using the mapping relationship configured by the configuration center; An update module is used to update the application to be updated according to the version number to be updated, including: determining the parent class corresponding to the version number to be updated; determining the subclass corresponding to the version number to be updated according to the parent class; and updating the application to be updated using the basic method in the parent class and the branch method in the subclass.

7. The device according to claim 6, characterized in that include: The configuration module is used to determine the version number to be updated that matches the client version number by using the mapping relationship configured by the configuration center. Configure the mapping relationship between each version number to be updated and each client version number in the configuration center; Or, configure the mapping relationship between each client version number, each version number to be updated, and the branch method corresponding to the version number to be updated in the configuration center.

8. An electronic device with a version update, characterized in that: include: one or more processors; a storage device 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 method according to any one of claims 1 to 5.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Version upgrading method and electronic device

    CN103731733A