Implement WeChat login in ShopNC, and use Detector to detect browser-related processes
1. To realize WeChat login in the WeChat client, the QR code scanning layer will pop up, which should be canceled and directly jump to the authorization page, as shown in Figure 1:
2. In the mobile browser, the QR code scanning layer will pop up, and an error will be reported after scanning, as shown in Figure 2:
3. Background – Platform – Members – Account Synchronization – WeChat public platform, as shown in Figure 3:
Execute SQL:
Insert into `trade_setting`(`name`, `value`) values (mp_weixin_isuse,1)
Insert into `trade_setting`(`name`, `value`) values (mp_weixin_appid,WX5C318E640E87F7E8)
Insert into `trade_setting`(`name`, `value`) values (mp_weixin_secret,1F436A3A0DBFDAC1C8E1C8F72D2FBEC)
4. Use Detector to detect the browser, the URL:http://detector.dmolsen.com/, it can automatically adapt to the new browser, version and device to use unique user agent characters for each browser, based on Modernizr, as shown in Figure 4:
5. Copy the directory lib/detector to core/framework/detector, as shown in Figure 5:
And set the directory: user-agents/core/, user-agents/extended/, config is writable;
6. The rules are formulated as follows, the code in the controller and template file is shown in Figure 6 and 7:
(1) PC, Tablet: pop up the QR code scanning layer (here WeChat open platform, website application);
(2) Mobile browser: hide;
(3) Mobile client: directly jump to the authorization page (here WeChat public platform, service number);
36kr.com: The mobile terminal does not currently support WeChat login, please use the bound mobile phone or mailbox to log in.
Dianping.com: Hide WeChat login button (use this scheme);
7. Under the Mobile client, the code to directly jump to the authorization page is shown in Figure 8:
8. Under the Mobile client, jump directly to the page of the authorization page, as shown in Figure 9:
9. Error when submitting SVN, as shown in Figure 10:
The working copy at
is too old(format 10) to work with client version1.8.10(R1615264)(Expects format 31).You need upgrade the working copy first.

The working copy at is too old(format 10) to work with client version1.8.10(R1615264)(Expects Format 31)
10. Delete all .svn directories under core/framework/detector to prevent svn conflicts, and the submission is successful, as shown in Figure 11 and 12:
11. Under the Edge browser, the error is reported, as shown in Figure 13:
script16389: Unspecified error.
12. Open the URL:http://detector.dmolsen.com/, I found that I also have this error, as shown in Figure 14:
13. The solution is based on $_SERVER[‘HTTP_USER_AGENT’], if it is IE10, IE11, Edge, then detector is not used to detect the browser, as shown in Figure 15:













![基于$_SERVER['HTTP_USER_AGENT'],如果为IE10、IE11、Edge,则不使用Detector来检测浏览器](https://www.shuijingwanwq.com/wp-content/uploads/2016/04/15-4.png)