CN113760921A - Method and device for creating dictionary value - Google Patents

Method and device for creating dictionary value Download PDF

Info

Publication number
CN113760921A
CN113760921A CN202011019714.9A CN202011019714A CN113760921A CN 113760921 A CN113760921 A CN 113760921A CN 202011019714 A CN202011019714 A CN 202011019714A CN 113760921 A CN113760921 A CN 113760921A
Authority
CN
China
Prior art keywords
user
level dictionary
dictionary
value
enumeration
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.)
Pending
Application number
CN202011019714.9A
Other languages
Chinese (zh)
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.)
Beijing Jingdong Tuoxian Technology Co Ltd
Original Assignee
Beijing Jingdong Tuoxian 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 Beijing Jingdong Tuoxian Technology Co Ltd filed Critical Beijing Jingdong Tuoxian Technology Co Ltd
Priority to CN202011019714.9A priority Critical patent/CN113760921A/en
Publication of CN113760921A publication Critical patent/CN113760921A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/242Dictionaries

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for creating dictionary values, and relates to the technical field of computers. One embodiment of the method comprises: in the starting process of a system, acquiring system level dictionary enumeration from a system code, and initializing a system level dictionary value in a database according to the system level dictionary enumeration; receiving a user request; acquiring user level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request, and updating a user level dictionary value in the database according to the user level dictionary enumeration; and/or; the user request is executed. The implementation mode can solve the technical problem of easily causing the dictionary enumeration in the system code to be inconsistent with the dictionary value in the database.

Description

Method and device for creating dictionary value
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for creating dictionary values.
Background
In the prior art, dictionary values related to system levels are generally added in a background mode through manual entry by developers after sql scripts or projects are deployed; or after a new function is developed, adding a system level dictionary value required by the new function by a developer by using an online system background before online. In the case of a multi-user or multi-tenant system, the user level dictionary values are created manually in the background when the user or tenant is created.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
dictionary enumeration in the system code is easily inconsistent with dictionary values in the database, thereby causing the system to fail to operate normally.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for creating dictionary values, so as to solve the technical problem that dictionary enumeration in system code is easily inconsistent with dictionary values in a database.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of creating a dictionary value, including:
in the starting process of a system, acquiring system level dictionary enumeration from a system code, and initializing a system level dictionary value in a database according to the system level dictionary enumeration;
receiving a user request;
acquiring user level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request, and updating a user level dictionary value in the database according to the user level dictionary enumeration; and/or; the user request is executed.
Optionally, initializing system-level dictionary values in a database according to the system-level dictionary enumeration comprises:
for each system level dictionary enumeration, judging whether a database has a system level dictionary value corresponding to the system level dictionary enumeration;
if not, a system level dictionary value is newly established in the database according to the enumerated value of the system level dictionary;
if yes, continuously judging whether the system level dictionary value is consistent with the enumerated value of the system level dictionary; if not, modifying the system level dictionary value in the database into the value enumerated by the system level dictionary; and if so, judging that the next system level dictionary enumerates the corresponding system level dictionary value.
Optionally, obtaining, from the system code, a user level dictionary enumeration corresponding to the user according to user information carried in the user request includes:
determining the type of the user according to user information carried by the user request;
and acquiring user level dictionary enumeration corresponding to the type of the user from the system code.
Optionally, after updating the user-level dictionary value in the database according to the user-level dictionary enumeration, the method further includes:
and setting the updating state of the user level dictionary value corresponding to the user to be finished, and storing the updating state of the user level dictionary value corresponding to the user and the updating time of the user level dictionary value into a cache.
Optionally, according to user information carried by the user request, obtaining a user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database according to the user level dictionary enumeration; and/or; executing the user request, including:
according to the user information, inquiring the updating state and the updating time of the user level dictionary value corresponding to the user from the cache;
according to the updating state and the updating time thereof, acquiring user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database; and/or; the user request is executed.
Optionally, according to the update state and the update time thereof, obtaining a user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database; and/or; executing the user request, including:
if the updating state is finished, calculating next integrity checking time according to the updating time and the integrity checking time interval, and judging whether the current time is later than the next integrity checking time; if so, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request; if not, directly executing the user request;
if the update state is incomplete, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request.
Optionally, updating the user-level dictionary values in the database according to the user-level dictionary enumeration comprises:
for each user level dictionary enumeration, judging whether a database has a user level dictionary value corresponding to the user level dictionary enumeration;
if not, a user level dictionary value is newly established in the database according to the value enumerated by the user level dictionary;
if yes, continuously judging whether the user level dictionary value is consistent with the value enumerated by the user level dictionary; if not, modifying the user level dictionary value in the database into the value enumerated by the user level dictionary; and if so, judging that the next user level dictionary enumerates the corresponding user level dictionary value.
In addition, according to another aspect of an embodiment of the present invention, there is provided an apparatus for creating a dictionary value, including:
the system comprises a first establishing module, a second establishing module and a third establishing module, wherein the first establishing module is used for acquiring system level dictionary enumeration from a system code in the process of starting a system and initializing a system level dictionary value in a database according to the system level dictionary enumeration;
the receiving module is used for receiving a user request;
and the second creating module is used for acquiring user level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request, updating a user level dictionary value in the database according to the user level dictionary enumeration, and/or executing the user request.
Optionally, the first creating module is further configured to:
for each system level dictionary enumeration, judging whether a database has a system level dictionary value corresponding to the system level dictionary enumeration;
if not, a system level dictionary value is newly established in the database according to the enumerated value of the system level dictionary;
if yes, continuously judging whether the system level dictionary value is consistent with the enumerated value of the system level dictionary; if not, modifying the system level dictionary value in the database into the value enumerated by the system level dictionary; and if so, judging that the next system level dictionary enumerates the corresponding system level dictionary value.
Optionally, the second creating module is further configured to:
determining the type of the user according to user information carried by the user request;
and acquiring user level dictionary enumeration corresponding to the type of the user from the system code.
Optionally, the second creating module is further configured to:
after updating the user level dictionary value in the database according to the user level dictionary enumeration, setting the updating state of the user level dictionary value corresponding to the user to be completed, and storing the updating state of the user level dictionary value corresponding to the user and the updating time thereof in a cache.
Optionally, the second creating module is further configured to:
according to the user information, inquiring the updating state and the updating time of the user level dictionary value corresponding to the user from the cache;
according to the updating state and the updating time thereof, acquiring user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database; and/or; the user request is executed.
Optionally, the second creating module is further configured to:
if the updating state is finished, calculating next integrity checking time according to the updating time and the integrity checking time interval, and judging whether the current time is later than the next integrity checking time; if so, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request; if not, directly executing the user request;
if the update state is incomplete, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request.
Optionally, the second creating module is further configured to:
for each user level dictionary enumeration, judging whether a database has a user level dictionary value corresponding to the user level dictionary enumeration;
if not, a user level dictionary value is newly established in the database according to the value enumerated by the user level dictionary;
if yes, continuously judging whether the user level dictionary value is consistent with the value enumerated by the user level dictionary; if not, modifying the user level dictionary value in the database into the value enumerated by the user level dictionary; and if so, judging that the next user level dictionary enumerates the corresponding user level dictionary value.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any of the embodiments described above.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of any of the above embodiments.
One embodiment of the above invention has the following advantages or benefits: the technical means that the system level dictionary enumeration is obtained from the system codes in the system starting process, the system level dictionary values in the database are initialized according to the system level dictionary enumeration, the user level dictionary enumeration is obtained from the system codes after the user request is received, and the user level dictionary values in the database are updated according to the user level dictionary enumeration is adopted, so that the technical problem that the dictionary enumeration in the system codes is inconsistent with the dictionary values in the database in the prior art is solved. The embodiment of the invention can complete the creation of the system level dictionary value when the system is started, initialize the system level dictionary value under the condition of no shutdown and check the system level dictionary value at regular time, thereby ensuring that the dictionary enumeration in the system code is consistent with the dictionary value in the database and ensuring that the system can normally run.
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 a main flow of a method of creating dictionary values according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a main flow of a method of creating dictionary values according to one referenceable embodiment of the present invention;
FIG. 3 is a diagram showing the main flow of a method of creating dictionary values according to another referenceable embodiment of the present invention;
FIG. 4 is a schematic diagram of the main blocks of an apparatus for creating dictionary values in accordance with an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of 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.
In the prior art, when a developer manually enters a background to add a system-level dictionary value when a project is just deployed, because many system-level dictionary values exist in a system code and are all used in an enumeration form, the use mode has strict requirements on the dictionary value, and if the dictionary value is not matched or the dictionary value does not exist, the problem that the system cannot normally run is caused.
If the dictionary value is initialized in the sql script mode, the sql script is separated from the system code, and therefore the situation that the sql is modified in a missing way or modified in an error way may exist, and the problem that the dictionary value is not matched or the dictionary value does not exist, and therefore the system cannot run normally is caused.
If a new function of the system comes online, it may cause a problem because the developer forgets to add the system level dictionary required for the new function. Problems with bringing online may also occur if the user-level dictionary values are created at the time the user or tenant is created because the developer forgets to add the user-level dictionary values that the user or tenant is required to use.
The reason for the above problem is that dictionary enumeration in system code is not consistent with dictionary values added to a database by sql scripts or developers, and to solve the above technical problem, embodiments of the present invention provide a method for creating dictionary values, which can automatically add dictionary values to a database according to dictionary enumeration in system code, thereby ensuring that dictionary enumeration in system code is consistent with dictionary values in a database.
Fig. 1 is a schematic diagram of a main flow of a method of creating dictionary values according to an embodiment of the present invention. As an embodiment of the present invention, as shown in fig. 1, the method for creating a dictionary value may include:
step 101, in the process of starting the system, obtaining system level dictionary enumeration from a system code, and initializing a system level dictionary value in a database according to the system level dictionary enumeration.
Each modification of a system level dictionary value is typically accompanied by a modification of a system level dictionary enumeration value in the system code, so that such a case requires only initialization at system start-up. The embodiment of the invention monitors the starting event during starting, firstly obtains system level dictionary enumeration in system codes in the starting process of the system, and then initializes the system level dictionary values in the database according to the system level dictionary enumeration, so that the enumerated values of the system level dictionary are consistent with the system level dictionary values in the data dictionary added to the database, and the normal operation of the system is ensured.
In the embodiment of the invention, the dictionary generally refers to a description of a number, a word and a letter corresponding to a result, so as to conveniently compare and judge data in software engineering code and present correspondingly friendly human visualized information when a user browses. The dictionary is typically stored in a database. The dictionary values in the dictionary include keys and values, the keys can be numbers, words, letters and the like, and the values can be descriptions of the results. Enumeration and dictionary can be understood as the same meaning, except that enumeration is to write the data of the corresponding relation of the dictionary in software engineering by means of codes, and the codes for describing the corresponding relation of the dictionary are called enumeration. Where the enumerated value is also the dictionary value.
Optionally, initializing system-level dictionary values in a database according to the system-level dictionary enumeration comprises: for each system level dictionary enumeration, judging whether a database has a system level dictionary value corresponding to the system level dictionary enumeration; if not, a system level dictionary value is newly established in the database according to the enumerated value of the system level dictionary; if yes, continuously judging whether the system level dictionary value is consistent with the enumerated value of the system level dictionary; if not, modifying the system level dictionary value in the database into the value enumerated by the system level dictionary; and if so, judging that the next system level dictionary enumerates the corresponding system level dictionary value. In the embodiment of the invention, in the process of starting the system, all system level dictionary enumerations in system codes are obtained firstly, and then the system level dictionary enumerations are inquired one by one in a database to inquire whether dictionary values corresponding to the dictionary enumerations exist or not. If the dictionary value corresponding to dictionary enumeration is not found through querying the database, a new construction is carried out according to the value of dictionary enumeration; if the dictionary value corresponding to the enumeration is inquired through inquiring the database, but the dictionary value is different from the value in the dictionary enumeration, modifying the dictionary value in the database into the value in the dictionary enumeration; and if the dictionary value corresponding to the dictionary enumeration is inquired through inquiring the database and the dictionary value is completely the same as the value in the dictionary enumeration, continuously inquiring the next dictionary enumeration until all system level dictionary enumerations are inquired.
Step 102, receiving a user request.
The user request sent by the user terminal to the server carries user information, wherein the user information may include information such as a user identifier and a user account. In the embodiment of the present invention, the user may be a certain user in the multi-tenancy, or may be a certain tenant in the multi-tenancy.
Step 103, obtaining a user level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request, and updating a user level dictionary value in the database according to the user level dictionary enumeration; and/or; the user request is executed.
Before the server executes the user request, judging whether a user level dictionary value in the database needs to be updated or not, if so, updating the user level dictionary value in the database, and then executing the user request; if not, the user request is performed directly.
Optionally, obtaining, from the system code, a user level dictionary enumeration corresponding to the user according to user information carried in the user request includes: determining the type of the user according to user information carried by the user request; and acquiring user level dictionary enumeration corresponding to the type of the user from the system code. If each type of user has the corresponding user level dictionary enumeration, after user information is obtained through analysis in a user request, the user type is matched according to the user information, and then the user level dictionary enumeration corresponding to the user type is obtained from a system code, so that the user level dictionary value in the database can be updated according to the user level dictionary enumeration.
Optionally, after updating the user-level dictionary value in the database according to the user-level dictionary enumeration, the method further includes: and setting the updating state of the user level dictionary value corresponding to the user to be finished, and storing the updating state of the user level dictionary value corresponding to the user and the updating time of the user level dictionary value into a cache. In order to facilitate the integrity check of the user-level dictionary values periodically, the update status of the user-level dictionary values and the update time of each time are recorded in the cache. Therefore, the server can judge whether the user level dictionary value in the database needs to be updated first and then the user request is executed according to the updating state and the updating time in the cache.
Optionally, according to user information carried by the user request, obtaining a user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database according to the user level dictionary enumeration; and/or; executing the user request, including: according to the user information, inquiring the updating state and the updating time of the user level dictionary value corresponding to the user from the cache; according to the updating state and the updating time thereof, acquiring user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database; and/or; the user request is executed. In the embodiment of the invention, a filter can be added before the server really executes the user request, and the updating state and the updating time of the user level dictionary value corresponding to the user are inquired in the cache server in the filter, so that whether the user level dictionary value in the database needs to be updated first or not is judged according to the updating state and the updating time of the user level dictionary value.
Optionally, according to the update state and the update time thereof, obtaining a user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database; and/or; executing the user request, including: if the updating state is finished, calculating next integrity checking time according to the updating time and the integrity checking time interval, and judging whether the current time is later than the next integrity checking time; if so, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request; if not, directly executing the user request; if the update state is incomplete, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request. An integrity check time interval may be preconfigured, after the update time is obtained from the cache, the next integrity check time is calculated according to the update time and the integrity check time interval, if the current time is later than the next integrity check time, the user-level dictionary enumeration corresponding to the user is obtained from the system code, the user-level dictionary value in the database is updated, and then the user request is executed. And if the current time is earlier than the next integrity check time, directly executing the user request.
Optionally, updating the user-level dictionary values in the database according to the user-level dictionary enumeration comprises: for each user level dictionary enumeration, judging whether a database has a user level dictionary value corresponding to the user level dictionary enumeration; if not, a user level dictionary value is newly established in the database according to the value enumerated by the user level dictionary; if yes, continuously judging whether the user level dictionary value is consistent with the value enumerated by the user level dictionary; if not, modifying the user level dictionary value in the database into the value enumerated by the user level dictionary; and if so, judging that the next user level dictionary enumerates the corresponding user level dictionary value. Similar to the initialization of the system level dictionary value, all user level dictionary enumerations of the users in the system code are obtained firstly, and then the user level dictionary enumerations are inquired in the database one by one and are compared with the inquired user level dictionary values. If the dictionary value corresponding to dictionary enumeration is not found through querying the database, a new construction is carried out according to the value of dictionary enumeration; if the dictionary value corresponding to the enumeration is inquired through inquiring the database, but the dictionary value is different from the value in the dictionary enumeration, modifying the dictionary value in the database into the value in the dictionary enumeration; and if the dictionary value corresponding to the dictionary enumeration is inquired through the inquiry database and is completely the same as the value in the dictionary enumeration, continuously inquiring the next dictionary enumeration until all user-level dictionary enumerations are inquired.
According to the various embodiments described above, it can be seen that the technical problem in the prior art that dictionary enumeration in system codes is not consistent with dictionary values in a database is solved by a technical means of acquiring system-level dictionary enumeration from system codes in a system starting process, initializing system-level dictionary values in the database according to the system-level dictionary enumeration, acquiring user-level dictionary enumeration from the system codes after receiving a user request, and updating the user-level dictionary values in the database according to the user-level dictionary enumeration. The embodiment of the invention can complete the creation of the system level dictionary value when the system is started, initialize the system level dictionary value under the condition of no shutdown and check the system level dictionary value at regular time, thereby ensuring that the dictionary enumeration in the system code is consistent with the dictionary value in the database and ensuring that the system can normally run.
Fig. 2 is a schematic diagram of a main flow of a method of creating dictionary values according to one referenceable embodiment of the present invention. As another embodiment of the present invention, as shown in fig. 2, the method for creating dictionary values may include:
step 201, in the process of starting the system, system level dictionary enumeration is obtained from the system code.
Step 202, enumerating and initializing system level dictionary values in a database according to the system level dictionary.
For each system level dictionary enumeration, judging whether a database has a system level dictionary value corresponding to the system level dictionary enumeration; if not, a system level dictionary value is newly established in the database according to the enumerated value of the system level dictionary; if yes, continuously judging whether the system level dictionary value is consistent with the enumerated value of the system level dictionary; if not, modifying the system level dictionary value in the database into the value enumerated by the system level dictionary; and if so, judging that the next system level dictionary enumerates the corresponding system level dictionary value.
Step 203, receiving a user request.
And 204, determining the type of the user according to the user information carried by the user request.
If each type of user has the corresponding user level dictionary enumeration, the user type needs to be matched according to the user information after the user information is obtained by analyzing the user request.
Step 205, obtaining a user level dictionary enumeration corresponding to the type of the user from the system code.
Step 206, initializing user level dictionary values in the database according to the user level dictionary enumeration.
If the user request is received for the first time, initializing a user level dictionary value in the database according to the user level dictionary enumeration, and then executing the user request. This step is similar to step 202 and will not be described again.
Step 207, setting the update state of the user level dictionary value corresponding to the user to be completed, and storing the update state of the user level dictionary value corresponding to the user and the update time thereof in a cache.
In order to facilitate the integrity check of the user-level dictionary values periodically, the update status of the user-level dictionary values and the update time of each time are recorded in the cache. When receiving the user request next time, the updating state and the updating time are firstly obtained from the cache and are used for judging whether the user level dictionary value in the database needs to be updated first and then the user request is executed.
Step 208, the user request is executed.
In addition, in a reference embodiment of the present invention, the detailed implementation of the method for creating dictionary values is described in detail in the above-mentioned method for creating dictionary values, and therefore, the repeated description is not repeated here.
Fig. 3 is a schematic diagram of a main flow of a method of creating dictionary values according to another referenceable embodiment of the present invention. As another embodiment of the present invention, as shown in fig. 3, the method for creating dictionary values may include:
step 301, receiving a user request.
Step 302, according to the user information, the updating state and the updating time of the user level dictionary value corresponding to the user are inquired from the cache.
Step 303, judging whether the updating state is finished; if yes, go to step 304; if not, go to step 306.
And step 304, calculating the next integrity check time according to the updating time and the integrity check time interval.
Step 305, judging whether the current time is later than the next integrity check time; if yes, go to step 306; if not, go to step 308.
Step 306, obtaining the user level dictionary enumeration corresponding to the user from the system code, and updating the user level dictionary value in the database.
Step 307, setting the update state of the user level dictionary value corresponding to the user to be completed, and storing the update state of the user level dictionary value corresponding to the user and the update time thereof in a cache.
Step 308, executing the user request.
In addition, in another embodiment of the present invention, the detailed implementation contents of the method for creating dictionary values are already described in detail in the above-mentioned method for creating dictionary values, and therefore, the repeated contents are not described again.
Fig. 4 is a schematic diagram of the main blocks of an apparatus for creating dictionary values according to an embodiment of the present invention, and as shown in fig. 4, the apparatus 400 for creating dictionary values includes a first creating module 401, a receiving module 402, and a second creating module 403; the first creating module 401 is configured to obtain system-level dictionary enumeration from a system code in a system starting process, and initialize a system-level dictionary value in a database according to the system-level dictionary enumeration; the receiving module 402 is used for receiving a user request; the second creating module 403 obtains, from the system code, a user-level dictionary enumeration corresponding to the user according to the user information carried in the user request, updates a user-level dictionary value in the database according to the user-level dictionary enumeration, and/or executes the user request.
Optionally, the first creating module 401 is further configured to:
for each system level dictionary enumeration, judging whether a database has a system level dictionary value corresponding to the system level dictionary enumeration;
if not, a system level dictionary value is newly established in the database according to the enumerated value of the system level dictionary;
if yes, continuously judging whether the system level dictionary value is consistent with the enumerated value of the system level dictionary; if not, modifying the system level dictionary value in the database into the value enumerated by the system level dictionary; and if so, judging that the next system level dictionary enumerates the corresponding system level dictionary value.
Optionally, the second creating module 403 is further configured to:
determining the type of the user according to user information carried by the user request;
and acquiring user level dictionary enumeration corresponding to the type of the user from the system code.
Optionally, the second creating module 403 is further configured to:
after updating the user level dictionary value in the database according to the user level dictionary enumeration, setting the updating state of the user level dictionary value corresponding to the user to be completed, and storing the updating state of the user level dictionary value corresponding to the user and the updating time thereof in a cache.
Optionally, the second creating module 403 is further configured to:
according to the user information, inquiring the updating state and the updating time of the user level dictionary value corresponding to the user from the cache;
according to the updating state and the updating time thereof, acquiring user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database; and/or; the user request is executed.
Optionally, the second creating module 403 is further configured to:
if the updating state is finished, calculating next integrity checking time according to the updating time and the integrity checking time interval, and judging whether the current time is later than the next integrity checking time; if so, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request; if not, directly executing the user request;
if the update state is incomplete, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request.
Optionally, the second creating module 403 is further configured to:
for each user level dictionary enumeration, judging whether a database has a user level dictionary value corresponding to the user level dictionary enumeration;
if not, a user level dictionary value is newly established in the database according to the value enumerated by the user level dictionary;
if yes, continuously judging whether the user level dictionary value is consistent with the value enumerated by the user level dictionary; if not, modifying the user level dictionary value in the database into the value enumerated by the user level dictionary; and if so, judging that the next user level dictionary enumerates the corresponding user level dictionary value.
According to the various embodiments described above, it can be seen that the technical problem in the prior art that dictionary enumeration in system codes is not consistent with dictionary values in a database is solved by a technical means of acquiring system-level dictionary enumeration from system codes in a system starting process, initializing system-level dictionary values in the database according to the system-level dictionary enumeration, acquiring user-level dictionary enumeration from the system codes after receiving a user request, and updating the user-level dictionary values in the database according to the user-level dictionary enumeration. The embodiment of the invention can complete the creation of the system level dictionary value when the system is started, initialize the system level dictionary value under the condition of no shutdown and check the system level dictionary value at regular time, thereby ensuring that the dictionary enumeration in the system code is consistent with the dictionary value in the database and ensuring that the system can normally run.
It should be noted that, in the implementation of the apparatus for creating dictionary values according to the present invention, the above-mentioned method for creating dictionary values has been described in detail, and therefore, the repeated description is not repeated here.
Fig. 5 illustrates an exemplary system architecture 500 to which the method of creating dictionary values or the apparatus for creating dictionary values of embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 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 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and otherwise process the received data such as the item information query request, and feed back a processing result (for example, target push information, item information — just an example) to the terminal device.
It should be noted that the method for creating dictionary values provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the apparatus for creating dictionary values is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 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. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
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 programs 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 a first creation module, a reception module, and a second creation module, where the names of the modules do not in some cases constitute a limitation on the modules themselves.
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, implement the method of: in the starting process of a system, acquiring system level dictionary enumeration from a system code, and initializing a system level dictionary value in a database according to the system level dictionary enumeration; receiving a user request; acquiring user level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request, and updating a user level dictionary value in the database according to the user level dictionary enumeration; and/or; the user request is executed.
According to the technical scheme of the embodiment of the invention, the technical means that the system level dictionary enumeration is obtained from the system code in the system starting process, the system level dictionary value in the database is initialized according to the system level dictionary enumeration, the user level dictionary enumeration is obtained from the system code after the user request is received, and the user level dictionary value in the database is updated according to the user level dictionary enumeration is adopted, so that the technical problem that the dictionary enumeration in the system code is inconsistent with the dictionary value in the database in the prior art is solved. The embodiment of the invention can complete the creation of the system level dictionary value when the system is started, initialize the system level dictionary value under the condition of no shutdown and check the system level dictionary value at regular time, thereby ensuring that the dictionary enumeration in the system code is consistent with the dictionary value in the database and ensuring that the system can normally run.
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 method of creating dictionary values, comprising:
in the starting process of a system, acquiring system level dictionary enumeration from a system code, and initializing a system level dictionary value in a database according to the system level dictionary enumeration;
receiving a user request;
acquiring user level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request, and updating a user level dictionary value in the database according to the user level dictionary enumeration; and/or; the user request is executed.
2. The method of claim 1, wherein initializing system-level dictionary values in a database according to the system-level dictionary enumeration comprises:
for each system level dictionary enumeration, judging whether a database has a system level dictionary value corresponding to the system level dictionary enumeration;
if not, a system level dictionary value is newly established in the database according to the enumerated value of the system level dictionary;
if yes, continuously judging whether the system level dictionary value is consistent with the enumerated value of the system level dictionary; if not, modifying the system level dictionary value in the database into the value enumerated by the system level dictionary; and if so, judging that the next system level dictionary enumerates the corresponding system level dictionary value.
3. The method of claim 1, wherein obtaining a user-level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request comprises:
determining the type of the user according to user information carried by the user request;
and acquiring user level dictionary enumeration corresponding to the type of the user from the system code.
4. The method of claim 1, further comprising, after updating user-level dictionary values in the database according to the user-level dictionary enumeration:
and setting the updating state of the user level dictionary value corresponding to the user to be finished, and storing the updating state of the user level dictionary value corresponding to the user and the updating time of the user level dictionary value into a cache.
5. The method according to claim 4, wherein a user level dictionary enumeration corresponding to the user is obtained from the system code according to user information carried by the user request, and a user level dictionary value in the database is updated according to the user level dictionary enumeration; and/or; executing the user request, including:
according to the user information, inquiring the updating state and the updating time of the user level dictionary value corresponding to the user from the cache;
according to the updating state and the updating time thereof, acquiring user level dictionary enumeration corresponding to the user from the system code, and updating a user level dictionary value in the database; and/or; the user request is executed.
6. The method of claim 5, wherein a user-level dictionary enumeration corresponding to the user is obtained from the system code according to the update status and the update time thereof, and a user-level dictionary value in the database is updated; and/or; executing the user request, including:
if the updating state is finished, calculating next integrity checking time according to the updating time and the integrity checking time interval, and judging whether the current time is later than the next integrity checking time; if so, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request; if not, directly executing the user request;
if the update state is incomplete, acquiring user level dictionary enumeration corresponding to the user from the system code, updating a user level dictionary value in the database, and then executing the user request.
7. The method of claim 1, wherein updating user-level dictionary values in the database according to the user-level dictionary enumeration comprises:
for each user level dictionary enumeration, judging whether a database has a user level dictionary value corresponding to the user level dictionary enumeration;
if not, a user level dictionary value is newly established in the database according to the value enumerated by the user level dictionary;
if yes, continuously judging whether the user level dictionary value is consistent with the value enumerated by the user level dictionary; if not, modifying the user level dictionary value in the database into the value enumerated by the user level dictionary; and if so, judging that the next user level dictionary enumerates the corresponding user level dictionary value.
8. An apparatus for creating dictionary values, comprising:
the system comprises a first establishing module, a second establishing module and a third establishing module, wherein the first establishing module is used for acquiring system level dictionary enumeration from a system code in the process of starting a system and initializing a system level dictionary value in a database according to the system level dictionary enumeration;
the receiving module is used for receiving a user request;
and the second creating module is used for acquiring user level dictionary enumeration corresponding to the user from the system code according to user information carried by the user request, updating a user level dictionary value in the database according to the user level dictionary enumeration, and/or executing the user request.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
the one or more programs, when executed by the one or more processors, implement the method of any of claims 1-7.
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-7.
CN202011019714.9A 2020-09-24 2020-09-24 Method and device for creating dictionary value Pending CN113760921A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011019714.9A CN113760921A (en) 2020-09-24 2020-09-24 Method and device for creating dictionary value

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011019714.9A CN113760921A (en) 2020-09-24 2020-09-24 Method and device for creating dictionary value

Publications (1)

Publication Number Publication Date
CN113760921A true CN113760921A (en) 2021-12-07

Family

ID=78785865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011019714.9A Pending CN113760921A (en) 2020-09-24 2020-09-24 Method and device for creating dictionary value

Country Status (1)

Country Link
CN (1) CN113760921A (en)

Similar Documents

Publication Publication Date Title
CN108984197B (en) Code updating method and device
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN113760948A (en) Data query method and device
CN110688305B (en) Test environment synchronization method, device, medium and electronic equipment
CN109218338B (en) Information processing system, method and device
CN116737662A (en) Method, device, electronic equipment and storage medium for processing business data
CN108628909B (en) Information pushing method and device
CN113722007B (en) Configuration method, device and system of VPN branch equipment
CN112395194B (en) Method and device for accessing test platform
CN113760921A (en) Method and device for creating dictionary value
CN112783903B (en) Method and device for generating update log
CN114625458A (en) Page data processing method and device, electronic equipment and storage medium
CN113760727A (en) Interface regression testing method and device
CN113821249A (en) Project development configuration method and device, electronic equipment and readable storage medium
CN108287792B (en) Method and apparatus for outputting information
CN112099841A (en) Method and system for generating configuration file
CN113032004A (en) Method, apparatus and program product for managing development jobs in a development environment
CN111176982A (en) Test interface generation method and device
CN112835609A (en) Method and device for modifying dependent package download address
CN111460273B (en) Information pushing method and device
CN115993981A (en) Data processing method, device, electronic equipment and computer readable medium
CN114281697A (en) Test data generation method and device
CN113297087A (en) Test method and device
CN112905182A (en) Data analysis method and device
CN115309612A (en) Method and device for monitoring data

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