{"id":18577,"date":"2024-07-28T14:21:17","date_gmt":"2024-07-28T06:21:17","guid":{"rendered":"https:\/\/0592ban.cn\/?p=18577"},"modified":"2024-07-28T14:21:17","modified_gmt":"2024-07-28T06:21:17","slug":"79%e5%b9%b48%e6%9c%8821%e6%97%a5%e4%b8%91%e6%97%b6%e7%94%9f%e4%ba%ba%e5%91%bd%e8%bf%90%e5%a6%82%e4%bd%95-79%e5%b9%b48%e6%9c%8825%e6%97%a5%e5%86%9c%e5%8e%86%e5%87%ba%e7%94%9f%e6%98%af%e4%bb%80","status":"publish","type":"post","link":"https:\/\/0592ban.cn\/index.php\/2024\/07\/28\/79%e5%b9%b48%e6%9c%8821%e6%97%a5%e4%b8%91%e6%97%b6%e7%94%9f%e4%ba%ba%e5%91%bd%e8%bf%90%e5%a6%82%e4%bd%95-79%e5%b9%b48%e6%9c%8825%e6%97%a5%e5%86%9c%e5%8e%86%e5%87%ba%e7%94%9f%e6%98%af%e4%bb%80\/","title":{"rendered":"79\u5e748\u670821\u65e5\u4e11\u65f6\u751f\u4eba\u547d\u8fd0\u5982\u4f55 (79\u5e748\u670825\u65e5\u519c\u5386\u51fa\u751f\u662f\u4ec0\u4e48\u547d)"},"content":{"rendered":"<p><img decoding=\"async\" alt=\"79\u5e748\u670825\u65e5\u519c\u5386\u51fa\u751f\u662f\u4ec0\u4e48\u547d\" loading=\"lazy\" src=\"https:\/\/0592ban.cn\/wp-content\/uploads\/2024\/07\/0f52cb4a-5bff-4318-93bc-065f637a2e85.jpg\"\/><\/p>\n<form>\n <label for=\"birth_year\"><br \/>\n  \u51fa\u751f\u5e74\u4efd\uff1a<br \/>\n <\/label><br \/>\n <input id=\"birth_year\" max=\"2022\" min=\"1900\" type=\"number\"\/><br \/>\n <label for=\"birth_month\"><br \/>\n  \u51fa\u751f\u6708\u4efd\uff1a<br \/>\n <\/label><br \/>\n <input id=\"birth_month\" max=\"12\" min=\"1\" type=\"number\"\/><br \/>\n <label for=\"birth_day\"><br \/>\n  \u51fa\u751f\u65e5\u671f\uff1a<br \/>\n <\/label><br \/>\n <input id=\"birth_day\" max=\"31\" min=\"1\" type=\"number\"\/><br \/>\n <label for=\"birth_hour\"><br \/>\n  \u51fa\u751f\u65f6\u8fb0\uff1a<br \/>\n <\/label><br \/>\n <input id=\"birth_hour\" max=\"23\" min=\"0\" type=\"number\"\/><br \/>\n <button type=\"submit\"><br \/>\n  \u8ba1\u7b97<br \/>\n <\/button><br \/>\n<\/form>\n<p><script>\n \/\/ \u83b7\u53d6\u8868\u5355\u5143\u7d20\n    const form = document.querySelector('form');\n    const result = document.querySelector('result');<\/p>\n<p>    \/\/ \u76d1\u542c\u8868\u5355\u63d0\u4ea4\u4e8b\u4ef6\n    form.addEventListener('submit', (event) => {\n      \/\/ \u963b\u6b62\u8868\u5355\u9ed8\u8ba4\u63d0\u4ea4\u884c\u4e3a\n      event.preventDefault();<\/p>\n<p>      \/\/ \u83b7\u53d6\u51fa\u751f\u65e5\u671f\u4fe1\u606f\n      const birthYear = document.querySelector('birth_year').value;\n      const birthMonth = document.querySelector('birth_month').value;\n      const birthDay = document.querySelector('birth_day').value;\n      const birthHour = document.querySelector('birth_hour').value;<\/p>\n<p>      \/\/ \u8ba1\u7b97\u516c\u5386\u51fa\u751f\u65f6\u95f4\n      const civilTime = new Date(birthYear, birthMonth - 1, birthDay, birthHour);<\/p>\n<p>      \/\/ \u8ba1\u7b97\u519c\u5386\u51fa\u751f\u65f6\u95f4\n      const lunarTime = calendar.solar2lunar(civilTime);<\/p>\n<p>      \/\/ \u8ba1\u7b97\u516b\u5b57\n      const bazi = calculateBazi(lunarTime);<\/p>\n<p>      \/\/ \u663e\u793a\u7ed3\u679c\n      result.innerHTML = `\n        <b>\u516c\u5386\u51fa\u751f\u65f6\u95f4\uff1a<\/b>${civilTime.toLocaleDateString()} ${civilTime.toLocaleTimeString()}<br \/>\n        <b>\u519c\u5386\u51fa\u751f\u65f6\u95f4\uff1a<\/b>${lunarTime.lunarYear}\u5e74${lunarTime.lunarMonth}\u6708${lunarTime.lunarDay}\u65e5${lunarTime.lunarHour}\u65f6<br \/>\n        <b>\u516b\u5b57\uff1a<\/b>${bazi[0]} ${bazi[1]} ${bazi[2]} ${bazi[3]}<br \/>\n        <b>\u4e94\u884c\uff1a<\/b>${bazi[4]} ${bazi[5]} ${bazi[6]} ${bazi[7]} ${bazi[8]}<br \/>\n        <b>\u7eb3\u97f3\uff1a<\/b>${bazi[9]} ${bazi[10]} ${bazi[11]} ${bazi[12]}<br \/>\n        <b>\u672c\u547d\u5c5e\u76f8\uff1a<\/b>${lunarTime.zodiac}<br \/>\n        <b>\u5929\u4e0a\u706b\u547d<\/b><br \/>\n        <b>\u4e94\u884c\u3010\u91d1\u65fa\u3011\u3010\u571f\u65fa\u3011\u3010\u7f3a\u6728\u3011<\/b>\uff0c\u65e5\u4e3b\u5929\u5e72\u4e3a\u3010\u91d1\u3011\uff0c\u751f\u4e8e\u3010\u590f\u5b63\u3011\u3002<br \/>\n        <b>\u3010\u540c\u7c7b\u91d1\u571f\uff0c\u5f02\u7c7b\u706b\u6728\u6c34\u3011<\/b><br \/>\n        <small>\u5c0f\u8d34\u58eb\uff1a\u672c\u7ed3\u679c\u4e3a\u7cfb\u7edf\u81ea\u52a8\u5206\u6790\uff0c\u4ec5\u4f9b\u53c2\u8003\uff0c\u516b\u5b57\u7f3a\u4ec0\u4e48\u4e0e\u8865\u4ec0\u4e48\u65e0\u5173\uff0c\u5177\u4f53\u5e94\u7531\u4e13\u4e1a\u8001\u5e08\u5206\u6790\uff01<\/small><br \/>\n      `;\n    });<\/p>\n<p>    \/\/ \u8ba1\u7b97\u516b\u5b57\n    function calculateBazi(lunarTime) {\n      \/\/ \u83b7\u53d6\u5e74\u67f1\n      let yearStem = getStem(lunarTime.lunarYear);\n      let yearBranch = getBranch(lunarTime.lunarYear);<\/p>\n<p>      \/\/ \u83b7\u53d6\u6708\u67f1\nlet monthStem = getStem(lunarTime.lunarMonth);\n      let monthBranch = getBranch(lunarTime.lunarMonth);<\/p>\n<p>      \/\/ \u83b7\u53d6\u65e5\u67f1\n      let dayStem = getStem(lunarTime.lunarDay);\n      let dayBranch = getBranch(lunarTime.lunarDay);<\/p>\n<p>      \/\/ \u83b7\u53d6\u65f6\u67f1\n      let hourStem = getStem(lunarTime.lunarHour);\n      let hourBranch = getBranch(lunarTime.lunarHour);<\/p>\n<p>      return [\n        yearStem,\n        yearBranch,\n        monthStem,\n        monthBranch,\n        dayStem,\n        dayBranch,\n        hourStem,\n        hourBranch,<\/p>\n<p>        \/\/ \u4e94\u884c\n        getElement(yearStem),\n        getElement(yearBranch),\n        getElement(monthStem),\n        getElement(monthBranch),\n        getElement(dayStem),\n        getElement(dayBranch),\n        getElement(hourStem),\n        getElement(hourBranch),<\/p>\n<p>        \/\/ \u7eb3\u97f3\n        getNayin(yearStem, yearBranch),\n        getNayin(monthStem, monthBranch),\n        getNayin(dayStem, dayBranch),\n        getNayin(hourStem, hourBranch),\n      ];\n    }<\/p>\n<p>    \/\/ \u83b7\u53d6\u5929\u5e72\n    function getStem(year) {\n      return ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'][year % 10];\n    }<\/p>\n<p>    \/\/ \u83b7\u53d6\u5730\u652f\n    function getBranch(year) {\n      return ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'][year % 12];\n    }<\/p>\n<p>    \/\/ \u83b7\u53d6\u4e94\u884c\n    function getElement(stem) {\n      switch (stem) {\n        case '\u7532':\n        case '\u4e59':\n          return '\u6728';\n        case '\u4e19':\n        case '\u4e01':\n          return '\u706b';\n        case '\u620a':\n        case '\u5df1':\n          return '\u571f';\n        case '\u5e9a':\n        case '\u8f9b':\n          return '\u91d1';\n        case '\u58ec':\n        case '\u7678':\n          return '\u6c34';\n      }\n    }<\/p>\n<p>    \/\/ \u83b7\u53d6\u7eb3\u97f3\n    function getNayin(stem, branch) {\n      switch (stem + branch) {\n        case '\u7532\u5b50':\n        case '\u5df1\u672a':\n          return '\u5929\u4e0a\u706b';\n        case '\u4e59\u4e11':\n        case '\u5e9a\u7533':\n          return '\u6d77\u4e2d\u91d1';\n        case '\u4e19\u5bc5':\n        case '\u8f9b\u9149':\n          return '\u7089\u4e2d\u706b';\n        case '\u4e01\u536f':\n        case '\u58ec\u620c':\n          return '\u5927\u6797\u6728';\n        case '\u620a\u8fb0':\n        case '\u7678\u4ea5':\n          return '\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u51fa\u751f\u5e74\u4efd\uff0c\u51fa\u751f\u6708\u4efd\uff0c\u51fa\u751f\u65e5\u671f\uff0c\u51fa\u751f\u65f6\u8fb0\uff0c\u8ba1\u7b97\uff0c\u83b7\u53d6\u8868\u5355\u5143\u7d20constform=document.querySelector\uff0cform\uff0cconstresult=document.querySelector\uff0cresult\uff0c\u76d1\u542c\u8868\u5355\u63d0\u4ea4\u4e8b\u4ef6form.addEventListener\uff0csubmit\uff0cevent\uff0c=\uff0c\u963b\u6b62\u8868\u5355\u9ed8&#8230;\u3002<\/p>\n","protected":false},"author":1,"featured_media":18576,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8257],"class_list":["post-18577","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-12shengxiao","tag-8257"],"_links":{"self":[{"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/posts\/18577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/comments?post=18577"}],"version-history":[{"count":1,"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/posts\/18577\/revisions"}],"predecessor-version":[{"id":18578,"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/posts\/18577\/revisions\/18578"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/media\/18576"}],"wp:attachment":[{"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/media?parent=18577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/categories?post=18577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/0592ban.cn\/index.php\/wp-json\/wp\/v2\/tags?post=18577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}