CN108984197B - Code updating method and device - Google Patents

Code updating method and device Download PDF

Info

Publication number
CN108984197B
CN108984197B CN201810762250.7A CN201810762250A CN108984197B CN 108984197 B CN108984197 B CN 108984197B CN 201810762250 A CN201810762250 A CN 201810762250A CN 108984197 B CN108984197 B CN 108984197B
Authority
CN
China
Prior art keywords
code
command
updating
code updating
update
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810762250.7A
Other languages
Chinese (zh)
Other versions
CN108984197A (en
Inventor
梁冬冬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Holding Co Ltd
Original Assignee
Jingdong Technology Holding Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingdong Technology Holding Co Ltd filed Critical Jingdong Technology Holding Co Ltd
Priority to CN201810762250.7A priority Critical patent/CN108984197B/en
Publication of CN108984197A publication Critical patent/CN108984197A/en
Application granted granted Critical
Publication of CN108984197B publication Critical patent/CN108984197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Library & Information Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a code updating method and device, and relates to the technical field of computers. One embodiment of the method comprises: acquiring a code update file, wherein the code update file indicates a user identifier and a code update command; determining that the code updating command indicated by the code updating file can be called according to a preset user authority list, the user identification indicated by the code updating file and the code updating command; and calling the code updating command to update the code by executing the code updating command. The method comprises the steps of determining a code updating command which can be called by acquiring a code updating file comprising a user identifier and the code updating command, and calling the code updating command to update codes. The invention can directly update the code of the server without manual operation, thereby saving time and labor.

Description

Code updating method and device
Technical Field
The present invention relates to the field of computers, and in particular, to a method and an apparatus for updating a code.
Background
During the development of software products, the code that has been released often needs to be updated. When the code is updated based on the Web service deployed by the Windows system, a developer needs to submit the code of a certain newly-built branch to the Windows server or partially or completely update the code of an existing branch.
The prior art code updating method generally has two modes. The first method is as follows: the user name, password are manually entered on the Windows server, after which the code is updated by command. The second method comprises the following steps: logging in the Windows server through a remote tool or a third-party tool carried by the Windows system, and updating the code in a remote operation mode.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art: in the first mode, the Windows server needs to be operated manually, and the code is pulled to be updated, so that time and labor are wasted; in the second mode, disconnection and unknown unstable factors are easy to occur in remote connection, and if the company network is limited and the networks between the two servers cannot be communicated with each other, remote code updating cannot be realized.
Disclosure of Invention
In view of this, embodiments of the present invention provide a code updating method and apparatus, where a code updating file including a user identifier and a code updating command is obtained, a code updating command that can be invoked is determined, and then the code updating command is invoked to perform code updating. The invention can directly update the code of the server without manual operation, thereby saving time and labor.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a code updating method.
The code updating method of the embodiment of the invention comprises the following steps: acquiring a code updating file, wherein the code updating file indicates a user identifier and a code updating command; determining that the code updating command indicated by the code updating file can be called according to a preset user authority list, the user identification indicated by the code updating file and the code updating command; and calling the code updating command to update the code by executing the code updating command.
Optionally, the obtaining a code update file includes: polling to access a mailbox server according to a preset time interval; when a new mail is detected, judging whether the new mail indicates the code updating command or not; and when the code updating command is indicated in the new mail, taking the new mail as the code updating mail, wherein the sender of the new mail is the user identification.
Optionally, the determining, according to the preset user permission list, the user identifier indicated by the code update file, and the code update command, that the code update command indicated by the code update file may be called includes: comparing the user identification indicated by the code updating file with the user identification included in the preset user authority list; under the condition that the preset user authority list comprises the user identification indicated by the code updating file, comparing the code updating command indicated by the code updating file with an executable code updating command corresponding to the user identification in the preset user authority list; in the event that the code update command indicated by the update file matches the executable code update command, the code update command indicated by the code update file may be invoked.
Optionally, the method further comprises: and receiving a return result after the code updating command is executed, and pushing the return result to the user in a mail sending mode.
To achieve the above object, according to another aspect of the embodiments of the present invention, there is provided a code updating apparatus.
The code updating device of the embodiment of the invention comprises: the code updating module is used for acquiring a code updating file, wherein the code updating file indicates a user identifier and a code updating command; the determining module is used for determining that the code updating command indicated by the code updating file can be called according to a preset user authority list, the user identifier indicated by the code updating file and the code updating command; and the updating module is used for calling the code updating command so as to update the code by executing the code updating command.
Optionally, the obtaining module is further configured to: polling to access a mailbox server according to a preset time interval; when a new mail is detected, judging whether the new mail indicates the code updating command; and when the code updating command is indicated in the new mail, taking the new mail as the code updating mail, wherein the sender of the new mail is the user identification.
Optionally, the determining module is further configured to: comparing the user identification indicated by the code updating file with the user identification included in the preset user authority list; under the condition that the preset user authority list comprises the user identification indicated by the code updating file, comparing the code updating command indicated by the code updating file with an executable code updating command corresponding to the user identification in the preset user authority list; and in the case that the code update command indicated by the update file matches the executable code update command, the code update command indicated by the code update file may be invoked.
Optionally, the apparatus further comprises: and the pushing module is used for receiving a return result after the code updating command is executed and pushing the return result to the user in a mail sending mode.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus.
An electronic device of an embodiment of the present invention includes: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement a code updating method of an embodiment of the present invention.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium.
A computer-readable medium of an embodiment of the present invention has stored thereon a computer program that, when executed by a processor, implements a code updating method of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: the code updating file comprising the user identification and the code updating command is obtained, the code updating command which can be called is determined, then the code updating command is called to update the code, the code of the server can be directly updated, manual operation is not needed, and time and labor are saved; the user sends the mail for updating the code to the mailbox server, so that the server can obtain a new mail through a mechanism of polling to access the mailbox server, the user and the server are bridged, the code of the server is directly updated, and the code updating efficiency is improved; presetting a user authority list to find out a code updating file meeting the user authority list, avoiding a user without authority from updating a code of a server, and ensuring the safety of code updating; and pushing a return result after the execution of the code updating command is finished to the user, so that the user can conveniently know the success or failure condition of the code updating.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a code update method according to an embodiment of the invention;
FIG. 2 is a schematic main flow chart of a code updating method according to an embodiment of the invention;
FIG. 3 is a schematic main flow chart of a code updating method according to another embodiment of the invention;
FIG. 4 is a schematic diagram of the main modules of a code update apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of the major modules of a code update system according to an embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 7 is a schematic diagram of a computer apparatus suitable for use in an electronic device to implement an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main steps of a code updating method according to an embodiment of the present invention. As shown in fig. 1, the code updating method according to the embodiment of the present invention mainly includes the following steps:
step S101: a code update file is obtained, wherein the code update file indicates a user identification and a code update command. The code update command, such as git (distributed version control system with open source) command, svn (subversion, version control system with open source) command. The code update file can be a code update mail or a code update configuration file, and if the code update file is the code update mail, a mailbox server needs to be accessed through a polling mechanism to acquire the code update mail; if the code update file is a code update configuration file, the code update configuration file can be transmitted through an HTTP (hyper text transport protocol) protocol to be directly acquired.
Step S102: and determining that the code updating command indicated by the code updating file can be called according to a preset user authority list, the user identification indicated by the code updating file and the code updating command. The user authority list comprises user identifications of users with code updating authority and corresponding executable code updating commands. Comparing the user identification of the code updating file with the user identification of a user authority list; comparing a code updating command of the code updating file with an executable code updating command corresponding to the user identifier in the user authority list under the condition that the user identifier of the code updating file exists in the user authority list; when the code update command matches the executable code update command, the code update command of the code update file may be invoked; when the code update command does not match the executable code update command, the code update command of the code update file may not be invoked.
Step S103: and calling the code updating command to update the code by executing the code updating command. And under the condition that the code updating command of the code updating file can be called, calling the code updating command to execute the code updating command under the path of updating the code, and finishing the code updating. The path of the update code is the storage address of the update code in a code server, and the code server is a server for storing the code inside a company.
Fig. 2 is a schematic main flow chart of a code updating method according to an embodiment of the invention. As shown in fig. 2, the code updating method according to an embodiment of the present invention mainly includes the following steps:
step S201: the server accesses the mailbox server through a polling mechanism to acquire the code updating mail. Wherein, the code updating mail is sent to the mailbox server by the user through the mailbox client, and comprises a user (namely a sender) name, a mailbox address and a code updating command. The mailbox server, such as the mailbox servers of Singal, 163 and the like, needs to start third party authorization, and is connected with the open address of the mailbox server through the mailbox client so as to realize the communication between the mailbox client and the mailbox server. In an embodiment, the server is a Windows server, and accesses the mailbox server at preset time intervals, such as 10 seconds, 5 seconds, and the like, determines whether the mailbox server receives the code update mail, and stores the mailbox address of the sender in a variable form if the mailbox server receives the code update mail. The polling may be implemented as: obtaining an unread mail from a mailbox server every 5 seconds, aiming at detecting whether a new mail exists or not and judging whether the new mail comprises a code updating command or not, and if the new mail exists and the new mail comprises the code updating command, taking the new mail as the code updating mail; if no new mail exists or no code updating command is included in the new mail, the Windows server sleeps for 5 seconds, and after 5 seconds, the unread mail is continuously acquired from the mailbox server to judge whether the mail is a code updating mail.
Step S202: the server judges whether the code updating command indicated by the code updating mail can be called or not according to a preset user authority list, the user identification of the code updating mail and the code updating command, and if the code updating command can be called, the step S203 is executed; if it cannot be called, the flow ends. In the embodiment, if the user can not be called, prompt information without the updating authority can be fed back to the corresponding user. In order to ensure the security of code update, the Windows server stores a user permission list, where the user permission list includes a user name, a corresponding mailbox address, and a corresponding executable code update command, which is specifically shown in table 1.
TABLE 1 user Authority List
User name Mailbox address Executable code update command
Zhang San zhangsan@sina.com git pull
Li Si lisi@sina.com git commit
Wang Wu wangwu@163.com git add
Wherein, the git pull command in table 1 retrieves the update of a branch of the remote host, and then merges with the local designated branch. Common usage formats are:
git pull < remote host name > < remote branch name > < local branch name >
git commit command, submitting the locally modified content into the cache. A common usage format may be:
git commit-m 'XXX', XXX represents the modified content.
gitadd command, add file content to index (add modifications to scratch). The basic usage format is:
gitadd < path >, which may be a file or a directory, indicates that information for modifying (excluding deleted files) or newly adding files is added to the index repository.
List 1 is merely an example, and the executable code update command may be a git command and/or a svn command. In a preferred embodiment, since the mailbox address can be used as a unique user identifier, the user name in the user authority list can be omitted, and only the mailbox address and the corresponding executable code update command are stored. Correspondingly, the user name in the user authority list can also be used as a unique user identifier, so that the mailbox address in the user authority list can be omitted, and only the user name and the corresponding executable code updating command are stored.
The Windows server acquires a mailbox address and a code updating command of a code updating mail, compares the acquired mailbox address with a mailbox address of the user permission list, compares the code updating command with an executable code updating command corresponding to the mailbox address if the mailbox address exists in the user permission list, and indicates that the code updating command of the code updating mail can be called if the code updating command is matched with the executable code updating command; and if the mailbox address does not exist in the user permission list or the mailbox address exists in the user permission list but the code updating command does not match with the executable code updating command corresponding to the mailbox address, indicating that the code updating command of the code updating mail cannot be called. For example, the Windows server acquires a code update mail sent by zhang san, and if a code update command in the code update mail has a git pull word, the code update command of the code update mail can be called; if the code update command in the code update mail carries a git commit word, the code update command stating that the code update mail cannot be called.
In a preferred embodiment, the code update command may be written in the mail subject and/or the mail body, the mail subject area and/or the mail body area are retrieved, and if the area contains the code update command, the code update command is obtained and compared with the executable code update command corresponding to the mailbox address.
Step S203: the server-opening sub-process calls the code update command to execute the code update command under a path of the update code. And the updating code is a code which is pushed to the code server after the original code is updated by the developer. The Windows server opens a subprocess by using Python language, calls a code updating command by using the subprocess, executes the code updating command under a path of updating codes, and monitors a return result of the subprocess. For example, a git pull command is executed that compares whether the local branch code differs from the most recent code of the corresponding remote branch, and if so, updates the delta code. After the git pull command is executed, returning results possibly comprise updated (availability up-to-date), update error (error), update failure (fail) and other keywords, judging whether the updated (availability up-to-date) exists in the returning results, if so, indicating that the code updating is completed, and the remote branch and the code of the local corresponding branch are consistent without incremental codes; if keywords such as error and fail exist, the code update exception is explained. The incremental code is a part of a remote branch code which is different from a local corresponding branch code.
Step S204: and the server receives a return result after the code updating command is executed, and calls an email sending program to push the return result to the user. For example, taking the execution of the git pull command as an example, if the return result contains an available up-to-date keyword, the instruction code is updated, the return result is saved in a variable form, an e-mail sending program is called, and the return result is fed back to the user (sender). If the keyword does not have any update up-to-date, the code update is abnormal, the return result is stored in a variable form, and the return result is fed back to a user (sender) to inform the user of the abnormal update. The mail subject may be "update completion notification of the Windows server", the receiver is the sender saved in step S201, and the mail content is the return result.
The following takes the mailbox server as the newwave mailbox server as an example, and further explains the code updating method of the embodiment of the present invention.
Firstly, updating the code of the code server, specifically: web service is deployed in the Windows server cluster, and after developers develop new functions of the Web service, newly added codes are pushed to a remote code server through a git push command. In this step, the client used by the developer development program needs to install the git client. The git address of the code server to which the new code is pushed by git push command is a URL (Uniform Resource Locator) address, such as https:// github.
And then updating codes of the Windows server cluster, specifically: a developer sends a mail to a Xinlang mailbox, and the subject of the mail is git pull; after the transmission is successful, the Windows server detects an unread mail, acquires a sender, a mailbox address and a code updating command of the unread mail, and stores the mailbox address of the sender through a first variable; judging whether the sender and the code updating command meet the requirement of a user permission list, when the sender and the code updating command meet the requirement of the user permission list, starting a Python subprocess by the Windows server to call a git pull command so as to execute the git pull command under a path (namely a git address) of a newly added code, monitoring a return value of the subprocess, and storing the return value through a second variable; and after the git pull command is executed, sending the return value serving as the text of the feedback mail to the stored mailbox address of the sender.
FIG. 3 is a main flowchart of a code updating method according to another embodiment of the present invention. As shown in FIG. 3, the code updating method of another embodiment of the present invention mainly includes the following steps
Step S301: the server acquires a code updating configuration file, and analyzes the updating configuration file to obtain a user identifier and a code updating command. Wherein the code update configuration file is defined by a developer and comprises a user identification and a code update command. In the embodiment, the user identifier is a user name, and the code update configuration file can be sent to the Windows server in the form of an email or directly sent to the Windows server through an HTTP protocol.
Step S302: the server judges whether the code updating command of the code updating configuration file can be called or not according to a preset user authority list, the user identification of the code updating configuration file and the code updating command, and if the code updating command can be called, the step S303 is executed; if it cannot be called, the flow ends. In this embodiment, the user permission list includes column 1 labeled user name and column 3 labeled executable code update command in table 1. Comparing a user identifier with a user name of the user authority list, if the user identifier exists in the user authority list, comparing the code updating command with an executable code updating command corresponding to the user identifier, and if the code updating command is matched with the executable code updating command, indicating that the code updating command of the code updating configuration file can be called; and if the user identification does not exist in the user authority list or the user identification exists in the user authority list but the code updating command does not match with the executable code updating command corresponding to the user identification, indicating that the code updating command of the code updating configuration file cannot be called. For example, the Windows server acquires an update configuration file, the user identifier is zhang san, and the code update command has a git pull word, which indicates that the code update command of the code update configuration file can be called; if the code update command carries a git commit word, then the code update command that states the code update configuration file may not be invoked.
Step S303: the server-opening sub-process calls the code update command to execute the code update command under a path of the update code. The specific implementation process of this step is the same as step S203.
Step S304: and the server receives a return result after the code updating command is executed, and pushes the return result to the user through the updating result configuration file. And storing the return result in the update result configuration file. For example, taking the execution of a git pull command as an example, if an available up-to-date keyword exists in the returned result, it indicates that the code is updated, and the returned result is saved in an update result configuration file in a variable form; and if the keyword does not have the overload up-to-date, indicating that the code is abnormal, and storing the return result in an update result configuration file in a variable form. In an embodiment, the update result configuration file may be sent to the Windows server in the form of an email, or may be directly sent to the Windows server through an HTTP protocol.
According to the code updating method provided by the embodiment of the invention, the code updating file comprising the user identification and the code updating command is obtained to determine the code updating command which can be called, and then the code updating command is called to update the code, so that the code of the server can be directly updated, manual operation is not needed, and time and labor are saved; the user sends the mail for updating the code to the mailbox server, so that the server can obtain a new mail through a mechanism of polling access to the mailbox server, the user and the server are bridged, the code of the server is directly updated, and the code updating efficiency is improved; presetting a user authority list to find out a code updating file meeting the user authority list, avoiding a user without authority from updating a code of a server, and ensuring the safety of code updating; and pushing a return result after the execution of the code updating command is finished to the user, so that the user can conveniently know the success or failure condition of the code updating.
Fig. 4 is a schematic diagram of main modules of a code updating apparatus according to an embodiment of the present invention. As shown in fig. 4, the code updating apparatus 400 according to the embodiment of the present invention mainly includes:
an obtaining module 401, configured to obtain a code update file, where the code update file indicates a user identifier and a code update command. The code update commands, such as git commands, svn commands. The code update file can be a code update mail or a code update configuration file, and if the code update file is the code update mail, a mailbox server needs to be accessed through a polling mechanism to acquire the code update mail; if the code update file is a code update configuration file, the code update configuration file can be transmitted through an HTTP (hyper text transport protocol) so as to be directly acquired.
A determining module 402, configured to determine, according to a preset user permission list, a user identifier indicated by the code update file, and a code update command, that the code update command indicated by the code update file may be invoked. The user authority list comprises user identifications of users with code updating authority and corresponding executable code updating commands. Comparing the user identification of the code updating file with the user identification of a user authority list; comparing a code updating command of the code updating file with an executable code updating command corresponding to the user identifier in the user authority list under the condition that the user identifier of the code updating file exists in the user authority list; when the code update command matches the executable code update command, the code update command of the code update file may be invoked; when the code update command does not match the executable code update command, the code update command of the code update file may not be invoked.
An updating module 403, configured to invoke the code updating command, so as to perform code updating by executing the code updating command. And under the condition that the code updating command of the code updating file can be called, calling the code updating command to execute the code updating command under the path of updating the code, and finishing the code updating. The path of the update code is the storage address of the update code in a code server, and the code server is a server for storing the code inside a company.
In addition, the code updating apparatus 400 according to the embodiment of the present invention may further include: and a pushing module (not shown in fig. 4) configured to receive a return result after the code update command is executed, and push the return result to the user in a manner of sending an email.
FIG. 5 is a schematic diagram of the main modules of a code update system according to an embodiment of the present invention. As shown in fig. 5, a code updating system 500 according to an embodiment of the present invention includes: a client 501, a mailbox server 502, a Windows server 503 (i.e., the code update apparatus 400), and a code server 504. The developer sends a new mail to the mailbox server 502 through a mailbox client installed in the client 501, and pushes (push) the updated code to the code server 504 through the client 501. Mailbox server 502 receives new mail from the developer. The Windows server 503 judges whether a new mail is received in the mailbox server 502 through a polling mechanism, and when the new mail is received in the mailbox server 502 and the new mail includes a code update command, the new mail is used as a code update mail; then judging whether the code updating command in the code updating mail can be called or not according to the user authority list, the user identification in the code updating mail and the code updating command; when the code updating mail code updating command can be called, calling the code updating command to execute the command under the path of the updating code and receiving a return result after the command is executed; the return result is sent to the client 501 of the developer as the body of the mail sending.
As can be seen from the above description, the code update file including the user identifier and the code update command is obtained, the code update command that can be called is determined, and then the code update command is called to update the code, so that the code of the server can be directly updated without manual operation, and time and labor are saved; the user sends the mail for updating the code to the mailbox server, so that the server can obtain a new mail through a mechanism of polling access to the mailbox server, the user and the server are bridged, the code of the server is directly updated, and the code updating efficiency is improved; presetting a user authority list to find out a code updating file meeting the user authority list, avoiding a user without authority from updating a code of a server, and ensuring the safety of code updating; and pushing a return result after the execution of the code updating command is finished to the user, so that the user can conveniently know the success or failure condition of the code updating.
Fig. 6 illustrates an exemplary system architecture 600 to which the code updating method or code updating apparatus of embodiments of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with a server 605, via a network 604, to receive or send messages or the like. Various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like, may be installed on the terminal devices 601, 602, and 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server that provides various services, such as a background management server that provides support for code update mails generated by users using the terminal apparatuses 601, 602, 603. The background management server can analyze and the like the received code updating mail and call a code updating command in the code updating mail according to an analysis result (for example, according with an updating authority rule).
It should be noted that the code updating method provided in the embodiment of the present application is generally executed by the server 605, and accordingly, the code updating apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The invention also provides an electronic device and a computer readable medium according to the embodiment of the invention.
The electronic device of the present invention includes: one or more processors; a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement a code updating method of an embodiment of the present invention.
The computer-readable medium of the present invention has stored thereon a computer program which, when executed by a processor, implements a code updating method of an embodiment of the present invention.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with an electronic device implementing an embodiment of the present invention. The electronic device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the computer system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, the processes described above with respect to the main step diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program containing program code for performing the method illustrated in the main step diagram. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes an acquisition module, a determination module, and an update module. The names of these modules do not in some cases constitute a limitation on the module itself, and for example, the acquiring module may also be described as a "module that acquires a code update file".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a code update file, wherein the code update file indicates a user identifier and a code update command; determining that the code updating command indicated by the code updating file can be called according to a preset user authority list, the user identification indicated by the code updating file and the code updating command; and calling the code updating command to update the code by executing the code updating command.
As can be seen from the above description, the code update file including the user identifier and the code update command is obtained, the code update command that can be called is determined, and then the code update command is called to update the code, so that the code of the server can be directly updated without manual operation, and time and labor are saved; the user sends the mail for updating the code to the mailbox server, so that the server can obtain a new mail through a mechanism of polling to access the mailbox server, the user and the server are bridged, the code of the server is directly updated, and the code updating efficiency is improved; a user authority list is preset to find out a code updating file meeting the user authority list, so that the condition that a user without authority updates a code of a server is avoided, and the safety of code updating is ensured; and pushing a return result after the execution of the code updating command is finished to the user, so that the user can conveniently know the success or failure condition of the code updating.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A code update method, comprising:
acquiring a code updating file, wherein the code updating file indicates a user identifier and a code updating command and is a code updating mail or a code updating configuration file;
determining that the code updating command indicated by the code updating file can be called according to a preset user authority list, the user identification indicated by the code updating file and the code updating command; the user authority list comprises user identifications of users with code updating authority and corresponding executable code updating commands;
and calling the code updating command to update the code by executing the code updating command.
2. The method of claim 1, wherein obtaining the code update file comprises:
polling to access a mailbox server according to a preset time interval;
when a new mail is detected, judging whether the new mail indicates the code updating command;
and when the code updating command is indicated in the new mail, taking the new mail as the code updating mail, wherein the sender of the new mail is the user identification.
3. The method according to claim 1, wherein the determining that the code update command indicated by the code update file can be invoked according to a preset user permission list, the user identifier indicated by the code update file, and the code update command comprises:
comparing the user identification indicated by the code updating file with the user identification included in the preset user authority list;
under the condition that the preset user authority list comprises the user identification indicated by the code updating file, comparing the code updating command indicated by the code updating file with an executable code updating command corresponding to the user identification in the preset user authority list;
in the event that the code update command indicated by the update file matches the executable code update command, the code update command indicated by the code update file may be invoked.
4. The method according to any one of claims 1 to 3, further comprising: and receiving a return result after the code updating command is executed, and pushing the return result to the user in a mail sending mode.
5. A code updating apparatus, comprising:
the code updating module is used for updating a mail or a configuration file for the code;
the determining module is used for determining that the code updating command indicated by the code updating file can be called according to a preset user authority list, the user identifier indicated by the code updating file and the code updating command; the user authority list comprises user identifications of users with code updating authority and corresponding executable code updating commands;
and the updating module is used for calling the code updating command so as to update the code by executing the code updating command.
6. The apparatus of claim 5, wherein the obtaining module is further configured to:
polling to access a mailbox server according to a preset time interval;
when a new mail is detected, judging whether the new mail indicates the code updating command; and
and when the code updating command is indicated in the new mail, taking the new mail as the code updating mail, wherein the sender of the new mail is the user identification.
7. The apparatus of claim 5, wherein the determining module is further configured to:
comparing the user identification indicated by the code updating file with the user identification included in the preset user authority list;
under the condition that the preset user authority list comprises the user identification indicated by the code updating file, comparing the code updating command indicated by the code updating file with an executable code updating command corresponding to the user identification in the preset user authority list; and
in the event that the code update command indicated by the update file matches the executable code update command, the code update command indicated by the code update file may be invoked.
8. The apparatus of any of claims 5 to 7, further comprising: and the pushing module is used for receiving a return result after the code updating command is executed and pushing the return result to the user in a mail sending mode.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN201810762250.7A 2018-07-12 2018-07-12 Code updating method and device Active CN108984197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810762250.7A CN108984197B (en) 2018-07-12 2018-07-12 Code updating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810762250.7A CN108984197B (en) 2018-07-12 2018-07-12 Code updating method and device

Publications (2)

Publication Number Publication Date
CN108984197A CN108984197A (en) 2018-12-11
CN108984197B true CN108984197B (en) 2022-08-12

Family

ID=64537842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810762250.7A Active CN108984197B (en) 2018-07-12 2018-07-12 Code updating method and device

Country Status (1)

Country Link
CN (1) CN108984197B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559001B (en) * 2019-09-26 2023-09-26 北京京东振世信息技术有限公司 Method and device for updating application
CN111045725B (en) * 2019-12-16 2023-08-18 广州唯品会信息科技有限公司 Control method and device of code management system and storage medium
CN113595962B (en) * 2020-04-30 2022-11-18 华为技术有限公司 Safety control method and device and safety control equipment
CN113900680A (en) * 2020-07-06 2022-01-07 中国移动通信集团重庆有限公司 Code management method and device and computing equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727337A (en) * 2008-10-24 2010-06-09 鸿富锦精密工业(深圳)有限公司 Electronic device with automatic software updating function and method
CN103581256A (en) * 2012-08-02 2014-02-12 阿里巴巴集团控股有限公司 Method, device and system for publishing information to website
CN104461578A (en) * 2014-12-26 2015-03-25 广州唯品会信息科技有限公司 Automatic code merging method and system
CN106250548A (en) * 2016-08-12 2016-12-21 福建中金在线信息科技有限公司 A kind of code update method
CN107493198A (en) * 2017-08-29 2017-12-19 北纬通信科技南京有限责任公司 Honeycomb game packaging system and SDK cut-in methods based on SDK accesses
CN107886008A (en) * 2016-09-30 2018-04-06 北京京东尚科信息技术有限公司 File management method and system
CN108255502A (en) * 2016-12-27 2018-07-06 杭州海康威视数字技术股份有限公司 A kind of update in library, upload, management method, device and base management system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101098313B (en) * 2006-06-30 2011-08-10 华为技术有限公司 Mail transmitting method and system
US8923806B2 (en) * 2008-03-14 2014-12-30 William J. Johnson System and method for presenting application data by data processing system(s) in a vicinity
CN104239756B (en) * 2013-06-19 2017-08-15 深圳市莫廷影像技术有限公司 A kind of administrator right update method and device
US10248403B2 (en) * 2015-03-13 2019-04-02 Kony, Inc. Providing updates for natively rendered mobile applications
CN107579865A (en) * 2017-10-18 2018-01-12 北京奇虎科技有限公司 Right management method, the apparatus and system of distributed code server

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727337A (en) * 2008-10-24 2010-06-09 鸿富锦精密工业(深圳)有限公司 Electronic device with automatic software updating function and method
CN103581256A (en) * 2012-08-02 2014-02-12 阿里巴巴集团控股有限公司 Method, device and system for publishing information to website
CN104461578A (en) * 2014-12-26 2015-03-25 广州唯品会信息科技有限公司 Automatic code merging method and system
CN106250548A (en) * 2016-08-12 2016-12-21 福建中金在线信息科技有限公司 A kind of code update method
CN107886008A (en) * 2016-09-30 2018-04-06 北京京东尚科信息技术有限公司 File management method and system
CN108255502A (en) * 2016-12-27 2018-07-06 杭州海康威视数字技术股份有限公司 A kind of update in library, upload, management method, device and base management system
CN107493198A (en) * 2017-08-29 2017-12-19 北纬通信科技南京有限责任公司 Honeycomb game packaging system and SDK cut-in methods based on SDK accesses

Also Published As

Publication number Publication date
CN108984197A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
CN108984197B (en) Code updating method and device
CN107844324B (en) Client page jump processing method and device
CN112148711B (en) Batch processing task processing method and device
CN111038906B (en) Order sorting method and device
CN110895603B (en) Multi-system account information integration method and device
CN111427701A (en) Workflow engine system and business processing method
CN116737662A (en) Method, device, electronic equipment and storage medium for processing business data
CN112948138A (en) Method and device for processing message
CN112835609B (en) Method and device for modifying download address of dependent packet
CN112783903B (en) Method and device for generating update log
CN110765445B (en) Method and device for processing request
CN111950232B (en) Method and device for automatically switching number segments
CN112272211A (en) Service request processing method, device and system
CN110048991B (en) Method and device for realizing signal interaction reliability
CN111737218A (en) File sharing method and device
CN112732728A (en) Data synchronization method and system
CN113268417B (en) Task execution method and device
CN113760921A (en) Method and device for creating dictionary value
CN110727739B (en) Data storage method and device
CN113688152B (en) System function self-checking method and device
CN110830662A (en) Outbound call data generation method and device
CN114253520B (en) Interface code generation method and device
CN115955327A (en) Interception authentication method and device based on document system
CN118283028A (en) Data processing method, device, electronic equipment and storage medium
CN113297087A (en) Test method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant after: Jingdong Technology Holding Co.,Ltd.

Address before: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant before: Jingdong Digital Technology Holding Co.,Ltd.

Address after: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant after: Jingdong Digital Technology Holding Co.,Ltd.

Address before: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant before: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.

Address after: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant after: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.

Address before: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant before: BEIJING JINGDONG FINANCIAL TECHNOLOGY HOLDING Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant