Message card generation method and device, computer device and storage medium

By identifying and utilizing abstract syntax tree nodes of expression instruction data in instant messaging to generate calculation results, the problem of high overhead in the dynamic parsing and rendering of message cards is solved, thus improving the efficiency of message card generation and communication.

CN117010358BActive Publication Date: 2026-07-24TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2022-08-22
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

In instant messaging, the dynamic parsing and rendering process of message cards is costly and affects communication efficiency.

Method used

By obtaining the message card generation request, obtaining the message template based on the template specification information, recognizing the expression data and searching for the instruction data in the expression instruction set, generating the calculation result using the nodes in the abstract syntax tree, reducing the overhead of the expression calculation process, directly implementing the expression calculation through the instruction data, and finally rendering and generating the message card.

Benefits of technology

It reduces the expression parsing overhead in the message parsing process, improves the efficiency of message card generation, and thus enhances communication efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117010358B_ABST
    Figure CN117010358B_ABST
Patent Text Reader

Abstract

The application relates to a message card generation method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: obtaining a message card generation request containing template specification information and business data; obtaining a message template corresponding to the message card generation request based on the template specification information; obtaining message data according to the message template and the business data; identifying expression data in the message data, searching for instruction data corresponding to the expression data in an expression instruction set, and obtaining an operation result of the expression data according to the instruction data; and rendering and generating a message card based on the message data and the operation result. The application can effectively improve the generation efficiency of the message card.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a message card generation method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the development of computer and communication technologies, instant messaging (IM) technology based on the internet has emerged. It allows two or more people to exchange text messages, files, voice, and video messages in real time over the internet. Generally speaking, the content that appears on the message conversation page during instant messaging is called a message card. Currently, common message cards in messaging services include text, rich text, voice, photos, videos, and notification messages.

[0003] Currently, message cards can generally be parsed and rendered using cross-platform view controls with dynamic parsing and rendering capabilities. However, during the dynamic parsing process of message cards, the overhead of expression calculation is relatively large, which affects the communication efficiency of message cards. Summary of the Invention

[0004] Therefore, it is necessary to provide a message card generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can effectively improve the communication efficiency of message cards, addressing the aforementioned technical problems.

[0005] Firstly, this application provides a method for generating message cards. The method includes:

[0006] Get a message card generation request that includes template-specified information and business data;

[0007] The message template corresponding to the message card generation request is obtained based on the template specified information;

[0008] Message data is obtained based on the message template and the business data;

[0009] The expression data in the message data is identified, the instruction data corresponding to the expression data is found in the expression instruction set, and the operation result of the expression data is obtained according to the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules.

[0010] Based on the message data and the calculation results, a message card is rendered and generated.

[0011] Secondly, this application also provides a message card generation apparatus. The apparatus includes:

[0012] The request retrieval module is used to retrieve message card generation requests that include template-specified information and business data.

[0013] The template lookup module is used to obtain the message template corresponding to the message card generation request based on the template specified information;

[0014] The message parsing module is used to obtain message data based on the message template and the business data;

[0015] The data processing module is used to identify expression data in the message data, search for the instruction data corresponding to the expression data in the expression instruction set, and obtain the operation result of the expression data based on the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules.

[0016] The message card generation module is used to render and generate message cards based on the message data and the calculation results.

[0017] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0018] Get a message card generation request that includes template-specified information and business data;

[0019] The message template corresponding to the message card generation request is obtained based on the template specified information;

[0020] Message data is obtained based on the message template and the business data;

[0021] The expression data in the message data is identified, the instruction data corresponding to the expression data is found in the expression instruction set, and the operation result of the expression data is obtained according to the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules.

[0022] Based on the message data and the calculation results, a message card is rendered and generated.

[0023] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0024] Get a message card generation request that includes template-specified information and business data;

[0025] The message template corresponding to the message card generation request is obtained based on the template specified information;

[0026] Message data is obtained based on the message template and the business data;

[0027] The expression data in the message data is identified, the instruction data corresponding to the expression data is found in the expression instruction set, and the operation result of the expression data is obtained according to the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules.

[0028] Based on the message data and the calculation results, a message card is rendered and generated.

[0029] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0030] Get a message card generation request that includes template-specified information and business data;

[0031] The message template corresponding to the message card generation request is obtained based on the template specified information;

[0032] Message data is obtained based on the message template and the business data;

[0033] The expression data in the message data is identified, the instruction data corresponding to the expression data is found in the expression instruction set, and the operation result of the expression data is obtained according to the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules.

[0034] Based on the message data and the calculation results, a message card is rendered and generated.

[0035] The aforementioned message card generation method, apparatus, computer equipment, storage medium, and computer program product, after obtaining a message card generation request containing template specification information and business data, first obtains a message template corresponding to the message card generation request based on the template specification information; then obtains message data based on the message template and business data; subsequently, by identifying expression data in the message data, searching for corresponding instruction data in the expression instruction set, and obtaining the calculation result of the expression data based on the instruction data, wherein the instructions in the expression instruction set are generated based on nodes in an abstract syntax tree that traverses various expressions in historical data. The abstract syntax tree is constructed by performing lexical and syntactic analysis on various expressions in historical data, and the nodes in the abstract syntax tree represent the operands or operators of the expression operation rules. By abstracting the lexical and syntactic analysis process in the expression operation process into instruction data, expression operation can be directly implemented through instruction data when facing repeated expressions, reducing the overhead of the expression operation process. Finally, a message card can be rendered and generated based on the message data and the calculation result. This application improves the efficiency of message card generation by reducing the overhead of the expression parsing process in message parsing, thereby improving the communication efficiency of communication based on message cards. Attached Figure Description

[0036] Figure 1 This is an application environment diagram of a message card generation method in one embodiment;

[0037] Figure 2 This is a schematic diagram of a message card generation method in one embodiment;

[0038] Figure 3 This is a schematic diagram of the data processing procedure in one embodiment;

[0039] Figure 4 This is a flowchart illustrating the data processing procedure of this application in one embodiment;

[0040] Figure 5 This is a schematic diagram comparing the existing template loading processing method with the template loading processing method of this application in one embodiment;

[0041] Figure 6 This is a flowchart illustrating the template loading process in one embodiment;

[0042] Figure 7 This is a flowchart illustrating the template cache data reuse process in one embodiment;

[0043] Figure 8 This is a flowchart illustrating the expression-based code generation steps in one embodiment;

[0044] Figure 9This is a schematic diagram of the field null detection optimization process in one embodiment;

[0045] Figure 10 This is a schematic diagram illustrating the optimization process of constant expressions in one embodiment;

[0046] Figure 11 This is a structural block diagram of a message card generation device in one embodiment;

[0047] Figure 12 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0049] In this article, it is important to understand the following terms:

[0050] FunView is a cross-platform view control with dynamic parsing and rendering capabilities.

[0051] XmlNode: is a view node structure in FunView used to describe the style of the user interface.

[0052] The message card generation method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be placed on the cloud or other servers. When staff on server 104 need to push a message card to terminal 102, they can send a message card generation request containing template specification information and business data to terminal 102. Terminal 102 obtains the message card generation request containing template specification information and business data; obtains the message template corresponding to the message card generation request based on the template specification information; obtains message data based on the message template and business data; identifies expression data in the message data; searches for the corresponding instruction data in the expression instruction set; obtains the calculation result of the expression data based on the instruction data. The instruction data in the expression instruction set is generated based on nodes in the abstract syntax tree of various expressions in historical data. The abstract syntax tree is constructed by performing lexical and syntactic analysis on various expressions in historical data. Nodes in the abstract syntax tree represent operands or operators of the expression operation rules. Based on the message data and the calculation result, the message card is finally rendered and generated on the display screen of terminal 102. Terminals 102 and 104 can be, but are not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0053] In one embodiment, such as Figure 2 As shown, a message card generation method is provided, which can be applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps:

[0054] Step 201: Obtain a message card generation request containing template-specified information and business data.

[0055] The message card generation request refers to a request generated by server 104 to convey information via message cards. A message card, also known as a card message, is a structured message that provides an easy-to-use, unified, and richly interactive format. In one embodiment, the message card may specifically refer to a FunView message. FunView is a cross-platform view control with dynamic parsing and rendering capabilities, widely used in the message streams of various instant messaging software. FunView performs dynamic parsing and rendering based on templates and data. The template is a set of style descriptions, sent with the message as a file link. It is dynamically downloaded and parsed when needed, combined with data calculations, to obtain a renderable view tree, which is then drawn onto the screen. The message card generation request specifically includes template specification information and business data. The template specification message specifies the message template used in the message card generation process, while the business data is used to populate the message template and obtain the message card data. The template specification information specifies the message template used to generate the message card. Specifically, the template specification information can specify the required message template through information such as template name, template number, or template type.

[0056] Specifically, when staff on server 104 need to send a message to a user on terminal 102, the message can be sent as a message card. In this case, server 104 first needs to submit a message card generation request to terminal 102 to render the message card on the terminal 102's display interface. Simultaneously, a template specification message is added to the message card generation request to specify the message template used by the message card, along with corresponding business data. After receiving the message card generation request, server 104 can first determine the template used to generate the message card and then download the corresponding message data from terminal 102 to generate the message card. In one embodiment, the solution of this application applies to instant messaging software used for internal enterprise communication. The message card specifically refers to FunView messages. When enterprise personnel need to send messages to individual users or group chats in the instant messaging software, they can use FunView message cards to send data. In this case, a message card generation request needs to be submitted to each terminal, along with template specification information and business data. Terminal 102 receives the message data, dynamically downloads the message template, and then, through data parsing and data calculation operations, obtains a renderable view tree, which is finally drawn onto the terminal's screen.

[0057] Step 203: Obtain the message template corresponding to the message card generation request based on the template specified information.

[0058] The message template is a component of the message card. By loading and parsing business data and the message template, the final message card can be generated. The message template specifically includes information such as template name, template type, and template content. The template content includes the specific style of the message card, including the message title and message content. The final message card (including some content requiring expression calculation) can be generated by combining business data and the message template. The business data is the data containing the specific message content. The message template can be transmitted to server 104 in binary data format.

[0059] Specifically, when the server receives a message card generation request, it can first parse out the template specification information and business data contained therein, and then find and download the corresponding message template based on the template specification information. Simultaneously, based on the message card generation request, it can also download binary message data from terminal 102, and then generate the required message card based on the message data and the message template. In one embodiment, the solution of this application is applicable to an instant messaging software used for internal enterprise communication. The instant messaging software has several preset message templates. The terminal can specify the required message template by template name. When the server receives the terminal's message card generation request, it can find and download the corresponding message template by template name. Simultaneously, the terminal can obtain business data from the message card generation request to generate the required message card.

[0060] Step 205: Obtain message data based on the message template and business data.

[0061] Specifically, message data refers to the data obtained by combining message templates with business data after they have been converted into style description trees.

[0062] Specifically, the message template is data in binary form, which needs to be parsed before it can be rendered on the screen of terminal 102. The parsing and rendering process of the message template includes steps such as reading binary data, parsing it into a style description tree, parsing the same data, and converting the same style description tree into a rendering tree. First, the binary message template needs to be downloaded and read from server 104. Then, the binary message template is converted into a style description tree. During this process, the business data is combined with the nodes in the style description tree obtained from the parsed message template. The attribute node values ​​in the template may be expressions, and the expressions specify the fields in the business data to be used for calculation. After obtaining the style description tree, the corresponding fields of the business data can be added to the style description tree to fill in the expressions. In one embodiment, this application is specifically used to implement the parsing and rendering of FunView dynamic message cards. In this case, the style description tree is specifically an XmlNode style description tree, and the business data is combined with the XmlNode style description tree corresponding to the message template to obtain the message data.

[0063] Step 207: Identify the expression data in the message data, search for the instruction data corresponding to the expression data in the expression instruction set, and obtain the operation result of the expression data based on the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules.

[0064] An expression is a combination of numbers, operators, number grouping symbols (brackets), free variables, and constraint variables arranged in a meaningful way that yields a numerical value. Constraint variables are assigned values ​​within the expression, while free variables can be assigned values ​​separately outside the expression. Instruction data contains multiple instructions, which are codes used to tell the computer to perform a specific operation. Examples include data transfer instructions, arithmetic operation instructions, bitwise operation instructions, program flow control instructions, string manipulation instructions, and processor control instructions. Instructions are used to cache the results of lexical and syntactic analysis during expression computation. Specifically, an abstract syntax tree (AST) can be generated based on the results of lexical and syntactic analysis of the expression. Instructions are generated by traversing the nodes in the AST. An expression instruction set is a set of instructions constructed based on the previously parsed expression data. Nodes in the AST represent operands or operators in the expression's algorithm. Nodes in the AST include leaf nodes and non-leaf nodes. Leaf nodes represent operands in an algorithm, while non-leaf nodes represent operators.

[0065] Specifically, the rich and dynamic style of message cards is jointly declared by expressions and business data. In actual message card business scenarios, there are usually a large number of similar or repetitive expressions that need to be calculated. These expressions all require repetitive processes such as lexical analysis, syntax analysis, and numerical calculation, which account for a significant portion of the overhead in the message card parsing process. Currently, the results of lexical analysis of expressions are directly cached, saving the overhead of repeatedly performing lexical analysis when encountering repetitive expressions. The specific method is to use the hash value of the expression as the key and the data structure of the lexical analysis result as the value. During the lexical analysis process, the cache is updated and retrieved using this key-value pair. For details, please refer to [link / reference]. Figure 3 As shown, this method only saves the overhead of the lexical analysis process. Lexical analysis mainly involves sequential traversal with few backtracking scenarios, and compared to syntax analysis, it only accounts for about 10% of the total overhead, far less than the syntax analysis process. The performance of this method is poor. Therefore, this application proposes an intermediate instruction layer to effectively cache the results of lexical and syntax analysis, significantly reducing repetitive overhead when dealing with repetitive expressions. The overall process is changed to four steps: lexical analysis, syntax analysis, instruction generation, and instruction execution, as detailed below. Figure 4 As shown. First, after obtaining the repeated expressions, the corresponding instruction data can be directly extracted from the constructed instruction data. Then, data operations are performed based on the instruction data to obtain the operation result of the expression data. By caching the results of lexical analysis and syntax analysis as instructions, the expression can be quickly calculated directly through the instructions, thereby improving the efficiency of message card generation and thus improving the communication efficiency of communication based on message cards.

[0066] Step 209: Based on the message data and the calculation results, render and generate a message card.

[0067] Specifically, after obtaining the calculation result, the style description tree corresponding to the calculation result and the style description tree of the non-expression part of the message data can be converted into a rendering tree. Then, the obtained rendering tree is rendered and displayed on the screen, thereby generating the corresponding message card on the terminal 104, completing the message card generation process. In one embodiment, the solution of this application is applicable to an instant messaging software used for internal enterprise communication. In this case, the message card can be pushed to individuals or group chats within the enterprise. When pushed to an individual, the message card will be displayed on the individual's corresponding terminal. When pushed to a group chat, it will be pushed to all members of the group chat, and the message card will be displayed on the terminals of each group chat member.

[0068] The aforementioned message card generation method, after obtaining a message card generation request containing template specification information and business data, first obtains the message template corresponding to the message card generation request based on the template specification information; then, obtains message data based on the message template and business data; next, by identifying expression data in the message data, it searches for the corresponding instruction data in the expression instruction set, and obtains the calculation result of the expression data based on the instruction data. The instructions in the expression instruction set are generated based on nodes in an abstract syntax tree that traverses various expressions in historical data. The abstract syntax tree is constructed by performing lexical and syntactic analysis on various expressions in historical data, and the nodes in the abstract syntax tree represent the operands or operators of the expression operation rules. By abstracting the lexical and syntactic analysis processes in the expression calculation process into instruction data, expression calculation can be directly implemented through instruction data when facing repetitive expressions, reducing the overhead of the expression calculation process. Finally, a message card can be rendered and generated based on the message data and the calculation result. This application improves the efficiency of message card generation by reducing the overhead of the expression parsing process in message parsing, thereby improving the communication efficiency of communication based on message cards.

[0069] In one embodiment, step 203 includes: when no template loading task corresponding to the template specified information is found in the task queue, creating a template loading task corresponding to the template specified information, and registering a listening task in the created template loading task. The listening task is used to listen for the download completion status of the message template specified by the template specified information; and obtaining the message template corresponding to the message card generation request based on the template loading task.

[0070] The task queue refers to the queue used for sending messages, with each queue containing a task for generating a message card. The template loading task downloads the message template corresponding to the message card generation request from the template library. Since generating a message card requires template data and business data, the corresponding template needs to be loaded from the template library to construct the message card. The listener task is used to monitor whether the message template download is complete. By listening to the download process, the corresponding message template can be obtained directly once the download is complete, allowing the subsequent message card generation process to proceed.

[0071] Specifically, the current method of using message templates results in multiple reads and downloads of the same template for each message when multiple messages using the same template are loaded simultaneously, leading to unnecessary waste. Therefore, as Figure 5As shown, this application manages the template loading process by adding a template manager. When a template loading action occurs, the template manager generates a template loading task corresponding to the template to be loaded. When a new template needs to be loaded, before loading, it checks the task queue to see if a template loading task corresponding to the new template already exists. If it doesn't exist, it means that a new template loading task is needed to retrieve the template. At this time, a template loading task can be created based on the message template, and a listening task can be registered in the created template loading task according to the template's specified information. This allows the task to listen to the download process of the message template corresponding to the specified template information, and then obtain the corresponding message template through the template loading task. During this process, other template loading tasks can also determine the message template loading process by listening to the template loading task, thus enabling the template reading tasks for multiple message card creation processes to be implemented with a single template loading task. In one embodiment, the solution of this application is applicable to instant messaging software used for internal enterprise communication. A message template library can be established according to the enterprise's needs, storing different message templates using the template name as the key. When a message card needs to be created, the corresponding message template can be searched for and downloaded from the message template library by template name. Simultaneously, during the template loading process, if other message card generation tasks need to read the same message template, listeners can be added to monitor the loading process. Once the message template is loaded, these message card generation tasks can directly obtain the message template for subsequent parsing and rendering. In this embodiment, the template loading process is monitored and managed through a template manager and a task queue, which reduces the number of times the same message template is read, thereby improving the processing efficiency of generating message cards based on message templates.

[0072] In one embodiment, step 203 further includes: when a template loading task corresponding to the template specified information is found in the task queue, a listening task is registered in the template loading task corresponding to the template specified information. The listening task is used to listen for the download completion status of the message template specified by the template specified information; when the listening task detects that the message template download is complete, the message template corresponding to the message card generation request is obtained.

[0073] Specifically, such as Figure 6As shown, when a new template needs to be loaded, server 104 will first check the task queue to see if a template loading task corresponding to the new template exists before creating a template loading task. If it exists, it can directly monitor the download process of the message template in the template loading task by registering a listening task, thus enabling the template reading task for multiple message card creation processes to be implemented with a single template loading task. That is, only one message template task is generated. When other message cards need to load the same message template, they only need to listen to whether this task is completed. If the task is completed, it will notify all listeners that the file loading is complete and the next operation can proceed. If it does not exist, the template loading task needs to be created first to implement the template loading process. In this embodiment, the template manager and task queue are used to monitor and manage the template loading process, which can reduce the number of times the same message template is read, thereby improving the processing efficiency of the process of generating message cards based on message templates.

[0074] In one embodiment, step 205 includes: parsing the message template to obtain a style description tree; and obtaining message data based on the style description tree and business data.

[0075] Parsing the message template refers to resolving it into a style description tree. Expression data refers to a portion of the message data. After receiving the message template, the server can convert the binary form into a corresponding data structure, then parse it into a style description tree. This style description tree contains the hierarchical structure between multiple nodes and the attribute descriptions of individual nodes. However, some attributes in this description tree may be expressions and cannot be directly rendered. Data needs to be applied to the expressions to calculate specific values, which are then assigned to the node attributes. Only after this process can the resulting rendering tree be displayed. Therefore, after obtaining the style description tree, it can be combined with business data to populate relevant expressions and obtain the message data.

[0076] Specifically, after obtaining the business data and message template, the process involves several steps: parsing the message template, converting it into a style description tree, performing data operations, converting the style description tree into a rendering tree, and finally rendering it for display. The data operation process specifically refers to performing data calculations on the style description tree corresponding to the expression to calculate specific values ​​and assign them to node attributes for subsequent rendering. Therefore, after obtaining the message template, the server can first parse the message template and then combine it with the business data to obtain message data containing expression data, thus laying the groundwork for subsequent calculations.

[0077] In one embodiment, after step 209, the method further includes: obtaining a template reuse request containing a template identifier; searching for a cache file based on the template identifier, the cache file including at least one of a view cache, a node cache, or a file cache; when a view cache corresponding to the template identifier is found, obtaining a rendering tree corresponding to the template reuse request through data processing; when a node cache corresponding to the template identifier is found, obtaining a rendering tree corresponding to the template reuse request through node parsing and data processing; when a file cache corresponding to the template identifier is found, obtaining a rendering tree corresponding to the template reuse request through full template parsing; when no view cache, node cache, or file cache corresponding to the template identifier is found, obtaining a rendering tree corresponding to the template reuse request through template loading and full template parsing; and rendering a message card corresponding to the template reuse request based on the rendering tree.

[0078] The template identifier refers to the identification information used to identify the required target message template from the message template library. Specifically, the template identifier can include template type, template number, and template name. The template cache file refers to the cached file of the message template. For the same template, its loading and parsing will produce three outputs depending on the stage: a file, a style description tree, and a rendered view tree. The cached data differs at different stages. By identifying the message template cache file, unnecessary parsing processes for message templates can be reduced, improving the efficiency of message card generation. A message template is specifically a view file; therefore, the template parsing process is also a view parsing process. The complete message template parsing process also includes loading the message template file, parsing nodes into a style description tree, and data processing. The view cache file contains the view tree converted from the style description tree. In other words, the view cache file is generated after parsing the message template nodes. Therefore, if a view cache exists in the cache file, it means that the current message template has already undergone template loading and node parsing, and the view tree in the template has been converted into a view tree. Thus, only data operations need to be performed on the view tree to obtain the fully parsed message template file. Data operations can calculate the specific data from the expressions in the view tree and assign it to attributes for rendering. The node cache is the cached data corresponding to the style description tree file. After reading the message template, it can be converted into a style description tree, resulting in the node cache file. The node cache file needs to be converted into a view tree through node parsing, and then processed through data operations to obtain the rendering tree. Therefore, after obtaining the node cache, it still needs to undergo two steps of node parsing and data operations before further parsing. The file cache refers to the cache of the template file. Full template parsing includes all parsing processes such as node parsing to convert into a style description tree and data operations. If a file cache exists in the cache but not a view cache or node cache, it means that a full parsing process needs to be completed through full template parsing. If there is no file cache, it means that the message template must be read first and then the full template parsing process must be performed before the rendering tree can be obtained.

[0079] Specifically, this application can also reuse message templates through template cache files. The template identifier of the message template can be used first, and then the template identifier can be used as a key to find related cached data or the message template itself. Since the template process generates three different products—files, style description trees, and rendering view trees—and each product corresponds to a template cache file, a multi-level caching mechanism can be set up to find the corresponding cache file for the template. Then, different template loading processes are performed based on the found cache file, reducing the parsing process for message templates and thus ensuring processing efficiency. In one embodiment, such as... Figure 7As shown, when the final parsed view cache file is found, only data processing is needed to obtain the rendering tree corresponding to the template reuse request. However, if only the XmlNode cache file is found, it is necessary to first convert the XmlNode cache file into a view tree through XmlNode parsing, and then obtain the rendering tree through data processing. If only the file cache corresponding to the template identifier is found, it means that a full template parsing process, including style description tree conversion, node parsing, and data processing, is required to obtain the rendering tree corresponding to the template reuse request. If even the file cache is not found, the corresponding message template file must be loaded first before performing a full template parsing. In this embodiment, the template cache file is found through the template identifier, allowing the loading and parsing of message templates through the template cache file, reducing the message template parsing process and improving the efficiency of message card generation.

[0080] In one embodiment, before step 207, the method further includes: obtaining expression data from historical data; performing lexical analysis on the expression data from historical data to obtain word stream data; performing syntactic analysis on the word stream data to construct an abstract syntax tree; traversing each node in the abstract syntax tree and generating each instruction in the instruction data based on the traversal result.

[0081] Lexical analysis, in computer science, refers to the process of converting a sequence of characters into a stream of tokens. The program or function that performs lexical analysis is called a lexical analyzer or scanner. Lexical analyzers typically exist as functions, called by the syntax analyzer. The program that performs lexical analysis is called a lexical analyzer or scanner. It scans the source program from left to right, identifying various tokens according to the language's lexical rules and generating the corresponding attribute words. Syntax analysis, on the other hand, is a logical stage in the compilation process. The task of syntax analysis is to combine the sequence of tokens into various grammatical phrases, such as "program," "statement," and "expression," based on lexical analysis. The syntax analyzer determines whether the source program is structurally correct. The structure of the source program is described by a context-free grammar. Syntax analyzers can also be automatically generated using tools. The program that performs syntax analysis is called a syntax analyzer or syntax analyzer program. It identifies the corresponding grammatical categories from the results of lexical analysis according to the grammatical rules of the source language and performs grammatical checks. An Abstract Syntax Tree (AST), or simply a syntax tree, is an abstract representation of the syntactic structure of source code. It represents the syntactic structure of a programming language in a tree-like structure, where each node represents a structure within the source code. Since the scheme in this application is primarily used for processing expression data, nodes represent operands or operators in the expression's arithmetic rules. By traversing the nodes in the abstract syntax tree, the instructions in the instruction data are generated based on the traversal results.

[0082] Specifically, the solution of this application uses instruction data to analyze and cache the lexical and syntactic analysis processes to obtain various instruction data, and the specific instructions can be generated through syntactic analysis. First, a lexical analyzer such as Lex is used to perform lexical analysis on each expression in the historical data to obtain the word stream data corresponding to the expression. Then, a syntactic analyzer such as Yacc is used to perform syntactic analysis on the word stream data to construct the corresponding abstract syntax tree. After obtaining the syntax tree, the instructions corresponding to each node can be obtained by traversing the nodes. In one embodiment, the process of constructing each instruction in the instruction data based on the expression "a = b + c * d" in the historical data can be referred to... Figure 8As shown, the expression is first lexically analyzed using the Lex lexical analysis tool to obtain the word stream data "id1=id2+id3-id4". Then, the word stream is parsed using the Yace syntax analysis tool to obtain the abstract syntax tree (AST), as shown in the figure. Next, the nodes in the AST are traversed, and the found instructions include four commands: "load id3", "mul id4", "addid2", and "store id1". In this embodiment, various instructions can be constructed through the syntax analysis of the expression. In subsequent data processing, these instructions can be directly used for computation, thereby improving the efficiency of message card generation.

[0083] In one embodiment, obtaining the calculation result of the expression data based on the instruction data includes: performing field nulling processing on the instruction data to identify the data to be optimized in the instruction data; optimizing the instruction data based on the data to be optimized to obtain an optimized instruction; and obtaining the calculation result of the expression data based on the optimized instruction.

[0084] Specifically, optimizing instructions refers to optimizing certain null-checking instructions in the instruction data. For example, common null-checking syntax for arrays (array capacity) and strings (string length) can be optimized, thereby replacing multiple instructions with a single instruction.

[0085] Specifically, the found instructions may contain some empty instructions. To reduce the overhead of instruction execution, these empty instructions can be optimized first. In this case, a null check instruction (CHECK_EMPTY) can be used to identify whether each instruction in the instruction data is empty. This null check instruction specifically performs null checks, such as checking arrays and strings in the instruction data for null values, replacing the previous LOAD, CALL, and EQAL instructions. This reduces the number of instructions and improves the processing efficiency of the data operation. In one embodiment, such as... Figure 9 As shown on the left, the data to be optimized is first identified from the code of the instruction data, which includes "desc_list.size()" and "num 0". Therefore, for... Figure 9 On the right, the first three instructions are optimized by replacing the instruction corresponding to the null check operation with the CHECK_EMPTY instruction. In this embodiment, by handling the null check of instruction data, the number of instructions can be effectively reduced, thereby improving the processing efficiency of the data operation process.

[0086] In one embodiment, obtaining the calculation result of the expression data based on the instruction data includes: identifying the most frequent data field in the instruction data; constructing a fast access instruction corresponding to the most frequent data field; updating the instruction data based on the fast access instruction; and obtaining the calculation result of the expression data through the updated instruction data.

[0087] The most frequent data field refers to the data field that appears most frequently in the instruction data containing all instructions. Such frequently occurring data fields generally require a strategy of accessing nested fields hierarchically. Fast access instructions, on the other hand, allow access to nested fields in one go, preventing data from being repeatedly transferred between temporary registers.

[0088] Specifically, the solution in this application can further simplify the data processing procedure through field access optimization measures. This is achieved by identifying the most frequent data field in the instruction data; constructing a fast access instruction corresponding to the most frequent data field; updating the instruction data based on the fast access instruction; and obtaining the result of the expression data through the updated instruction data. For the most frequent data field, a direct access syntax is used, replacing the strategy of accessing nested fields hierarchically with a strategy of accessing nested fields once, thus avoiding repeated data transfers in temporary registers. For the most frequent data field, it can be transformed into a one-time access nested field, thereby optimizing the instruction data. In this embodiment, field access optimization can effectively simplify the data processing flow, thereby improving the processing efficiency of data operations.

[0089] In one embodiment, obtaining the calculation result of expression data based on instruction data includes: identifying constant expression nodes in the expression data, where constant expressions are syntax nodes with all operands being constant; performing data calculations on the constant expression nodes to obtain constant calculation results; replacing the constant expression nodes in the expression data with the constant calculation results corresponding to the constant expression nodes to update the expression data; searching for instruction data corresponding to the updated expression data in the expression instruction set, and obtaining the calculation result of the expression data based on the instruction data.

[0090] Among them, constant expressions are syntax nodes where all operands are constant. These syntax nodes can be directly calculated to obtain the result, which can then replace the original node.

[0091] Specifically, this application can also optimize constant expressions in the expression data. If it is identified that all operands within a node of the expression are constants, such as... Figure 10As shown, the operands within the node (2+1) are all constants. Therefore, they can be calculated first to obtain the constant operation result of 3. Then, 3 is used to replace the original (2+1) to update the expression. The instruction data can then be obtained based on the updated expression, thus directly avoiding instruction generation and improving the processing efficiency of the data operation process. In this embodiment, further optimization of the expression data through constant expression optimization can effectively improve processing efficiency.

[0092] This application also provides an application scenario in which the above-described message card generation method is applied. Specifically, the message card generation method is applied in this scenario as follows:

[0093] This application can be specifically applied to an instant messaging software suitable for enterprise management. Administrators can push messages from the server side to individual members of the enterprise within the instant messaging software, or to group chats containing several enterprise members. The message push format can be implemented using FunView message cards. The administrator on the server side first submits business data for generating message cards, and simultaneously sets template specifications for the message templates to be used. Then, a message card generation request containing the template specifications and business data is pushed to the terminals corresponding to each member, so that the corresponding message cards are rendered and generated on the terminals. Upon receiving the message card generation request containing the template specifications and business data, the terminal first needs to obtain the message template corresponding to the message card generation request based on the template specifications. This process can be achieved by downloading the message template from the server using a template loading task. However, there may be situations where multiple messages load the same message template simultaneously. At this point, regarding the message template loading process, we can first search for the template loading task corresponding to the specified information in the message template loading task queue based on the template-specified message. If no template loading task corresponding to the specified information is found in the task queue, a template loading task corresponding to the specified information is created, and a listener task is registered in the created template loading task. The listener task is used to monitor the download completion status of the message template specified by the specified information. Based on the template loading task, the message template corresponding to the message card generation request is obtained. Conversely, if a template loading task corresponding to the specified information is found in the task queue, a listener task is registered in the template loading task corresponding to the specified information. The listener task is used to monitor the download completion status of the message template specified by the specified information. When the listener task detects that the message template download is complete, the message template corresponding to the message card generation request is obtained. After obtaining the message template, it can be parsed to obtain an XmlNode style description tree; based on the XmlNode style description tree and business data, the message data is obtained. Then, expression data within the message data can be identified, and the corresponding instruction data can be found in the expression instruction set. The result of the expression data's operation is obtained based on the instruction data. The instruction data in the expression instruction set is generated based on nodes in the abstract syntax tree (AST) of various expressions in the historical data. The AST is constructed by performing lexical and syntactic analysis on various expressions in the historical data. Nodes in the AST represent operands or operators of the expression's operational rules. Specifically, the construction process of the expression instruction set involves: acquiring expression data from the historical data; performing lexical analysis on the expression data in the historical data to obtain word stream data; performing syntactic analysis on the word stream data to construct the AST; traversing each node in the AST, and generating each instruction in the instruction data based on the traversal results.The expression calculation process can also include three optimization steps. The first is field null detection optimization: by checking for null fields in the instruction data, data to be optimized is identified; the instruction data is then optimized based on this data to obtain optimized instructions; and the result of the expression data is obtained based on these optimized instructions. The second is field access optimization: by identifying the most frequent data fields in the instruction data, a fast access instruction corresponding to the most frequent data field is constructed; the instruction data is updated based on the fast access instruction; and the result of the expression data is obtained based on the updated instruction data. The third is constant expression optimization: by identifying constant expression nodes in the expression data (constant expressions are syntax nodes where all operands are constants), data operations are performed on these constant expression nodes to obtain constant operation results; the constant expression nodes in the expression data are replaced with their corresponding constant operation results to update the expression data; the updated instruction data is then searched in the expression instruction set to find the corresponding instruction data, and the result of the expression data is obtained based on this instruction data. Furthermore, this application also includes a process for reusing cached template data through a caching mechanism. Specifically, the terminal can begin template reuse processing after receiving a template reuse request containing a template identifier. First, it searches for cache files based on the template identifier. These cache files include at least one of view cache, node cache, or file cache. When a view cache corresponding to the template identifier is found, a rendering tree corresponding to the template reuse request is obtained through data processing. When a node cache corresponding to the template identifier is found, a rendering tree corresponding to the template reuse request is obtained through node parsing and data processing. When a file cache corresponding to the template identifier is found, a full template parsing process is used to obtain the rendering tree corresponding to the template reuse request. When no view cache, node cache, or file cache corresponding to the template identifier is found, a rendering tree corresponding to the template reuse request is obtained through template loading and full template parsing. Finally, a message card corresponding to the template reuse request is generated based on the rendering tree. This effectively improves the processing efficiency of the message card generation process.

[0094] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0095] Based on the same inventive concept, this application also provides a message card generation apparatus for implementing the message card generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more message card generation apparatus embodiments provided below can be found in the limitations of the message card generation method described above, and will not be repeated here.

[0096] In one embodiment, such as Figure 11 As shown, a message card generation device is provided, including...

[0097] The request retrieval module 1102 is used to retrieve a message card generation request containing template-specified information and business data.

[0098] Template lookup module 1104 is used to obtain the message template corresponding to the message card generation request based on the template specified information;

[0099] The message parsing module 1106 is used to obtain message data based on the message template and business data;

[0100] The data processing module 1108 is used to identify expression data in message data, search for instruction data corresponding to the expression data in the expression instruction set, and obtain the operation result of the expression data based on the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules.

[0101] The message card generation module 1110 is used to render and generate message cards based on message data and calculation results.

[0102] In one embodiment, the template lookup module 1104 is specifically used to: when no template loading task corresponding to the template specified information is found in the task queue, create a template loading task corresponding to the template specified information, and register a listening task in the created template loading task. The listening task is used to listen to the download completion status of the message template specified by the template specified information; and obtain the message template corresponding to the message card generation request based on the template loading task.

[0103] In one embodiment, the template lookup module 1104 is specifically used to: when a template loading task corresponding to the template specified information is found in the task queue, register a listening task in the template loading task corresponding to the template specified information, the listening task is used to listen to the download completion status of the message template specified by the template specified information; when the listening task detects that the message template download is complete, obtain the message template corresponding to the message card generation request.

[0104] In one embodiment, the message parsing module 1106 is specifically used to: parse the message template to obtain a style description tree; and obtain message data based on the style description tree and business data.

[0105] In one embodiment, a template reuse module is further included, configured to: obtain a template reuse request containing a template identifier; search for a cache file based on the template identifier, the cache file including at least one of a view cache, a node cache, or a file cache; when a view cache corresponding to the template identifier is found, obtain a rendering tree corresponding to the template reuse request through data processing; when a node cache corresponding to the template identifier is found, obtain a rendering tree corresponding to the template reuse request through node parsing and data processing; when a file cache corresponding to the template identifier is found, obtain a rendering tree corresponding to the template reuse request through full template parsing; when no view cache, node cache, or file cache corresponding to the template identifier is found, obtain a rendering tree corresponding to the template reuse request through template loading and full template parsing; and render and generate a message card corresponding to the template reuse request based on the rendering tree.

[0106] In one embodiment, an instruction construction module is further included, which is used to: acquire historical data; perform lexical analysis on the historical data to obtain word stream data; perform syntactic analysis on the word stream data to construct an abstract syntax tree; traverse each node in the abstract syntax tree and generate each instruction in the instruction data based on the traversal result.

[0107] In one embodiment, the data processing module 1108 is specifically used to: perform field null detection processing on the instruction data to identify the data to be optimized in the instruction data; optimize the instruction data based on the data to be optimized to obtain an optimized instruction; and obtain the calculation result of the expression data according to the optimized instruction.

[0108] In one embodiment, the data processing module 1108 is specifically used to: identify the most frequent data field in the instruction data; construct a fast access instruction corresponding to the most frequent data field; update the instruction data based on the fast access instruction; and obtain the calculation result of the expression data through the updated instruction data.

[0109] In one embodiment, the data operation module 1108 is specifically used to: identify constant expression nodes in the expression data, where a constant expression is a syntax node whose operands are all constant; perform data operation processing on the constant expression nodes to obtain constant operation results; replace the constant expression nodes in the expression data with the constant operation results corresponding to the constant expression nodes to update the expression data; search for the instruction data corresponding to the updated expression data in the expression instruction set, and obtain the operation result of the expression data based on the instruction data.

[0110] Each module in the aforementioned message card generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0111] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 12 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a message card generation method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0112] Those skilled in the art will understand that Figure 12The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0113] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0114] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0115] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above method embodiments.

[0116] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0117] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0118] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0119] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for generating message cards, characterized in that, The method includes: Get a message card generation request that includes template-specified information and business data; The message template corresponding to the message card generation request is obtained based on the template specified information; Message data is obtained based on the message template and the business data; The expression data in the message data is identified, the instruction data corresponding to the expression data is found in the expression instruction set, and the operation result of the expression data is obtained according to the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules. Based on the message data and the calculation results, a message card is rendered and generated. Obtain a template reuse request containing a template identifier; search for cache files based on the template identifier, the cache files including at least one of view cache, node cache, or file cache; when a view cache corresponding to the template identifier is found, obtain the rendering tree corresponding to the template reuse request through data processing; when a node cache corresponding to the template identifier is found, obtain the rendering tree corresponding to the template reuse request through node parsing and data processing; when a file cache corresponding to the template identifier is found, obtain the rendering tree corresponding to the template reuse request through full template parsing; when no view cache, node cache, or file cache corresponding to the template identifier is found, obtain the rendering tree corresponding to the template reuse request through template loading and full template parsing; render and generate the message card corresponding to the template reuse request based on the rendering tree.

2. The method according to claim 1, characterized in that, The message template corresponding to the message card generation request obtained based on the template specified information includes: When no template loading task corresponding to the specified template information is found in the task queue, a template loading task corresponding to the specified template information is created, and a listening task is registered in the created template loading task. The listening task is used to listen for the download completion status of the message template specified by the specified template information. The message template corresponding to the message card generation request is obtained based on the template loading task.

3. The method according to claim 1, characterized in that, The message template corresponding to the message card generation request obtained based on the template specified information includes: When a template loading task corresponding to the specified template information is found in the task queue, a listening task is registered in the template loading task corresponding to the specified template information. The listening task is used to listen for the download completion status of the message template specified by the specified template information. When the listening task detects that the message template download is complete, the message template corresponding to the message card generation request is obtained.

4. The method according to claim 1, characterized in that, The process of obtaining message data based on the message template and the business data includes: The message template is parsed to obtain a style description tree; Message data is obtained based on the style description tree and the business data.

5. The method according to claim 1, characterized in that, Before searching for the instruction data corresponding to the expression data in the expression instruction set and obtaining the calculation result of the expression data based on the instruction data, the method further includes: Retrieve expression data from historical data; Lexical analysis is performed on the expression data in the historical data to obtain word stream data; The word stream data is subjected to syntactic analysis to construct an abstract syntax tree; Traverse each node in the abstract syntax tree and generate each instruction in the instruction data based on the traversal results.

6. The method according to claim 1, characterized in that, The calculation result of obtaining the expression data based on the instruction data includes: The instruction data is subjected to field null detection processing to identify the data to be optimized in the instruction data; The instruction data is optimized based on the data to be optimized to obtain optimized instructions. The result of the expression data is obtained according to the optimization instructions.

7. The method according to any one of claims 1 to 6, characterized in that, The calculation result of obtaining the expression data based on the instruction data includes: Identify the most frequently used data field in the instruction data; Construct the quick access command corresponding to the most frequently used data field; Update the instruction data based on the fast access instruction; The result of the expression data is obtained by using the updated instruction data.

8. The method according to any one of claims 1 to 6, characterized in that, The step of identifying expression data in the message data, searching for instruction data corresponding to the expression data in the expression instruction set, and obtaining the calculation result of the expression data based on the instruction data includes: Identify constant expression nodes in the expression data, where the constant expression is a syntax node whose operands are all constant; Perform data operations on the constant expression nodes to obtain constant operation results; The constant expression nodes in the expression data are replaced with the constant operation results corresponding to the constant expression nodes to update the expression data; The updated instruction data corresponding to the expression data is searched in the expression instruction set, and the calculation result of the expression data is obtained based on the instruction data.

9. A message card generation device, characterized in that, The device includes: The request retrieval module is used to retrieve message card generation requests that include template-specified information and business data. The template lookup module is used to obtain the message template corresponding to the message card generation request based on the template specified information; The message parsing module is used to obtain message data based on the message template and the business data; The data processing module is used to identify expression data in the message data, search for the instruction data corresponding to the expression data in the expression instruction set, and obtain the operation result of the expression data based on the instruction data. The instruction data in the expression instruction set is generated based on the nodes in the abstract syntax tree of various expressions in the historical data. The abstract syntax tree is constructed by performing lexical analysis and syntax analysis on various expressions in the historical data. The nodes in the abstract syntax tree represent the operands or operators of the expression operation rules. The message card generation module is used to render and generate message cards based on the message data and the calculation results; The template reuse module is used to obtain a template reuse request containing a template identifier; search for cache files based on the template identifier, wherein the cache files include at least one of view cache, node cache, or file cache; when a view cache corresponding to the template identifier is found, a rendering tree corresponding to the template reuse request is obtained through data processing; when a node cache corresponding to the template identifier is found, a rendering tree corresponding to the template reuse request is obtained through node parsing and data processing; when a file cache corresponding to the template identifier is found, a rendering tree corresponding to the template reuse request is obtained through full template parsing; when no view cache, node cache, or file cache corresponding to the template identifier is found, a rendering tree corresponding to the template reuse request is obtained through template loading and full template parsing; and a message card corresponding to the template reuse request is generated based on the rendering tree.

10. The apparatus according to claim 9, characterized in that, The template lookup module is specifically used for: when no template loading task corresponding to the specified template information is found in the task queue, creating a template loading task corresponding to the specified template information, and registering a listening task in the created template loading task. The listening task is used to listen for the download completion status of the message template specified by the specified template information; and obtaining the message template corresponding to the message card generation request based on the template loading task.

11. The apparatus according to claim 9, characterized in that, The template lookup module is specifically used for: when a template loading task corresponding to the specified template information is found in the task queue, a listening task is registered in the template loading task corresponding to the specified template information. The listening task is used to listen for the download completion status of the message template specified by the specified template information; when the listening task detects that the message template download is complete, the message template corresponding to the message card generation request is obtained.

12. The apparatus according to claim 9, characterized in that, The message parsing module is specifically used to: parse the message template to obtain a style description tree; and obtain message data based on the style description tree and the business data.

13. The apparatus according to claim 9, characterized in that, It also includes an instruction construction module: acquiring expression data from historical data; performing lexical analysis on the expression data from the historical data to obtain word stream data; and performing syntactic analysis on the word stream data to construct an abstract syntax tree; Traverse each node in the abstract syntax tree and generate each instruction in the instruction data based on the traversal results.

14. The apparatus according to claim 9, characterized in that, The data processing module is specifically used for: performing field null detection processing on the instruction data to identify data to be optimized in the instruction data; optimizing the instruction data based on the data to be optimized to obtain an optimized instruction; and obtaining the calculation result of the expression data according to the optimized instruction.

15. The apparatus according to any one of claims 9 to 14, characterized in that, The data processing module is specifically used for: identifying the most frequent data field in the instruction data; constructing a quick access instruction corresponding to the most frequent data field; updating the instruction data based on the quick access instruction; and obtaining the calculation result of the expression data through the updated instruction data.

16. The apparatus according to any one of claims 9 to 14, characterized in that, The data processing module is specifically used to: identify constant expression nodes in the expression data, wherein the constant expression is a syntax node in which all operands are constant; and perform data processing on the constant expression nodes to obtain constant processing results. The constant expression nodes in the expression data are replaced with the constant operation results corresponding to the constant expression nodes to update the expression data; The updated instruction data corresponding to the expression data is searched in the expression instruction set, and the calculation result of the expression data is obtained based on the instruction data.

17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.

19. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.