QR Code Generation Method, Device, Computer Equipment and Storage Medium

By obtaining input parameters and calling the same QR code component to generate QR codes, the problem of different QR code generation requirements for different applications is solved, and the applicability of QR code components and the efficiency of application development is improved.

CN115221988BActive Publication Date: 2025-07-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110426497.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-20
Publication Date
2025-07-18
Estimated Expiration
2041-04-20

AI Technical Summary

Technical Problem

Different QR code generation and display requirements for different applications lead to the need to develop different QR code components, which affects the development efficiency of the application.

Method used

By obtaining input parameters, including rendering content, target data type and target rendering type, calling the same QR code component to generate QR code, it supports compatibility of multiple data types and rendering types, and adapts to the needs of different clients.

Benefits of technology

It improves the applicability of QR code components, enhances the development efficiency of application programs, and simplifies the development process of QR code generation and display functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221988B_ABST
    Figure CN115221988B_ABST
Patent Text Reader

Abstract

This application relates to a method, device, computer device, and storage medium for generating two-dimensional codes, and pertains to the technical field of two-dimensional codes. The method includes: obtaining input parameters, which include rendering content for generating a two-dimensional code, a target data type, and a target rendering type; the target data type is used to indicate the format of the rendering content in the two-dimensional code, and the target rendering type is used to indicate the type of the two-dimensional code; calling a two-dimensional code component based on the input parameters, and the two-dimensional code component generates a two-dimensional code containing the rendering content based on the target data type and the target rendering type; and displaying the two-dimensional code. Through the above method, for application programs with different requirements for data types and rendering types, the respective required two-dimensional codes can be generated by the same two-dimensional code component, thereby improving the applicability of the two-dimensional code component and further improving the development efficiency of application programs with two-dimensional code generation and display functions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of two-dimensional codes, and particularly to a two-dimensional code generation method, apparatus, computer device, and storage medium. Background Art

[0002] In daily life, the application of two-dimensional codes is becoming increasingly popular, and there are more and more applications for generating and managing two-dimensional codes.

[0003] In the related art, the two-dimensional code generation and display functions in an application are usually implemented through a two-dimensional code component. Among them, for different applications, the application requirements for two-dimensional codes may be different, and correspondingly, different two-dimensional code components need to be developed.

[0004] However, in the above related art, different applications with different application requirements need to develop different two-dimensional code components, which affects the development efficiency of applications with two-dimensional code generation and display functions. Summary of the Invention

[0005] Embodiments of this application provide a two-dimensional code generation method, apparatus, computer device, and storage medium, which can improve the development efficiency of applications with two-dimensional code generation and display functions. The technical solution is as follows:

[0006] On the one hand, a two-dimensional code generation method is provided. The method includes:

[0007] Obtain input parameters, where the input parameters include rendering content for generating a two-dimensional code, a target data type, and a target rendering type; the target data type is used to indicate the format of the rendering content in the two-dimensional code, and the target rendering type is used to indicate the type of the two-dimensional code;

[0008] Call a two-dimensional code component based on the input parameters, and the two-dimensional code component generates the two-dimensional code including the rendering content based on the target data type and the target rendering type;

[0009] Display the two-dimensional code.

[0010] On the other hand, a two-dimensional code display apparatus is provided. The apparatus includes:

[0011] A parameter acquisition module, configured to obtain input parameters, where the input parameters include rendering content for generating a two-dimensional code, a target data type, and a target rendering type; the target data type is used to indicate the format of the rendering content in the two-dimensional code, and the target rendering type is used to indicate the type of the two-dimensional code;

[0012] A QR code generation module, which is used to call a QR code component based on the input parameters, and the QR code component generates the QR code containing the rendering content based on the target data type and the target rendering type;

[0013] A QR code display module, which is used to display the QR code.

[0014] In a possible implementation, the target data type is a byte array, a string, or a base64 image string;

[0015] The target rendering type is an image type or a canvas type.

[0016] In a possible implementation, the QR code generation module includes:

[0017] A format conversion sub-module, which is used to respond to the format of the rendering content being different from the format indicated by the target data type, and convert the format of the rendering content to the format indicated by the target data type through the QR code component;

[0018] A QR code generation sub-module, which is used to generate the QR code based on the format-converted rendering content and the target rendering type through the QR code component.

[0019] In a possible implementation, when the format indicated by the target data type is a byte array and the format of the rendering content is a string, the format conversion sub-module is used to convert the format of the rendering content from a string format to a byte array format through the QR code component.

[0020] In a possible implementation, the parameter acquisition module is used to obtain the input parameters through a subroutine, and the subroutine is an application program that depends on the host program for execution;

[0021] The QR code generation module is used to call the QR code component installed in the host program through the subroutine, and the QR code component generates the QR code containing the rendering content based on the target data type and the target rendering type.

[0022] In a possible implementation, the input parameters include a valid duration; the device further includes:

[0023] A cancellation display module, which is used to cancel the display of the QR code in response to the display duration of the QR code reaching the valid duration.

[0024] In a possible implementation, the device further includes:

[0025] An expiration prompt display module, configured to display an expiration prompt in response to the display duration of the two-dimensional code reaching the effective duration, where the expiration prompt is used to indicate that the two-dimensional code has expired.

[0026] In a possible implementation manner, the device further includes:

[0027] A screenshot count acquisition module, configured to acquire the number of screenshots of the two-dimensional code within a specified time period;

[0028] The parameter acquisition module is configured to, in response to the number of screenshots not reaching the screenshot count threshold, call the two-dimensional code component based on the input parameter, where the two-dimensional code component generates the two-dimensional code including the rendering content based on the target data type and the target rendering type.

[0029] In a possible implementation manner, the two-dimensional code display module is configured to display a screenshot prompt in response to detecting a screenshot operation, where the screenshot prompt is used to indicate the screenshot count threshold.

[0030] In a possible implementation manner, the device further includes:

[0031] A brightness adjustment module, configured to adjust the brightness of the two-dimensional code display interface to a brightness threshold in response to displaying the two-dimensional code.

[0032] In a possible implementation manner, the device further includes:

[0033] A scan record acquisition module, configured to acquire the scan record of the two-dimensional code from a background server;

[0034] A scan record display module, configured to display the scan record, where the scan record is used to indicate the scan result of the two-dimensional code by a scanning end, and the scan result indicates a successful scan or a failed scan.

[0035] In a possible implementation manner, the device further includes:

[0036] A pop-up display module, configured to display a message subscription pop-up in response to the message subscription function not being enabled, where the message subscription pop-up is used to prompt whether to enable the message subscription function.

[0037] On the other hand, a computer device is provided, where the computer device includes a processor and a memory, and the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the above two-dimensional code generation method.

[0038] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned QR code generation method.

[0039] On the other hand, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the QR code generation method provided in the above various optional implementation manners.

[0040] The technical solution provided by this application may include the following beneficial effects:

[0041] By selecting one of multiple data types as the target data type based on a selection operation, selecting one of multiple target rendering types as the target rendering type based on the user's selection operation, and after obtaining the rendering content, generating a QR code through the same QR code component based on the target data type and the target rendering type corresponding to different clients, so that when generating a QR code, the same QR code component compatible with each platform can be used to generate QR codes corresponding to different platforms, thereby improving the development efficiency of an application program with QR code generation and display functions. Description of the Drawings

[0042] The drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with this application, and are used together with the specification to explain the principles of this application.

[0043] Figure 1 It shows a schematic diagram of the system structure used in the QR code generation method provided by an exemplary embodiment of this application;

[0044] Figure 2 It shows a flowchart of the QR code generation method provided by an exemplary embodiment of this application;

[0045] Figure 3 It shows a flowchart of the QR code generation method provided by an exemplary embodiment of this application;

[0046] Figure 4 It shows a schematic diagram of the QR code generated when the target data type is a byte array shown in an exemplary embodiment of this application;

[0047] Figure 5 It shows a schematic diagram of the QR code generated when the target data type is a string shown in an exemplary embodiment of this application;

[0048] Figure 6Shows a schematic diagram of a QR code generated when the target data type shown in an exemplary embodiment of the present application is a base64 image string;

[0049] Figure 7 Shows a timing diagram of the scan code callback shown in an exemplary embodiment of the present application;

[0050] Figure 8 Shows a schematic diagram of the interface of the scan code success prompt and the scan code failure prompt shown in an exemplary embodiment of the present application;

[0051] Figure 9 Shows a schematic diagram of the front-end scan code polling logic shown in an exemplary embodiment of the present application;

[0052] Figure 10 Shows a schematic diagram of the scan code record shown in an exemplary embodiment of the present application;

[0053] Figure 11 Shows a schematic diagram of the failure prompt information shown in an exemplary embodiment of the present application;

[0054] Figure 12 Shows a schematic diagram of the anti-screen capture function shown in an exemplary embodiment of the present application;

[0055] Figure 13 Shows a schematic diagram of the urban code generation process shown in an exemplary embodiment of the present application;

[0056] Figure 14 Shows a block diagram of a QR code display device provided in an exemplary embodiment of the present application;

[0057] Figure 15 Shows a block diagram of a computer device shown in an exemplary embodiment of the present application;

[0058] Figure 16 Shows a block diagram of a computer device provided in an exemplary embodiment of the present application. Detailed Description of the Invention

[0059] Here, exemplary embodiments will be described in detail, and examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0060] It should be understood that "a plurality of" as mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, both A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.

[0061] The embodiment of the present application provides a method for generating a two-dimensional code, which can improve the development efficiency of an application program with the functions of generating and displaying a two-dimensional code. For the convenience of understanding, several terms related to the present application are explained below.

[0062] 1) Two-dimensional barcode

[0063] A two-dimensional barcode, also known as a two-dimensional bar code and also called a QR code (Quick Response code), is a readable barcode extended on the basis of a one-dimensional barcode. When a device scans a two-dimensional barcode, the information contained therein can be obtained by identifying the binary data recorded in the length and width of the barcode.

[0064] Generally, a two-dimensional barcode is a graphic that records data symbol information distributed in a plane (two-dimensional direction) according to a certain rule by using a certain specific geometric figure; in the code compilation, the concept of "0" and "1" bit streams that form the internal logic basis of a computer is cleverly utilized, and several geometric figures corresponding to binary are used to represent alphanumeric information. It can be automatically read by an image input device or an optoelectronic scanning device to achieve automatic information processing. It has some commonalities with barcode technology: each code system has its specific character set; each character occupies a certain width; it has a certain verification function, etc. At the same time, it also has the characteristics of automatically identifying information in different rows and processing graphic rotation changes. Among many types of two-dimensional barcodes, the commonly used code systems include: Data Matrix, Maxi Code, Aztec, QR Code, Vericode, PDF417, Ultracode, Code 49, Code 16K, etc.

[0065] 2) Mini-program and H5 (Hyper Text Markup Language 5, the fifth revised version of the hypertext markup language)

[0066] A Mini Program is an application that can be used without being downloaded and installed. To provide users with more diverse business services, developers can develop corresponding Mini Programs for applications on the terminal (such as instant messaging applications, shopping applications, email applications, etc.). The Mini Program can be embedded in the application on the terminal as a sub-application, and corresponding business services can be provided to users by running the sub-application (i.e., the corresponding Mini Program) within the application. The running environment of the Mini Program is not a complete browser because only a part of H5 technology is used in the development of the Mini Program; H5 is a technology that depends on the browser shell, that is, the running environment of H5 is the browser, and the web-view components of APPs and the web-view components provided by Mini Programs can all open H5 pages.

[0067] Figure 1 FIG. shows a schematic diagram of the system structure used in the QR code generation method provided by an exemplary embodiment of the present application, as Figure 1 shown, the system includes: a server 110 and a terminal 120.

[0068] Among them, the above-mentioned server 110 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms, or a node server on a blockchain network.

[0069] The above-mentioned terminal 120 is a terminal with an interface display function. For example, the terminal 120 can be a smart phone, a tablet computer, an e-book reader, smart glasses, a smart watch, a smart TV, a smart vehicle-mounted device, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer, a desktop computer, and so on.

[0070] Optionally, the above system includes one or more servers 110 and multiple terminals 120. The embodiments of the present application do not limit the number of servers 110 and terminals 120.

[0071] The terminal and the server are connected through a communication network. Optionally, the communication network is a wired network or a wireless network.

[0072] Optionally, the above-mentioned wireless network or wired network uses standard communication technologies and / or protocols. The network is usually the Internet, but can also be any network, including but not limited to any combination of a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or a virtual private network. In some embodiments, technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. are used to represent the data exchanged through the network. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec), etc. can be used to encrypt all or some of the links. In other embodiments, customized and / or dedicated data communication technologies can be used to replace or supplement the above data communication technologies. This application does not limit here.

[0073] Figure 2 The flowchart of a two-dimensional code generation method provided by an exemplary embodiment of the present application is shown. This method is executed by a computing device, and the computer device can be implemented as a terminal, and the terminal can be Figure 1 the terminal shown, such as Figure 2 shown, and the two-dimensional code generation method includes the following steps:

[0074] Step 210, obtain input parameters, where the input parameters include rendering content for generating a two-dimensional code, a target data type, and a target rendering type; the target data type is used to indicate the format of the rendering content in the two-dimensional code, and the target rendering type is used to indicate the type of the two-dimensional code.

[0075] Wherein, the target data type is one of at least two data types of the target data. Among the at least two data types of the target data, each data type is different, and different data types can be adapted to different clients.

[0076] The target data required for generating the two-dimensional code is data generated based on the rendering content, and the target data type is obtained from at least two data types of the target data based on the user's selection operation.

[0077] One of at least two rendering forms of the target rendering form QR code.

[0078] The results of QR codes generated based on the same data type and rendering content are the same. That is to say, the information content obtained by scanning the QR code or the interface changes triggered are the same. It's just that based on the different rendering types corresponding to the QR code, the QR code is drawn through different drawing methods to meet different rendering methods in different client scenarios, so that the QR code adapts to different clients.

[0079] The target rendering type is obtained from at least two rendering forms of the QR code based on the user's selection operation.

[0080] In a possible implementation, in different scenarios, the ways to obtain the rendering content are different. Schematically, the rendering content can be the user's input content obtained as the rendering content, or the rendering content can be the QR code generation data corresponding to the input content obtained based on the user's input content.

[0081] Step 220, call the QR code component based on the input parameters. The QR code component generates a QR code containing the rendering content based on the target data type and the target rendering type.

[0082] Schematically, the QR code component is a component optimized from the weapp.qrcode.js code project, which can be compatible with multiple clients. For example, the multiple clients can be the H5 side and the mini-program side, and are used to generate corresponding QR codes based on the input parameters.

[0083] Step 230, display the QR code.

[0084] In summary, the QR code generation method provided by the embodiments of the present application selects one of multiple data types as the target data type based on the selection operation, selects one of multiple target rendering types as the target rendering type based on the user's selection operation, and after obtaining the rendering content, generates a QR code through the QR code component based on the corresponding target data type and target rendering type. Thus, when generating QR codes, application programs with different requirements for data types and rendering types can generate the QR codes they need through the same QR code component, thereby improving the applicability of the QR code component and further improving the development efficiency of application programs with QR code generation and display functions.

[0085] Figure 3 Shows a flowchart of a QR code generation method provided by an exemplary embodiment of the present application. This method is executed by a computing device, and the computing device can be implemented as a terminal or a server. The terminal or the server can be Figure 1 The terminal or server shown, such asFigure 3 As shown in the figure, the method for generating a two-dimensional code includes the following steps:

[0086] Step 310, obtain input parameters, where the input parameters include rendering content for generating a two-dimensional code, a target data type, and a target rendering type; the target data type is used to indicate the format of the rendering content in the two-dimensional code, and the target rendering type is used to indicate the type of the two-dimensional code.

[0087] In a possible implementation, the target data type is a byte array, a string, or a base64 image string. That is to say, the target data type can be one of a byte array, a string, and a base64 image string determined based on the user's selection operation.

[0088] Among them, a byte is a unit for transmitting information over a network (or storing information on a hard disk or in memory), and an array is a form in programming that organizes several variables of the same type in an ordered form for convenient processing. A set of these sequentially arranged homogeneous data elements is called an array.

[0089] A string, abbreviated as a string, is a linear list with certain constraints on the composition of data elements in a data structure. That is, all data elements that make up the linear list are required to be characters. Therefore, a string is a finite sequence of characters.

[0090] The rendering types of the two-dimensional code include an image type (image) and a canvas type (canvas). The target obvious type is an image type or a canvas type.

[0091] When the target data type and the rendering content are the same, the results of the two-dimensional codes obtained based on the above two rendering types are the same, only the rendering methods are different. Among them, the drawing process of the image type (image) is simpler, while the canvas type (canvas) can meet the requirement of drawing two-dimensional codes of different colors.

[0092] In a possible implementation, the target data type affects the initial data type of the rendering content. When the target data type is a byte array or a string, the initial data type of the rendering content is a string; when the target data type is a base64 image string, the initial data type of the rendering content is a base64 image string.

[0093] In a possible application scenario, the rendering content of the base64 image string type is a base64 image string for generating a two-dimensional code obtained by querying from the background based on the user's query instruction. The user query instruction can be a keyword input by the user.

[0094] When the application scenario is a mini-program scenario, in one possible implementation, the QR code component can be set corresponding to the mini-program; or, in another possible implementation, the QR code component can be set in the host program independently of the mini-program. That is to say, for mini-programs in the host program, when there is a need to generate a QR code, they can all call the QR code component in the host program to generate a QR code, so as to reduce the redundant deployment of the QR code component and reduce the resource occupancy of the mini-program. In one possible implementation, the obtaining of the input parameter is implemented as obtaining the input parameter through a subprogram, and the subprogram is an application program that depends on the host program for execution;

[0095] Call the QR code component based on the input parameter, and the QR code component generates a QR code containing the rendering content based on the target data type and the target rendering type, including: calling the QR code component installed in the host program through the subprogram, and the QR code component generates a QR code containing the rendering content based on the target data type and the target rendering type.

[0096] Step 320, call the QR code component based on the input parameter, and the QR code component generates a QR code containing the rendering content based on the target data type and the target rendering type.

[0097] Among them, when the initial data type of the rendering content is different, that is, in response to the format of the rendering content being different from the format indicated by the target data type, the QR code component converts the format of the rendering content into the format indicated by the target data type;

[0098] The QR code component generates a QR code based on the rendering content after format conversion and the target rendering type.

[0099] Illustratively, when the target data type is a byte array and the initial data type of the rendering content is a string, the process of generating a QR code based on the target data type, the target rendering type, and the rendering content can be implemented as:

[0100] In response to the format indicated by the target data type being a byte array and the format of the rendering content being a string, the QR code component converts the format of the rendering content from a string format to a byte array format. After that, the QR code component generates a QR code based on the rendering content in byte array format and the target rendering type. Figure 4 Shows a schematic diagram of the QR code generated when the target data type shown in an exemplary embodiment of the present application is a byte array, as Figure 4 shown, the QR code 410 is based on the rendering content "abc123" with an initial data type of a string. When generating the QR code, after converting "abc123" into a byte array [1,223,232,23,232], the QR code is generated based on the converted byte array.

[0101] Among them, when the byte array (byte array) needs to accommodate more QR code content, the QR code can be rendered with less QR code information, but the result of scanning the QR code is the data obtained by converting the byte array to a string.

[0102] For the scanning end, in response to the target data type being a byte array, the process of scanning the QR code by the scanning end to obtain the scanning result includes:

[0103] Converting the data type of the rendering content from a byte array to a string;

[0104] Generating a scanning result based on the rendering content with the data type being a string.

[0105] When the target data type is a string and the initial data type of the rendering content is a string, when generating a QR code by calling the QR code component based on the input parameters, a QR code is directly generated based on the rendering content with the data type being a string and the target rendering type. Schematically, Figure 5 The figure shows a schematic diagram of a QR code generated when the target data type is a string shown in an exemplary embodiment of the present application. As Figure 5 shown, the QR code 510 is directly generated based on the initial rendering content "abc123".

[0106] Among them, the usage scenario where the target data type is a string can be a front-end QR code rendering scenario, and the result of scanning is the input. That is, if the input is "abc123", then the scanning end can obtain "abc123" after scanning the QR code, so as to reduce the processing pressure on the front end.

[0107] For the scanning end, in response to the target data type being a string, the scanning end generates a scanning result based on the rendering content in string format.

[0108] When the target data type is a base64 image string and the initial data type of the rendering content is a base64 image string, when generating a QR code by calling the QR code component based on the input parameters, a QR code is generated based on the rendering content with the data type being a base64 image string and the target rendering type. Schematically, Figure 6 The figure shows a schematic diagram of a QR code generated when the target data type is a base64 image string shown in an exemplary embodiment of the present application. As Figure 6 shown, the QR code 610 is generated based on the base64 image characters obtained from "abc123".

[0109] Among them, the target data type being a base64 image string can be applied to scenarios where, in order to be compatible with the background directly returning a base64 image string to reduce the front-end pressure. And when there are complex scenarios that cause the methods of generating QR codes with the target data type being a string and the target data type being byte data to fail, a QR code image can be generated in the form of the target data type being a base64 image string.

[0110] Step 330, display the QR code.

[0111] In a possible implementation, the QR code is displayed in a QR code display interface, which can be a QR code display interface on the H5 side, or the QR code display interface can be a QR code display interface on the applet side. That is to say, the QR code can correspond to that generated on the H5 side, or the QR code can also correspond to that generated on the applet side.

[0112] Among them, the H5 side and the applet side can respectively correspond to different input types and / or rendering types. When generating QR codes corresponding to each client, the QR codes corresponding to each client can be generated through the same QR code component based on the target data type and the target rendering type corresponding to each client. In a possible implementation, when generating a QR code, prompts for the target data type and the target rendering type can be made corresponding to different clients. For example, if the data type corresponding to the applet side is a byte array and the rendering type is an image type, then when generating a QR code corresponding to the applet side, prompt to set the target data type to a byte array and the target rendering type to an image type.

[0113] In a possible implementation, there can be multiple target data types corresponding to one client. At the same time, there can be multiple target rendering types corresponding to one client. In this case, based on the type of the client, the corresponding optional data types and optional rendering types can be set as optional controls, and the incompatible data types and incompatible rendering types can be set as disabled controls, so that the user can determine the data type and rendering type for generating a QR code compatible with the current client based on the optional controls and the disabled controls.

[0114] In a possible implementation, during the process of displaying the QR code in the QR code display interface, obtain the scanning status of the QR code, where the scanning status includes that the QR code is scanned, or the QR code is not scanned.

[0115] In a possible implementation, in response to the QR code being scanned, obtain the scanning record of the QR code from the background server;

[0116] Display the scanning record on the two-dimensional code display interface. The scanning record is used to indicate the scanning result of the two-dimensional code by the scanning end. The scanning result indicates successful scanning or failed scanning.

[0117] Among them, the scanning record is implemented as a scanning callback. That is, after the scanning end scans the two-dimensional code, the client that displays the two-dimensional code obtains and displays the receipt result to notify the client that displays the two-dimensional code that the two-dimensional code has been scanned, and the scanning status indicates successful scanning or failed scanning. Taking a small program as an example Figure 7 shows the timing diagram of the scanning callback shown in an exemplary embodiment of the present application, as Figure 7 shown. Taking the specified client as the small program 710 as an example, when the small program 710 displays a two-dimensional code, the small program 710, the small program background server 720, the device 730, and the device background server 740 perform polling to obtain the scanning status of the two-dimensional code. Among them, the device background server 740 refers to the server corresponding to the scanning end (device 730), and the scanning end can be implemented as a terminal with a scanning function. When the scanning status obtained by the small program 710 from the device background server 740 through the small program background server 720 and the device 730 is "scanned", the two-dimensional code is transmitted to the code rule background server 740 so that the code rule background server 750 verifies the two-dimensional code (two-dimensional code verification). Based on the verification result, the device background server 740 is instructed to perform business processing (perform business processing if the verification is successful, and do not perform business processing if the verification fails); based on the business processing result of the device background server 730, a callback result is returned to the small program 710. The callback result is used to indicate that the two-dimensional code has been scanned. The small program 710 requests the scanning result from the device background server 740 through the device 730, and the device background server 740 returns a callback result to the small program. The callback result indicates that the small program 710 displays a successful scanning prompt or a failed scanning prompt. Figure 8 shows the interface schematic diagrams of the successful scanning prompt and the failed scanning prompt shown in an exemplary embodiment of the present application, as Figure 8 shown, Figure 8 The part (a) in it corresponds to the failed scanning prompt information, which is used to indicate the failure to obtain two-dimensional code information caused by reasons such as two-dimensional code decoding failure and network delay; Figure 8 The part (b) in it corresponds to the successful scanning prompt information, which is used to indicate that after scanning and decoding, the two-dimensional code information is successfully obtained. Optionally, the successful scanning prompt information of the two-dimensional code may further include scanning information, and the scanning information may include information such as the time and location when the two-dimensional code is scanned.

[0118] Among them, the background server of the applet and the background server of the device are the same server, or the background server of the applet and the background server of the device are not the same server. This application does not limit this; when the two are the same server, the server is implemented as the background server, and when the two are not the same server, the device server is implemented as the background server.

[0119] When the two-dimensional code is used for interface jump or to enable the message subscription function, in a possible implementation, when the scanning result indicates that the scanning is successful, the scanning result may also include a pop-up window for jumping to an interface or message subscription, etc. When the scanning result indicates the pop-up window information for jumping to an interface or message subscription, taking the two-dimensional code used to enable the message subscription function as an example, Figure 9 shows a schematic diagram of the front-end scanning code polling logic shown in an exemplary embodiment of the present application, as Figure 9 shown, the polling time, timeout parameter, and callback request function are preset in the applet. After enabling the polling query:

[0120] Step 901, the applet, the applet background server, the device, and the device background server poll the scanning status to determine whether the two-dimensional code has been scanned; if so, execute Step 902, otherwise continue the polling process;

[0121] Step 902, determine that the two-dimensional code has been scanned and enter the specified callback template;

[0122] Determining that the two-dimensional code has been scanned can be reflected as obtaining a correct request result, and the callback template can be implemented as a page as Figure 8 shown.

[0123] Step 903, the user clicks the "jump back" control;

[0124] The "jump back" can be a control in the callback module for returning to the specified interface, such as the "return to two-dimensional code" shown in part (a) of Figure 8 or the "return to home page" shown in part (b) of Figure 8 .

[0125] Step 904, query whether the subscription message switch has been manually turned off; if so, execute Step 905, otherwise end;

[0126] Step 905, determine whether the function of automatically turning on the subscription message switch is enabled; if so, execute Step 908, otherwise, execute Step 906;

[0127] Step 906, determine whether to jump to the interface for manually turning on the message subscription switch; if so, execute Step 907, otherwise end;

[0128] Step 907, jump to the subscription message setting interface;

[0129] Step 908, determine whether there is a template ID that requires the user to perform a confirmation operation. If so, execute Step 909; otherwise, execute Step 910;

[0130] Step 909, jump to subscription, and pop up a message subscription dialog box;

[0131] Step 910, return a template message, which can indicate that the specified template ID has been set as permanently allowed / canceled by the user.

[0132] In response to the scanning result indicating that the scanning is successful and the two-dimensional code is used to trigger subsequent notification messages, the method further includes:

[0133] In response to the message subscription function not being enabled, a message subscription dialog box is displayed, which is used to prompt whether to enable the message subscription function; that is, when the execution result of the front-end scanning polling logic is to jump to subscription and pop up a message subscription dialog box, the scanning result is used to indicate that the code scanning end (such as a small program) displays a message subscription dialog box on the two-dimensional code display interface. Figure 10 FIG. shows a schematic diagram of a scanning record shown in an exemplary embodiment of the present application, as Figure 10 shown, the scanning result is used to indicate that the small program displays a message subscription dialog box 1010 containing a message prompt information of "mask reservation result notification" on the two-dimensional code display interface. In this scenario, the user presents the two-dimensional code to the code scanning end, and after the code scanning end scans the two-dimensional code and determines that the user registers for mask reservation and the mask reservation is successful, a mask reservation result will be sent to the user's terminal. At this time, the user needs to subscribe to the message prompt information of "mask reservation result notification" to receive the notification message. Therefore, when the two-dimensional code is scanned, if the message subscription function is not enabled, a message subscription dialog box is displayed on the two-dimensional code display interface to remind the user to enable the message subscription function.

[0134] Schematically, the process of enabling the message subscription function can be implemented by the following code:

[0135]

[0136]

[0137] In the above code, when the back end returns a data structure agreed upon by both the front and back ends, templateType indicates which template to display. When it is 0, it means to directly return the result without displaying a template; document can customize the displayed text in the template; when subscribe in msgTmpl is true, it means that message subscription needs to be pulled up, and tmplIds are the IDs of message subscription.

[0138] Step 340: Cancel the display of the QR code in response to the display duration of the QR code reaching the effective duration.

[0139] In a possible implementation, the input parameter includes the effective duration. That is to say, the QR code is correspondingly set with an effective duration, which is used to indicate the time length between the moment when the QR code is generated and the moment when the QR code becomes invalid. When the display duration of the QR code is within the effective duration, the scanning end can obtain a scanning result generated based on the rendering content by scanning the QR code, that is, the scanning is successful; while when the display duration of the QR code is outside the effective duration, the scanning end cannot obtain a scanning result generated based on the rendering content by scanning the QR code, that is, the scanning fails.

[0140] When the display duration of the QR code reaches the effective duration, the code-displaying end can automatically hide the QR code to remind the user that the QR code has expired and avoid wasting the terminal decoding resources caused by the user's invalid scanning.

[0141] This process can be implemented as follows:

[0142] Obtain the display duration of the QR code;

[0143] In response to the display duration of the QR code being less than the effective duration of the QR code, after the QR code is scanned, obtain the scanning result;

[0144] In response to the display duration of the QR code being greater than the effective duration of the QR code, display a failure prompt message.

[0145] Among them, the display duration of the QR code is used to indicate the time length from the moment when the QR code is generated to the current moment.

[0146] In a possible implementation, in response to the display duration of the QR code reaching the effective duration, display an expiration prompt, and this expiration prompt is used to prompt that the QR code has expired;

[0147] The above process can be implemented as follows: in response to the display duration of the QR code being greater than the effective duration of the QR code, refresh the QR code display interface and display a failure prompt message in the QR code display interface; or, in response to the display duration of the QR code being greater than the effective duration of the QR code, after the QR code is scanned, jump to the QR code expiration display interface and display a failure prompt message in the QR code expiration display interface. Figure 11 Shows a schematic diagram of the failure prompt message shown in an exemplary embodiment of the present application. As Figure 11 shown, this failure prompt message is used to indicate that the display duration of the QR code has exceeded the effective duration of the QR code. At the same time, a refresh control 1110 is also displayed in the display interface of this failure prompt message, which is used to prompt the user to refresh the QR code to obtain a valid QR code.

[0148] In a possible implementation, the QR code corresponds to a screenshot prevention function to reduce the reuse of QR code information and avoid the illegal use of the QR code by users. Therefore, before calling the QR code component based on the input parameters, and before the QR code component generates a QR code containing the rendering content based on the target data type and the target rendering type, the method further includes:

[0149] Obtain the number of screenshot times based on the QR code display within a specified time period;

[0150] In response to the number of screenshot times not reaching the screenshot times threshold, call the QR code component based on the input parameters, and the QR code component generates a QR code containing the rendering content based on the target data type and the target rendering type.

[0151] Among them, the number of screenshot times based on the QR code can be implemented as the number of screenshot times of the QR code display interface. After the number of screenshot times reaches the screenshot times threshold, when the user has a need to display the QR code, the code display end cannot display the QR code in the QR code display interface.

[0152] Taking the number of screenshot times based on the QR code being implemented as the number of screenshot times of the QR code display interface as an example, in a possible implementation, the process of obtaining the number of screenshot times can be implemented as follows: when the user opens the page displaying the QR code, that is, when the QR code is displayed in the QR code display interface, the front end enables screenshot monitoring to monitor the screenshot events of the QR code display interface. When a screenshot event is detected, the front end will send the relevant data of the applet and the user data to the background for screenshot times judgment.

[0153] To prevent the user from missing information and causing misoperation of taking screenshots, in a possible implementation, in response to detecting a screenshot operation, a screenshot prompt is displayed in the QR code display interface, and the screenshot prompt is used to indicate the screenshot times threshold to remind the user that the QR code has a screenshot prevention function.

[0154] Taking the applet as an example, Figure 12 shows a schematic diagram of the screenshot prevention function shown in an exemplary embodiment of the present application. This function is executed by the interaction between the applet and the applet background, as Figure 12As shown in the figure, the process of implementing the anti-screen capture function includes: when the applet 1210 (front end) detects a screen capture event, it sends a query request to the applet background 1220. The query request includes relevant data of the applet and user data. After receiving the query request, the applet background 1220 queries and stores the screen capture details, and feeds back the screen capture request result to the applet 1210. The screen capture request result may include the threshold of the number of times the QR code has been screen captured, so that the front end displays the anti-screen capture prompt message 1230 corresponding to the current QR code. The anti-screen capture prompt message 1230 includes a prompt for the threshold of the number of times the QR code has been screen captured. In response to the applet 1210 having a code display request (a request to display the QR code), it sends a code display request to the applet background 1220. Based on the received code display request, the applet background 1220 determines the relationship between the number of times the current QR code has been screen captured and the threshold of the number of times it has been screen captured. If the number of times the QR code has been screen captured is greater than the threshold of the number of times it has been screen captured (taking the threshold of the number of times of screen capture as 5 times as an example), it feeds back a code display request failure message to the applet 1210, so that the applet 1210 displays a code display failure prompt message, that is, the code display fails. If the number of times the QR code has been screen captured is less than the threshold of the number of times it has been screen captured, the applet background 1220 queries the code display related data and sends the code display related data to the applet 1210, so that the applet 1210 can display the code based on the code display related data, that is, the code display is successful.

[0155] Illustratively, the specified time period can be several hours, one day or one week, etc. After the specified time period, the statistics of the number of times the QR code has been screen captured and the code display judgment are restarted. For example, if the specified time period is one day and the threshold of the number of times of screen capture is 5 times, then the user can only perform 5 screen capture operations on the QR code in one day. After that, the applet cannot display the code. After one day, the applet resumes the code display function and starts the statistics of the number of times of screen capture and the code display judgment again.

[0156] In order to improve the success rate of code scanning at the code scanning end, in a possible implementation manner, in response to the display of the QR code in the QR code display interface, the brightness of the QR code display interface is adjusted to the brightness threshold to improve the screen contrast.

[0157] Among them, this process can be implemented as follows: in response to the display of the QR code on the client, the screen brightness is monitored to obtain the value of the screen display brightness of the current client.

[0158] In response to the value of the screen display brightness being less than the brightness threshold, the screen display brightness is set to the brightness threshold. For example, if the value of the current screen display brightness is 0.6 and the brightness threshold is 0.8, the applet can set the screen display brightness to 0.8 by calling the API (Application Programming Interface) for brightness adjustment.

[0159] In a possible implementation, in response to the value of the screen display brightness being greater than the brightness threshold, the current screen display brightness is maintained unchanged.

[0160] In a possible implementation, when the client jumps from the display interface of the two-dimensional code to other interfaces, the value of the screen display brightness is restored to the value of the screen display brightness before adjustment. For example, when the brightness value of the screen display brightness after adjustment is 0.8, when the client jumps from the display interface of the two-dimensional code to other interfaces, the brightness value of the screen display brightness is restored to 0.6.

[0161] In a possible implementation, the method further includes: in response to receiving a setting operation on the functional attributes of the generated two-dimensional code, setting the functional attributes of the two-dimensional code, where the functional attributes of the two-dimensional code include at least one of an anti-screen capture attribute, a scan code callback attribute, and a brightness adjustment attribute.

[0162] That is to say, the user can, based on the setting of the attributes of the two-dimensional code in the two-dimensional code generation component, implement different functions during the display process of the two-dimensional code. Schematically, the two-dimensional code can only have a display effect, or, while the two-dimensional code is being displayed, it has at least one of a brightness adjustment function, a scan code callback function, and an anti-screen capture function, so as to meet the different design requirements of the two-dimensional code in different usage scenarios.

[0163] In the embodiments of the present application, by optimizing the weapp.qrcode.js code project, compatibility with H5 and mini-programs is achieved, and the input methods of byte data and strings can be compatible. Since byte data can accommodate more two-dimensional code content than strings, the two-dimensional code can be rendered with less two-dimensional code information; it can improve the development efficiency of two-dimensional code-related projects. Therefore, the two-dimensional code component provided by the present application can not only speed up the speed of secondary development, but also, as an independent module, quickly embed the ability to generate two-dimensional codes in the project.

[0164] In summary, the two-dimensional code generation method provided by the embodiments of the present application selects one of multiple data types as the target data type based on a selection operation, selects one of multiple target rendering types as the target rendering type based on the user's selection operation, and after obtaining the rendering content, generates a two-dimensional code through a two-dimensional code component based on the corresponding target data type and target rendering type. Thus, when generating a two-dimensional code, application programs with different requirements for data types and rendering types can generate their respective required two-dimensional codes through the same two-dimensional code component, thereby improving the applicability of the two-dimensional code component, and further improving the development efficiency of application programs with two-dimensional code generation and display functions.

[0165] Taking the two-dimensional code as the city code as an example, Figure 13The figure shows a schematic diagram of the urban code generation process shown in an exemplary embodiment of the present application, as Figure 13 shown, when generating the urban code, input parameters need to be obtained, and the input parameters include the QR code input type (input Type), the rendering type (render Type), the rendering content (content), and the expiration time (expireTime).

[0166] In the process of generating the QR code, first execute the QR code generation process 1310. In the QR code generation process 1310, based on the user's selection, determine that the input type of the QR code is one of string (text), byte stream (arrayBuffer), and base64 QR code image, determine that the rendering type is one of canvas type (canvas) and image type (image), and combine the rendering content to generate the QR code through the QR code component.

[0167] Step 1320, display the QR code (bright code).

[0168] Step 1330, judge the expiration time to determine whether the expiration time has ended. If so, execute step 1340; otherwise, execute step 1360.

[0169] Step 1340, display the expired style and stop the display of the bright code.

[0170] Step 1350, re-request the input parameters and the expiration time, and return to step 1310.

[0171] Step 1360, determine whether the rendering content has changed. If so, return to step 1310; otherwise, return to step 1320.

[0172] In the QR code generation process, in the text string mode, the binary principle is to encode the string, convert it into byte data, and then perform the subsequent QR code generation process; in the array-buffer mode, input the string, convert the string into an ArrayBuffer object, and then convert it into a byte array according to the Uint8Array class.

[0173] Figure 14 The figure shows a block diagram of a QR code display device provided by an exemplary embodiment of the present application, as Figure 14 shown, the QR code display device includes:

[0174] A parameter acquisition module 1410, configured to acquire input parameters, where the input parameters include the rendering content, the target data type, and the target rendering type for generating the QR code; the target data type is used to indicate the format of the rendering content in the QR code, and the target rendering type is used to indicate the type of the QR code;

[0175] A QR code generation module 1420, configured to call a QR code component based on the input parameters, where the QR code component generates the QR code including the rendering content based on the target data type and the target rendering type;

[0176] A QR code display module 1430, configured to display the QR code.

[0177] In a possible implementation, the target data type is a byte array, a string, or a base64 image string;

[0178] The target rendering type is an image type or a canvas type.

[0179] In a possible implementation, the QR code generation module 1420 includes:

[0180] A format conversion sub-module, configured to, in response to the format of the rendering content being different from the format indicated by the target data type, convert the format of the rendering content to the format indicated by the target data type through the QR code component;

[0181] A QR code generation sub-module, configured to generate the QR code through the QR code component based on the rendering content after format conversion and the target rendering type.

[0182] In a possible implementation, when the format indicated by the target data type is a byte array and the format of the rendering content is a string, the format conversion sub-module is configured to convert the format of the rendering content from a string format to a byte array format through the QR code component.

[0183] In a possible implementation, the parameter acquisition module 1410 is configured to obtain the input parameters through a sub-program, and the sub-program is an application program that depends on the host program for execution;

[0184] The QR code generation module 1420 is configured to call the QR code component installed in the host program through the sub-program, and the QR code component generates the QR code including the rendering content based on the target data type and the target rendering type.

[0185] In a possible implementation, the input parameters include an effective duration; the apparatus further includes:

[0186] A cancellation display module, configured to cancel the display of the QR code in response to the display duration of the QR code reaching the effective duration.

[0187] In a possible implementation, the apparatus further includes:

[0188] An expiration prompt display module, configured to display an expiration prompt in response to the display duration of the two-dimensional code reaching the effective duration, where the expiration prompt is used to prompt that the two-dimensional code has expired.

[0189] In a possible implementation, the device further includes:

[0190] A screenshot count acquisition module, configured to acquire the number of screenshots of the two-dimensional code within a specified time period;

[0191] The parameter acquisition module 1410 is configured to, in response to the number of screenshots not reaching the screenshot count threshold, call the two-dimensional code component based on the input parameter, where the two-dimensional code component generates the two-dimensional code including the rendering content based on the target data type and the target rendering type.

[0192] In a possible implementation, the two-dimensional code display module 1430 is configured to display a screenshot prompt in response to detecting a screenshot operation, where the screenshot prompt is used to indicate the screenshot count threshold.

[0193] In a possible implementation, the device further includes:

[0194] A brightness adjustment module, configured to adjust the brightness of the two-dimensional code display interface to a brightness threshold in response to displaying the two-dimensional code.

[0195] In a possible implementation, the device further includes:

[0196] A scan record acquisition module, configured to acquire the scan record of the two-dimensional code from a background server;

[0197] A scan record display module, configured to display the scan record, where the scan record is used to indicate the scan result of the two-dimensional code by the scanning end, and the scan result indicates successful scanning or failed scanning.

[0198] In a possible implementation, the device further includes:

[0199] A pop-up display module, configured to display a message subscription pop-up in response to the message subscription function not being enabled, where the message subscription pop-up is used to prompt whether to enable the message subscription function.

[0200] In summary, the QR code display device provided by the embodiments of the present application selects one of multiple data types as the target data type based on a selection operation, selects one of multiple target rendering types as the target rendering type based on the user's selection operation, and after obtaining the rendering content, generates a QR code through a QR code component based on the corresponding target data type and target rendering type. Therefore, when generating a QR code, application programs with different requirements for data types and rendering types can generate the QR codes they need through the same QR code component, thereby improving the applicability of the QR code component and further improving the development efficiency of application programs with QR code generation and display functions.

[0201] Figure 15 FIG. shows a block diagram of a computer device 1500 shown in an exemplary embodiment of the present application. The computer device can be implemented as the applet background server or the device background server in the above solution of the present application. The computer device 1500 includes a central processing unit (CPU) 1501, a system memory 1504 including a random access memory (RAM) 1502 and a read-only memory (ROM) 1503, and a system bus 1505 connecting the system memory 1504 and the central processing unit 1501. The computer device 1500 also includes a mass storage device 1506 for storing an operating system 1509, application programs 1510, and other program modules 1511.

[0202] The mass storage device 1506 is connected to the central processing unit 1501 through a mass storage controller (not shown) connected to the system bus 1505. The mass storage device 1506 and its associated computer-readable medium provide non-volatile storage for the computer device 1500. That is to say, the mass storage device 1506 can include a computer-readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0203] Without loss of generality, the computer-readable medium may include a computer storage medium and a communication medium. The computer storage medium includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. The computer storage medium includes RAM, ROM, erasable programmable read-only registers (Erasable Programmable Read Only Memory, EPROM), electrically erasable programmable read-only memory (Electrically-Erasable Programmable Read-Only Memory, EEPROM) flash memory or other solid-state storage technologies, CD-ROM, digital versatile disc (Digital Versatile Disc, DVD) or other optical storage, magnetic tape cartridges, tapes, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above several types. The above system memory 1504 and mass storage device 1506 may be collectively referred to as memory.

[0204] According to various embodiments of the present disclosure, the computer device 1500 may also run on a remote computer on the network through a network such as the Internet. That is, the computer device 1500 may be connected to the network 1508 through the network interface unit 1507 connected to the system bus 1505, or in other words, the network interface unit 1507 may also be used to connect to other types of networks or remote computer systems (not shown).

[0205] The memory further includes at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, at least one program, code set or instruction set is stored in the memory, and the central processing unit 1501 implements all or part of the steps in the QR code generation method shown in the above various embodiments by executing the at least one instruction, at least one program, code set or instruction set.

[0206] Figure 16 The block diagram of the computer device 1600 provided by an exemplary embodiment of the present application is shown. The computer device 1600 may be implemented as the above terminal, such as: a smart phone, a tablet computer, a notebook computer or a desktop computer. The computer device 1600 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, etc.

[0207] Generally, the computer device 1600 includes: a processor 1601 and a memory 1602.

[0208] The processor 1601 may include one or more processing cores, such as a 4-core processor, a 16-core processor, etc. The processor 1601 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1601 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1601 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1601 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0209] The memory 1602 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 1602 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1602 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 1601 to implement the two-dimensional code generation method provided in the method embodiments of the present application.

[0210] In some embodiments, the computer device 1600 may also optionally include: a peripheral device interface 1603 and at least one peripheral device. The processor 1601, the memory 1602, and the peripheral device interface 1603 may be connected through a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 1603 through a bus, signal lines, or a circuit board. Specifically, the peripheral devices include at least one of a radio frequency circuit 1604, a display screen 1605, a camera assembly 1606, an audio circuit 1607, a positioning assembly 1608, and a power supply 1609.

[0211] The peripheral device interface 1603 can be used to connect at least one I / O (Input / Output) related peripheral device to the processor 1601 and the memory 1602. In some embodiments, the processor 1601, the memory 1602, and the peripheral device interface 1603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1601, the memory 1602, and the peripheral device interface 1603 can be implemented on separate chips or circuit boards, and this embodiment does not limit this.

[0212] In some embodiments, the computer device 1600 further includes one or more sensors 1610. The one or more sensors 1610 include but are not limited to: an acceleration sensor 1611, a gyroscope sensor 1612, a pressure sensor 1613, a fingerprint sensor 1614, an optical sensor 1615, and a proximity sensor 1616.

[0213] Those skilled in the art can understand that Figure 16 the structure shown in

[0214] does not constitute a limitation on the computer device 1600, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.

[0215] In an exemplary embodiment, there is also provided a computer-readable storage medium for storing at least one instruction, at least one segment of program, a code set, or an instruction set, and the at least one instruction, the at least one segment of program, the code set, or the instruction set is loaded and executed by the processor to implement all or part of the steps in the above-mentioned two-dimensional code generation method. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, a floppy disk, and an optical data storage device, etc. Figure 2 、 Figure 3 or Figure 13 any one of the methods shown in the above

[0216] Other embodiments of the present application will be readily apparent to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and examples are only illustrative, and the true scope and spirit of the present application are pointed out by the following claims.

[0217] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A method for generating a two-dimensional code, characterized in that, The method includes: Obtaining input parameters, where the input parameters include rendering content for generating a QR code, a target data type, and a target rendering type; the target data type is used to indicate the format of the rendering content in the QR code, the target rendering type is used to indicate the type of the QR code, the target data type is one of a byte array, a string, or a base64 image string, the string is a finite sequence of characters, and the target rendering type is an image type or a canvas type; Invoking a QR code component based on the input parameters, where the QR code component, in response to the format of the rendering content being different from the format indicated by the target data type, converts the format of the rendering content into the format indicated by the target data type, and generates the QR code containing the format-converted rendering content based on the target rendering type; Displaying the QR code.

2. The method according to claim 1, wherein When the format indicated by the target data type is the byte array and the format of the rendering content is the string, the QR code component converts the format of the rendering content from the string format to the byte array format.

3. The method according to claim 1, wherein The obtaining of the input parameters includes: Obtaining the input parameters through a subroutine, where the subroutine is an application program that depends on the host program for execution; The invoking of the QR code component based on the input parameters includes: Invoking the QR code component installed in the host program through the subroutine.

4. The method according to claim 1, wherein The input parameters include a valid duration; the method further includes: In response to the display duration of the QR code reaching the valid duration, canceling the display of the QR code.

5. The method according to claim 4, wherein The method further includes: In response to the display duration of the QR code reaching the valid duration, displaying an expiration prompt, where the expiration prompt is used to prompt that the QR code has expired.

6. The method according to claim 1, characterized in that, Before invoking the QR code component based on the input parameters, the method further includes: Obtaining the number of screenshot times of the QR code within a specified time period; The invoking of the QR code component based on the input parameters includes: In response to the number of screenshot times not reaching the screenshot times threshold, invoking the QR code component based on the input parameters.

7. The method according to claim 6, wherein The method further includes: In response to detecting a screenshot operation, displaying a screenshot prompt, where the screenshot prompt is used to indicate the screenshot times threshold.

8. The method according to claim 1, wherein The method further includes: In response to displaying the QR code, adjusting the brightness of the QR code display interface to a brightness threshold.

9. The method according to claim 1, wherein The method further includes: Obtaining a scan record of the QR code from a background server; Displaying the scan record, where the scan record is used to indicate the scan result of the QR code by a scanning end, and the scan result indicates a successful scan or a failed scan.

10. The method according to claim 9, wherein The method further includes: When the scan result indicates a successful scan and the QR code is used to trigger subsequent notification messages, in response to the message subscription function not being enabled, displaying a message subscription pop-up window, where the message subscription pop-up window is used to prompt whether to enable the message subscription function.

11. A two-dimensional code generating device, characterized in that, The device includes: A parameter acquisition module for acquiring input parameters, where the input parameters include rendering content for generating a QR code, a target data type, and a target rendering type; the target data type is used to indicate the format of the rendering content in the QR code, the target rendering type is used to indicate the type of the QR code, the target data type is one of a byte array, a string, or a base64 image string, the string is a finite sequence of characters, and the target rendering type is an image type or a canvas type; A QR code generation module for calling a QR code component based on the input parameters, where the QR code component converts the format of the rendering content to the format indicated by the target data type in response to the format of the rendering content being different from the format indicated by the target data type, and generates the QR code containing the format-converted rendering content based on the target rendering type; A QR code display module for displaying the QR code.

12. A computer device, characterized in that, The computer device includes a processor and a memory, and the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the QR code generation method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, At least one computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the QR code generation method according to any one of claims 1 to 10.

14. A computer program product, characterized in that, The computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium, and a processor reads and executes the computer instructions from the computer-readable storage medium to implement the QR code generation method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Method, system and terminal for augmenting reality based on two-dimension code

    CN103049729A

  • Multi-thread two-dimensional code generation algorithm based on Web Workers

    CN111797960A