{"id":1841,"date":"2025-08-29T12:54:21","date_gmt":"2025-08-29T04:54:21","guid":{"rendered":"https:\/\/stayeasyinn.net\/?page_id=1841"},"modified":"2025-10-02T17:31:45","modified_gmt":"2025-10-02T09:31:45","slug":"join","status":"publish","type":"page","link":"https:\/\/stayeasyinn.net\/ko\/join\/","title":{"rendered":"\u52a0\u5165\u6703\u54e1"},"content":{"rendered":"<div id=\"lml-wrap\">\n  <h3>\u52a0\u5165\u6703\u54e1<\/h3>\n\n  <!-- \u624b\u6a5f\u5728\u5916\u90e8\u700f\u89bd\u5668\u6642\uff1a\u986f\u793a\u300c\u7528 LINE App \u958b\u555f\u300d -->\n  <div class=\"open-in-line\" style=\"display:none;\">\n    <a href=\"#\" onclick=\"openInLINE();return false;\" class=\"line-btn\">\u7528 LINE App \u958b\u555f<\/a>\n    <small>\u82e5\u672a\u6210\u529f\uff0c\u5c07\u6539\u7528\u700f\u89bd\u5668\u767b\u5165<\/small>\n  <\/div>\n\n  <!-- \u684c\u6a5f\uff1a\u986f\u793a QR Code\uff08\u53ef\u63db\u6210\u4f60\u7684 QR \u751f\u6210\u670d\u52d9\uff09 -->\n  <div class=\"desktop-qr\" style=\"display:none; text-align:center; margin-bottom:16px;\">\n    <p>\u8acb\u7528\u624b\u6a5f\u6383\u63cf\u958b\u555f LINE\uff1a<\/p>\n    <img id=\"line-qr\" alt=\"LINE QR\" style=\"width:200px;height:200px\">\n  <\/div>\n\n  <form onsubmit=\"return LML_Safe_Submit(event)\" action=\"\">\n    <label>\uc774\ub984* <input id=\"lml_name\" required><\/label><br>\n    <label>\u624b\u6a5f* <input id=\"lml_phone\" required maxlength=\"10\"><\/label><br>\n    <label>Email <input id=\"lml_email\" type=\"email\"><\/label><br>\n\n    <!-- \u65b0\u589e\uff1a\u8eab\u5206\u8b49\u8207\u751f\u65e5\uff08\u5fc5\u586b\uff09 -->\n    <label>\u8eab\u5206\u8b49\u865f* <input id=\"lml_nid\" required maxlength=\"10\"><\/label><br>\n    <label>\u751f\u65e5* <input id=\"lml_birthday\" required type=\"date\" placeholder=\"YYYY-MM-DD\"><\/label><br>\n\n    <div style=\"font-size:0.9em;color:#666;margin-top:8px;\">\n      * \u63d0\u4f9b\u8eab\u5206\u8b49\u8207\u751f\u65e5\u50c5\u4f5c\u70ba\u5e97\u5bb6\u6298\u6263\u8cc7\u683c\u6838\u5c0d\u4f7f\u7528\u3002\u6211\u5011\u53ea\u6703\u9a57\u8b49\u683c\u5f0f\u4e26\u4fdd\u5b58\u5fc5\u8981\u6b04\u4f4d\uff08\u4e0d\u6703\u516c\u958b\u986f\u793a\uff09\u3002\n    <\/div>\n\n    <label><input id=\"lml_consent\" type=\"checkbox\"> \u6211\u540c\u610f\u63a5\u6536\u884c\u92b7\u8a0a\u606f<\/label><br>\n\n    <button type=\"submit\">\u9001\u51fa<\/button>\n  <input type=\"hidden\" name=\"trp-form-language\" value=\"ko\"\/><\/form>\n<\/div>\n\n<!-- \u63d0\u4f9b goProfile() \u4f7f\u7528 -->\n<script>\n  window.LML_PROFILE_PAGE_URL = \"https:\\\/\\\/stayeasyinn.net\\\/ko\\\/profile\\\/\";\n  window.LML_PROFILE_LIFF_ID  = \"2008012141-bWgDmRL3\";\n<\/script>\n\n<script src=\"https:\/\/static.line-scdn.net\/liff\/edge\/2\/sdk.js\"><\/script>\n<script>\n(function(){\n  var st = { userId:null, endpoint:\"https:\/\/stayeasyinn.net\/ko\/wp-json\/line\/v1\/member\" };\n  var LIFF_ID   = \"2008012141-bWgDmRL3\";\n  var REDIRECT  = \"https:\/\/stayeasyinn.net\/ko\/join\/\";\n  var IN_LINE   = \/Line\\\/\/i.test(navigator.userAgent);\n  var IS_MOBILE = \/iPhone|iPad|iPod|Android\/i.test(navigator.userAgent);\n\n  if (!LIFF_ID) {\n    console.error(\"[join] LIFF_ID \u672a\u8a2d\u5b9a\");\n  }\n\n  \/\/ ==== \u5171\u7528\uff1a\u5efa LIFF \u9023\u7d50\uff08\u53ef\u628a\u4f7f\u7528\u8005\u62c9\u56de LINE App \u4e26\u5c0e\u81f3\u6307\u5b9a\u9801\uff09====\n  function buildLiffUrl(liffId, redirectUrl){\n    return 'https:\/\/liff.line.me\/' + encodeURIComponent(liffId) +\n           '?liff.redirectUri=' + encodeURIComponent(redirectUrl);\n  }\n\n  \/\/ ==== \u53bb Profile\uff08\u512a\u5148\u7528 LIFF \u9023\u7d50\uff1b\u5916\u90e8\u700f\u89bd\u5668\u4e5f\u6703\u62c9\u56de LINE App\uff09====\n  const PROFILE_LIFF_ID  = window.LML_PROFILE_LIFF_ID  || LIFF_ID;\n  const PROFILE_PAGE_URL = window.LML_PROFILE_PAGE_URL || '\/profile\/';\n  async function goProfile(){\n    var liffUrl = PROFILE_LIFF_ID ? buildLiffUrl(PROFILE_LIFF_ID, PROFILE_PAGE_URL) : PROFILE_PAGE_URL;\n    try{\n      \/\/ \u5728 LINE App webview\n      if (typeof liff !== 'undefined' && typeof liff.isInClient === 'function' && liff.isInClient()){\n        try{\n          \/\/ \u5617\u8a66\u5728\u7576\u524d webview \u76f4\u63a5\u5207\u5230 profile \u9801\uff08\u540c LIFF \u60c5\u6cc1\uff09\n          if (PROFILE_LIFF_ID){\n            await liff.init({ liffId: PROFILE_LIFF_ID });\n          }\n          window.location.replace(PROFILE_PAGE_URL);\n          return;\n        }catch(_){\n          \/\/ \u4e0d\u540c LIFF \u6216 init \u5931\u6557 \u2192 \u7528 openWindow \u6253 LIFF \u9023\u7d50\n          await liff.openWindow({ url: liffUrl, external: false });\n          return;\n        }\n      }\n      \/\/ \u5916\u90e8\u700f\u89bd\u5668\uff1a\u4e1f LIFF \u9023\u7d50\u628a\u4eba\u62c9\u56de App\n      window.location.replace(liffUrl);\n    }catch(e){\n      \/\/ \u6700\u5f8c\u4fdd\u5e95\n      window.location.replace(PROFILE_PAGE_URL);\n    }\n  }\n\n  \/\/ ==== \u6df1\u9023\u7d50\u5de5\u5177 ====\n  function deepLink(){\n    return \"line:\/\/app\/\" + encodeURIComponent(LIFF_ID) +\n           \"?liff.redirectUri=\" + encodeURIComponent(REDIRECT);\n  }\n  function webLink(){\n    return \"https:\/\/liff.line.me\/\" + encodeURIComponent(LIFF_ID) +\n           \"?liff.redirectUri=\" + encodeURIComponent(REDIRECT);\n  }\n  function androidIntent(){\n    return \"intent:\/\/app\/\" + encodeURIComponent(LIFF_ID) +\n           \"#Intent;scheme=line;package=jp.naver.line.android;\" +\n           \"S.browser_fallback_url=\" + encodeURIComponent(webLink()) + \";end\";\n  }\n\n  function setDesktopQR(){\n    var el = document.getElementById('line-qr');\n    if(!el) return;\n    \/\/ \u4f60\u4e5f\u53ef\u4ee5\u628a webLink() \u8f49\u6210 QR \u5716\uff0c\u9019\u88e1\u5148\u7528\u65e2\u6709\u793a\u610f\u5716\n    el.src = \"https:\/\/stayeasyinn.net\/wp-content\/uploads\/2025\/08\/qrcode-generator.png\";\n  }\n\n  function autoTryOpen(){\n    if (!IS_MOBILE || IN_LINE || !LIFF_ID) return;\n    var triedKey = \"liff_open_tried\";\n    if (sessionStorage.getItem(triedKey)) return;\n    sessionStorage.setItem(triedKey, \"1\");\n\n    location.href = deepLink();\n    setTimeout(function(){\n      if (\/Android\/i.test(navigator.userAgent)) location.href = androidIntent();\n      else location.href = webLink();\n    }, 1200);\n  }\n\n  function setupUX(){\n    if (IN_LINE){\n      initLIFF();\n      return;\n    }\n    if (IS_MOBILE){\n      document.querySelector('.open-in-line').style.display = 'block';\n      autoTryOpen();\n    } else {\n      document.querySelector('.desktop-qr').style.display = 'block';\n      setDesktopQR();\n    }\n    initLIFF();\n  }\n\n  \/\/ ==== \u5075\u6e2c\u662f\u5426\u525b\u5f9e LIFF\/\u6388\u6b0a\u56de\u4f86 & \u6e05\u53c3 ====\n  function cameFromLiffAuth(){\n    var q = new URLSearchParams(location.search);\n    return q.has('code') || q.has('state') || q.has('liff.state') || q.has('liff_state') || q.has('liffClientId');\n  }\n  function clearAuthParams(){\n    try{\n      var q = new URLSearchParams(location.search);\n      ['code','state','liff.state','liff_state','liffClientId'].forEach(function(k){ q.delete(k); });\n      if (history.replaceState){\n        var clean = location.pathname + (q.toString()?('?'+q.toString()):'') + location.hash;\n        history.replaceState(null,'',clean);\n      }\n    }catch(_){}\n  }\n\n  \/\/ ==== \u521d\u59cb\u5316 LIFF\u3001\u62ff profile ====\n  async function initLIFF(){\n    if (!LIFF_ID) return;\n    try{\n      await liff.init({ liffId: LIFF_ID });\n\n      \/\/ \u53ea\u6709\u5728\u300c\u975e\u525b\u56de\u4f86\u300d\u4e14\u300c\u672a\u767b\u5165\u300d\u6642\u624d login\uff0c\u907f\u514d\u7121\u7aae\u8df3\u8f49\n      if (typeof liff.isLoggedIn === 'function' && !liff.isLoggedIn()){\n        if (!cameFromLiffAuth()) {\n          liff.login({ redirectUri: REDIRECT });\n          return;\n        }\n        \/\/ \u525b\u56de\u4f86\u4f46\u9084\u672a ready\uff0c\u7a0d\u7b49\u4e00\u4e0b\n        await new Promise(function(r){ setTimeout(r, 300); });\n      }\n\n      var prof = await liff.getProfile();\n      st.userId = prof.userId || null;\n\n      \/\/ \u6e05\u6389\u6b98\u53c3\n      clearAuthParams();\n    }catch(e){\n      console.error('[join] LIFF init error', e);\n    }\n  }\n\n  \/\/ \u624b\u52d5\u300c\u7528 LINE App \u958b\u555f\u300d\n  window.openInLINE = function(){\n    if (!LIFF_ID) return;\n    location.href = deepLink();\n    setTimeout(function(){\n      if (\/Android\/i.test(navigator.userAgent)) location.href = androidIntent();\n      else location.href = webLink();\n    }, 800);\n  };\n\n  \/\/ \u57fa\u672c\u6aa2\u67e5\n  function validTwId(id){ return \/^[A-Z][0-9]{9}$\/.test((id||'').toUpperCase().trim()); }\n  function validPhone(p){ return \/^[0-9]{10}$\/.test(p||''); }\n\n  \/\/ ==== \u9001\u51fa\u8868\u55ae ====\n  window.LML_Safe_Submit = async function(e){\n    e.preventDefault();\n\n    var name = document.getElementById('lml_name').value.trim();\n    var phone = document.getElementById('lml_phone').value.trim();\n    var email = document.getElementById('lml_email').value.trim();\n    var nid = document.getElementById('lml_nid').value.trim().toUpperCase();\n    var birthday = document.getElementById('lml_birthday').value.trim();\n    var consent_marketing = document.getElementById('lml_consent').checked ? 1 : 0;\n\n    if (!name){ alert('\u8acb\u586b\u5beb\u59d3\u540d'); return false; }\n    if (!phone || !validPhone(phone)){ alert('\u624b\u6a5f\u683c\u5f0f\u932f\u8aa4\uff0c\u8acb\u8f38\u5165 10 \u4f4d\u6578\u5b57'); return false; }\n    if (!nid || !validTwId(nid)){ alert('\u8eab\u5206\u8b49\u683c\u5f0f\u6709\u8aa4\uff08A123456789\uff09'); return false; }\n    if (!birthday){ alert('\u8acb\u586b\u5beb\u751f\u65e5'); return false; }\n\n    if (!st.userId){\n      alert('\u5c1a\u672a\u53d6\u5f97 LINE \u8eab\u5206\uff0c\u8acb\u7528 LINE App \u958b\u555f\u6216\u7a0d\u5f8c\u518d\u8a66');\n      return false;\n    }\n\n    var payload = {\n      line_user_id: st.userId,\n      name: name,\n      phone: phone,\n      email: email,\n      national_id: nid,\n      birthday: birthday,\n      consent_marketing: consent_marketing\n    };\n\n    try {\n      var res = await fetch(st.endpoint, {\n        method:'POST',\n        headers:{'Content-Type':'application\/json'},\n        body: JSON.stringify(payload),\n        credentials:'same-origin'\n      });\n\n      var data = null; try { data = await res.clone().json(); } catch(_){}\n\n      if (res.status === 409 || (data && data.error === 'already_member')) {\n        alert('\u6b64 LINE \u5df2\u52a0\u5165\u6703\u54e1\uff0c\u7121\u9700\u91cd\u8907\u8a3b\u518a');\n        await goProfile();\n        return false;\n      }\n\n      if (res.ok){\n        alert('\u5b8c\u6210\uff01\u5df2\u52a0\u5165\u6703\u54e1');\n        await goProfile();\n      } else {\n        var msg = '\u9001\u51fa\u5931\u6557';\n        if (data && (data.error || data.msg)) msg = data.error || data.msg;\n        alert(msg);\n      }\n    } catch(err){\n      console.error(err);\n      alert('\u9001\u51fa\u932f\u8aa4\uff0c\u8acb\u7a0d\u5f8c\u518d\u8a66');\n    }\n    return false;\n  };\n\n  \/\/ \u555f\u52d5 UX\n  setupUX();\n})();\n<\/script>\n\n<style>\n.open-in-line { text-align:center; margin-bottom:16px; }\n.open-in-line .line-btn{\n  display:inline-block; padding:10px 16px; border-radius:999px;\n  background:#06c755; color:#fff; font-weight:600; text-decoration:none;\n}\n.open-in-line small{ display:block; color:#666; margin-top:6px; }\n<\/style>\n\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"\u52a0\u5165\u6703\u54e1 \u7528 LINE App \u958b\u555f \u82e5\u672a\u6210\u529f\uff0c\u5c07\u6539\u7528\u700f\u89bd\u5668\u767b\u5165 \u8acb\u7528\u624b\u6a5f\u6383\u63cf\u958b\u555f LINE\uff1a \u59d3\u540d* \u624b\u6a5f* [...]","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1841","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/pages\/1841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/comments?post=1841"}],"version-history":[{"count":6,"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/pages\/1841\/revisions"}],"predecessor-version":[{"id":1864,"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/pages\/1841\/revisions\/1864"}],"wp:attachment":[{"href":"https:\/\/stayeasyinn.net\/ko\/wp-json\/wp\/v2\/media?parent=1841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}