[0025] In order to make the objectives, technical solutions, and advantages of the present invention clearer, the following further describes the present invention in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention.
[0026] The embodiment of the present invention provides an anti-counterfeiting method based on WeChat official account and supporting terminal memory, such as figure 1 As shown, the method is implemented through the following steps:
[0027] Step 101: The terminal submits the anti-counterfeiting information carried in the scanned anti-counterfeiting QR code to the server.
[0028] Specifically, the anti-counterfeiting two-dimensional code is generated in advance by the server, and specifically it is to first convert the decimal number into a 28-base number. The 28-base number is 6 digits, and the shortage is filled with 0, and then the converted 28 is entered. After the system number and batch number are spliced, md5 encryption is performed, and then the encrypted string is truncated to one character, and the one character is hexdec processed. The obtained value is modulo 8 and the remainder obtained corresponds to 8. Hash algorithm, get the algorithm followed by the incoming md5 encrypted string and only perform hash encryption, take 4 bits of the encrypted string and convert it to uppercase and return it as the check code. After the check code is obtained, the {'0', Replace '1','C'} with {'H','K','S'}, and the supplementary character in the 28 base number is A, that is, replace 0 with A, and finally, combine the security string code, The anti-counterfeiting QR code is generated by concatenating the batch code, check code and serial number into a 14-digit string.
[0029] Specific, such as figure 2 As shown, the method for generating the anti-counterfeiting QR code:
[0030] S1: Generate a 4-digit batch code. The batch code is a combination of 4 characters randomly obtained from the characters contained in the string code, and its uniqueness is guaranteed by technical means; according to the rules, it can be guaranteed that the 4-digit combination can accommodate 614656 unique batch codes
[0031] S2: Generate a 6-digit serial number. The serial number is obtained by arranging the custom 28 digits in a certain order. The serial number is 6 digits and never repeats; the number of 6-digit characters is 481890304.
[0032] S3: Generate a check code. The check code is obtained by arithmetic operation from the serial number and batch code; the number of digits is 4 digits.
[0033] Enter the 4-digit batch number and the serial number of the decimal number, first convert the decimal number into a 28-base number (the 28-base is 6 digits, and the shortage is filled with 0), and then the converted 28-base number and After the batch number is spliced, md5 is encrypted, and then the encrypted string is truncated to one character, and the character is processed by hexdec. The obtained value is modulo 8, and the obtained remainder corresponds to the hash algorithm in 8, and the obtained algorithm is followed by the incoming The md5 encrypted string only performs hash encryption. Take 4 digits of the encrypted string and convert it to uppercase and return it as a password (check code). After the check code is obtained, replace {'0','1' in the password ,'C'}; Replace with {'H','K','S'}; The supplementary character in the 28 base number is A (replace 0 with A).
[0034] S4: Combine the anti-counterfeiting string code, splicing the batch code, check code and serial number into a 14-digit string
[0035] S5: Batch code storage. If the batch code is generated for the first time, save the batch code in the database. The generated anti-counterfeiting code is not saved, which can save server resources.
[0036] Step 102: The server performs a legality check on the anti-counterfeiting two-dimensional code corresponding to the anti-counterfeiting information.
[0037] Specifically, the server performs a legality check on the anti-counterfeiting QR code corresponding to the anti-counterfeiting information, specifically: checking whether the length of the anti-counterfeiting code corresponding to the anti-counterfeiting two-dimensional code is 14 digits, and when it is satisfied Describe the legality of the anti-counterfeiting QR code, truncating the anti-counterfeiting code to obtain a 4-digit batch code, a 4-digit check code, and a 6-digit serial number. The decomposed 4-digit batch code and 6-digit serial number are generated by pre-generating the anti-counterfeiting QR code. The code generation method generates a legal check code. The legal check code is compared with the 6-digit check code decomposed from the anti-counterfeit QR code to be verified. If they are completely consistent, the anti-counterfeit QR code is a legal two-dimensional code. Code, because the process of generating the check code [S3] is irreversible, so the validity cannot be deduced from the check code. Otherwise, the anti-counterfeiting two-dimensional code is an illegal two-dimensional code.
[0038] Further, the decomposed 4-digit batch code and 6-digit serial number are generated by the method of generating anti-counterfeiting QR codes in advance to generate a new 6-digit serial number, specifically: the 28-digit serial number and the batch number After splicing, md5 encryption is performed, and then the encrypted string is truncated to one character, and the characters are processed by hexdec. The obtained value is modulo 8, and the obtained remainder corresponds to the hash algorithm in 8, and the obtained algorithm is followed by the incoming md5 encrypted string Only perform hash encryption, take 4 digits of the encrypted string and convert it to uppercase and return it as the password (check code). After the check code is obtained, replace the {'0','1','C in the password '}; Replace with {'H','K','S'}; The complement character in the 28 base number is A (replace 0 with A).
[0039] Step 103: When the anti-counterfeiting QR code is a legal QR code, the server queries the merchant's official account information corresponding to the anti-counterfeit QR code and pushes it to the terminal, and requests the WeChat server to obtain the user order corresponding to the terminal Brand information, binding the merchant official account and user information according to the user token information.
[0040] Specifically, after binding the merchant official account and user information according to the user token information, the method further includes: displaying the authenticity of the anti-counterfeiting code and the number of queries, and after successfully jumping to the merchant official account, the method The conspicuous position on the top of the terminal completely displays the 14-digit anti-counterfeiting code. At the same time, it is the first time to query the anti-counterfeiting code from the display. If the user of the current terminal has inquired the anti-counterfeiting code, the current query will not add up; if the current terminal’s The user will record the current query for the first query, so that it can be identified to avoid double counting when querying again.
[0041] The server prompts the terminal whether to follow the official account, and the merchant's official account page continues to prompt the user to follow the official account to complete the user's deposit function; prompts the terminal whether to draw a lottery, if the current anti-counterfeiting QR code is the first scan , There will be a lottery reminder.
[0042] The embodiment of the present invention also provides an anti-counterfeiting system based on WeChat official account and supporting terminal memory. The system includes: anti-counterfeiting QR code, server, terminal, WeChat server;
[0043] The anti-counterfeiting QR code is a QR code that can be recognized by WeChat and has a cover layer on the surface. The cover layer is scratched off when verification is required, generated by the server, and used to associate with the corresponding merchant's official account;
[0044] The terminal is used to submit the anti-counterfeiting information carried in the scanned anti-counterfeiting QR code to the server,
[0045] The server is configured to generate the anti-counterfeiting two-dimensional code, and is also used to verify the legality of the anti-counterfeiting two-dimensional code corresponding to the anti-counterfeiting information. When the anti-counterfeiting two-dimensional code is a legal two-dimensional code, query the The merchant official account information corresponding to the anti-counterfeiting QR code is pushed to the terminal, and the WeChat server is requested to obtain the user token information corresponding to the terminal, and the merchant official account is bound to the user information according to the user token information;
[0046] The WeChat server is configured to push user token information corresponding to the terminal according to the request of the server.
[0047] The server is specifically used to first convert the decimal number into a 28-base number, the 28-base number is 6 digits, and the shortage is filled with 0, and then the converted 28-base number and the batch number are spliced together. md5 encryption, the encrypted string is truncated to one character, and the one character is hexdec processed, the obtained value is modulo 8, and the obtained remainder corresponds to the hash algorithm in 8, and the obtained algorithm is followed by the incoming The md5 encrypted string only performs hash encryption. Take 4 bits of the encrypted string and convert it to uppercase and return it as the check code. After the check code is obtained, replace {'0','1','C'} in the password Into {'H','K','S'}, the supplementary character in the 28-base number is A, that is, replace 0 with A, and finally, combine the anti-counterfeiting string code, and combine the batch code, check code and The serial number is spliced into a 14-bit string to form the anti-counterfeiting QR code.
[0048] The server is specifically configured to check whether the length of the anti-counterfeiting code corresponding to the anti-counterfeiting two-dimensional code is 14 digits, and when it is satisfied, verify the legitimacy of the anti-counterfeiting two-dimensional code, and truncating the anti-counterfeiting code to obtain a 4-digit batch code, 4-digit check code, 6-digit serial number, the decomposed 4-digit batch code and 6-digit serial number are generated by the method of generating anti-counterfeiting QR codes in advance to generate a legal check code, and the legal check code is the same as the one to be verified Compared with the 6-digit check codes decomposed in the anti-counterfeiting two-dimensional code, if they are completely consistent, the anti-counterfeiting two-dimensional code is a legal two-dimensional code, otherwise, the anti-counterfeiting two-dimensional code is an illegal two-dimensional code.
[0049] The terminal is also used to display the authenticity of the anti-counterfeiting code and the number of inquiries. After successfully jumping to the merchant's official account, the conspicuous position above the terminal completely displays the 14-digit anti-counterfeiting code. After several queries, if the current terminal user has inquired about the anti-counterfeiting code, the current query will not add up; if the current terminal user queries for the first time, the current query will be recorded so that it can be identified in the next query Avoid double counting.
[0050] The server is also used to prompt the terminal whether to follow the official account, the merchant's official account page continues to prompt the user to follow the official account to complete the user's precipitation function; prompt the terminal whether to draw a lottery, if the current anti-counterfeiting QR code is the first During a scan, a lucky draw reminder will appear.
[0051] The above are only the preferred embodiments of the present invention, and are not used to limit the protection scope of the present invention.