CN114995861B - Weex-based application program updating method, storage medium and electronic equipment - Google Patents

Weex-based application program updating method, storage medium and electronic equipment Download PDF

Info

Publication number
CN114995861B
CN114995861B CN202210919963.6A CN202210919963A CN114995861B CN 114995861 B CN114995861 B CN 114995861B CN 202210919963 A CN202210919963 A CN 202210919963A CN 114995861 B CN114995861 B CN 114995861B
Authority
CN
China
Prior art keywords
weex
file
error
loading
target page
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
CN202210919963.6A
Other languages
Chinese (zh)
Other versions
CN114995861A (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.)
China Travelsky Mobile Technology Co Ltd
Original Assignee
China Travelsky Mobile Technology 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 China Travelsky Mobile Technology Co Ltd filed Critical China Travelsky Mobile Technology Co Ltd
Priority to CN202210919963.6A priority Critical patent/CN114995861B/en
Publication of CN114995861A publication Critical patent/CN114995861A/en
Application granted granted Critical
Publication of CN114995861B publication Critical patent/CN114995861B/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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

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

Abstract

The present invention relates to the field of data processing, and in particular, to a weex-based application program updating method, a storage medium, and an electronic device. Including a trigger instruction responsive to the target page; acquiring and loading a first weex file, and acquiring a second version number corresponding to a second weex file from a server; if the second version number is different from the first version number, downloading a second weex file from the server; if an error occurs in the loading process of the first weex file, determining the error level of the error; when the error grade is a first preset target grade, continuously loading the first weex file; and when the trigger instruction of the target page is received again, acquiring and loading a second weex file in the local memory. Due to the fact that the time for waiting for the second weex file to finish downloading is saved, the time for finishing loading of the target page cannot be prolonged, the waiting time of a user is short, and the access smoothness of the target page is improved.

Description

Weex-based application program updating method, storage medium and electronic equipment
Technical Field
The present invention relates to the field of data processing, and in particular, to a weex-based application program updating method, a storage medium, and an electronic device.
Background
weex is an open-source lightweight mobile end cross-platform dynamic technical solution, can perfectly take performance and dynamic into account as a universal cross-platform Web development language, and enables a mobile developer to write Native-level performance experience through simple front-end grammar. And a set of writing rules can be used through weex, and programs which are simultaneously suitable for an iOS system, a web system and an Android system are developed.
In the prior art, various errors can occur in the loading and running process of an application program, and the errors can cause the phenomena that the application program runs in a blocking mode, a page is loaded slowly, and even the application program crashes and cannot run, so that the access smoothness of the page is reduced, and the user experience is influenced.
Disclosure of Invention
Aiming at the technical problems, the technical scheme adopted by the invention is as follows:
according to a first aspect of the present invention, there is provided a weex-based application program updating method, comprising the steps of:
responding to a triggering instruction of the target page;
acquiring and loading a first weex file, and acquiring a second version number corresponding to a second weex file from a server;
the first weex file is a weex file of the latest version corresponding to a target page stored in the local memory; the second weex file is a weex file of the latest version corresponding to a target page stored in the server;
if the second version number is different from the first version number, downloading a second weex file from the server to the local memory; downloading the second weex file does not interrupt the loading of the first weex file; the first version number is the version number of the first weex file;
if an error occurs in the loading process of the first weex file, determining an error grade of the error according to an error code of the error;
when the error level is a first preset target level, continuously loading the first weex file;
and when the trigger instruction of the target page is received again, acquiring and loading a second weex file in the local memory.
According to a second aspect of the present invention, there is provided a non-transitory computer readable storage medium having at least one instruction or at least one program stored therein, the at least one instruction or the at least one program being loaded and executed by a processor to implement the above method.
According to a third aspect of the invention, there is provided an electronic device comprising a processor and a non-transitory computer-readable storage medium.
The invention has at least the following beneficial effects:
in the invention, when the first weex file is loaded each time, whether a second weex file with a new version exists in the server or not is checked at the same time, if yes, the second weex file is downloaded to the local for standby, and the first weex file originally in the local is still continuously loaded while the second weex file is downloaded so as to complete the loading display of the corresponding target page. Meanwhile, the second weex file is downloaded to the local, and the second weex file is loaded when the target page is started next time, so that the loading and displaying work of the target page is completed.
If the error does not affect the normal loading of the first weex file in the loading process of the first weex file, even if a new second weex file can be downloaded and loaded, the program can continue to load the first weex file of the original version to complete the loading and displaying work of the target page. The loading and displaying work of the target page is not required to be completed by loading the second weex file, so that the time for waiting for the second weex file to complete downloading is saved, the loading completion time of the target page cannot be prolonged, the time for a user to wait for the target page to complete displaying is shorter, the access smoothness of the target page is improved, and the use experience of the user is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a weex-based application program updating method according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
According to a first aspect of the present invention, as shown in fig. 1, there is provided a weex-based application program updating method, comprising the steps of:
step S100: and responding to the triggering instruction of the target page.
Specifically, the target page may be a page corresponding to a certain service in a certain program, and the corresponding target page may be loaded by a trigger instruction.
Step S200: and acquiring and loading the first weex file, and acquiring a second version number corresponding to the second weex file from the server.
The first weex file is a weex file of the latest version corresponding to a target page stored in the local memory. The second weex file is the weex file of the latest version corresponding to the target page stored in the server.
Step S300: and if the second version number is different from the first version number, downloading a second weex file from the server to the local memory. And downloading the second weex file does not interrupt the loading of the first weex file. The first version number is the version number of the first weex file.
Specifically, the downloading of the second weex file is to download a weex compression packet corresponding to the second weex file, where the weex compression packet includes a page special compression packet, and after the downloading of the corresponding page special compression packet is completed, the page special compression packet, the page common compression packet, and a code in the base file are spliced to obtain an object code, where the object code is a code when the second weex file is loaded. Because the code shared by a plurality of pages in the application program is stored in the page sharing compression package in the embodiment, the basic file is the code shared by all the pages in the locally stored application program, and the page sharing compression package and the basic file can be stored locally in advance, and do not need to be downloaded repeatedly in the later use process.
Therefore, when the weex compression packet corresponding to the second weex file is downloaded, only the page dedicated compression packet corresponding to the second weex file needs to be downloaded, and in addition, the size of the page dedicated compression packet is usually within 1.5 megabytes, so that the time for downloading the corresponding weex compression packet from the server is reduced by greatly reducing the size of the file to be downloaded, and the time for downloading the second weex file is also reduced.
Step S400: and if an error occurs in the loading process of the first weex file, determining the error grade of the error according to the error code of the error.
Step S500: and when the error level is the first preset target level, continuously loading the first weex file.
Specifically, the error corresponding to the first preset target level is a non-fatal error, that is, the error may be an error that does not cause the first weex file to be unable to be loaded or the first weex file to be loaded slowly, for example, the error may be an error such as a mismatch between field types or an exception in rendering a part of components.
Step S600: and when the trigger instruction of the target page is received again, acquiring and loading a second weex file in the local memory.
In this embodiment, each time the first weex file is loaded, whether a new version of the second weex file exists in the server is checked, if yes, the second weex file is downloaded to the local for standby, and the local original first weex file is still loaded while the second weex file is downloaded, so as to complete loading and displaying of the corresponding target page. Meanwhile, the second weex file is downloaded to the local, and the second weex file is loaded when the target page is started next time, so that the loading and displaying work of the target page is completed.
If the error does not affect the normal loading of the first weex file in the loading process of the first weex file, even if a new second weex file can be downloaded and loaded, the program can continue to load the first weex file of the original version to complete the loading and displaying work of the target page. The loading and displaying work of the target page is not required to be completed by loading the second weex file, so that the time for waiting for the second weex file to complete downloading is saved, the loading completion time of the target page cannot be prolonged, the time for a user to wait for the target page to complete displaying is shorter, the access smoothness of the target page is improved, and the use experience of the user is improved.
As one possible embodiment of the present invention, in step S400: after determining the corresponding error level based on the error code, the method further comprises:
step S410: and when the error level is a second preset target level, stopping the loading of the first weex file and determining whether the downloading of the second weex file is finished.
Step S420: and if the second weex file is downloaded, loading the second weex file.
And the corresponding error in the second preset target level can cause that the target page can not finish loading.
Specifically, the fatal error may be an error that causes the first weex file not to complete loading, that is, an error that causes no response to the target page or a corresponding error when the target page is blank,
in this embodiment, when a fatal error occurs during the process of loading the first weex file, the first weex file is stopped from being loaded, and after the second weex file is downloaded, the second weex file is loaded to complete the display of the target page. Because the second weex file is an updated version of the first weex file, the updated second weex file can solve errors existing in the first weex file of the original version, namely, fewer errors exist in the updated second weex file, and the operation is more stable.
Meanwhile, the web page special compression packet corresponding to the second web file to be downloaded only comprises the corresponding web page special compression packet, and the size of the web page special compression packet is small, so that the downloading can be completed in a very short time, and therefore, the time for a user to wait for the second web file to complete the downloading can be greatly reduced, the time for a target page to complete the loading and displaying again is further shortened, and the use experience of the user is improved.
As one possible embodiment of the present invention, step S400: determining a corresponding error level based on the error code, including:
step S401: acquiring a first mapping relation table; the first mapping relation table is used for representing the mapping relation between each error code and the corresponding error grade.
Step S402: and determining the corresponding error grade according to the error code and the first mapping relation table.
Specifically, the corresponding error level may be determined according to the type of the error that may occur in the loader corresponding to the target page and the operating condition of the target page caused by the error, for example, the error level may be a fatal error level or a non-fatal error level. The error corresponding to the fatal error level can cause the loader corresponding to the target page to completely crash and cannot complete loading, such as version incompatibility. The error corresponding to the non-fatal error level will not affect the normal loading of the loader corresponding to the target page, such as field type mismatch.
In the embodiment, the mapping relation between each error code and each error level is pre-established according to the actual use condition, and each mapping relation is stored in the first mapping relation table, and the mapping relation can be adaptively adjusted according to the use requirement in the later use process so as to adapt to different use scenes, so that the applicability of the embodiment can be improved, and meanwhile, the sensitivity of the method for adjusting whether the second weex file needs to be loaded or not can be adjusted in real time by adjusting the corresponding relation between the error code and the error level.
As one possible embodiment of the present invention, in step S400: after determining the corresponding error level based on the error code, the method further comprises:
step S430: and acquiring a second mapping relation table, wherein the second mapping relation table is used for representing the mapping relation between each error code and the corresponding error description information.
The specific second mapping relation table is pre-established according to the actual usage scenario, and the establishing method is the same as the establishing method of the first mapping relation table, and is not described herein again.
Step S440: and generating alarm log information according to the error description information and the error grade corresponding to the error code.
Step S450: and sending the alarm log information to a preset terminal.
In this embodiment, the alarm log information is sent to the preset terminal, so that the error condition can be more visually embodied, and meanwhile, related personnel or systems can be correspondingly reminded through the alarm log information. Therefore, the method is beneficial to the early intervention of later operation and maintenance, and can make corresponding solutions in advance, thereby ensuring the long-term stable operation of corresponding system programs.
Meanwhile, step S450 may specifically include the following steps:
step S4501 transmits alarm log information corresponding to the error level to a corresponding preset terminal according to the error level.
The preset terminals can also be classified according to the properties of the users using the preset terminals, for example, the preset terminals used by the users for research and development personnel can be first-class terminals, and the preset terminals used by the users for operation and maintenance personnel can be second-class terminals, so that the alarm log information can be sent to the corresponding preset terminals according to the specific conditions of the error levels. Such as: and if the abnormity corresponding to the error grade needs to be informed by research personnel, the alarm log information corresponding to the error grade is sent to the first class terminal. Therefore, the alarm log information can be sent to the corresponding preset terminal according to the error level, and the pertinence of the alarm log information in sending can be improved.
As a possible embodiment of the present invention, step S420: if the second weex file is downloaded, loading the second weex file, including:
step S421: and performing MD5 value check on the second weex file downloaded into the local memory.
Step S422: when the MD5 value of the second weex file verifies, the second weex file is loaded.
Specifically, after the second weex file is downloaded to the local storage, the MD5 value of the downloaded compressed packet needs to be checked, and the second weex file can be loaded only when the check is passed. Therefore, the security of the file downloaded from the server to the local can be improved by adding the step of checking the MD5 value, the downloaded file can be further prevented from being maliciously falsified, and the security of the downloaded file can be improved.
As one possible embodiment of the present invention, in step S420: after loading the second weex file, the method further comprises:
step S423: and if the second weex file fails to be loaded, reloading the first weex file.
Generally, because the second weex file of the new version also has a higher requirement on the version of the operating system of the installation device, it may occur during the use process that the second weex file cannot be run due to the lower version of the operating system of the installation device, and in addition, an error occurs when the first weex file is loaded, and it may also be caused by mutual influence when other programs running simultaneously run to a certain special node, and the time of the node is extremely short.
As one possible embodiment of the present invention, in step S410: after determining whether the second weex file is downloaded, the method further includes:
step S411: and if the second weex file fails to download, reloading the first weex file.
Further, the method further comprises the following steps:
step S700: and when the reloading of the first weex file fails, reloading the first weex file.
Step S800: and if the loading times of reloading the first weex file is greater than the first threshold value, stopping loading the first weex file.
In this embodiment, the number of times of reloading the first weex file is limited by setting the first threshold, and when the number of times of reloading is greater than the first threshold, not only may the first weex file be stopped from being loaded, but also corresponding failure information may be generated and sent to the corresponding terminal. Generally, since the error is mostly caused by the defect of the first weex file, when the loading time for reloading the first weex file is greater than the first threshold, it is determined that the first weex file is really problematic, and the first weex file is not loaded any more, and at this time, the target page may be converted into the html H5 page.
Embodiments of the present invention also provide a non-transitory computer-readable storage medium, which may be configured in an electronic device to store at least one instruction or at least one program for implementing a method of the method embodiments, where the at least one instruction or the at least one program is loaded into and executed by a processor to implement the method provided by the above embodiments.
Embodiments of the present invention also provide an electronic device comprising a processor and the aforementioned non-transitory computer-readable storage medium.
Embodiments of the present invention further provide a computer program product comprising program code means for causing an electronic device to carry out the steps of the method according to various exemplary embodiments of the invention described above when the program product is run on the electronic device.
Although some specific embodiments of the present invention have been described in detail by way of illustration, it should be understood by those skilled in the art that the above illustration is only for the purpose of illustration and is not intended to limit the scope of the invention. It will also be appreciated by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.

Claims (10)

1. A weex-based application program updating method is characterized by comprising the following steps:
responding to a trigger instruction of a target page;
acquiring and loading a first weex file, and acquiring a second version number corresponding to a second weex file from a server;
the first weex file is a weex file of the latest version corresponding to the target page stored in a local memory; the second weex file is a weex file of the latest version corresponding to the target page stored in the server;
if the second version number is different from the first version number, downloading a second weex file from the server to the local memory; downloading the second weex file does not interrupt the loading of the first weex file; the first version number is the version number of the first weex file;
if an error occurs in the loading process of the first weex file, determining the error grade of the error according to the error code of the error;
when the error grade is a first preset target grade, continuously loading the first weex file;
and when the trigger instruction of the target page is received again, acquiring and loading a second weex file in the local memory.
2. The method of claim 1, wherein after said determining a corresponding error level from said error code, said method further comprises:
when the error level is a second preset target level, stopping the loading of the first weex file, and determining whether the downloading of the second weex file is finished;
if the second weex file is downloaded, loading the second weex file;
and the corresponding error in the second preset target level can cause that the target page cannot be loaded.
3. The method of claim 1, wherein determining a corresponding error level based on the error code comprises:
acquiring a first mapping relation table; the first mapping relation table is used for representing the mapping relation between each error code and the corresponding error grade;
and determining the corresponding error grade according to the error code and the first mapping relation table.
4. The method of claim 3, wherein after said determining a corresponding error level based on said error code, said method further comprises:
acquiring a second mapping relation table, wherein the second mapping relation table is used for representing the mapping relation between each error code and corresponding error description information;
generating alarm log information according to the error description information and the error grade corresponding to the error code;
and sending the alarm log information to a preset terminal.
5. The method of claim 2, wherein loading the second weex file if the second weex file is downloaded is completed comprises:
performing MD5 value check on the second weex file downloaded into the local memory;
and when the MD5 value of the second weex file passes the check, loading the second weex file.
6. The method of claim 2, wherein after said loading said second weex file, said method further comprises:
and if the second weex file fails to be loaded, reloading the first weex file.
7. The method of claim 2, wherein after the determining whether the second weex file is downloaded is complete, the method further comprises:
and if the second weex file fails to be downloaded, reloading the first weex file.
8. The method according to claim 6 or 7, further comprising:
when the first weex file fails to be reloaded, reloading the first weex file;
and if the loading times of reloading the first weex file is greater than a first threshold value, stopping loading the first weex file.
9. A non-transitory computer readable storage medium having stored therein at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by a processor to implement the method of any one of claims 1-8.
10. An electronic device comprising a processor and the non-transitory computer readable storage medium of claim 9.
CN202210919963.6A 2022-08-02 2022-08-02 Weex-based application program updating method, storage medium and electronic equipment Active CN114995861B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210919963.6A CN114995861B (en) 2022-08-02 2022-08-02 Weex-based application program updating method, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210919963.6A CN114995861B (en) 2022-08-02 2022-08-02 Weex-based application program updating method, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN114995861A CN114995861A (en) 2022-09-02
CN114995861B true CN114995861B (en) 2022-09-30

Family

ID=83021756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210919963.6A Active CN114995861B (en) 2022-08-02 2022-08-02 Weex-based application program updating method, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114995861B (en)

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108287839B (en) * 2017-01-09 2022-01-28 阿里巴巴集团控股有限公司 Page loading method and equipment
CN107577491B (en) * 2017-08-09 2021-05-11 时趣互动(北京)科技有限公司 Weex-based method and system for updating version in mobile application
CN107784086B (en) * 2017-10-09 2020-08-04 中国平安人寿保险股份有限公司 Webpage loading method, terminal equipment and computer readable storage medium
CN107818163B (en) * 2017-11-01 2019-03-29 平安科技(深圳)有限公司 Page display method, device, computer equipment and storage medium
CN108846131A (en) * 2018-07-03 2018-11-20 深圳鼎盛电脑科技有限公司 Weex page rendering method, apparatus, terminal and storage medium
CN110119290A (en) * 2019-04-12 2019-08-13 平安科技(深圳)有限公司 The spare page switching method of application program, device, computer equipment and storage medium
CN112256296B (en) * 2020-09-22 2024-07-19 上海东普信息科技有限公司 Weex-based express service APP updating method, weex-based express service APP updating device, weex-based express service APP updating equipment and storage medium
CN112507263B (en) * 2021-02-05 2021-05-14 平安普惠企业管理有限公司 Page loading updating method and device, electronic equipment and storage medium
CN113282354B (en) * 2021-06-28 2023-04-07 中国平安人寿保险股份有限公司 H5 page loading method, device and equipment of application program and storage medium
CN113779458B (en) * 2021-07-27 2024-02-27 贝壳找房(北京)科技有限公司 Method and device for accelerating application loading, electronic equipment and storage medium
CN113535211B (en) * 2021-09-15 2021-12-28 中航信移动科技有限公司 Application program updating method and device, computer equipment and storage medium
CN114237736A (en) * 2021-11-19 2022-03-25 中国建设银行股份有限公司 Page resource loading method, system, device, computer equipment and storage medium
CN114371887A (en) * 2022-01-12 2022-04-19 挂号网(杭州)科技有限公司 Method, device, equipment and medium for preloading application program based on Weex framework

Also Published As

Publication number Publication date
CN114995861A (en) 2022-09-02

Similar Documents

Publication Publication Date Title
CN106569847B (en) Method for vehicle-mounted system to realize IAP remote upgrade based on mobile network
US7536599B2 (en) Methods and systems for validating a system environment
AU2021206497B2 (en) Method and apparatus for authority control, computer device and storage medium
US20190149571A1 (en) Method and device for repairing page vulnerability
CN110737548B (en) Data request method and server
CN113448862A (en) Software version testing method and device and computer equipment
CN110362416B (en) Page component loading method and device, electronic equipment and storage medium
CN114995861B (en) Weex-based application program updating method, storage medium and electronic equipment
CN109947407B (en) Data acquisition method and device
CN113127329A (en) Script debugging method and device and computer storage medium
CN116775086A (en) Partition upgrading method and related device of android device
CN116795408A (en) ECU software upgrading method and system and vehicle
CN111090442A (en) Application updating method and device and storage medium
CN111552586B (en) Application crash processing method and device
CN111209197B (en) Application continuous integration test method, system, equipment and storage medium
CN114090055A (en) Application program updating method and device, terminal and storage medium
CN113568834A (en) SDK code compatibility detection method, device, computer equipment and medium
CN112783522B (en) File loading method, file loading device and electronic equipment
CN111694730B (en) Method and device for eliminating error reference control resource
CN112860224B (en) Function execution environment construction method and device, electronic equipment and storage medium
CN117331754B (en) Abnormality problem reduction method, abnormality problem reduction system, electronic device, and computer storage medium
CN114268624B (en) Version file transmission method and device and server
WO2024142721A1 (en) Environment creation management device, system, method, and program
CN116149693A (en) Firmware upgrading method and device and terminal equipment
CN114428628A (en) Application program upgrading method and related equipment

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
GR01 Patent grant
GR01 Patent grant