Disclosure of Invention
The application mainly aims to solve the technical problem that information acquired by a single two-dimensional code on the existing express bill cannot provide different services.
The first aspect of the invention provides a service providing method based on two-dimension codes, comprising the following steps:
Scanning and identifying a secret two-dimensional code on an express delivery bill, and extracting a bill number carried in the secret two-dimensional code, wherein the secret two-dimensional code is a two-dimensional code generated by hiding the bill number in original information;
Identifying whether a user unique identifier exists at a terminal where a scanning action is performed;
If yes, determining the account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to the association relation between the preset account type and the service and the waybill number, and providing the first service to the terminal;
If the equipment type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal.
Optionally, in a first implementation manner of the first aspect of the present invention, before the scanning and identifying the secret two-dimensional code on the express delivery side sheet and extracting the waybill number carried in the secret two-dimensional code, the method further includes:
Acquiring original information, a waybill number and an embedded key;
performing data coding and error correction coding on the original information to obtain a data codeword, and calculating the maximum concealable information quantity of the data codeword;
Encoding the waybill number to obtain a formatted secret sequence, and calculating the hidden information quantity of the secret sequence;
judging whether the hidden information amount is larger than the maximum hidden information amount or not;
if yes, outputting alarm information to prompt that the hidden information quantity is too large;
If not, initializing a preset pseudo-random generator according to the embedded key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence;
According to the embedding position, replacing the original sequence in the data code word with the secret sequence, and adding an ending symbol after the replaced digital code word to obtain the encrypted data;
And generating the secret two-dimensional code according to the secret data.
Optionally, in a second implementation manner of the first aspect of the present invention, the performing data encoding processing and error correction encoding processing on the original information to obtain a data codeword includes:
Selecting the version and the error correction code level of the encrypted two-dimension code to be generated according to the length and the type of the original information;
according to the version, carrying out data coding on the original information to obtain a coded character string;
generating an error correction character string according to the error correction code level and the original information;
and adding the error correction code character string to the code character string to obtain a data codeword.
Optionally, in a third implementation manner of the first aspect of the present invention, the embedded key includes a first key and a second key, initializing a preset pseudo-random generator according to the embedded key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence includes:
Initializing the pseudo-random generator to generate a first pseudo-random sequence according to the first secret key;
Randomly selecting at least one character from the data codeword according to the pseudo-random sequence, and generating a continuous bit stream according to the character;
initializing the pseudo-random generator to generate a second pseudo-random sequence according to the second secret key, and determining the embedding position of the secret sequence on the bit stream according to the second pseudo-random sequence.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the scanning and identifying the secret two-dimensional code on the express delivery side sheet, and extracting the freight note number carried in the secret two-dimensional code includes:
scanning the encrypted two-dimensional code and acquiring the embedded key;
Identifying and analyzing the encrypted two-dimensional code to obtain encrypted data of the encrypted two-dimensional code;
Initializing a preset pseudo-random generator according to the embedded secret key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence;
Acquiring a secret sequence in the secret-carrying data according to the embedded position;
The secret sequence is converted into a bill number.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the determining the account type uniquely identified by the user, according to a preset association relationship between the account type and a service and the waybill number, obtaining a first service corresponding to the account type from a server, and providing the first service to the terminal includes:
Judging the account type of the unique identifier of the user;
If the account type is a sender, inquiring the freight charge of the corresponding express according to the freight bill number, and displaying the freight charge on the corresponding terminal so as to prompt the sender to pay the freight charge;
if the account type is an express delivery person, inquiring order information and logistics information of the corresponding express according to the freight bill number and displaying the order information and the logistics information on the corresponding terminal;
and if the account type is a member user, inquiring and displaying the logistics information of the corresponding express mail according to the waybill number.
Optionally, in a sixth implementation manner of the first aspect of the present invention, determining a device type of the terminal performing the scanning action, according to the device type and the waybill number, acquiring a second service corresponding to the device type from the server, and providing the second service to the terminal includes:
Judging the equipment type of the terminal;
And if the equipment type of the terminal is a pipeline terminal, generating a corresponding scanning record according to the waybill number, and uploading the scanning record.
And if the equipment type of the terminal is a user terminal, inquiring and displaying the logistics information of the corresponding express according to the waybill number.
The second aspect of the present invention provides a service providing apparatus based on a two-dimensional code, including:
The scanning module is used for scanning and identifying the carrying two-dimensional code on the express bill and extracting the freight bill number carried in the carrying two-dimensional code;
The identification module is used for identifying whether a user unique identifier exists in the terminal where the scanning action is performed;
The first service providing module is used for determining the account type of the unique user identifier when the unique user identifier exists in the terminal, acquiring a first service corresponding to the account type from a server according to the association relationship between the preset account type and the service and the waybill number, and providing the first service to the terminal;
And the second service providing module is used for determining the equipment type of the terminal performing the scanning action when the unique user identifier does not exist in the terminal, acquiring the second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal.
Optionally, in a first implementation manner of the second aspect of the present invention, the service providing device based on a two-dimensional code further includes a two-dimensional code generating module, where the two-dimensional code generating module includes:
the acquisition unit is used for acquiring the original information, the waybill number and the embedded secret key;
The information coding unit is used for carrying out data coding processing and error correction coding processing on the original information to obtain data code words and calculating the maximum concealable information quantity of the data code words;
The waybill coding unit is used for coding the waybill number to obtain a formatted secret sequence and calculating the hidden information quantity of the secret sequence;
A judging unit configured to judge whether the hidden information amount is greater than the maximum hidden information amount;
The alarm unit is used for outputting alarm information when the hidden information quantity is larger than the maximum hidden information quantity so as to prompt that the hidden information quantity is overlarge;
the determining unit is used for initializing a preset pseudo-random generator according to the embedded secret key to generate a pseudo-random sequence when the hidden information quantity is not more than the maximum hidden information quantity, and determining an embedded position according to the pseudo-random sequence;
The embedding unit is used for replacing the original sequence in the data code word with the secret sequence according to the embedding position, and adding an ending symbol after the replaced digital code word to obtain the encrypted data;
And the generating unit is used for generating the secret two-dimensional code according to the secret data.
Optionally, in a second implementation manner of the second aspect of the present invention, the information encoding unit is specifically configured to:
Selecting the version and the error correction code level of the encrypted two-dimension code to be generated according to the length and the type of the original information;
according to the version, carrying out data coding on the original information to obtain a coded character string;
generating an error correction character string according to the error correction code level and the original information;
and adding the error correction code character string to the code character string to obtain a data codeword.
Optionally, in a third implementation manner of the second aspect of the present invention, the determining unit is specifically configured to:
Initializing the pseudo-random generator to generate a first pseudo-random sequence according to the first secret key;
Randomly selecting at least one character from the data codeword according to the pseudo-random sequence, and generating a continuous bit stream according to the character;
initializing the pseudo-random generator to generate a second pseudo-random sequence according to the second secret key, and determining the embedding position of the secret sequence on the bit stream according to the second pseudo-random sequence.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the scanning module is specifically configured to:
scanning the encrypted two-dimensional code and acquiring the embedded key;
Identifying and analyzing the encrypted two-dimensional code to obtain encrypted data of the encrypted two-dimensional code;
Initializing a preset pseudo-random generator according to the embedded secret key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence;
Acquiring a secret sequence in the secret-carrying data according to the embedded position;
The secret sequence is converted into a bill number.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the first service module is specifically configured to:
Judging the account type of the unique identifier of the user;
If the account type is a sender, inquiring the freight charge of the corresponding express according to the freight bill number, and displaying the freight charge on the corresponding terminal so as to prompt the sender to pay the freight charge;
if the account type is an express delivery person, inquiring order information and logistics information of the corresponding express according to the freight bill number and displaying the order information and the logistics information on the corresponding terminal;
and if the account type is a member user, inquiring and displaying the logistics information of the corresponding express mail according to the waybill number.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the second service module is specifically configured to:
Judging the equipment type of the terminal;
And if the equipment type of the terminal is a pipeline terminal, generating a corresponding scanning record according to the waybill number, and uploading the scanning record.
And if the equipment type of the terminal is a user terminal, inquiring and displaying the logistics information of the corresponding express according to the waybill number.
A third aspect of the present invention provides a service providing apparatus based on a two-dimensional code, including: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line; the at least one processor invokes the instructions in the memory to cause the two-dimensional code-based service providing apparatus to execute the two-dimensional code-based service providing method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having instructions stored therein, which when run on a computer, cause the computer to perform the above-described two-dimensional code-based service providing method.
According to the technical scheme, the secret two-dimensional code on the express delivery face bill is scanned and identified, and the freight bill number carried in the secret two-dimensional code is extracted; identifying whether a user unique identifier exists at a terminal where a scanning action is performed; if yes, determining the account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to the association relation between the preset account type and the service and the waybill number, and providing the first service to the terminal; if the equipment type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal. According to the method, the freight bill number information is hidden in the secret two-dimensional code in the express delivery face bill, so that different users can obtain different information when scanning the secret two-dimensional code, the users who obtain the freight bill number can provide different types of services according to own unique user identification and the equipment type of scanning the secret two-dimensional code, one-to-one service on one express delivery face is realized through the combination of the two modes, one area fixed on the express delivery face bill is provided with the secret two-dimensional code, and different users can scan and display different effects, so that service diversification is realized.
Detailed Description
The embodiment of the invention provides a service providing method, device, equipment and storage medium based on two-dimension codes, and in the technical scheme of the invention, the encrypted two-dimension codes on an express delivery face bill are scanned and identified, and the freight bill number carried in the encrypted two-dimension codes is extracted; identifying whether a user unique identifier exists at a terminal where a scanning action is performed; if yes, determining the account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to the association relation between the preset account type and the service and the waybill number, and providing the first service to the terminal; if the equipment type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal. According to the method, the freight bill number information is hidden in the secret two-dimensional code in the express delivery face list, so that different users can obtain different information when scanning the secret two-dimensional code, the users who obtain the freight bill number can provide different types of services according to own unique user identification and the equipment type of scanning the secret two-dimensional code, one-to-one service on one express delivery face is realized through the combination of the two modes, one area fixed on the express delivery face list is provided with the secret two-dimensional code, and different users can scan and display different effects, so that service diversification is realized.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For easy understanding, the following describes a specific flow of an embodiment of the present invention, referring to fig. 1, and a first embodiment of a service providing method based on two-dimensional codes in the embodiment of the present invention includes:
101. Scanning and identifying a carrier secret two-dimensional code on the express delivery face bill, and extracting a waybill number carried in the carrier secret two-dimensional code;
It can be understood that the execution subject of the present invention may be a service providing device based on two-dimensional code, and may also be a terminal or a server, which is not limited herein. The embodiment of the invention is described by taking a server as an execution main body as an example.
In practical application, a barcode or a two-dimensional code is arranged on an express bill of a part of express, wherein the two-dimensional code is a coding mode which is superpopular on mobile equipment in recent years, more information can be stored than a traditional barcode, more data types can be represented, generally, the barcode is arranged on the express bill, the two-dimensional code is less arranged, the bill number of the express can be identified through the barcode, different operation processes and services are realized through the bill number, and the two-dimensional code on the arranged bill is generally an advertisement of an express company, so that the popularization effect is achieved.
In practical application, the two-dimensional code is generally a graph which is distributed on a plane (in a two-dimensional direction) according to a certain rule by using a certain specific geometric figure, is alternately black and white, and records data symbol information; the concept of 0 and 1 bit streams forming the internal logic foundation of a computer is skillfully utilized in code programming, a plurality of geometric shapes corresponding to binary are used for representing literal numerical information, and the literal numerical information is automatically read through an image input device or an optoelectronic scanning device to realize automatic information processing: it has some commonalities in barcode technology: each code has its specific character set; each character occupies a certain width; has a certain checking function and the like. Generally, one coding mode only stores one type of data, meanwhile, the two-dimensional codes and the bar codes can enlarge the occupied area of the express delivery face bill, the space area of the face bill is limited, and meanwhile, the arrangement of a plurality of bar codes and the two-dimensional codes is impractical, in practical application, a face bill number or other types of data can be hidden in the data originally carried by the two-dimensional codes through a two-dimensional code information hiding technology, under the condition that original information is not influenced, multiple information is carried on one two-dimensional code, a secret two-dimensional code is generated, and different service types are provided by scanning the face bill number obtained by the secret two-dimensional code by different people in the logistics process.
102. Identifying whether a user unique identifier exists at a terminal where a scanning action is performed;
In this embodiment, through some two-dimension code information hiding technologies, the freight list number and other information can be hidden in the secret two-dimension code, different logistics processes can scan the secret two-dimension code by different scanning devices, for example, in the stage of sending a mail, after obtaining a to-be-transported express mail, a post prints the express mail face list for the express mail, at this time, the sender does not pay, after the secret two-dimension code on the scanned express mail face list is scanned, the system inquires the freight system to display that the express mail is not paid, so that the character freight is displayed on the user page of the sender, if the inquiry is made to pay the freight, the current logistics information of the express mail is displayed, in this embodiment, the unique user identifier is the user ID registered by the system when the user uses the system running the method, the account type of the user can be identified by the user ID, and different services can be provided according to different account types.
103. If the service exists, determining an account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to a preset association relationship between the account type and the service and a waybill number, and providing the first service to a terminal;
in this embodiment, after identifying that the terminal device where the scanning action is located has the unique user identifier, different services can be provided according to the account type of the unique user identifier, where the relationship between the unique user identifier and the account type may be that when the user is registered in the system, the system allocates to the user according to different registration processes of the user, for example, when the user registers and selects a sender, the system marks the unique user identifier as the account type of the sender, or separates the registration processes of different users through different registration systems, marks the unique user identifier registered in the sender system as the account type of the sender, marks the unique user identifier registered in the courier system as the courier, and realizes service diversification through different unique user identifiers.
104. If the service type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal.
In this embodiment, there may be a case that the code scanning device does not have a unique identifier of a user, for example, when a express mail is in a stage of pipeline sorting, a sorter uses the sorting device to scan a secret two-dimensional code on an express bill, generally in a sorting process, a scan record of the express mail is irrelevant to the identity of a sorter, the secret two-dimensional code on the express mail is scanned to generate a scan record of the express mail, and the scan record has no information about the sorter, so that in a sorting stage of the express mail, the user ID does not need to be allocated to the sorter. By means of different equipment types of the scanning terminal, on the premise of no unique user identification, various different services can be provided, and service diversity is achieved.
In the embodiment, a carrying two-dimensional code on an express delivery face sheet is scanned and identified, and a freight sheet number carried in the carrying two-dimensional code is extracted; identifying whether a user unique identifier exists at a terminal where a scanning action is performed; if yes, determining the account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to the association relation between the preset account type and the service and the waybill number, and providing the first service to the terminal; if the equipment type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal. According to the method, the freight bill number information is hidden in the secret two-dimensional code in the express delivery face bill, so that different users can obtain different information when scanning the secret two-dimensional code, the users who obtain the freight bill number can provide different types of services according to own unique user identification and the equipment type of scanning the secret two-dimensional code, one-to-one service on one express delivery face is realized through the combination of the two modes, one area fixed on the express delivery face bill is provided with the secret two-dimensional code, and different users can scan and display different effects, so that service diversification is realized.
Referring to fig. 2, a second embodiment of a service providing method based on two-dimensional codes in an embodiment of the present invention includes:
201. acquiring original information, a waybill number and an embedded key;
in this embodiment, the original information is information that generates the encrypted two-dimensional code, and generally, the information included in the two-dimensional code on the express bill is some propaganda contents of the express company, for example, may be a official network, public number, and the like of the express company.
In this embodiment, the function of the embedded key is mainly to determine the location of the data generated by the waybill number embedded in the data of the original information.
202. Selecting the version and the error correction code level of the encrypted two-dimension code to be generated according to the length and the type of the original information;
203. according to the version, carrying out data coding on the original information to obtain a coded character string;
204. generating an error correction character string according to the error correction code level and the original information;
In practical application, the generation of the two-dimensional code requires selecting the version and the error correction code level of the two-dimensional code, and in this embodiment, the original information is taken as the company's official network as an example, and the original information is "http: the operation list number is 123044162062, version is defined as two-dimensional code Version, t is BCH error correction bit number, s is binary character string converted by operation list number, and t is binary character string with BCH error correction code added by operation list number.
According to the length of original information carried by the two-dimensional code in general, the Version of the two-dimensional code is selected to be version=3, the two-dimensional code matrix 29×29 can accommodate 70 code words in total, for four error correction levels L, M, Q, H, the original single number is converted into character strings s= 1110010100110000000001110101000001110, the length is 37 bits, s are divided into two groups due to the fact that the total error correction 4 bit selection is needed, each of the two groups is subjected to BCH coding, namely t=2, the original BCH (31, 21) code is selected according to the BCH coding principle, namely the character strings of 21-bit effective information are generated to be 10 as BCH error correction codes, and therefore, the binary information containing the BCH error correction codes which needs to be embedded finally needs to have 62 bits, and the selected error correction level is Q in consideration of error correction capacity of each error correction level.
205. Adding the error correction code character string to the code character string to obtain a data codeword, and calculating the maximum concealable information quantity of the data codeword;
In this embodiment, the maximum amount of concealable information of a digital codeword can be obtained by:
0<k<n<2m+2;
Where k is the number of encoded data symbols, n is the number of encoded symbols in the encoded block, 1 symbol consists of m bits, and the maximum concealable information quantity r of the digital codeword is:
r=n-k;
The data of the waybill code is embedded into redundancy of the maximum concealable information quantity of the N-dimension code data, so that information carried by the two-dimension code cannot be influenced.
206. Coding the waybill number to obtain a formatted secret sequence, and calculating the hidden information quantity of the secret sequence;
207. Judging whether the hidden information amount is larger than the maximum hidden information amount or not;
208. if yes, outputting alarm information to prompt that the hidden information amount is too large;
209. if not, initializing a preset pseudo-random generator according to the embedded secret key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence;
210. according to the embedding position, replacing the original sequence in the data code word with the secret sequence, and adding an ending symbol after the replaced digital code word to obtain the encrypted data;
211. Generating a secret two-dimensional code according to the secret data;
212. scanning and identifying a carrier secret two-dimensional code on the express delivery face bill, and extracting a waybill number carried in the carrier secret two-dimensional code;
213. identifying whether a user unique identifier exists at a terminal where a scanning action is performed;
214. If the service exists, determining an account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to a preset association relationship between the account type and the service and a waybill number, and providing the first service to a terminal;
215. If the service type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal.
Steps 212 to 215 in this embodiment are similar to steps 101 to 104 in the first embodiment, and will not be described here.
The present embodiment describes in detail, based on the previous embodiment, a process of generating an encrypted two-dimensional code and obtaining a digital codeword contained in the encrypted two-dimensional code, by obtaining original information, a bill number, and an embedded key; performing data coding and error correction coding on the original information to obtain data code words, and calculating the maximum concealable information quantity of the data code words; coding the waybill number to obtain a formatted secret sequence, calculating the hidden information quantity of the secret sequence, and judging whether the hidden information quantity is larger than the maximum hidden information quantity or not; if yes, outputting alarm information to prompt that the hidden information amount is too large; if not, initializing a preset pseudo-random generator according to the embedded secret key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence; according to the embedding position, replacing the original sequence in the data code word with the secret sequence, and adding an ending symbol after the replaced digital code word to obtain the encrypted data; generating a secret two-dimensional code according to secret data, wherein the original information is subjected to data coding and error correction coding to obtain a data codeword, and selecting a version and an error correction code level of the secret two-dimensional code to be generated according to the length and the type of the original information; according to the version, carrying out data coding on the original information to obtain a coded character string; generating an error correction character string according to the error correction code level and the original information; and adding the error correction code character string to the code character string to obtain a data codeword. By the encrypted two-dimensional code generated in the above way, the waybill number can be hidden in the original information,
Referring to fig. 3, a third embodiment of a service providing method based on two-dimensional codes in an embodiment of the present invention includes:
301. Acquiring original information, a waybill number and an embedded key;
302. performing data coding and error correction coding on the original information to obtain data code words, and calculating the maximum concealable information quantity of the data code words;
303. coding the waybill number to obtain a formatted secret sequence, and calculating the hidden information quantity of the secret sequence;
304. judging whether the hidden information amount is larger than the maximum hidden information amount or not;
305. if yes, outputting alarm information to prompt that the hidden information amount is too large;
306. If not, initializing a pseudo-random generator to generate a first pseudo-random sequence according to a first key embedded with the key;
307. Randomly selecting at least one character from the data codeword according to the pseudo-random sequence, and generating a continuous bit stream according to the character;
308. initializing a pseudo-random generator to generate a second pseudo-random sequence according to a second key of the embedded key, and determining the embedded position of the secret sequence on the bit stream according to the second pseudo-random sequence;
309. According to the embedding position, replacing the original sequence in the data code word with the secret sequence, and adding an ending symbol after the replaced digital code word to obtain the encrypted data;
In this embodiment, it is assumed that one data block B of the two-dimensional code contains N symbols, where K check symbols, with embedded information m= { M i i i e {0,l }, i=1, 2,3 … … l }, where, The embedded keys are K1 and K2 respectively, and for each block, the detailed embedding algorithm is as follows:
step 1: the first embedded key K1 initializes the pseudorandom number generator G1 to generate a set of random sequences r1= { R1 i i R1 i∈{1,2,……,N-1,N},r1i≠r1j, i, j=1, 2, … … [ K/2] };
Step 2: randomly selecting from a block B of data containing N symbols, K/2 symbols according to a random sequence R1, the selected symbols constituting a logically continuous bit stream
Step 3: the second embedded key K2 initializes the pseudo-random number generator G2 to generate a set of random sequences
Step 4: determining the embedding position of the information M to be embedded in the bit stream S according to the random sequence R2 ifThenAnd the reverse is carried out, otherwise, the method is unchanged.
310. Generating a secret two-dimensional code according to the secret data;
311. scanning and identifying a carrier secret two-dimensional code on the express delivery face bill, and extracting a waybill number carried in the carrier secret two-dimensional code;
312. Identifying whether a user unique identifier exists at a terminal where a scanning action is performed;
313. If the service exists, determining an account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to a preset association relationship between the account type and the service and a waybill number, and providing the first service to a terminal;
314. if the service type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal.
Steps 211 to 214 in this embodiment are similar to steps 101 to 104 in the first embodiment, and will not be described here.
The present embodiment describes in detail the process of embedding the waybill number into the original information based on the previous embodiment, and initializes the pseudo random generator to generate a first pseudo random sequence according to the first key; randomly selecting at least one character from the data codeword according to the pseudo-random sequence, and generating a continuous bit stream according to the character; according to the second secret key, initializing the pseudo-random generator to generate a second pseudo-random sequence, and determining the embedding position of the secret sequence on the bit stream according to the second pseudo-random sequence.
Referring to fig. 4, a fourth embodiment of a service providing method based on two-dimensional codes in an embodiment of the present invention includes:
401. Scanning the encrypted two-dimensional code and acquiring an embedded secret key;
402. identifying and analyzing the encrypted two-dimensional code to obtain encrypted data of the encrypted two-dimensional code;
In this embodiment, there are three kinds of methods for scanning and identifying the encrypted two-dimensional code, which are respectively linear CCD, linear image type, laser reader with grating, image type and image type. The technical scheme adopts an optimized two-dimensional code decoding algorithm which mainly comprises five steps of: image preprocessing, positioning correction, data reading and error correction decoding. The positioning purpose in the positioning correction is to find the accurate position of the two-dimensional code pattern in the image, and obtain part of information of the two-dimensional code, such as the size, the coverage area and the edge. The two-dimensional code is usually rectangular, so the positioning is to acquire the positions of four vertexes of the rectangle. Two directions are mainly used for researching a two-dimensional code positioning algorithm: the first direction is to locate through the structural features of the two-dimensional code, for example, by searching for an image finding pattern of the two-dimensional code, and determining the position of the two-dimensional code by using the image finding pattern: the second direction is that the two-dimensional code is shaped like a rectangle, edges of the two-dimensional code can be recognized first, and then the accurate position of the two-dimensional code can be calculated according to the edges. If the image is only changed in angle and position, the image can be corrected by only carrying out translation or rotation operation on the image. However, in practical practice, the conditions of the image sampling angle and the unevenness of the two-dimensional code are complex, which can lead to distortion of the sampled image, so that more correction operations are needed to face the problems.
403. Initializing a preset pseudo-random generator according to the embedded secret key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence;
404. Acquiring a secret sequence in the secret data according to the embedding position;
405. converting the secret sequence into a bill number;
in this embodiment, the hidden waybill number is extracted by an extraction algorithm opposite to the embedding algorithm, which includes the following steps:
step 1: the first embedded key K1 initializes the pseudorandom number generator G1 to generate a set of random sequences r1= { R1 i i R1 i∈{1,2,……,N-1,N},r1i≠r1j, i, j=1, 2, … … [ K/2] };
Step 2: constructing a logically continuous bit stream from a data block containing N symbols according to a random sequence R1, the same as the embedding process
Step 3: the second embedded key K2 initializes the pseudo-random number generator G2 to generate a set of random sequences
Step 4: and determining the embedding position of the bill number in the bit stream S according to the random sequence R2 and extracting.
406. Identifying whether a user unique identifier exists at a terminal where a scanning action is performed;
407. If the service exists, determining an account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to a preset association relationship between the account type and the service and a waybill number, and providing the first service to a terminal;
408. If the service type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal.
The embodiment describes the process of scanning and identifying the secret two-dimensional code on the express bill on the basis of the previous embodiment, extracting the waybill number carried in the secret two-dimensional code, scanning the secret two-dimensional code and acquiring the embedded key; identifying and analyzing the encrypted two-dimensional code to obtain encrypted data of the encrypted two-dimensional code; initializing a preset pseudo-random generator according to the embedded secret key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence; acquiring a secret sequence in the secret-carrying data according to the embedded position; the secret sequence is converted into a bill number.
Referring to fig. 5, a fifth embodiment of a service providing method based on two-dimensional codes in an embodiment of the present invention includes:
501. Scanning and identifying a carrier secret two-dimensional code on the express delivery face bill, and extracting a waybill number carried in the carrier secret two-dimensional code;
502. identifying whether a user unique identifier exists at a terminal where a scanning action is performed;
503. If yes, judging the account type of the unique identifier of the user;
504. If the account type is a sender, inquiring the freight rate of the corresponding express according to the freight bill number, and displaying the freight rate on the corresponding terminal so as to prompt the sender to pay the freight rate;
505. If the account type is the courier, inquiring order information and logistics information of the corresponding express according to the freight bill number and displaying the order information and the logistics information on the corresponding terminal;
506. if the account type is a member user, inquiring and displaying the logistics information of the corresponding express according to the waybill number;
507. if the equipment type of the terminal does not exist, judging the equipment type of the terminal;
508. If the equipment type of the terminal is a pipeline terminal, generating a corresponding scanning record according to the waybill number, and uploading the scanning record;
509. if the equipment type of the terminal is the user terminal, inquiring and displaying the logistics information of the corresponding express according to the waybill number.
The embodiment describes in detail the process of providing different services to different users and different terminal devices on the basis of the previous embodiment, after the user scans the encrypted two-dimension code, different services are provided by identifying whether the terminal where the scanning action is located has a unique user identifier and the type of the unique user identifier, and when the user terminal does not have the unique user identifier, different types of services are provided according to the device type of the terminal, so that the diversity of the services provided by the two-dimension code hidden waybill numbers is realized.
The two-dimensional code based service providing method in the embodiment of the present invention is described above, and the two-dimensional code based service providing device in the embodiment of the present invention is described below, referring to fig. 6, one embodiment of the two-dimensional code based service providing device in the embodiment of the present invention includes:
the scanning module 601 is used for scanning and identifying a carrier two-dimensional code on an express delivery face sheet and extracting a waybill number carried in the carrier two-dimensional code;
The identifying module 602 is configured to identify whether a unique user identifier exists in a terminal where the scanning action is performed;
The first service providing module 603 is configured to determine an account type of the unique user identifier when the unique user identifier exists in the terminal, obtain a first service corresponding to the account type from a server according to an association relationship between a preset account type and a service and the waybill number, and provide the first service to the terminal;
and the second service providing module 604 is configured to determine a device type of the terminal performing the scanning action when the unique user identifier does not exist in the terminal, obtain a second service corresponding to the device type from the server according to the device type and the waybill number, and provide the second service to the terminal.
In the embodiment of the invention, the service providing device based on the two-dimensional code operates the service providing method based on the two-dimensional code, scans and identifies the secret two-dimensional code on the express delivery face bill, and extracts the freight bill number carried in the secret two-dimensional code; identifying whether a user unique identifier exists at a terminal where a scanning action is performed; if yes, determining the account type of the unique identifier of the user, acquiring a first service corresponding to the account type from a server according to the association relation between the preset account type and the service and the waybill number, and providing the first service to the terminal; if the equipment type does not exist, determining the equipment type of the terminal performing the scanning action, acquiring a second service corresponding to the equipment type from the server according to the equipment type and the waybill number, and providing the second service to the terminal. According to the method, the freight bill number information is hidden in the secret two-dimensional code in the express delivery face bill, so that different users can obtain different information when scanning the secret two-dimensional code, the users who obtain the freight bill number can provide different types of services according to own unique user identification and the equipment type of scanning the secret two-dimensional code, one-to-one service on one express delivery face is realized through the combination of the two modes, one area fixed on the express delivery face bill is provided with the secret two-dimensional code, and different users can scan and display different effects, so that service diversification is realized.
Referring to fig. 7, a second embodiment of a service providing apparatus based on two-dimensional codes in an embodiment of the present invention includes:
the scanning module 601 is used for scanning and identifying a carrier two-dimensional code on an express delivery face sheet and extracting a waybill number carried in the carrier two-dimensional code;
The identifying module 602 is configured to identify whether a unique user identifier exists in a terminal where the scanning action is performed;
The first service providing module 603 is configured to determine an account type of the unique user identifier when the unique user identifier exists in the terminal, obtain a first service corresponding to the account type from a server according to an association relationship between a preset account type and a service and the waybill number, and provide the first service to the terminal;
and the second service providing module 604 is configured to determine a device type of the terminal performing the scanning action when the unique user identifier does not exist in the terminal, obtain a second service corresponding to the device type from the server according to the device type and the waybill number, and provide the second service to the terminal.
Wherein, the service providing device based on the two-dimensional code further comprises a two-dimensional code generating module 605, and the two-dimensional code generating module 605 comprises:
an acquisition unit 6051 for acquiring original information, a waybill number, and an embedded key;
An information encoding unit 6052, configured to perform data encoding processing and error correction encoding processing on the original information, obtain a data codeword, and calculate a maximum concealable information amount of the data codeword;
a waybill encoding unit 6053, configured to encode the waybill number to obtain a formatted secret sequence, and calculate the hidden information amount of the secret sequence;
a judging unit 6054 for judging whether the hidden information amount is larger than the maximum hidden information amount;
an alarm unit 6055 for outputting alarm information to prompt that the amount of hidden information is too large when the amount of hidden information is greater than the maximum amount of hidden information;
A determining unit 6056, configured to initialize a preset pseudo-random generator according to the embedding key when the hidden information amount is not greater than the maximum hidden information amount, generate a pseudo-random sequence, and determine an embedding position according to the pseudo-random sequence;
An embedding unit 6057 for replacing the secret sequence with the original sequence in the data codeword according to the embedding position, and adding an ending symbol after the replaced digital codeword to obtain the encrypted data;
and the generating unit 6058 is used for generating the secret two-dimensional code according to the secret data.
Wherein, the information encoding unit 6052 specifically is configured to:
Selecting the version and the error correction code level of the encrypted two-dimension code to be generated according to the length and the type of the original information;
according to the version, carrying out data coding on the original information to obtain a coded character string;
generating an error correction character string according to the error correction code level and the original information;
and adding the error correction code character string to the code character string to obtain a data codeword.
Optionally, the determining unit 6056 is specifically configured to:
Initializing the pseudo-random generator to generate a first pseudo-random sequence according to the first secret key;
Randomly selecting at least one character from the data codeword according to the pseudo-random sequence, and generating a continuous bit stream according to the character;
initializing the pseudo-random generator to generate a second pseudo-random sequence according to the second secret key, and determining the embedding position of the secret sequence on the bit stream according to the second pseudo-random sequence.
Optionally, the scanning module 601 is specifically configured to:
scanning the encrypted two-dimensional code and acquiring the embedded key;
Identifying and analyzing the encrypted two-dimensional code to obtain encrypted data of the encrypted two-dimensional code;
Initializing a preset pseudo-random generator according to the embedded secret key, generating a pseudo-random sequence, and determining an embedded position according to the pseudo-random sequence;
Acquiring a secret sequence in the secret-carrying data according to the embedded position;
The secret sequence is converted into a bill number.
Optionally, the first service module 603 is specifically configured to:
Judging the account type of the unique identifier of the user;
If the account type is a sender, inquiring the freight charge of the corresponding express according to the freight bill number, and displaying the freight charge on the corresponding terminal so as to prompt the sender to pay the freight charge;
if the account type is an express delivery person, inquiring order information and logistics information of the corresponding express according to the freight bill number and displaying the order information and the logistics information on the corresponding terminal;
and if the account type is a member user, inquiring and displaying the logistics information of the corresponding express mail according to the waybill number.
Optionally, the second service module 604 is specifically configured to:
Judging the equipment type of the terminal;
And if the equipment type of the terminal is a pipeline terminal, generating a corresponding scanning record according to the waybill number, and uploading the scanning record.
And if the equipment type of the terminal is a user terminal, inquiring and displaying the logistics information of the corresponding express according to the waybill number.
The embodiment adds a two-dimension code generating module based on the previous embodiment, and simultaneously describes the unit structure of the two-dimension code generating module in detail, including an acquisition unit, an information encoding unit, a waybill encoding unit, a judging unit, an alarm unit, a determining unit, an embedding unit and a generating unit, wherein the waybill number is stored in original information of originally generated two-dimension codes through the units, and the function realization process of part of the modules is described in detail, and different service types are provided for different account types and different terminal devices through two service modules, namely a first service module and a second service module, so as to realize service diversification.
Fig. 6 and fig. 7 above describe the two-dimensional code-based service providing apparatus in the embodiment of the present invention in detail from the point of view of a modularized functional entity, and the two-dimensional code-based service providing device in the embodiment of the present invention is described in detail from the point of view of hardware processing.
Fig. 8 is a schematic structural diagram of a two-dimensional code-based service providing apparatus according to an embodiment of the present invention, where the two-dimensional code-based service providing apparatus 800 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 810 (e.g., one or more processors) and a memory 820, and one or more storage media 830 (e.g., one or more mass storage devices) storing application programs 833 or data 832. Wherein memory 820 and storage medium 830 can be transitory or persistent. The program stored in the storage medium 830 may include one or more modules (not shown), each of which may include a series of instruction operations on the two-dimensional code-based service providing apparatus 800. Still further, the processor 810 may be configured to communicate with the storage medium 830, and execute a series of instruction operations in the storage medium 830 on the two-dimensional code based service providing apparatus 800 to implement the steps of the two-dimensional code based service providing method described above.
The two-dimensional code based service providing apparatus 800 may also include one or more power supplies 840, one or more wired or wireless network interfaces 850, one or more input/output interfaces 860, and/or one or more operating systems 831, such as Windows Serve, mac OS X, unix, linux, freeBSD, and the like. It will be appreciated by those skilled in the art that the two-dimensional code based service providing apparatus structure shown in fig. 8 does not constitute a limitation of the two-dimensional code based service providing apparatus provided by the present application, and may include more or less components than those illustrated, or may combine some components, or may be a different arrangement of components.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, and may also be a volatile computer readable storage medium, where instructions are stored in the computer readable storage medium, when the instructions are executed on a computer, cause the computer to perform the steps of the two-dimensional code based service providing method.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the system or apparatus and unit described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.