{"id":66,"date":"2026-10-26T12:00:22","date_gmt":"2026-10-26T20:00:22","guid":{"rendered":"\/?p=66"},"modified":"2026-10-26T12:00:22","modified_gmt":"2026-10-26T20:00:22","slug":"post-mvoqar04","status":"publish","type":"post","link":"https:\/\/www.woiov.cn\/?p=66","title":{"rendered":"\u96e8\u4e91 DNS \u63a5\u5165\u8fd4\u5de5\u8bb0\uff1a\u7aef\u70b9\u3001\u8fd4\u56de\u7ed3\u6784\u3001\u5c3e\u659c\u6760\uff0c\u6587\u6863\u91cc\u4e00\u4e2a\u90fd\u6ca1\u5199"},"content":{"rendered":"<h3>\u8d77\u56e0\uff1a\u4e00\u53e5\u300c\u627e\u4e0d\u5230\u96e8\u4e91\u57df\u540d\u300d<\/h3>\n<p>\u72f8\u82b1\u4e91\u7684 DDNS \u6258\u7ba1\u652f\u6301\u56db\u5bb6\u670d\u52a1\u5546\uff0c\u96e8\u4e91\u662f\u6700\u540e\u63a5\u5165\u7684\u4e00\u5bb6\u3002\u914d\u7f6e\u754c\u9762\u4e0a\u586b\u597d API Key\u3001\u586b\u597d\u57df\u540d\uff0c\u70b9\u540c\u6b65\uff0c\u7ea2\u5b57\u5f39\u56de\u6765\uff1a<\/p>\n<blockquote class=\"wp-block-quote\">\n<p>\u627e\u4e0d\u5230\u96e8\u4e91\u57df\u540d\uff1axuanwork.top\uff08\u8bf7\u5230\u96e8\u4e91\u63a7\u5236\u53f0\u786e\u8ba4\u57df\u540d\u5df2\u6dfb\u52a0\uff0c\u4e14 API Key \u6709 domain \u6743\u9650\uff09<\/p>\n<\/blockquote>\n<p>\u7b2c\u4e00\u53cd\u5e94\u5f53\u7136\u662f\u6000\u7591\u6743\u9650\u3002\u53bb\u96e8\u4e91\u63a7\u5236\u53f0\u786e\u8ba4\uff1a\u57df\u540d\u5728\u3001Key \u4e5f\u5728\u3001\u6743\u9650\u6ca1\u95ee\u9898\u3002\u4e8e\u662f\u6253\u5f00 Chrome DevTools\uff0c\u76f4\u63a5\u624b\u6253\u63a5\u53e3\u3002<\/p>\n<p>\u4e09\u6b21\u8fd4\u5de5\u5c31\u4ece\u8fd9\u91cc\u5f00\u59cb\u3002<\/p>\n<h3>\u5751\u4e00\uff1a\u7aef\u70b9\u8def\u5f84\u4e0d\u662f\u6587\u6863\u91cc\u5199\u7684\u90a3\u6837<\/h3>\n<p>\u65e9\u671f\u6309\u7f51\u4e0a\u6d41\u4f20\u7684\u5199\u6cd5\uff0c\u8bb0\u5f55\u63a5\u53e3\u662f <code>\/dns\/domain\/<\/code>\u3002\u5b9e\u6d4b\u8fd9\u4e2a\u8def\u5f84<strong>\u4e00\u5f8b\u8fd4\u56de 404<\/strong>\uff0c\u8fde\u9274\u6743\u90fd\u8fc7\u4e0d\u53bb\u3002<\/p>\n<p>\u96e8\u4e91\u7684 API \u6587\u6863\uff08<code>api.v2.rainyun.com\/openapi.json<\/code>\uff09\u7ed9\u51fa\u7684\u771f\u5b9e\u8def\u5f84\u662f <code>\/product\/domain\/<\/code>\u2014\u2014\u57df\u540d\u548c\u8bb0\u5f55\u90fd\u6302\u5728\u4ea7\u54c1\u4f53\u7cfb\u4e0b\uff0c\u4e0d\u662f\u72ec\u7acb\u7684 DNS \u6a21\u5757\u3002<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>\u64cd\u4f5c<\/th>\n<th>\u9519\u8bef\u5199\u6cd5<\/th>\n<th>\u6b63\u786e\u5199\u6cd5<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u57df\u540d\u5217\u8868<\/td>\n<td><code>\/dns\/domain\/<\/code><\/td>\n<td><code>\/product\/domain\/<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u8bb0\u5f55\u5217\u8868<\/td>\n<td><code>\/dns\/domain\/{id}\/record\/<\/code><\/td>\n<td><code>\/product\/domain\/{id}\/dns<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u9274\u6743\u5934<\/td>\n<td><code>Authorization: Bearer<\/code><\/td>\n<td><code>x-api-key: <key><\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>\u987a\u5e26\u4e00\u4e2a\u7ec6\u8282\uff1a\u57df\u540d\u5217\u8868\u7684 <code>options<\/code> \u53c2\u6570\u662f<strong>\u5fc5\u586b<\/strong>\u7684\u3002\u4e0d\u5e26\u53c2\u6570\u76f4\u63a5 GET\uff0c\u8fd4\u56de\u7684\u662f\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\n{\"code\":10002,\"message\":\"\u8f93\u5165\u53c2\u6570\u65e0\u6548\"}\n<\/code><\/pre>\n<p>\u5e26\u4e0a <code>options={}<\/code>\uff08\u7a7a\u5bf9\u8c61\uff09\u624d\u6b63\u5e38\u8fd4\u56de\u3002\u8fd9\u79cd&#8221;\u7a7a\u53c2\u6570\u4e5f\u662f\u53c2\u6570&#8221;\u7684\u8bbe\u8ba1\uff0c\u4e0d\u8bd5\u4e00\u6b21\u6839\u672c\u4e0d\u4f1a\u77e5\u9053\u3002<\/p>\n<h3>\u5751\u4e8c\uff1a\u8fd4\u56de\u7ed3\u6784\u91cc\u5957\u4e86\u4e00\u5c42<\/h3>\n<p>\u7aef\u70b9\u6539\u5bf9\u4e4b\u540e\uff0c\u57df\u540d\u5217\u8868\u80fd\u62ff\u5230\u4e86\u3002\u4f46\u4ee3\u7801\u91cc\u7684\u89e3\u6790\u662f\u8fd9\u4e48\u5199\u7684\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\nconst list = r.data?.data || r.data?.list || r.data?.rows\n<\/code><\/pre>\n<p>\u6309\u5e38\u89c1\u7ea6\u5b9a\u731c\u7684\uff0c\u6570\u7ec4\u76f4\u63a5\u5728 <code>data<\/code> \u4e0b\u3002\u800c\u96e8\u4e91\u5b9e\u9645\u8fd4\u56de\u7684\u662f\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\n{\n  \"code\": 200,\n  \"data\": {\n    \"TotalRecords\": 1,\n    \"Records\": [\n      { \"id\": 1222, \"domain\": \"xuanwork.top\", \"status\": \"ok\" }\n    ]\n  }\n}\n<\/code><\/pre>\n<p><code>data<\/code> \u662f\u4e2a<strong>\u5bf9\u8c61<\/strong>\uff0c\u4e0d\u662f\u6570\u7ec4\u3002<code>data.find()<\/code> \u76f4\u63a5\u629b\u9519\uff0c\u88ab try \u63a5\u4f4f\uff0c\u7136\u540e\u4e00\u8def\u8d70\u5230&#8221;\u627e\u4e0d\u5230\u57df\u540d&#8221;\u2014\u2014\u9519\u8bef\u4fe1\u606f\u8fd8\u662f\u6211\u4e0a\u4e00\u7248\u521a\u6539\u7684\u90a3\u53e5\uff0c\u770b\u8d77\u6765\u50cf\u6743\u9650\u95ee\u9898\uff0c\u5b9e\u9645\u662f\u89e3\u6790\u95ee\u9898\u3002<\/p>\n<p>\u4fee\u6b63\u5c31\u4e00\u884c\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\nconst raw = r.data?.data\nconst list = Array.isArray(raw) ? raw : (raw?.Records || raw?.records || raw?.list || [])\n<\/code><\/pre>\n<p>\u52a0\u4e0a <code>Records<\/code> \u8fd9\u4e00\u8def\u515c\u5e95\uff0c<code>TotalRecords \/ Records<\/code> \u8fd9\u79cd&#8221;\u603b\u6570\u5b57\u6bb5\u5728\u524d\u3001\u6570\u636e\u5728\u540e&#8221;\u7684\u5206\u9875\u98ce\u683c\u5c31\u8dd1\u901a\u4e86\u3002<\/p>\n<h3>\u5751\u4e09\uff1a\u5c3e\u659c\u6760\u4f1a 301<\/h3>\n<p>\u8bb0\u5f55\u63a5\u53e3\u5e26\u4e0d\u5e26\u5c3e\u659c\u6760\uff0c\u7ed3\u679c\u5b8c\u5168\u4e0d\u540c\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\n# 301 Moved Permanently\uff0cbody \u662f\u4e00\u6bb5 HTML\ncurl -H \"x-api-key: $K\" \\\n  \"https:\/\/api.v2.rainyun.com\/product\/domain\/1222\/dns\/?limit=5&amp;page_no=1\"\n\n# 200\uff0c\u6b63\u5e38 JSON\ncurl -H \"x-api-key: $K\" \\\n  \"https:\/\/api.v2.rainyun.com\/product\/domain\/1222\/dns?limit=5&amp;page_no=1\"\n<\/code><\/pre>\n<p>301 \u7684\u54cd\u5e94\u4f53\u662f <code><a href=\"...\">Moved Permanently<\/a><\/code>\uff0c<code>JSON.parse<\/code> \u4e00\u6302\uff0c\u53c8\u88ab catch \u541e\u6389\u3002\u8fd9\u7c7b&#8221;\u89e3\u6790\u5931\u8d25\u88ab\u9759\u9ed8&#8221;\u7684\u5199\u6cd5\u5f88\u5371\u9669\u2014\u2014\u5efa\u8bae\u6240\u6709 provider \u7684 error \u90fd\u81f3\u5c11 <code>console.warn<\/code> \u4e00\u6b21\uff0c\u4e0d\u7136\u51fa\u95ee\u9898\u5168\u9760\u8089\u773c\u731c\u3002<\/p>\n<h3>\u9a8c\u8bc1\uff1a\u5e42\u7b49\u6bd4&#8221;\u6210\u529f&#8221;\u66f4\u6709\u4fe1\u606f\u91cf<\/h3>\n<p>\u4e09\u5904\u6539\u5b8c\uff0c\u8dd1\u4e00\u6b21\u771f\u5b9e\u8c03\u7528\uff1a<\/p>\n<pre class=\"wp-block-code\"><code>\nzoneId = 1222\nupsert = {\"ok\":true,\"unchanged\":true,\"id\":151040519}\n<\/code><\/pre>\n<p><code>unchanged: true<\/code> \u6bd4 <code>ok: true<\/code> \u66f4\u8ba9\u4eba\u653e\u5fc3\u2014\u2014\u8bf4\u660e\u5b83\u4e0d\u53ea\u77e5\u9053&#8221;\u6211\u80fd\u5199&#8221;\uff0c\u8fd8\u77e5\u9053&#8221;\u8fd9\u6761\u8bb0\u5f55\u5df2\u7ecf\u662f\u8fd9\u4e2a\u503c\uff0c\u4e0d\u7528\u52a8&#8221;\u3002DDNS \u6bcf 2 \u5206\u949f\u8dd1\u4e00\u6b21\uff0c\u5e42\u7b49\u505a\u4e0d\u5bf9\uff0c\u5c31\u662f\u6bcf 2 \u5206\u949f\u5237\u4e00\u6b21\u63a5\u53e3\u3002<\/p>\n<h3>\u9644\u5e26\uff1a\u5bb9\u5668\u4fe1\u606f\u4e0d\u518d\u9760\u624b\u52a8\u8865\u62a5<\/h3>\n<p>\u8fd9\u7248\u8fd8\u987a\u624b\u6539\u4e86\u4e00\u4ef6\u8fd0\u7ef4\u4e0a\u7684\u4e8b\uff1a<strong>\u5bb9\u5668\u6e05\u5355\u6539\u6210\u540e\u7aef\u6bcf 10 \u5206\u949f\u81ea\u52a8\u62c9\u53d6<\/strong>\uff0c\u542f\u52a8 3 \u5206\u949f\u540e\u5148\u8dd1\u4e00\u6b21\u3002\u4ee5\u524d\u65b0\u5f00\u7684\u5bb9\u5668\u8981\u7b49\u7528\u6237\u70b9\u300c\u4e00\u952e\u8865\u62a5\u300d\uff0c\u8282\u70b9\u4e0a\u591a\u4e86\u51e0\u53f0\u673a\u5668\uff0c\u9762\u677f\u91cc\u5c31\u662f\u4e00\u5806\u7a7a\u767d\u3002<\/p>\n<p>\u987a\u5e26\u4fee\u6389\u4e00\u4e2a\u8f6c\u4e49 bug\uff1a\u751f\u6210\u4e0a\u62a5\u811a\u672c\u65f6\uff0c<code>tools<\/code> \u6570\u7ec4\u88ab\u62fc\u6210\u4e86 <code>[curl,wget]<\/code>\uff08\u7f3a\u5f15\u53f7\uff09\uff0c\u670d\u52a1\u7aef\u6309 JSON \u89e3\u6790\u76f4\u63a5 400\u3002<\/p>\n<figure class=\"wp-block-table\">\n<table>\n<thead>\n<tr>\n<th>\u9879\u76ee<\/th>\n<th>\u6539\u524d<\/th>\n<th>\u6539\u540e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u5bb9\u5668\u4fe1\u606f\u6765\u6e90<\/td>\n<td>\u624b\u52a8\u4e00\u952e\u8865\u62a5<\/td>\n<td>\u540e\u7aef\u6bcf 10 \u5206\u949f\u81ea\u52a8\u62c9<\/td>\n<\/tr>\n<tr>\n<td>\u65b0\u5bb9\u5668<\/td>\n<td>\u7b49\u7528\u6237\u70b9\u4e00\u6b21<\/td>\n<td>\u521d\u59cb\u5316\u811a\u672c\u88c5 systemd timer \/ cron<\/td>\n<\/tr>\n<tr>\n<td>\u4e0a\u62a5 JSON<\/td>\n<td><code>tools: [curl,wget]<\/code> 400<\/td>\n<td>\u6b63\u786e\u8f6c\u4e49<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3>\u5c0f\u7ed3<\/h3>\n<p>\u8fd9\u4e09\u4e2a\u5751\u6709\u4e2a\u5171\u540c\u70b9\uff1a<strong>\u90fd\u4e0d\u5728\u6587\u6863\u91cc\uff0c\u800c\u4e14\u5931\u8d25\u65f6\u770b\u8d77\u6765\u90fd\u50cf\u6743\u9650\u95ee\u9898<\/strong>\u3002<\/p>\n<p>\u5bf9\u63a5\u7b2c\u4e09\u65b9 API\uff0c\u80fd\u7701\u65f6\u95f4\u7684\u4e09\u4ef6\u4e8b\uff1a\u76f4\u63a5\u8bfb <code>openapi.json<\/code> \u800c\u4e0d\u662f\u535a\u5ba2\u6559\u7a0b\uff1b\u5148\u624b\u6253\u4e00\u6b21 curl \u770b\u539f\u59cb\u54cd\u5e94\uff0c\u518d\u5199\u89e3\u6790\uff1b\u4efb\u4f55\u88ab catch \u541e\u6389\u7684\u9519\u8bef\uff0c\u81f3\u5c11\u7559\u4e00\u884c\u65e5\u5fd7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8d77\u56e0\uff1a\u4e00\u53e5\u300c\u627e\u4e0d\u5230\u96e8\u4e91\u57df\u540d\u300d \u72f8\u82b1\u4e91\u7684 DDNS \u6258\u7ba1\u652f\u6301\u56db\u5bb6\u670d\u52a1\u5546\uff0c\u96e8\u4e91\u662f\u6700\u540e\u63a5\u5165\u7684\u4e00\u5bb6\u3002\u914d\u7f6e\u754c\u9762\u4e0a\u586b\u597d AP\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-cat-e68a80e69cafe697"],"_links":{"self":[{"href":"https:\/\/www.woiov.cn\/index.php?rest_route=\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.woiov.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.woiov.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.woiov.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.woiov.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66"}],"version-history":[{"count":0,"href":"https:\/\/www.woiov.cn\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.woiov.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.woiov.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.woiov.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}