{"id":973,"date":"2025-11-04T06:22:36","date_gmt":"2025-11-04T06:22:36","guid":{"rendered":"https:\/\/mstaragency.com\/?page_id=973"},"modified":"2025-11-04T07:42:01","modified_gmt":"2025-11-04T07:42:01","slug":"lottery-with-invite","status":"publish","type":"page","link":"https:\/\/mstaragency.com\/es\/home\/lottery-with-invite\/","title":{"rendered":"Lottery with Invite"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"973\" class=\"elementor elementor-973\">\n\t\t\t\t<div class=\"elementor-element elementor-element-792cdc25 e-flex e-con-boxed e-con e-parent\" data-id=\"792cdc25\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-74c8683b elementor-widget elementor-widget-text-editor\" data-id=\"74c8683b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div id=\"mstar-lottery\"><\/div>\n<p>    <script>\n    (function () {\n      \/\/ \u2705 \u6bcf\u6b21\u8fdb\u5165\/\u5237\u65b0\u90fd\u5f3a\u5236\u8f93\u5165\u9080\u8bf7\u7801\uff08\u4e0d\u4f7f\u7528 sessionStorage\uff09\n      var validCodes = [\"ABC123\",\"XYZ789\",\"MSTAR2025\"]; \/\/ \u2190 \u5728\u8fd9\u91cc\u7ef4\u62a4\u4f60\u7684\u9080\u8bf7\u7801\n      var code = prompt(\"\u8bf7\u8f93\u5165\u9080\u8bf7\u7801\uff08\u5927\u5c0f\u5199\u4e0d\u654f\u611f\uff09\uff1a\");\n      if (!code) { alert(\"\u672a\u8f93\u5165\u9080\u8bf7\u7801\"); location.href=\"\/\"; return; }\n      code = code.trim().toUpperCase();\n      if (validCodes.indexOf(code) === -1) { alert(\"\u9080\u8bf7\u7801\u65e0\u6548\"); location.href=\"\/\"; return; }\n      window.__MSTAR_INVITE__ = code; \/\/ \u4f20\u7ed9\u9886\u5956\u8868\u5355\u4fdd\u5b58\n    })();\n    <\/script><\/p>\n<p>    [wp_optin_wheel wheel_id=&#8221;1&#8243;]<br \/>\n    <script>\n    \/\/ \u5982\u679c\u63d2\u4ef6\u6709\u6d3e\u53d1\u201c\u8f6c\u5b8c\u201d\u4e8b\u4ef6\uff0c\u76d1\u542c\u5373\u53ef\u663e\u793a\u8868\u5355\uff1b\u6ca1\u6709\u5c31\u63d0\u4f9b\u515c\u5e95\u6309\u94ae\n    document.addEventListener(\"wpo_wheel_spin_complete\", function(){ showWinnerForm(); });<\/p>\n<p>    \/\/ \u515c\u5e95\uff1a5\u79d2\u540e\u5982\u679c\u8fd8\u6ca1\u51fa\u8868\u5355\uff0c\u5c31\u7ed9\u4e00\u4e2a\u201c\u586b\u5199\u9886\u5956\u4fe1\u606f\u201d\u6309\u94ae\n    setTimeout(function(){\n      if(!document.getElementById('winnerForm')){\n        var btn = document.createElement('button');\n        btn.textContent = '\u586b\u5199\u9886\u5956\u4fe1\u606f';\n        btn.style.marginTop = '12px';\n        btn.onclick = showWinnerForm;\n        (document.querySelector('#mstar-lottery')||document.body).appendChild(btn);\n      }\n    }, 5000);<\/p>\n<p>    function showWinnerForm(){\n      if(document.getElementById('winnerForm')) return;\n      var html =\n        '<\/p>\n<div id=\"winnerForm\" style=\"position:fixed;inset:0;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:99999;\">'\n       +'  <\/p>\n<div style=\"background:#fff;padding:24px 24px 16px;border-radius:12px;max-width:420px;width:92%;\">'\n       +'    <\/p>\n<h3 style=\"margin:0 0 12px\">\ud83c\udf89 \u606d\u559c\u4e2d\u5956\uff01\u8bf7\u586b\u5199\u9886\u5956\u4fe1\u606f<\/h3>\n<p>'\n       +'    <label>\u59d3\u540d<\/label><input id=\"w_name\" style=\"width:100%;margin:6px 0 12px\" type=\"text\">'\n       +'    <label>\u7535\u8bdd<\/label><input id=\"w_phone\" style=\"width:100%;margin:6px 0 12px\" type=\"text\">'\n       +'    <label>\u5730\u5740<\/label><input id=\"w_address\" style=\"width:100%;margin:6px 0 12px\" type=\"text\">'\n       +'    <label>TikTok \u4e3b\u9875\/Handle<\/label><input id=\"w_tiktok\" style=\"width:100%;margin:6px 0 16px\" type=\"text\" placeholder=\"@\u4f60\u7684ID \u6216\u4e3b\u9875\u94fe\u63a5\">'\n       +'    <\/p>\n<div style=\"display:flex;gap:8px;justify-content:flex-end\">'\n       +\"      <button onclick=\\\"document.getElementById('winnerForm').remove()\\\">\u53d6\u6d88<\/button>\"\n       +'      <button onclick=\"submitWinnerInfo()\">\u63d0\u4ea4<\/button>'\n       +'    <\/div>\n<p>'\n       +'  <\/p><\/div>\n<p>'\n       +'<\/p><\/div>\n<p>';\n      document.body.insertAdjacentHTML('beforeend', html);\n    }<\/p>\n<p>    \/\/ \u63d0\u4ea4\u4fdd\u5b58\u5230 WP\uff08options \u6301\u4e45\u5316\uff09\u5e76\u90ae\u4ef6\u901a\u77e5\u7ba1\u7406\u5458\n    function submitWinnerInfo(){\n      var payload = {\n        name:    document.getElementById('w_name').value.trim(),\n        phone:   document.getElementById('w_phone').value.trim(),\n        address: document.getElementById('w_address').value.trim(),\n        tiktok:  document.getElementById('w_tiktok').value.trim(),\n        invite:  window.__MSTAR_INVITE__ || ''\n      };\n      if(!payload.name || !payload.phone || !payload.address || !payload.tiktok){\n        alert('\u8bf7\u5b8c\u6574\u586b\u5199'); return;\n      }\n      fetch('https:\/\/mstaragency.com\/wp-admin\/admin-ajax.php', {\n        method: 'POST',\n        headers: {'Content-Type':'application\/x-www-form-urlencoded;charset=UTF-8'},\n        body: new URLSearchParams(Object.assign({action:'mstar_save_winner'}, payload))\n      })\n      .then(r => r.json())\n      .then(resp => { alert(resp.message || '\u63d0\u4ea4\u6210\u529f'); document.getElementById('winnerForm').remove(); })\n      .catch(() => alert('\u63d0\u4ea4\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5'));\n    }\n    <\/script><\/p>\n\n\n\n<p><\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":222,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"elementor_theme","meta":{"footnotes":""},"class_list":["post-973","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/pages\/973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/comments?post=973"}],"version-history":[{"count":6,"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/pages\/973\/revisions"}],"predecessor-version":[{"id":992,"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/pages\/973\/revisions\/992"}],"up":[{"embeddable":true,"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/pages\/222"}],"wp:attachment":[{"href":"https:\/\/mstaragency.com\/es\/wp-json\/wp\/v2\/media?parent=973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}