Files
jk8_admin/public/assets/gameRtp-D9_K6WW6.js
2026-06-23 10:00:48 +08:00

46 lines
15 KiB
JavaScript

import{B as Re,a as B,b as c,l as J,o as Ce,D as T,G as i,U as s,u as r,H as o,P as d,Z as X,Y as K,a7 as he,_ as Ve,I as f,X as xe,C as U,V as b,O as we,ah as x,ag as W}from"./vue-DweYBrEc.js";import{x as ke,_ as Ue}from"./index-BIzd9_wD.js";import{g as Ie,a as Be,b as Te,e as Ae,c as Se}from"./embed-DFo9NHr7.js";const Ee={class:"default-main game-rtp-page"},Ne={class:"setting-grid"},qe={class:"panel setting-panel"},De={class:"panel-title"},Me={class:"panel-body setting-form"},Oe={class:"form-row"},ze={class:"form-row"},Ge={class:"form-row"},Pe={class:"form-hint"},Fe={class:"form-row"},je={class:"form-hint"},Le={class:"form-row textarea-row"},$e={class:"form-row"},He={class:"form-row"},Je={class:"color-grid"},Xe={class:"panel embed-panel"},Ke={class:"panel-title"},We={class:"panel-body"},Ye={class:"panel data-panel"},Ze={class:"panel-title"},Qe={class:"filter-bar"},et={class:"filter-field"},tt={class:"filter-field"},at={class:"filter-actions"},lt={class:"table-wrap"},ot=["href"],rt={class:"table-footer"},nt={class:"bottom-actions"},Y=`{
"customGameRTP": [
{"max": 99, "min": 95, "gameId": 153},
{"max": 80, "min": 60, "gameId": 723}
],
"providerNameMapping": {
"VP": "V-POWER",
"MG888H52": "MEGA888 H5"
}
}`,it=Re({name:"embed/gameRtp",__name:"gameRtp",setup(st){const{t}=ke.useI18n(),n=B({autoRtp:1,autoAmount:'{"max":"90","min":"30"}',frequency:"10",providerDisplay:"",customConfig:"",headerImage:"",textColor:"#ffffff",baseColor:"#045bb9",outlineColor:"#000000",buttonTextColor:"#ffffff",buttonBgColor:"#1c202a",progressBgColor:"#5f5f5f"}),Z=[{key:"textColor",label:"embed.gameRtp.textColor"},{key:"baseColor",label:"embed.gameRtp.baseColor"},{key:"outlineColor",label:"embed.gameRtp.outlineColor"},{key:"buttonTextColor",label:"embed.gameRtp.buttonTextColor"},{key:"buttonBgColor",label:"embed.gameRtp.buttonBgColor"},{key:"progressBgColor",label:"embed.gameRtp.progressBgColor"}],A=c(""),S=c(`<div style="position: relative;max-width: 1000px;margin: 0 auto;overflow: hidden;border: none;">
<iframe id="gameRtpIframe" src="https://api.tl-tech.top/index.php/api/external/gameRtp" style="width: 100%;overflow: hidden;border: none;"></iframe>
<script>
(() => {
const merchantId = (typeof _ !== "undefined" && typeof _.getVar === "function") ? (_.getVar("merchantId") ?? "") : "";
if (!merchantId) {
console.log("merchantId not found");
return;
}
function init(iframe) {
iframe.addEventListener('load', function() {
iframe.contentWindow.postMessage({ type: 'setIframeData', clientMerchant: merchantId }, '*');
});
window.addEventListener("message", function(event) {
if (event.data && event.data.type === "setGameRtpIframeHeight") {
iframe.style.height = event.data.height + 50 + "px";
}
}, false);
}
var el = document.getElementById('gameRtpIframe');
if (el) { init(el); return; }
var attempts = 0;
var timer = setInterval(function() {
attempts++;
var el = document.getElementById('gameRtpIframe');
if (el) {
clearInterval(timer);
init(el);
} else if (attempts >= 5) {
clearInterval(timer);
alert("iframe not found");
}
}, 1000);
})();
/script>
</div>`),I=c([]),h=B({provider:"",name:""}),E=B({provider:"",name:""}),P=c([]),Q=J(()=>[...new Set([...P.value,...I.value.map(a=>a.provider)].filter(Boolean))].sort()),_=c(1),F=c(1),j=c(50),L=c(0),N=c(!1),y=a=>{const e=Number(a);return Number.isFinite(e)?e:0},ee=a=>{if(typeof a=="string"){const e=a.trim().toUpperCase();if(e==="ACTIVE")return 1;if(e==="INACTIVE")return 0}return y(a)===1?1:0},te=a=>{if(!a)return"";if(typeof a=="string"&&!/^\d+$/.test(a))return a;const e=y(a);return e?new Date(e*(e<1e12?1e3:1)).toLocaleString():""},q=a=>a?typeof a=="string"?a:JSON.stringify(a):"",ae=a=>{a&&(n.autoRtp=y(a.auto_game_rtp)===1?1:0,n.autoAmount=q(a.auto_rtp_amount),n.frequency=String(a.auto_frequency??""),n.providerDisplay=q(a.provider_display),n.customConfig=q(a.custom_config),n.headerImage=a.header_image_url??"",n.textColor=a.text_color??"",n.buttonTextColor=a.button_text_color??"",n.baseColor=a.base_color??"",n.buttonBgColor=a.button_bg_color??"",n.outlineColor=a.outline_color??"",n.progressBgColor=a.progress_bar_bg_color??"",A.value=te(a.update_time))},le=a=>{const e=(a==null?void 0:a.data)??a??{},p=(Array.isArray(e.list)?e.list:[]).map(m=>({id:y(m.id??m.game_id),provider:String(m.provider_site??m.game_provider??m.provider??m.type??""),name:String(m.game_name??m.name??""),imageUrl:String(m.game_image_url??m.image_url??m.url??""),rtp:m.game_rtp==null&&m.rtp==null?null:y(m.game_rtp??m.rtp),status:ee(m.game_status??m.status)}));_.value===1&&p.length&&(j.value=p.length);const g=y(e.total??p.length);return{rows:p,total:g,lastPage:Math.max(1,Math.ceil(g/j.value)),providers:Array.isArray(e.provider)?e.provider.map(String):[],setting:e.rtp_setting}},R=async()=>{N.value=!0;try{const a=await Ie({provider:E.provider,game_name:E.name,page:_.value}),e=le(a.data);I.value=e.rows,L.value=e.total,F.value=e.lastPage,P.value=e.providers,ae(e.setting)}finally{N.value=!1}},D=async()=>{Object.assign(E,h),_.value=1,await R()},oe=async()=>{Object.assign(h,{provider:"",name:""}),await D()},re=()=>{n.customConfig=Y},M=c(!1),ne=async()=>{let a,e=[],v={};try{const p=JSON.parse(n.autoAmount);if(!p||Array.isArray(p)||typeof p!="object")throw new Error;a=p}catch{x.error(t("embed.gameRtp.invalidAutoAmount"));return}try{if(n.providerDisplay.trim()){const p=JSON.parse(n.providerDisplay);if(!p||typeof p!="object")throw new Error;e=p}}catch{x.error(t("embed.gameRtp.invalidProviderDisplay"));return}try{if(n.customConfig.trim()){const p=JSON.parse(n.customConfig);if(!p||Array.isArray(p)||typeof p!="object")throw new Error;v=p}}catch{x.error(t("embed.gameRtp.invalidCustomConfig"));return}M.value=!0;try{await Be({auto_game_rtp:n.autoRtp,auto_rtp_amount:a,auto_frequency:y(n.frequency),provider_display:e,custom_config:v,header_image_url:n.headerImage,text_color:n.textColor,button_text_color:n.buttonTextColor,base_color:n.baseColor,button_bg_color:n.buttonBgColor,outline_color:n.outlineColor,progress_bar_bg_color:n.progressBgColor}),await R()}finally{M.value=!1}},ie=async()=>{try{await navigator.clipboard.writeText(S.value),x.success(t("embed.gameRtp.copied"))}catch{x.error(t("embed.gameRtp.copyFailed"))}},V=c(!1),O=c("create"),z=c(),w=c(!1),$=c(),u=B({provider:"",name:"",imageUrl:"",rtp:0,status:1}),se=J(()=>({provider:[{required:!0,message:t("embed.gameRtp.providerRequired"),trigger:"blur"}],name:[{required:!0,message:t("embed.gameRtp.nameRequired"),trigger:"blur"}],imageUrl:[{required:!0,message:t("embed.gameRtp.urlRequired"),trigger:"blur"}]})),H=(a,e)=>{O.value=a,z.value=e==null?void 0:e.id,Object.assign(u,e??{provider:"",name:"",imageUrl:"",rtp:0,status:1}),V.value=!0},me=async()=>{var a;if(await((a=$.value)==null?void 0:a.validate().catch(()=>!1)))if(O.value==="create"){w.value=!0;try{await Te({provider_site:u.provider,game_name:u.name,image_url:u.imageUrl,rtp:u.rtp,status:u.status}),V.value=!1,_.value=1,await R()}finally{w.value=!1}}else{if(z.value==null)return;w.value=!0;try{await Ae({id:z.value,provider_site:u.provider,game_name:u.name,image_url:u.imageUrl,rtp:u.rtp,status:u.status}),V.value=!1,await R()}finally{w.value=!1}}},de=async a=>{try{await W.confirm(t("embed.gameRtp.deleteConfirm",{name:a.name}),t("embed.gameRtp.warning"),{type:"warning",confirmButtonText:t("embed.gameRtp.confirm"),cancelButtonText:t("embed.gameRtp.cancel")}),await Se({ids:[a.id]}),I.value.length===1&&_.value>1&&(_.value-=1),await R()}catch{return}},ue=async()=>{try{await W.confirm(t("embed.gameRtp.importConfirm"),t("embed.gameRtp.warning"),{type:"warning",confirmButtonText:t("embed.gameRtp.confirm"),cancelButtonText:t("embed.gameRtp.cancel")}),A.value=new Date().toLocaleString(),x.success(t("embed.gameRtp.imported"))}catch{return}};return Ce(R),(a,e)=>{const v=f("el-option"),p=f("el-select"),g=f("el-input"),m=f("el-button"),pe=f("el-color-picker"),C=f("el-table-column"),ce=f("el-tag"),ge=f("el-table"),fe=f("el-pagination"),k=f("el-form-item"),be=f("el-input-number"),ve=f("el-form"),_e=f("el-dialog"),ye=xe("loading");return U(),T("div",Ee,[i("section",Ne,[i("div",qe,[i("div",De,s(r(t)("embed.gameRtp.settingTitle")),1),i("div",Me,[i("div",Oe,[i("label",null,s(r(t)("embed.gameRtp.autoRtp"))+":",1),o(p,{modelValue:n.autoRtp,"onUpdate:modelValue":e[0]||(e[0]=l=>n.autoRtp=l)},{default:d(()=>[o(v,{label:"OFF",value:0}),o(v,{label:"ON",value:1})]),_:1},8,["modelValue"])]),i("div",ze,[i("label",null,s(r(t)("embed.gameRtp.autoAmount"))+":",1),o(g,{modelValue:n.autoAmount,"onUpdate:modelValue":e[1]||(e[1]=l=>n.autoAmount=l),placeholder:'e.g. {"max":70,"min":20}'},null,8,["modelValue"])]),i("div",Ge,[i("label",null,s(r(t)("embed.gameRtp.frequency"))+":",1),o(g,{modelValue:n.frequency,"onUpdate:modelValue":e[2]||(e[2]=l=>n.frequency=l),placeholder:"e.g. 60"},null,8,["modelValue"])]),i("div",Pe,s(r(t)("embed.gameRtp.lastRefresh"))+": "+s(A.value),1),i("div",Fe,[i("label",null,s(r(t)("embed.gameRtp.providerDisplay"))+":",1),o(g,{modelValue:n.providerDisplay,"onUpdate:modelValue":e[3]||(e[3]=l=>n.providerDisplay=l),placeholder:'e.g. ["XE88","LFC2","GMSL1"]'},null,8,["modelValue"])]),i("div",je,s(r(t)("embed.gameRtp.providerHint")),1),i("div",Le,[i("label",null,s(r(t)("embed.gameRtp.customConfig"))+":",1),o(g,{modelValue:n.customConfig,"onUpdate:modelValue":e[4]||(e[4]=l=>n.customConfig=l),type:"textarea",rows:7,placeholder:Y,resize:"vertical"},null,8,["modelValue"])]),i("div",$e,[e[18]||(e[18]=i("label",null,null,-1)),o(m,{size:"small",onClick:re},{default:d(()=>[b(s(r(t)("embed.gameRtp.loadTemplate")),1)]),_:1})]),i("div",He,[i("label",null,s(r(t)("embed.gameRtp.headerImage"))+":",1),o(g,{modelValue:n.headerImage,"onUpdate:modelValue":e[5]||(e[5]=l=>n.headerImage=l),placeholder:"e.g. https://image.png"},null,8,["modelValue"])]),i("div",Je,[(U(),T(X,null,K(Z,l=>i("div",{key:l.key,class:"color-item"},[i("label",null,s(r(t)(l.label))+":",1),o(pe,{modelValue:n[l.key],"onUpdate:modelValue":G=>n[l.key]=G},null,8,["modelValue","onUpdate:modelValue"]),i("span",null,s(n[l.key]),1)])),64))]),o(m,{type:"primary",class:"save-button",loading:M.value,onClick:ne},{default:d(()=>[b(s(r(t)("embed.gameRtp.save")),1)]),_:1},8,["loading"])])]),i("div",Xe,[i("div",Ke,s(r(t)("embed.gameRtp.embedCode")),1),i("div",We,[o(g,{modelValue:S.value,"onUpdate:modelValue":e[6]||(e[6]=l=>S.value=l),type:"textarea",rows:23,readonly:"",resize:"none"},null,8,["modelValue"]),o(m,{class:"copy-button",onClick:ie},{default:d(()=>[b(s(r(t)("embed.gameRtp.copyCode")),1)]),_:1})])])]),i("section",Ye,[i("div",Ze,s(r(t)("embed.gameRtp.dataTitle")),1),i("div",Qe,[i("div",et,[i("label",null,s(r(t)("embed.gameRtp.provider"))+":",1),o(p,{modelValue:h.provider,"onUpdate:modelValue":e[7]||(e[7]=l=>h.provider=l),filterable:""},{default:d(()=>[o(v,{label:r(t)("embed.gameRtp.allProviders"),value:""},null,8,["label"]),(U(!0),T(X,null,K(Q.value,l=>(U(),we(v,{key:l,label:l,value:l},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),i("div",tt,[i("label",null,s(r(t)("embed.gameRtp.gameName"))+":",1),o(g,{modelValue:h.name,"onUpdate:modelValue":e[8]||(e[8]=l=>h.name=l),placeholder:r(t)("embed.gameRtp.searchName"),clearable:"",onKeyup:he(D,["enter"])},null,8,["modelValue","placeholder"])]),i("div",at,[o(m,{type:"primary",onClick:D},{default:d(()=>[b(s(r(t)("embed.gameRtp.search")),1)]),_:1}),o(m,{onClick:oe},{default:d(()=>[b(s(r(t)("embed.gameRtp.clear")),1)]),_:1})])]),Ve((U(),T("div",lt,[o(ge,{data:I.value,border:"",stripe:""},{default:d(()=>[o(C,{prop:"id",label:r(t)("embed.gameRtp.gameId"),width:"100"},null,8,["label"]),o(C,{prop:"provider",label:r(t)("embed.gameRtp.provider"),"min-width":"140"},null,8,["label"]),o(C,{prop:"name",label:r(t)("embed.gameRtp.gameName"),"min-width":"180"},null,8,["label"]),o(C,{label:r(t)("embed.gameRtp.imageUrl"),"min-width":"360"},{default:d(({row:l})=>[i("a",{class:"image-link",href:l.imageUrl,target:"_blank",rel:"noopener noreferrer"},s(l.imageUrl),9,ot)]),_:1},8,["label"]),o(C,{prop:"rtp",label:r(t)("embed.gameRtp.rtp"),width:"100",align:"center"},null,8,["label"]),o(C,{label:r(t)("embed.gameRtp.status"),width:"110",align:"center"},{default:d(({row:l})=>[o(ce,{type:l.status===1?"success":"info",effect:"plain"},{default:d(()=>[b(s(l.status===1?r(t)("embed.gameRtp.active"):r(t)("embed.gameRtp.inactive")),1)]),_:2},1032,["type"])]),_:1},8,["label"]),o(C,{label:r(t)("embed.gameRtp.action"),width:"150",fixed:"right"},{default:d(({row:l})=>[o(m,{link:"",type:"primary",onClick:G=>H("edit",l)},{default:d(()=>[b(s(r(t)("embed.gameRtp.edit")),1)]),_:2},1032,["onClick"]),o(m,{link:"",type:"danger",onClick:G=>de(l)},{default:d(()=>[b(s(r(t)("embed.gameRtp.delete")),1)]),_:2},1032,["onClick"])]),_:1},8,["label"])]),_:1},8,["data"])])),[[ye,N.value]]),i("div",rt,[i("span",null,s(r(t)("embed.gameRtp.totalRecords",{total:L.value})),1),o(fe,{"current-page":_.value,"onUpdate:currentPage":e[9]||(e[9]=l=>_.value=l),background:"",layout:"prev, pager, next","page-count":F.value,onCurrentChange:R},null,8,["current-page","page-count"])])]),i("div",nt,[o(m,{type:"success",onClick:e[10]||(e[10]=l=>H("create"))},{default:d(()=>[b(s(r(t)("embed.gameRtp.create")),1)]),_:1}),o(m,{type:"warning",onClick:ue},{default:d(()=>[b(s(r(t)("embed.gameRtp.import")),1)]),_:1})]),o(_e,{modelValue:V.value,"onUpdate:modelValue":e[17]||(e[17]=l=>V.value=l),title:O.value==="create"?r(t)("embed.gameRtp.createTitle"):r(t)("embed.gameRtp.editTitle"),width:"520px","destroy-on-close":""},{footer:d(()=>[o(m,{onClick:e[16]||(e[16]=l=>V.value=!1)},{default:d(()=>[b(s(r(t)("embed.gameRtp.cancel")),1)]),_:1}),o(m,{type:"primary",loading:w.value,onClick:me},{default:d(()=>[b(s(r(t)("embed.gameRtp.confirm")),1)]),_:1},8,["loading"])]),default:d(()=>[o(ve,{ref_key:"formRef",ref:$,model:u,rules:se.value,"label-position":"top"},{default:d(()=>[o(k,{label:r(t)("embed.gameRtp.provider"),prop:"provider"},{default:d(()=>[o(g,{modelValue:u.provider,"onUpdate:modelValue":e[11]||(e[11]=l=>u.provider=l),placeholder:"e.g. XE88"},null,8,["modelValue"])]),_:1},8,["label"]),o(k,{label:r(t)("embed.gameRtp.gameName"),prop:"name"},{default:d(()=>[o(g,{modelValue:u.name,"onUpdate:modelValue":e[12]||(e[12]=l=>u.name=l),placeholder:"e.g. Aztec"},null,8,["modelValue"])]),_:1},8,["label"]),o(k,{label:r(t)("embed.gameRtp.imageUrl"),prop:"imageUrl"},{default:d(()=>[o(g,{modelValue:u.imageUrl,"onUpdate:modelValue":e[13]||(e[13]=l=>u.imageUrl=l),placeholder:"e.g. https://image.png"},null,8,["modelValue"])]),_:1},8,["label"]),o(k,{label:r(t)("embed.gameRtp.rtp"),prop:"rtp"},{default:d(()=>[o(be,{modelValue:u.rtp,"onUpdate:modelValue":e[14]||(e[14]=l=>u.rtp=l),min:0,max:100},null,8,["modelValue"])]),_:1},8,["label"]),o(k,{label:r(t)("embed.gameRtp.status"),prop:"status"},{default:d(()=>[o(p,{modelValue:u.status,"onUpdate:modelValue":e[15]||(e[15]=l=>u.status=l)},{default:d(()=>[o(v,{label:r(t)("embed.gameRtp.active"),value:1},null,8,["label"]),o(v,{label:r(t)("embed.gameRtp.inactive"),value:0},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])])}}}),pt=Ue(it,[["__scopeId","data-v-33ff3727"]]);export{pt as default};