{"id":29418,"date":"2024-11-25T10:08:10","date_gmt":"2024-11-25T02:08:10","guid":{"rendered":"https:\/\/fwq.ai\/blog\/29418\/"},"modified":"2024-11-25T10:08:10","modified_gmt":"2024-11-25T02:08:10","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e7%94%a8%e6%88%b7%e7%82%b9%e5%87%bb%e6%8c%89%e9%92%ae%e7%94%9f%e6%88%90%e5%b8%a6%e5%8f%82%e4%ba%8c%e7%bb%b4%e7%a0%81%e7%9a%84%e7%a4%ba%e4%be%8b%e4%bb%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/29418\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7528\u6237\u70b9\u51fb\u6309\u94ae\u751f\u6210\u5e26\u53c2\u4e8c\u7ef4\u7801\u7684\u793a\u4f8b\u4ee3\u7801"},"content":{"rendered":"<p style=\"text-align: left\">\u76ee\u6807\uff1a&nbsp;<br \/>\u8bf7\u6c42\u4e8c\u7ef4\u7801\u5e76\u5c55\u793a&nbsp;<br \/>\u6b65\u9aa4\uff1a&nbsp;<br \/>\u7528\u6237\u70b9\u51fb\u6309\u94ae\u751f\u6210\u4e8c\u7ef4\u7801&nbsp;<br \/>\u6b65\u9aa4\uff1a&nbsp;<br \/>1\u3001\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f80\u540e\u53f0\u8bf7\u6c42\u4e8c\u7ef4\u7801&nbsp;<br \/>2\u3001\u540e\u53f0\uff08java\/php\uff09 \u6839\u636e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4fe1\u606f\u5f80\u5fae\u4fe1\u7aef\u8bf7\u6c42tonken&nbsp;<br \/>3\u3001\u540e\u53f0\u5f97\u5230tonken\u540e\u5f80\u5fae\u4fe1\u7aef\u8bf7\u6c42\u4e8c\u7ef4\u7801\u56fe\u7247&nbsp;<br \/>4\u3001\u540e\u53f0\u5f97\u5230\u56fe\u7247\u540e\u4fdd\u5b58\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u5c06\u8def\u5f84\u8fd4\u56de\u7ed9\u5fae\u4fe1\u5c0f\u7a0b\u5e8f&nbsp;<br \/>5\u3001\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f97\u5230\u8def\u5f84\u540e\uff0c\u6839\u636e\u8def\u5f84\u4e0b\u8f7d\u56fe\u7247&nbsp;<br \/>6\u3001\u4e0b\u8f7d\u56fe\u7247\u6210\u529f\u540e\u518d\u4fdd\u5b58\u81f3\u672c\u5730&nbsp;<br \/>7\u3001\u4fdd\u5b58\u6210\u529f\u540e\u5c06\u8def\u5f84\u7ed9\u4e88image\u6807\u7b7e\u91cc\u9762\u5c55\u793a<br \/>\u4ee3\u7801\uff1a&nbsp;<br \/>wxml<\/p>\n<pre>&lt;image class=\"scanimg\" src=\"{{filePath}}\" bindtap=\"getAgain\"&gt;&lt;\/image&gt;\r\n&lt;button type=\"primary\" bindtap=\"primary\"&gt;\u70b9\u51fb\u751f\u6210\u4e8c\u7ef4\u7801&lt;\/button&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"text-align: left\">s\u4ee3\u7801<\/p>\n<pre>primary:function (e) {\r\nvar _url = '\u540e\u53f0\u5730\u5740';\r\n  wx.request({\r\n    url: _url,\r\n\/\/\u8bf7\u6c42\u62a5\u6587\u4f53\r\n    data: [{\r\n      id: agentCode\r\n    }],\r\n    method: 'POST',\r\n    header: {\r\n      'content-type': 'application\/json'\r\n    },\r\n    success: function (res) {\r\n\/\/\u4e3a00\u65f6\u8868\u793a\u6210\u529f\uff0c\u5f97\u5230\u4e8c\u7ef4\u7801\u7684\u5730\u5740\r\n      if (res.data.code == '00') {\r\n        console.log(\"\u6210\u529f\")\r\n\/\/\u4e0b\u8f7d\u4e8c\u7ef4\u7801\r\n        wx.downloadFile({\r\n          url: res.data.body[0].URL,\r\n          success: function (res) {\r\n\/\/\u5982\u679c\u4e8c\u7ef4\u7801\u4e2d\u7684id\u4e3a\u56fa\u5b9a\u503c\u53ef\u4ee5\u5c06\u56fe\u7247\u4fdd\u5b58\u5230\u672c\u5730\uff0c\u5426\u5219\u4e0d\u7528\u4fdd\u5b58\r\n            wx.saveFile({\r\n              tempFilePath: res.tempFilePath,\r\n              success: function (res) {\r\n                console.log(\"\u4fdd\u5b58\u6210\u529f\")\r\n_that.setData({\r\nfilePath: res.savedFilePath\r\n})\r\nconsole.log(res.savedFilePath)\r\ntry {\r\n\/\/id\u4e3a\u5b9a\u503c\uff0c\u5219\u5c06\u4fdd\u5b58\u7684\u5730\u5740\u5b58\u5165\u7f13\u5b58\uff0c\u975e\u5b9a\u503c\u5219\u53ea\u9700\u8981setData\u5c31\u884c\r\nwx.setStorageSync('filePath', res.savedFilePath)\r\n} catch (e) {\r\nconsole.log(e)\r\n}\r\n              },\r\n              fail: function (res) {\r\n                console.log(\"\u4fdd\u5b58\u5931\u8d25\")\r\n                console.log(res)\r\n              }\r\n            })\r\n          }, fail: function (res) {\r\n            util.msg(\"\u9519\u8bef\", \"\u901a\u8baf\u5931\u8d25\")\r\n            console.log(res)\r\n          }\r\n        })\r\n      } else {\r\n        console.log(\"\u9519\u8bef\")\r\n        util.msg(\"\u9519\u8bef\", res.data.msg)\r\n      }\r\n    },\r\n    fail: function () {\r\n      util.msg(\"\u9519\u8bef\", \"\u901a\u8baf\u5931\u8d25\")\r\n      console.log(res)\r\n    }\r\n  })\r\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"text-align: left\">java\u7aef\u4ee3\u7801<\/p>\n<pre>\/\/ \u8bbf\u95ee\u5fae\u4fe1\u540e\u53f0\u7684URL\r\nString URL = systemConfig.getString(\"LoginOrRegisterUrl\");\r\n\/\/ \u8bf7\u6c42\u7c7b\u578b\r\nString grant_type = systemConfig.getString(\"grant_type\");\r\n\/\/ \u7b2c\u4e09\u65b9\u7528\u6237\u552f\u4e00\u51ed\u8bc1\u5bc6\u94a5\r\nString secret = systemConfig.getString(\"secret\");\r\n\/\/ \u7b2c\u4e09\u65b9\u7528\u6237\u552f\u4e00\u51ed\u8bc1\r\nString appId = systemConfig.getString(\"appid\");\r\n\/\/ \u8bf7\u6c42token\u65f6\u7528\u5230\u7684URL\r\nString tokenUrl = systemConfig.getString(\"tokenUrl\");\r\n\/\/ \u5411\u5fae\u4fe1\u540e\u53f0\u8bf7\u6c42\u83b7\u53d6token\r\n                        String sendGet = HttpClientConnectionManager.sendGet(\r\n                                tokenUrl, \"grant_type=\" + grant_type\r\n                                        + \"&amp;secret=\" + secret + \"&amp;appid=\"\r\n                                        + appId + \"\");\r\n                        System.out.println(sendGet);\r\n                        JSONObject json = JSONObject.fromObject(sendGet);\r\n                        access_token = json.get(\"access_token\").toString();\r\n                        if (access_token == null) {\r\n\/\/\u6ca1\u6709token \u5219\u8fd4\u56de\u9519\u8bef\u7801\u548c\u9519\u8bef\u4fe1\u606f\r\n                            agentDTO.setCode(\"0002\");\r\n                            agentDTO.setDesc(\"\u83b7\u53d6tokenId\u5931\u8d25\");\r\n                            return agentDTO;\r\n                        }\r\nSystem.out.println(access_token);\r\n\/\/ \u8bbf\u95ee\u5fae\u4fe1\u540e\u53f0\u5e26\u7684json\u53c2\u6570\r\n                    Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();\r\n                    map.put(\"path\", \"pages\/register\");\/\/\u4f60\u4e8c\u7ef4\u7801\u4e2d\u8df3\u5411\u7684\u5730\u5740\r\n                    map.put(\"width\", \"430\");\/\/\u56fe\u7247\u5927\u5c0f\r\n                    JSONObject json = JSONObject.fromObject(map);\r\n                    HttpClientConnectionManager.httpPostWithJSON(URL\r\n                            + access_token, json.toString(), id + \"max\");\r\n                    \/\/ \u8fd4\u56de\u7ed9\u524d\u7aef\u7684\u540e\u53f0\u670d\u52a1\u5668\u6587\u4ef6\u8bfb\u53d6\u8def\u5f84\r\n                    String downloadUrl = systemConfig\r\n                            .getString(\"agentImgDownloadUrl\")\r\n                            + id\r\n                            + \"max\"\r\n                            + \"\/\";\r\n                    \/\/ \u8fd4\u56de\u7ed9\u524d\u7aef\u7684\u540e\u53f0\u670d\u52a1\u5668\u6587\u4ef6\u4e0b\u8f7d\u8def\u5f84\r\n                    String downloadfileUrl = downloadUrl + id + \"max\" + \".jpg\";\r\n                    agentResView.setURL(downloadfileUrl);\r\n                    agentDTO.setAgentResView(agentResView);\r\nagentDTO.setCode(\"00\");\r\nagentDTO.setDesc(\"\u6210\u529f\");\r\n                        return agentDTO;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"text-align: left\">tip&nbsp;<br \/>1\u3001\u8fd9\u662f\u7533\u8bf7\u4e00\u5f20\u4e8c\u7ef4\u7801\u7684\u4ee3\u7801\uff0c\u7533\u8bf7\u591a\u5f20\u53ef\u4ee5\u7528for\u6216\u8005\u5176\u4ed6\u7684\u65b9\u6cd5&nbsp;<br \/>2\u3001\u5f53id\u4e3a\u5b9a\u91cf\u65f6\uff0c\u6bcf\u6b21\u70b9\u51fb\u6309\u94ae\u5224\u65adfilePath\u7f13\u5b58\u662f\u5426\u5b58\u5728\uff0c\u5b58\u5728\u5219\u76f4\u63a5\u53d6\u503c\u5c55\u793a\uff0c\u4e0d\u5b58\u5728\u5219\u5411\u540e\u53f0\u8bf7\u6c42\u4e8c\u7ef4\u7801&nbsp;<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7528\u6237\u70b9\u51fb\u6309\u94ae\u751f\u6210\u5e26\u53c2\u4e8c\u7ef4\u7801\u7684\u793a\u4f8b\u4ee3\u7801\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>\u76ee\u6807\uff1a&nbsp;\u8bf7\u6c42\u4e8c\u7ef4\u7801\u5e76\u5c55\u793a&nbsp;\u6b65\u9aa4\uff1a&nbsp;\u7528\u6237\u70b9\u51fb\u6309\u94ae\u751f\u6210\u4e8c\u7ef4\u7801&nbsp;\u6b65\u9aa4\uff1a&nbsp;1\u3001\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f80\u540e\u53f0\u8bf7\u6c42\u4e8c\u7ef4\u7801&nbsp;2\u3001\u540e\u53f0\uff08java\/php\uff09 \u6839\u636e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4fe1\u606f\u5f80\u5fae\u4fe1\u7aef\u8bf7\u6c42tonken&nbsp;3\u3001\u540e\u53f0\u5f97\u5230tonken\u540e\u5f80\u5fae\u4fe1\u7aef\u8bf7\u6c42\u4e8c\u7ef4\u7801\u56fe\u7247&nbsp;4\u3001\u540e\u53f0\u5f97\u5230\u56fe\u7247\u540e\u4fdd\u5b58\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u5c06\u8def\u5f84\u8fd4\u56de\u7ed9\u5fae\u4fe1\u5c0f\u7a0b\u5e8f&nbsp;5\u3001\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f97\u5230\u8def\u5f84\u540e\uff0c\u6839\u636e\u8def\u5f84\u4e0b\u8f7d\u56fe\u7247&nbsp;6\u3001\u4e0b\u8f7d\u56fe\u7247\u6210\u529f\u540e\u518d\u4fdd\u5b58\u81f3\u672c\u5730&nbsp;7\u3001\u4fdd\u5b58\u6210\u529f\u540e\u5c06\u8def\u5f84\u7ed9\u4e88image\u6807\u7b7e\u91cc\u9762\u5c55\u793a\u4ee3\u7801\uff1a&nbsp;wxml &lt;image class=&#8221;scanimg&#8221; src=&#8221;{{filePath}}&#8221; bindtap=&#8221;getAgain&#8221;&gt;&lt;\/image&gt; &lt;button type=&#8221;primary&#8221; bindtap=&#8221;primary&#8221;&gt;\u70b9\u51fb\u751f\u6210\u4e8c\u7ef4\u7801&lt;\/button&gt; \u767b\u5f55\u540e\u590d\u5236 s\u4ee3\u7801 primary:function (e) { var _url = &#8216;\u540e\u53f0\u5730\u5740&#8217;; wx.request({ url: _url, \/\/\u8bf7\u6c42\u62a5\u6587\u4f53 data: [{ id: agentCode }], method: &#8216;POST&#8217;, header: { &#8216;content-type&#8217;: &#8216;application\/json&#8217; }, success: function (res) { \/\/\u4e3a00\u65f6\u8868\u793a\u6210\u529f\uff0c\u5f97\u5230\u4e8c\u7ef4\u7801\u7684\u5730\u5740 if (res.data.code == &#8217;00&#8217;) { console.log(&#8220;\u6210\u529f&#8221;) \/\/\u4e0b\u8f7d\u4e8c\u7ef4\u7801 wx.downloadFile({ url: res.data.body[0].URL, success: function (res) { \/\/\u5982\u679c\u4e8c\u7ef4\u7801\u4e2d\u7684id\u4e3a\u56fa\u5b9a\u503c\u53ef\u4ee5\u5c06\u56fe\u7247\u4fdd\u5b58\u5230\u672c\u5730\uff0c\u5426\u5219\u4e0d\u7528\u4fdd\u5b58 wx.saveFile({ [&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-29418","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29418","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=29418"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29418\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=29418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=29418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=29418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}