Resource management and synchronization methodTechnical Field
The invention relates to the technical field of data management, in particular to a resource management and synchronization method.
Background
With the popularization of APPs (applications) among different crowds in different regions, the requirements for development of the APPs are higher and higher, and for example, for multi-language requirements of different crowds in different regions, multi-version development and multi-language adaptation need to be performed on the same APP, so that the number of versions of character string resources which need to be maintained when an installation package of the APP is compiled and updated is increased day by day.
At present, the string resources of the versions of the APP are independent from each other, and when bugs (bugs) such as translation errors and correction errors occur, the string resources of different versions need to be modified synchronously, so that the time consumption is long, and the efficiency is low.
Secondly, the number of applications preset on the current intelligent device is gradually increased, and in most applications, a plurality of character string resources are repeated, and if each application stores one resource file independently, resource redundancy (possibly a plurality of same resources exist) occurs, which is not convenient for management and wastes space.
Disclosure of Invention
In view of the deficiencies of the prior art, the present invention is directed to a method for resource management and synchronization.
In order to achieve the purpose, the invention adopts the following technical scheme:
a resource management and synchronization method comprises the following specific processes:
s1, storing the resource files in a remote warehouse, wherein the remote warehouse is uniformly managed by an administrator, and the administrator can add, delete, modify and query the resource files in the remote warehouse;
the resource files comprise public files and exclusive files, the public files and the exclusive files have corresponding version numbers, the version numbers are set in a preset format, and when the resource files are modified, the remote warehouse can automatically add 1 to the version numbers of the resource files; the public file stores character string resources which are possibly used in all applications; each dedicated file stores character string resources strongly related to the corresponding App service; each character string resource has a unique reference key, and the character string resources stored in the public file also have a preset prefix at the front end of the reference key;
s2, in the process of starting an intelligent equipment system upgrading project, an administrator triggers the remote warehouse to perform statistical detection on the character string resources stored in each exclusive file, the character string resources with the reuse degree higher than a preset threshold value in each exclusive file are counted out, then the character string resources are stored in a public file, a preset prefix is added before a key is quoted, then the corresponding character string resources are deleted in the corresponding exclusive file, and each App application is notified;
s3, each App correspondingly modifies the reference mode to use the character string resource according to the reference key of the character string resource in the public file.
Further, when the intelligent device runs, if the resource file in the remote warehouse changes, the server initiates an update push message to all App applications affected by the change, if the public file is modified, the update push message is pushed to all App applications, and if only the exclusive file is modified, the update push message only needs to be pushed to the App application corresponding to the exclusive file; and after receiving the push, the corresponding App application completes the silent update of the corresponding resource file.
Furthermore, when the intelligent device is started or the network is switched, the resource file version information of all the App applications is reported to the server, the server is triggered to detect whether the resource files of the App applications need to be updated, and if yes, the corresponding resource files are updated.
The invention has the beneficial effects that: the resource file is divided into a public file and an exclusive file, the character string resources which can be used by all applications are stored in the public file, the space redundancy can be reduced, and when the character string resources with high reuse degree are modified, all the applications can be used only by modifying the public file in one place, so that the efficiency is improved, the unified management of the resources is realized, the bug caused by the resource error can be completed by modifying on-line, the user experience is improved, and the product public praise is protected.
Detailed Description
The present invention will be further described below, and it should be noted that the present embodiment is based on the technical solution, and a detailed implementation manner and a specific operation process are provided, but the protection scope of the present invention is not limited to the present embodiment.
The embodiment provides a method for resource management and synchronization, which specifically comprises the following processes:
s1, storing the resource files in a remote warehouse, wherein the remote warehouse is uniformly managed by an administrator, and the administrator can add, delete, modify and query the resource files in the remote warehouse;
the resource files comprise public files and exclusive files, the public files and the exclusive files have corresponding version numbers, the version numbers are set in a preset format (public _ version and spe _ sversion are adopted in the embodiment respectively, and the public files and the exclusive files are digital codes of versions), and when the resource files are modified, the remote warehouse can automatically add 1 to the version numbers of the resource files; the public file stores character string resources which are possibly used in all applications; each dedicated file stores character string resources strongly related to the corresponding App service; each character string resource has a unique reference key, and the character string resources stored in the public file also have a preset prefix at the front end of the reference key. For example, a net _ error is used as a reference key in the exclusive file to refer to 'network exception', when the character string resource is stored in the public file, a preset prefix string _ is added before the reference key, and the character string resource is changed into a string _ net _ error;
s2, in the process of starting an intelligent equipment system upgrading project, an administrator triggers the remote warehouse to perform statistical detection on the character string resources stored in each exclusive file, the character string resources with the reuse degree higher than a preset threshold value in each exclusive file are counted, then the character string resources are stored in a public file, a preset prefix is added before a key is quoted, then the corresponding character string resources are deleted in the corresponding exclusive file, and each App application is notified. For example, if 9 App applications all use the string "network exception", the reuse degree of the string is 90%.
S3, each App correspondingly modifies the reference mode to use the character string resource according to the reference key of the character string resource in the public file.
It should be noted that the resource file (i.e., the total resource file) actually applied in each App application is composed of a public file and an exclusive file corresponding to the current application, and the total resource file version number is composed of a public file version number and an exclusive file version number (e.g., public _ version _ space _ version). If the public file is triggered to be modified, the version number of pversion in the total resource file is changed, and if the exclusive file is changed, the version number of sversion is changed.
Further, when the intelligent device runs, if the resource file in the remote warehouse changes, the server initiates an update push message to all App applications affected by the change, if the public file is modified, the update push message is pushed to all App applications, and if only the exclusive file is modified, the update push message only needs to be pushed to the App application corresponding to the exclusive file; and after receiving the push, the corresponding App application completes silent update of the corresponding resource file (in this way, upward bug can be conveniently solved).
Further, when the intelligent device is started or a network is switched, the resource file version information of all App applications is reported to the server, the server is triggered to detect whether the resource files of the App applications need to be updated, and if yes, the corresponding resource files are updated. Therefore, failure of resource updating caused by failure of receiving push when the mobile terminal is disconnected or powered off can be prevented.
Various corresponding changes and modifications can be made by those skilled in the art based on the above technical solutions and concepts, and all such changes and modifications should be included in the protection scope of the present invention.