{"id":336757,"date":"2021-02-11T11:46:26","date_gmt":"2021-02-11T03:46:26","guid":{"rendered":"http:\/\/4563.org\/?p=336757"},"modified":"2021-02-11T11:46:26","modified_gmt":"2021-02-11T03:46:26","slug":"%e5%a4%a7%e5%ae%b6%e6%96%b0%e5%b9%b4%e5%bf%ab%e4%b9%90%ef%bc%8c%e5%a4%a7%e6%b8%85%e6%97%a9%e5%8f%91%e4%b8%aa%e6%95%99%e7%a8%8b%e5%90%a7%ef%bc%88%e5%be%85%e5%ae%8c%e5%96%84%e4%b8%ad%ef%bc%81%ef%bc%89","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=336757","title":{"rendered":"\u5927\u5bb6\u65b0\u5e74\u5feb\u4e50\uff0c\u5927\u6e05\u65e9\u53d1\u4e2a\u6559\u7a0b\u5427\uff08\u5f85\u5b8c\u5584\u4e2d\uff01\uff09"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>cherbim<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u5927\u5bb6\u65b0\u5e74\u5feb\u4e50\uff0c\u5927\u6e05\u65e9\u53d1\u4e2a\u6559\u7a0b\u5427\uff08\u5f85\u5b8c\u5584\u4e2d\uff01\uff09<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 cherbim \u4e8e 2021-2-11 09:22 \u7f16\u8f91 <\/p>\n<p> \u53cd\u6b63\u4e5f\u95f2\u7740\u6ca1\u4e8b\uff0c\u4e0e\u5176\u8e72\u5728\u5899\u89d2\u6652\u592a\u9633\uff0c\u4e0d\u5982\u4ee3\u7801\u64b8\u8d77\u6765\uff08\u6628\u5929\u64b8\u7684\uff0c\u4eca\u5929\u53d1\u6559\u7a0b\uff09<br \/>  cf worker\u53cd\u4ee3\u4f01\u4e1a\u5fae\u4fe1\u63a5\u53e3 (\u7528get\u8bf7\u6c42\u4ee3\u66ffpost\u8bf7\u6c42\uff09<br \/>  GitHub\u5730\u5740\uff08\u4e0d\u5efa\u8bae\u770b\uff0c\u7eaf\u4ee3\u7801\u6ca1\u5565\u8bf4\u660e\uff09\uff1ahttps:\/\/github.com\/w2r\/cfworker_WeCom<br \/>  \u7b80\u4ecb\uff1a<br \/>  \u6b63\u5e38\u7684\u4f01\u4e1a\u5fae\u4fe1\u5e94\u7528\u901a\u77e5\uff0c\u9700\u8981\u6784\u5efa\u53d1\u9001\u6587\u672cjson\uff0c\u83b7\u5f97token\uff0c\u7136\u540e\u6784\u5efapost\u8bf7\u6c42<br \/>  \u901a\u8fc7cf\u53cd\u4ee3\u7b80\u5316\u6d41\u7a0b\uff0c\u76f4\u63a5\u4e00\u4e2aget\u8bf7\u6c42\u89e3\u51b3\u6240\u6709\u6b65\u9aa4<br \/>  \u901a\u4fd7\u6613\u61c2\u70b9\uff1a\u6b63\u5e38\u4f01\u4e1a\u5fae\u4fe1\u5e94\u7528\u53d1\u9001\u4fe1\u606f\uff0c\u9700\u8981\u4f60\u8bbf\u95ee\u7f51\u5740https:\/\/qyapi.weixin.qq.com\/cgi-bin\/gettoken?corpid=********&amp;corpsecret=************\uff0c\u83b7\u5f97token\u548c\u63a8\u9001\u63a5\u53e3\u7ec4\u6210post url\uff0c\u7136\u540e\u6784\u9020\u53d1\u9001\u6587\u672c\uff08\u4e00\u4e2ajson\uff09\uff0c\u518d\u53bb\u627e\u4e00\u4e2a\u5728\u7ebfpost\u7f51\u7ad9\uff0c\u586b\u5199\u53c2\u6570\u53d1\u9001post\u8bf7\u6c42\u53d1\u9001\u5230\u5fae\u4fe1\uff0c\u5f88\u9ebb\u70e6\uff0c\u6211\u628a\u8fd9\u4e9b\u6b65\u9aa4\u5168\u90e8\u6253\u5305\uff0c\u4ea4\u7ed9cf worker\u6765\u505a\uff0c\u6b65\u9aa4\u7b80\u5316\u4e3a\uff0c\u642d\u5efa\u597dcf worker\u53cd\u4ee3\u540e\uff0c \u7528\u4f60\u7684\u6d4f\u89c8\u5668\u76f4\u63a5\u8bbf\u95ee\u4f60\u7684cf worker\u57df\u540d\u5730\u5740\uff1ahttps:\/\/******-sound-f816.qyu0615.workers.dev\/123456&nbsp; &nbsp;&nbsp; &nbsp; \u7136\u540e\u673a\u5668\u4eba\u5c31\u4f1a\u53d1\u9001123456\u5230\u5fae\u4fe1<br \/>  \u5177\u4f53\u6d41\u7a0b\u56fe\uff1a<br \/>  https:\/\/s3.ax1x.com\/2021\/02\/10\/ywsTUO.png<br \/>  \u64cd\u4f5c\u6b65\u9aa4\uff1a<br \/>  \u7b2c\u4e00\u6b65\uff1a\u83b7\u5f97\u4f01\u4e1aid\uff08corpid)\uff0c AgentId\u548cSecret\uff08corpsecret\uff09\uff0c\u8bb0\u5f97\u7528\u4f60\u7684\u5fae\u4fe1\u5173\u6ce8\u90a3\u4e2a\u5fae\u4fe1\u63d2\u4ef6\u4e8c\u7ef4\u7801\uff0c\u7136\u540e\u5fae\u4fe1\u624d\u53ef\u4ee5\u6536\u5230\u63a8\u9001 \uff08\u4e0d\u4f1a\u64cd\u4f5c\u7684\u770b\u627e\u4e2a\uff09https:\/\/github.com\/w2r\/hostloc2tg\/blob\/master\/hostloc2wechat\/README.md#%E4%BB%A5%E4%B8%8B%E4%BB%8B%E7%BB%8D%E7%9A%84%E6%98%AF%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E5%BA%94%E7%94%A8%E5%8F%AF%E4%BB%A5%E5%BE%AE%E4%BF%A1%E6%8E%A5%E4%BF%A1%E6%81%AF%E6%97%A0%E9%9C%80%E5%AE%89%E8%A3%85%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1\uff09<\/p>\n<p>  \u7b2c\u4e8c\u6b65\uff1a\u767b\u5f55cf\uff0c \u521b\u5efa\u65b0\u7684worker\uff0c\u6e05\u7a7a\u4ee3\u7801\u533a\u57df\uff0c\u7136\u540e\u4fee\u6539\u4ee5\u4e0b\u4ee3\u7801*****\u5185\u5bb9\uff0c\u603b\u5171\u56db\u5904\u4fee\u6539\uff08\u81ea\u884c\u5bfb\u627e\uff0c\u90fd\u6709\u4e2d\u6587\u8bf4\u660e\uff09\uff0c\u5206\u522b\u4e3a\u4f01\u4e1aid\uff08corpid)\uff0c AgentId\u548cSecret\uff08corpsecret\uff09\uff0c\u8fd8\u6709\u4f60\u7684cf worker\u5730\u5740\uff08\u8bb0\u5f97\u5305\u542b\u7ed3\u5c3e\u7684\/\uff09<br \/>  \u7136\u540e\u590d\u5236\u8fdb\u53bbworker \u4ee3\u7801\u533a\u57df\uff0c\u4fdd\u5b58\u4ee3\u7801\uff0c\u8bbf\u95ee\u4f60\u7684cf worker\u5730\u5740+\u63a8\u9001\u5185\u5bb9\uff0c\u5f62\u5f0f\u7c7b\u4f3c\u4e8e\uff1ahttps:\/\/******-sound-f816.qyu0615.workers.dev\/\u63a8\u9001\u5185\u5bb9<br \/>  \u53d1\u9001\u6210\u529f\u5219\u4f1a\u8fd4\u56de\uff1a{&quot;errcode&quot;:0,&quot;errmsg&quot;:&quot;ok&quot;,&quot;invaliduser&quot;:&quot;&quot;,&quot;invalidtag&quot;:&quot;2&quot;}<\/p>\n<p>  addEventListener(&#8216;fetch&#8217;, event =&gt; {<br \/>  &nbsp; &nbsp; event.respondWith(postWeChatUrl(event.request))<br \/>  })<\/p>\n<p>  async function gatherResponse(response) {<br \/>  const { headers } = response<br \/>  const contentType = headers.get(&quot;content-type&quot;) || &quot;&quot;<br \/>  if (contentType.includes(&quot;application\/json&quot;)) {<br \/>  &nbsp; &nbsp; return JSON.stringify(await response.json())<br \/>  }<br \/>  else if (contentType.includes(&quot;application\/text&quot;)) {<br \/>  &nbsp; &nbsp; return await response.text()<br \/>  }<br \/>  else if (contentType.includes(&quot;text\/html&quot;)) {<br \/>  &nbsp; &nbsp; return await response.text()<br \/>  }<br \/>  else {<br \/>  &nbsp; &nbsp; return await response.text()<br \/>  }<br \/>  }<\/p>\n<p>  async function postWeChatUrl(request) {<br \/>  \/\/ \u83b7\u53d6token\u94fe\u63a5\uff0c\u81ea\u884c\u4fee\u6539\u4f01\u4e1aid\u548c\u79d8\u94a5<br \/>  const url = &quot;https:\/\/qyapi.weixin.qq.com\/cgi-bin\/gettoken?corpid=*************&amp;corpsecret=***********&quot;<br \/>  const init = {<br \/>  &nbsp; &nbsp; headers: {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&quot;content-type&quot;: &quot;application\/json;charset=UTF-8&quot;,<br \/>  &nbsp; &nbsp; },<br \/>  }<br \/>  \/\/ \u53d1\u51faget\u8bf7\u6c42\u83b7\u5f97token<br \/>  const response = await fetch(url, init)<br \/>  const results = await gatherResponse(response)<br \/>  var jsonObj = JSON.parse(results)<br \/>  \/\/ \u4ececf workers\u622a\u53d6\u53d1\u9001\u5185\u5bb9\uff0c\u9700\u8981\u66ff\u6362\u6210\u81ea\u5df1\u7684cf work\u5730\u5740<br \/>  var text = decodeURI(request.url.replace(&quot;https:\/\/*******816.qyu0615.workers.dev\/&quot;, &quot;&quot;))<br \/>  var key = jsonObj[&quot;access_token&quot;]<br \/>  var wechat_work_url = &quot;https:\/\/qyapi.weixin.qq.com\/cgi-bin\/message\/send?access_token=&quot; + key;<br \/>  var template = <br \/>   {<br \/>  &quot;touser&quot;: &quot;&quot;,<br \/>  &quot;toparty&quot;: &quot;1&quot;,<br \/>  &quot;totag&quot;: &quot;2&quot;,<br \/>  &quot;msgtype&quot;: &quot;text&quot;,<br \/>  \/\/ \u5e94\u7528id<br \/>  &quot;agentid&quot;: ******,<br \/>  &quot;text&quot;: {<br \/>  &nbsp; &nbsp; \/\/ \u53d1\u9001\u6587\u672c\u5185\u5bb9\uff0c\u7f51\u9875\u7248\u53d1\u9001\u83ab\u540d\u5947\u5999\u51fa\u73b0\u7684\u73a9\u610f\uff0c\u66ff\u6362\u6210\u7a7a\u767d<br \/>  &nbsp; &nbsp; &quot;content&quot;: text.replace(&quot;favicon.ico&quot;, &quot;&quot;)<br \/>  },<br \/>  &quot;safe&quot;: 0,<br \/>  &quot;enable_id_trans&quot;: 0,<br \/>  &quot;enable_duplicate_check&quot;: 0,<br \/>  &quot;duplicate_check_interval&quot;: 1800<br \/>  }<\/p>\n<p>  const init2 = {<br \/>  &nbsp; &nbsp; body: JSON.stringify(template),<br \/>  &nbsp; &nbsp; method: &#8216;POST&#8217;,<br \/>  &nbsp; &nbsp; headers: {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&#8216;Content-Type&#8217;: &#8216;application\/json&#8217;,<br \/>  &nbsp; &nbsp; },<br \/>  }<\/p>\n<p>  \/\/ \u53d1\u9001post\u8bf7\u6c42<br \/>  const response1 = await fetch(wechat_work_url, init2)<br \/>  returnresponse1<br \/>  }<\/p>\n<p>  \u76ee\u524d\u5b58\u5728bug\uff1a<br \/>  1. \u4e0d\u80fd\u63a8\u9001#\u53f7\uff0c\u9047\u5230#\u53f7\u540e\u9762\u5185\u5bb9\u5c31\u4f1a\u4e22\u5931\uff0c\u4f01\u4e1a\u5fae\u4fe1\u7684#\u4f5c\u4e3a\u6807\u7b7e\uff0c\u4f1a\u9ed8\u8ba4\u94fe\u63a5\u5230\u89c6\u9891\u53f7\uff0c\u5c1d\u8bd5\u8fc7\u7f16\u7801\u53d1\u9001\u8fd8\u662f\u4e0d\u884c<br \/>  2.\u6709\u6781\u4f4e\u7684\u6982\u7387\u63a8\u9001\u6253\u65ad\u7684\u5185\u5bb9(\u53ef\u80fd\u53c8\u662f\u4e00\u4e9b\u7279\u6b8a\u7b26\u53f7\u5728\u641e\u4e8b\u60c5\uff09<\/p>\n<p>  \u4ee5\u4e0a\u95ee\u9898\u6682\u65f6\u65e0\u6cd5\u89e3\u51b3\uff0cjs\u6211\u662f\u4e00\u70b9\u90fd\u4e0d\u4f1a\uff08\u4e3b\u5b66python\u7684\uff09\uff0c\u8fd9\u4e2a\u8fd8\u662f\u6211\u7167\u7740cf\u6a21\u677f\u786c\u64b8\u51fa\u6765\u7684\uff08\u6765\u4e2a\u4f1ajs\u7684\u5927\u4f6c\u5b8c\u5584\u5b8c\u5584\u5427\uff09<br \/>  \u6700\u540e\u653e\u4e00\u4e0b\u6548\u679c\u5427\uff1a<br \/>  \u4efb\u52a1\u680f\u6548\u679c\uff1a\u56e0\u4e3a\u5fae\u4fe1\u4e0d\u652f\u6301html\u548cmarkdown\uff0c\u5185\u5bb9\u4f1a\u51fa\u73b0\u94fe\u63a5\uff0c\u4f46\u662f\u70b9\u5230\u63d2\u4ef6\u91cc\u5c31\u652f\u6301\u4e86<br \/>  https:\/\/s3.ax1x.com\/2021\/02\/11\/y0zJrd.png<br \/>  \u5fae\u4fe1\u63d2\u4ef6\u6548\u679c\uff1a<br \/>  https:\/\/s3.ax1x.com\/2021\/02\/11\/y0zUat.png<br \/>  #\u53f7bug\uff1a\u4e0a\u56fe\u624b\u52a8\u53d1\u7684123456#\u6d4b\u8bd5\uff0c\u70b9\u51fb\u5bfc\u6d41\u5230\u89c6\u9891\u53f7\uff0c\u53ef\u80fd\u4f01\u4e1a\u5fae\u4fe1\u9ed8\u8ba4#\u4e3a\u89c6\u9891\u53f7\u6807\u7b7e\uff08\u6240\u4ee5\u5982\u679c\u4f60\u7684\u63a8\u9001\u5185\u5bb9\u542b\u6709#\uff0c\u5219#\u540e\u9762\u5185\u5bb9\u4f1a\u201d\u6d88\u5931\u201c\uff09\uff0c\u76ee\u524d\u6211\u662f\u65e0\u6cd5\u641e\u5b9a\uff0c\u5c1d\u8bd5\u591a\u79cd\u65b9\u6cd5\u90fd\u4e0d\u884c\uff0c\u7b49\u4ee5\u540e\u8bd5\u8bd5markdown\u8bed\u6cd5\uff0c\u4e0d\u7528\u6587\u672c<br \/>  https:\/\/s3.ax1x.com\/2021\/02\/11\/y0z7L9.png\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>zxxx<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6280\u672f\u8d34\uff0c\u867d\u7136\u770b\u4e0d\u61c2\uff0c\u8fd8\u662f\u652f\u6301\u4e00\u4e0b\u3002\u795d\u65b0\u5e74\u5feb\u4e50\uff01\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>KuYeHQ<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u554a\u54c8\uff0c\u770b\u4e0d\u61c2+2\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u767e\u5e74\u5efa\u7ad9\u8001\u624b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6280\u672f\u8d34\uff0c\u7a33\uff01\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>xJogger<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4f1aPython\u7684\u8bdd\uff0c\u8fd9\u79cd\u4e1c\u897f\u53ef\u4ee5\u53bbVercel\u4e0a\u64b8\uff0c\u4e5f\u633a\u8212\u670d\u7684\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>wifitry<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u524d\u6392\u5173\u6ce8\u4e00\u6ce2\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>honey<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6280\u672f\u5e16\u554a \u7ed9\u5927\u4f6c\u9876\u8d77\u6765\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>kissmk3515<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u7528\u5904\u662f?\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>jqbaobao<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6ca1\u6709\u4f01\u4e1aWX:lol\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>dforel<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u652f\u6301\u652f\u6301\uff0c\u8d5e\u4e00\u4e2a\u3002\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>cherbim \u5927\u4f6c\u6709\u8bdd\u8bf4 : \u5927&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/336757"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336757"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/336757\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336757"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}