Hello, I am big zongzi.
Filling holes at work, like knowledge, has to be done step by step, like the problem I encountered below.
This is part of my log
The results of | Sweep code environment | Generate environment |
---|---|---|
no problem | Development tool simulation | Development tool generation |
There is a problem | Local and development tool emulation | Local and development tool simulation generation |
There is a problem | online | online |
To find problems
From the on-line small table you can see that there is no problem with the local simulation environment, but there is a problem with the online, local and online mutual generation and code scanning will have problems, then the problem is relatively easy to find.
Follow the business logic step by step to confirm.
After the front-end gets the commodity details in the commodity details, it passes the parameters to the background, and the background generates the Base64 data of the small program code and then gives it to the front-end. The rest of the function of drawing HTML into pictures is operated by the front-end independently.
Commodity details — “get small program code –” draw canvas after saving the picture.
So start with the QR code generated from the small program
Yeah, the parameters are fine.
Take the data and parse it and see what’s being generated in the background, right? (dog head), use the tool to restore Base64 image.
Save the screenshot, go to the small program verification, parsing out the data and then passed in the same parameters on the backend development code,
Or “hum” (front end little sister asked the back end of the development of the expression of their own imagination) (dog head)
Unexpectedly and parameter same, it seems that can’t seek backstage quarrel. (Boring, no atmosphere) Hahaha.
So what’s the problem
Careful children should think of, if the background to your small program code data is no problem, as long as the data is used correctly then the problem certainly does not exist!
So let’s prove it step by step! If you have to log the environment online, you can’t see it. If you have to log the environment online, you can use toast or output data directly.
Show it, violence!
And place me the wrong processing, every time is to turn images generated a temporary file, the name was the same, in order to eliminate the plugin function in itself I add a time stamp, I don’t want a tag, and then review the submitted online after the test, are all the time, gave him everything that could go wrong place all blocked.
Feel the anxiety of the online environment necessary to test this problem. The last audit turned out to be 1:17 in the middle of the night. Isn’t the goose factory forced to leave work at 6?
<img src=”https://gitee.com/stivepeim/img4mk/raw/master/20210621151306.png” style=”zoom:50%;” />
conclusion
You can rest assured to scan the code to the specified goods. Do you want to know which product is on the line?
<img src=”https://gitee.com/stivepeim/img4mk/raw/master/20210621151719.png” style=”zoom:25%;” />
In fact, the problem encountered above is purely a pit, the normal use of the process of the environment is complex, but we all have a heart to solve the bug is not it?
In the above modification, I actually just did the confirmation of data parameters and generated code optimization and online confirmation. It’s not clear whether it worked by optimizing the applet to parse the data or adding a temporary file timestamp, but it’s not important to me for the time being. We’ll continue to play with this problem later. Careful children’s shoes can also help me verify next ha!
Not afraid of hair loss, no door can always block a persistent person. Come on.