{"id":29081,"date":"2024-11-25T14:13:04","date_gmt":"2024-11-25T06:13:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/29081\/"},"modified":"2024-11-25T14:13:04","modified_gmt":"2024-11-25T06:13:04","slug":"%e5%9b%be%e6%96%87%e8%af%a6%e8%a7%a3%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%8f%b7%e5%bc%80%e5%8f%91%e8%87%aa%e5%ae%9a%e4%b9%89%e8%8f%9c%e5%8d%95%e8%b7%b3%e8%bd%ac%e9%a1%b5%e9%9d%a2%e5%b9%b6%e8%8e%b7","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/29081\/","title":{"rendered":"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b"},"content":{"rendered":"<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1 \u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u8be6\u89e3\u7684\u76f8\u5173\u8d44\u6599,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/p>\n<p><strong>\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1 \u81ea\u5b9a\u4e49\u83dc\u5355<\/strong><\/p>\n<p>\u8bf7\u5148\u8bfb\u5b8c\u672c\u6587\u518d\u8fdb\u884c\u914d\u7f6e\u5f00\u53d1 <\/p>\n<p>\u8bf7\u5148\u524d\u5f80\u5fae\u4fe1\u5e73\u53f0\u5f00\u53d1\u8005\u6587\u6863\u9605\u8bfb\u201c\u7f51\u9875\u6388\u6743\u83b7\u53d6\u7528\u6237\u57fa\u672c\u4fe1\u606f\u201d\u7684\u8bf4\u660e<\/p>\n<p>\u5728\u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u5f00\u53d1\u4e2d\uff0c\u5f80\u5f80\u6709\u5b9a\u4e49\u4e00\u4e2a\u83dc\u5355\uff0c\u7136\u540e\u7528\u6237\u70b9\u51fb\u8be5\u83dc\u5355\u5c31\u8fdb\u5165\u7528\u6237\u4e2a\u4eba\u4e2d\u5fc3\u7684\u529f\u80fd\uff0c\u901a\u5e38\u5e94\u7528\u4e8e\u5404\u4e2a\u516c\u4f17\u8d26\u53f7\u4e2d\u7684\u4f1a\u5458\u670d\u52a1\u3002<\/p>\n<p>\u5982\u4f55\u5728\u5fae\u4fe1\u81ea\u5b9a\u4e49\u83dc\u5355\u4e2d\u5c06\u7528\u6237\u5230\u4e2a\u4eba\u4e2d\u5fc3\u9875\u9762\u5462\uff1f <\/p>\n<p>\u9996\u9009\u9700\u8981\u901a\u8fc7\u7528\u6237\u70b9\u51fb\u83b7\u53d6\u7528\u6237openid\uff0c\u800c\u901a\u8fc7\u7528\u6237\u7684\u70b9\u51fb\u8df3\u8f6c\u83b7\u53d6\u7528\u6237openid\u5c31\u5fc5\u987b\u5728\u83dc\u5355\u4e2d\u52a8\u6001\u7ed1\u5b9a\u7528\u6237\u7684openid\uff0c\u6216\u8005\u5728\u83dc\u5355\u7684\u8df3\u8f6cURL\u4e2d\u586b\u5199\u5fae\u4fe1\u63d0\u4f9b\u7684\u94fe\u63a5\uff0c\u5b98\u65b9\u7ed9\u4e86\u4e24\u4e2a\u94fe\u63a5\u7c7b\u578b<\/p>\n<p>\u4e00\u79cd\u662fScope\u4e3asns_base\u7684\u94fe\u63a5<\/p>\n<\/p>\n<pre>https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=wx520c15f417810387&amp;amp;redirect_uri=https%3A%2F%2Fchong.qq.com%2Fphp%2Findex.php%3Fd%3D%26c%3DwxAdapter%26m%3DmobileDeal%26showwxpaytitle%3D1%26vb2ctag%3D4_2030_5_1194_60&amp;amp;response_type=code&amp;amp;scope=snsapi_base&amp;amp;state=123#wechat_redirect<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u53e6\u4e00\u79cd\u662fScope\u4e3asnsapi_userinfo\u7684\u94fe\u63a5<\/p>\n<\/p>\n<pre>https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=wxf0e81c3bee622d60&amp;amp;redirect_uri=http%3A%2F%2Fnba.bluewebgame.com%2Foauth_response.php&amp;amp;response_type=code&amp;amp;scope=snsapi_userinfo&amp;amp;state=STATE#wechat_redirect<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u4e24\u79cd\u94fe\u63a5\u7684\u533a\u522b\u5982\u4e0b<\/p>\n<p>\u5e94\u7528\u6388\u6743\u4f5c\u7528\u57df\uff0csnsapi_base \uff08\u4e0d\u5f39\u51fa\u6388\u6743\u9875\u9762\uff0c\u76f4\u63a5\u8df3\u8f6c\uff0c\u53ea\u80fd\u83b7\u53d6\u7528\u6237openid\uff09\uff0csnsapi_userinfo \uff08\u5f39\u51fa\u6388\u6743\u9875\u9762\uff0c\u53ef\u901a\u8fc7openid\u62ff\u5230\u6635\u79f0\u3001\u6027\u522b\u3001\u6240\u5728\u5730\u3002\u5e76\u4e14\uff0c\u5373\u4f7f\u5728\u672a\u5173\u6ce8\u7684\u60c5\u51b5\u4e0b\uff0c\u53ea\u8981\u7528\u6237\u6388\u6743\uff0c\u4e5f\u80fd\u83b7\u53d6\u5176\u4fe1\u606f\uff09<\/p>\n<p>\u7f51\u4e0a\u5f88\u591a\u8bf4\u6cd5\u662f\u5c06\u94fe\u63a5\u7684url\u76f4\u63a5\u4f5c\u4e3a\u5fae\u4fe1\u81ea\u5b9a\u4e49\u83dc\u5355\u4e2dview\u7c7b\u578b\u4e2d\u7684url\uff08\u5728\u586b\u5199\u662furl\u65f6\u9700\u8981\u914d\u7f6e\u7f51\u9875\u6388\u6743\u56de\u8c03\u57df\u540d\u548cappid\uff09\uff0c\u672c\u4eba\u8bd5\u4e86\u4e00\u4e0b\u8fd9\u79cd\u505a\u6cd5\u7136\u800c\u4e0d\u80fd\u6210\u529f<\/p>\n<\/p>\n<pre>{&nbsp;\"type\":\"view\",&nbsp;\"name\":\"\u4f1a\u5458\u4e2d\u5fc3\",&nbsp;\"url\":\"https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=\u4f60\u7684appid&amp;amp;redirect_uri=\u4f60\u914d\u7f6e\u63a5\u6536\u5fae\u4fe1\u8ba4\u8bc1\u7684\u5730\u5740?response_type=code&amp;amp;scope=snsapi_base&amp;amp;state=1#wechat_redirect\"&nbsp;},<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd4\u56de\u7ed3\u679c\u662f\u521b\u5efa\u83dc\u5355\u5931\u8d25<\/p>\n<p>\u521b\u5efa\u83dc\u5355\u5931\u8d25 errcode:{40033} errmsg:{invalid char. please check your request,   uxxxx will create fail! hint: [91..gA0792vr23]}<\/p>\n<p>\u6211\u8bd5\u4e86\u4e00\u4e0b\u5c06\u540e\u9762\u7684\u5730\u5740\u8fdb\u884curlEncode\uff0c\u8fd8\u662f\u540c\u6837\u7684\u9519\u8bef\u3002<\/p>\n<p>\u540e\u6765\u6211\u60f3\u4e86\u4e00\u4e2a\u529e\u6cd5<\/p>\n<p>\u5728\u81ea\u5b9a\u4e49\u83dc\u5355\u4e2d\u586b\u5199\u81ea\u5df1\u7684url\uff0c\u5728\u586b\u5199\u7684url\u4e2d\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230snsapi_base\u7684url\u4e2d\uff0c\u7136\u540e\u518d\u5728snsapi_base\u4e2d\u914d\u7f6e\u83b7\u53d6\u7528\u6237openid\u4ee5\u53ca\u7528\u6237\u5176\u4ed6\u4fe1\u606f\uff0c\u6700\u540e\u8df3\u8f6c\u5230\u4e00\u4e2a\u9875\u9762\uff0c\u4e5f\u5c31\u662f\u901a\u5e38\u7684\u4f1a\u5458\u4e2d\u5fc3\u9875\u9762\u3002<\/p>\n<p>\u6d41\u7a0b\u5982\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/285a3d21c22acdaad610992eab9767a6-0.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe\" alt=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe\" \/><\/p>\n<p>\u8bf7\u770b\u4ee3\u7801<\/p>\n<p>{ &#8220;type&#8221;:&#8221;view&#8221;,<\/p>\n<p> &#8220;name&#8221;:&#8221;\u4f1a\u5458\u4e2d\u5fc3&#8221;,<\/p>\n<p> &#8220;url&#8221;:&#8221;http:\/\/\u914d\u7f6e\u7684\u7f51\u5740\/redirect&#8221;}<\/p>\n<p>\u5176\u4e2d\u901a\u8fc7url\u5c06\u7528\u6237\u8df3\u8f6c\u5230<\/p>\n<blockquote><p>\n  http:\/\/\u914d\u7f6e\u7684\u7f51\u5740\/redirect\n<\/p><\/blockquote>\n<p>\u7136\u540e\u5728\u5904\u7406\u65b9\u6cd5\u4e2d\u8c03\u7528\u4e00\u6b21\u91cd\u5b9a\u5411\u5373\u53ef<\/p>\n<\/p>\n<pre>\/\/\u7c7b\u4e0a\u7684\u914d\u7f6e\r\n@Controller\r\n@RequestMapping(\"\/wechat\")\r\npublic&nbsp;class&nbsp;WeChatController{\r\n&nbsp;&nbsp;@RequestMapping(value&nbsp;=&nbsp;\"\/redirect\",&nbsp;method&nbsp;=&nbsp;RequestMethod.GET)\r\n&nbsp;&nbsp;public&nbsp;String&nbsp;weixinRedirect(HttpServletRequest&nbsp;request,&nbsp;HttpServletResponse&nbsp;response)&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;\"redirect:https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=\u4f60\u7684appid&amp;amp;redirect_uri=\u4f60\u7684\u670d\u52a1\u5668\u5904\u7406\u5730\u5740?response_type=code&amp;amp;scope=snsapi_base&amp;amp;state=1&amp;amp;connect_redirect=1#wechat_redirect\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u670d\u52a1\u5668\u4f1a\u5c06\u5fae\u4fe1\u8ba4\u8bc1 \u8df3\u8f6c\u5230\u4f60\u7684\u670d\u52a1\u5668\u5904\u7406\u5730\u5740\uff0c\u4e5f\u5c31\u662f\u4e0a\u9762<\/p>\n<p>redirect_uri=\u4f60\u7684\u670d\u52a1\u5668\u5904\u7406\u5730\u5740\u4e2d\u7684\u5730\u5740<\/p>\n<p>\u8fd9\u91cc\u914d\u7f6e\u4e3a<\/p>\n<p>\u4f60\u7684\u670d\u52a1\u5668\u5730\u5740\/oauth<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b<\/p>\n<\/p>\n<pre>@RequestMapping(value&nbsp;=&nbsp;\"\/oauth\",&nbsp;method&nbsp;=&nbsp;RequestMethod.GET)\r\n&nbsp;&nbsp;public&nbsp;String&nbsp;weixinOAuth(HttpServletRequest&nbsp;request,&nbsp;HttpServletResponse&nbsp;response,&nbsp;Model&nbsp;model)&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f97\u5230code\r\n&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;CODE&nbsp;=&nbsp;request.getParameter(\"code\");\r\n&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;APPID&nbsp;=&nbsp;\"\u4f60\u7684APPID\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;SECRET&nbsp;=&nbsp;\"\u4f60\u7684SECRET\";\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u6362\u53d6access_token&nbsp;\u5176\u4e2d\u5305\u542b\u4e86openid\r\n&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;URL&nbsp;=&nbsp;\"https:\/\/api.weixin.qq.com\/sns\/oauth2\/access_token?appid=APPID&amp;amp;secret=SECRET&amp;amp;code=CODE&amp;amp;grant_type=authorization_code\".replace(\"APPID\",&nbsp;APPID).replace(\"SECRET\",&nbsp;SECRET).replace(\"CODE\",&nbsp;CODE);\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/URLConnectionHelper\u662f\u4e00\u4e2a\u6a21\u62df\u53d1\u9001http\u8bf7\u6c42\u7684\u7c7b\r\n&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;jsonStr&nbsp;=&nbsp;URLConnectionHelper.sendGet(URL);\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/System.out.println(jsonStr);\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/out.print(jsonStr);\r\n&nbsp;&nbsp;&nbsp;&nbsp;JSONObject&nbsp;jsonObj&nbsp;=&nbsp;new&nbsp;JSONObject(jsonStr);\r\n&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;openid&nbsp;=&nbsp;jsonObj.get(\"openid\").toString();\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u6709\u4e86\u7528\u6237\u7684opendi\u5c31\u53ef\u4ee5\u7684\u5230\u7528\u6237\u7684\u4fe1\u606f\u4e86\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5730\u5740\u4e3ahttps:\/\/api.weixin.qq.com\/sns\/userinfo?access_token=ACCESS_TOKEN&amp;amp;openid=OPENID&amp;amp;lang=zh_CN\r\n&nbsp;&nbsp;&nbsp;&nbsp;\/\/\u5f97\u5230\u7528\u6237\u4fe1\u606f\u4e4b\u540e\u8fd4\u56de\u5230\u4e00\u4e2a\u9875\u9762\r\n&nbsp;&nbsp;&nbsp;&nbsp;model.addAttribute(\"user\",&nbsp;wechatUser);\r\n&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;\"vip\/userInfo\";\r\n&nbsp;&nbsp;}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6548\u679c\u5982\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/285a3d21c22acdaad610992eab9767a6-1.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe1\" alt=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe1\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/c0aa2db2b59cbac73c775009546f6a4d-2.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe2\" alt=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe2\" \/><\/p>\n<p>\u800c\u4e14\u8fd9\u79cd\u65b9\u5f0f\u5f53\u7528\u6237\u7528\u5176\u4ed6\u6d4f\u89c8\u5668\u6253\u5f00\u65f6\uff0c\u4f1a\u51fa\u9519\uff0c\u4fdd\u8bc1\u4e86\u53ea\u80fd\u5728\u5fae\u4fe1\u4e2d\u4f7f\u7528\uff0c\u4fdd\u969c\u4e86\u6027\u3002\u800c\u4e14\u5730\u5740\u680f\u4e0d\u4f1a\u6709\u5176\u4ed6\u7528\u6237\u4e2a\u4eba\u4fe1\u606f\u7684\u66b4\u9732\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/c0aa2db2b59cbac73c775009546f6a4d-3.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe3\" alt=\"\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u63d2\u56fe3\" \/><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u56fe\u6587\u8be6\u89e3\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1 \u8df3\u8f6c\u9875\u9762\u5e76\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u5b9e\u4f8b\u8be6\u89e3\u7684\u76f8\u5173\u8d44\u6599,\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b \u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1 \u81ea\u5b9a\u4e49\u83dc\u5355 \u8bf7\u5148\u8bfb\u5b8c\u672c\u6587\u518d\u8fdb\u884c\u914d\u7f6e\u5f00\u53d1 \u8bf7\u5148\u524d\u5f80\u5fae\u4fe1\u5e73\u53f0\u5f00\u53d1\u8005\u6587\u6863\u9605\u8bfb\u201c\u7f51\u9875\u6388\u6743\u83b7\u53d6\u7528\u6237\u57fa\u672c\u4fe1\u606f\u201d\u7684\u8bf4\u660e \u5728\u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u5f00\u53d1\u4e2d\uff0c\u5f80\u5f80\u6709\u5b9a\u4e49\u4e00\u4e2a\u83dc\u5355\uff0c\u7136\u540e\u7528\u6237\u70b9\u51fb\u8be5\u83dc\u5355\u5c31\u8fdb\u5165\u7528\u6237\u4e2a\u4eba\u4e2d\u5fc3\u7684\u529f\u80fd\uff0c\u901a\u5e38\u5e94\u7528\u4e8e\u5404\u4e2a\u516c\u4f17\u8d26\u53f7\u4e2d\u7684\u4f1a\u5458\u670d\u52a1\u3002 \u5982\u4f55\u5728\u5fae\u4fe1\u81ea\u5b9a\u4e49\u83dc\u5355\u4e2d\u5c06\u7528\u6237\u5230\u4e2a\u4eba\u4e2d\u5fc3\u9875\u9762\u5462\uff1f \u9996\u9009\u9700\u8981\u901a\u8fc7\u7528\u6237\u70b9\u51fb\u83b7\u53d6\u7528\u6237openid\uff0c\u800c\u901a\u8fc7\u7528\u6237\u7684\u70b9\u51fb\u8df3\u8f6c\u83b7\u53d6\u7528\u6237openid\u5c31\u5fc5\u987b\u5728\u83dc\u5355\u4e2d\u52a8\u6001\u7ed1\u5b9a\u7528\u6237\u7684openid\uff0c\u6216\u8005\u5728\u83dc\u5355\u7684\u8df3\u8f6cURL\u4e2d\u586b\u5199\u5fae\u4fe1\u63d0\u4f9b\u7684\u94fe\u63a5\uff0c\u5b98\u65b9\u7ed9\u4e86\u4e24\u4e2a\u94fe\u63a5\u7c7b\u578b \u4e00\u79cd\u662fScope\u4e3asns_base\u7684\u94fe\u63a5 https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=wx520c15f417810387&amp;amp;redirect_uri=https%3A%2F%2Fchong.qq.com%2Fphp%2Findex.php%3Fd%3D%26c%3DwxAdapter%26m%3DmobileDeal%26showwxpaytitle%3D1%26vb2ctag%3D4_2030_5_1194_60&amp;amp;response_type=code&amp;amp;scope=snsapi_base&amp;amp;state=123#wechat_redirect \u767b\u5f55\u540e\u590d\u5236 \u53e6\u4e00\u79cd\u662fScope\u4e3asnsapi_userinfo\u7684\u94fe\u63a5 https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=wxf0e81c3bee622d60&amp;amp;redirect_uri=http%3A%2F%2Fnba.bluewebgame.com%2Foauth_response.php&amp;amp;response_type=code&amp;amp;scope=snsapi_userinfo&amp;amp;state=STATE#wechat_redirect \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e24\u79cd\u94fe\u63a5\u7684\u533a\u522b\u5982\u4e0b \u5e94\u7528\u6388\u6743\u4f5c\u7528\u57df\uff0csnsapi_base \uff08\u4e0d\u5f39\u51fa\u6388\u6743\u9875\u9762\uff0c\u76f4\u63a5\u8df3\u8f6c\uff0c\u53ea\u80fd\u83b7\u53d6\u7528\u6237openid\uff09\uff0csnsapi_userinfo \uff08\u5f39\u51fa\u6388\u6743\u9875\u9762\uff0c\u53ef\u901a\u8fc7openid\u62ff\u5230\u6635\u79f0\u3001\u6027\u522b\u3001\u6240\u5728\u5730\u3002\u5e76\u4e14\uff0c\u5373\u4f7f\u5728\u672a\u5173\u6ce8\u7684\u60c5\u51b5\u4e0b\uff0c\u53ea\u8981\u7528\u6237\u6388\u6743\uff0c\u4e5f\u80fd\u83b7\u53d6\u5176\u4fe1\u606f\uff09 \u7f51\u4e0a\u5f88\u591a\u8bf4\u6cd5\u662f\u5c06\u94fe\u63a5\u7684url\u76f4\u63a5\u4f5c\u4e3a\u5fae\u4fe1\u81ea\u5b9a\u4e49\u83dc\u5355\u4e2dview\u7c7b\u578b\u4e2d\u7684url\uff08\u5728\u586b\u5199\u662furl\u65f6\u9700\u8981\u914d\u7f6e\u7f51\u9875\u6388\u6743\u56de\u8c03\u57df\u540d\u548cappid\uff09\uff0c\u672c\u4eba\u8bd5\u4e86\u4e00\u4e0b\u8fd9\u79cd\u505a\u6cd5\u7136\u800c\u4e0d\u80fd\u6210\u529f {&nbsp;&#8220;type&#8221;:&#8221;view&#8221;,&nbsp;&#8220;name&#8221;:&#8221;\u4f1a\u5458\u4e2d\u5fc3&#8221;,&nbsp;&#8220;url&#8221;:&#8221;https:\/\/open.weixin.qq.com\/connect\/oauth2\/authorize?appid=\u4f60\u7684appid&amp;amp;redirect_uri=\u4f60\u914d\u7f6e\u63a5\u6536\u5fae\u4fe1\u8ba4\u8bc1\u7684\u5730\u5740?response_type=code&amp;amp;scope=snsapi_base&amp;amp;state=1#wechat_redirect&#8221;&nbsp;}, \u767b\u5f55\u540e\u590d\u5236 \u8fd4\u56de\u7ed3\u679c\u662f\u521b\u5efa\u83dc\u5355\u5931\u8d25 \u521b\u5efa\u83dc\u5355\u5931\u8d25 errcode:{40033} errmsg:{invalid char. please check your request, uxxxx will create fail! hint: [91..gA0792vr23]} \u6211\u8bd5\u4e86\u4e00\u4e0b\u5c06\u540e\u9762\u7684\u5730\u5740\u8fdb\u884curlEncode\uff0c\u8fd8\u662f\u540c\u6837\u7684\u9519\u8bef\u3002 \u540e\u6765\u6211\u60f3\u4e86\u4e00\u4e2a\u529e\u6cd5 \u5728\u81ea\u5b9a\u4e49\u83dc\u5355\u4e2d\u586b\u5199\u81ea\u5df1\u7684url\uff0c\u5728\u586b\u5199\u7684url\u4e2d\u5c06\u7528\u6237\u91cd\u5b9a\u5411\u5230snsapi_base\u7684url\u4e2d\uff0c\u7136\u540e\u518d\u5728snsapi_base\u4e2d\u914d\u7f6e\u83b7\u53d6\u7528\u6237openid\u4ee5\u53ca\u7528\u6237\u5176\u4ed6\u4fe1\u606f\uff0c\u6700\u540e\u8df3\u8f6c\u5230\u4e00\u4e2a\u9875\u9762\uff0c\u4e5f\u5c31\u662f\u901a\u5e38\u7684\u4f1a\u5458\u4e2d\u5fc3\u9875\u9762\u3002 \u6d41\u7a0b\u5982\u4e0b \u8bf7\u770b\u4ee3\u7801 { &#8220;type&#8221;:&#8221;view&#8221;, &#8220;name&#8221;:&#8221;\u4f1a\u5458\u4e2d\u5fc3&#8221;, &#8220;url&#8221;:&#8221;http:\/\/\u914d\u7f6e\u7684\u7f51\u5740\/redirect&#8221;} \u5176\u4e2d\u901a\u8fc7url\u5c06\u7528\u6237\u8df3\u8f6c\u5230 http:\/\/\u914d\u7f6e\u7684\u7f51\u5740\/redirect \u7136\u540e\u5728\u5904\u7406\u65b9\u6cd5\u4e2d\u8c03\u7528\u4e00\u6b21\u91cd\u5b9a\u5411\u5373\u53ef \/\/\u7c7b\u4e0a\u7684\u914d\u7f6e @Controller @RequestMapping(&#8220;\/wechat&#8221;) public&nbsp;class&nbsp;WeChatController{ &nbsp;&nbsp;@RequestMapping(value&nbsp;=&nbsp;&#8220;\/redirect&#8221;,&nbsp;method&nbsp;=&nbsp;RequestMethod.GET) &nbsp;&nbsp;public&nbsp;String&nbsp;weixinRedirect(HttpServletRequest&nbsp;request,&nbsp;HttpServletResponse&nbsp;response)&nbsp;{ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-29081","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=29081"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29081\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=29081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=29081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=29081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}