diff --git a/.gitignore b/.gitignore index 083eaa7..70627c8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /bin/ /frontend/node_modules/ *.test +build/ \ No newline at end of file diff --git a/build/bin/huya-go.app/Contents/MacOS/huya-gui b/build/bin/huya-go.app/Contents/MacOS/huya-gui index d4ee478..abb17ca 100755 Binary files a/build/bin/huya-go.app/Contents/MacOS/huya-gui and b/build/bin/huya-go.app/Contents/MacOS/huya-gui differ diff --git a/frontend/dist/assets/index-qimuTmHR.js b/frontend/dist/assets/index-BkTscxvR.js similarity index 99% rename from frontend/dist/assets/index-qimuTmHR.js rename to frontend/dist/assets/index-BkTscxvR.js index 2801d1c..d801c50 100644 --- a/frontend/dist/assets/index-qimuTmHR.js +++ b/frontend/dist/assets/index-BkTscxvR.js @@ -472,4 +472,4 @@ html body { * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MV=Wa("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);function TV(){return window.go.gui.App.DefaultConfig()}function _V(e){return window.go.gui.App.Exchange(e)}function zV(){return window.go.gui.App.GetLogs()}function jV(e){return window.go.gui.App.GetRecords(e)}function LV(){return window.go.gui.App.IsRunning()}function DV(e){return window.go.gui.App.ListPrizes(e)}function kV(e){return window.go.gui.App.PreviewAccounts(e)}function BV(e){return window.go.gui.App.QueryScores(e)}function AV(e){return window.go.gui.App.StartMonitor(e)}function FV(){return window.go.gui.App.StopMonitor()}function HV(e,t,n){return window.runtime.EventsOnMultiple(e,t,n)}function Rv(e,t){return HV(e,t,-1)}const KE="huya-go.gui.config";function VV(e){return(e==null?void 0:e.exchange_info)||(e==null?void 0:e.exchangeInfo)||{}}function WV(e){return(e==null?void 0:e.act_pre_condition)||(e==null?void 0:e.actPreCondition)||{}}function px(e,t){return t?Ye.jsx(ka,{color:"error",children:"失败"}):e===200?Ye.jsx(ka,{color:"success",children:"成功"}):e?Ye.jsx(ka,{color:"warning",children:e}):Ye.jsx(ka,{children:"等待"})}function KV(e){return{transport:e.transport||"wss",wssHost:e.wssHost||"",sid:Number(e.sid||0),pid:Number(e.pid||0),name:e.name||"",cookieText:e.cookieText||"",loops:Number(e.loops||1),delayMs:Number(e.delayMs||150),concurrency:Number(e.concurrency||1),stopAfterSuccess:!!e.stopAfterSuccess,timeoutSec:Number(e.timeoutSec||15),startAt:e.startAt||""}}function UV(){try{return JSON.parse(localStorage.getItem(KE)||"{}")}catch{return{}}}function GV(){const{message:e}=Ig.useApp(),[t]=Gn.useForm(),[n,r]=s.useState(""),[o,i]=s.useState(!1),[c,u]=s.useState([]),[d,f]=s.useState([]),[v,p]=s.useState([]),[g,h]=s.useState([]),[S,C]=s.useState([]),[y,x]=s.useState([]);s.useEffect(()=>{let _=!0;Promise.all([TV(),zV(),LV()]).then(([B,k,A])=>{_&&(t.setFieldsValue({...B,...UV(),cookieText:""}),x(k||[]),i(!!A))}).catch(B=>e.error(String(B)));const L=Rv("gui:log",B=>{x(k=>[...k.slice(-499),B])}),D=Rv("gui:monitor-result",B=>{C(k=>[YV(B),...k].slice(0,300))}),z=Rv("gui:monitor-state",B=>{i(!!(B!=null&&B.running)),B!=null&&B.message&&e.info(B.message)});return()=>{_=!1,L(),D(),z()}},[t,e]);const w=()=>KV(t.getFieldsValue(!0)),$=async()=>{const _=await kV(t.getFieldValue("cookieText")||"");u(_||[])},O=async(_,L,D)=>{r(_);try{const z=await L();D==null||D(z),e.success("完成")}catch(z){e.error(String(z))}finally{r("")}},I=()=>{const _=w(),L={transport:_.transport,wssHost:_.wssHost,sid:_.sid,pid:_.pid,name:_.name,loops:_.loops,delayMs:_.delayMs,concurrency:_.concurrency,stopAfterSuccess:_.stopAfterSuccess,timeoutSec:_.timeoutSec,startAt:_.startAt};localStorage.setItem(KE,JSON.stringify(L)),e.success("已保存")},P=s.useMemo(()=>[{title:"PID",dataIndex:"id",width:92},{title:"名称",dataIndex:"name",minWidth:220,ellipsis:!0},{title:"积分",width:90,render:(_,L)=>L.new_score||L.score||0},{title:"总量",dataIndex:"num",width:84},{title:"剩余",dataIndex:"left_num",width:84},{title:"状态",dataIndex:"status",width:82},{title:"比例",dataIndex:"percent",width:88}],[]),M=s.useMemo(()=>[{title:"UID",dataIndex:"uid",width:140},{title:"可用积分",dataIndex:"score",width:110},{title:"状态",width:90,render:(_,L)=>{var D;return px((D=L.resp)==null?void 0:D.status,L.error)}},{title:"消息",render:(_,L)=>{var D;return L.error||((D=L.resp)==null?void 0:D.msg)||""}}],[]),N=s.useMemo(()=>{const _=[];return g.forEach(L=>{var D,z;if(!((D=L.records)!=null&&D.length)){_.push({key:`${L.uid}-empty`,uid:L.uid,name:L.error||((z=L.resp)==null?void 0:z.msg)||""});return}L.records.forEach((B,k)=>{_.push({key:`${L.uid}-${k}-${B.id||"record"}`,uid:L.uid,...B})})}),_},[g]),R=s.useMemo(()=>[{title:"UID",dataIndex:"uid",width:140},{title:"名称",dataIndex:"name",minWidth:220,ellipsis:!0},{title:"积分",width:90,render:(_,L)=>L.new_score||L.score||0},{title:"状态",dataIndex:"status",width:84},{title:"时间",dataIndex:"create_time",width:130}],[]),j=s.useMemo(()=>[{title:"轮次",dataIndex:"loop",width:70},{title:"UID",dataIndex:"uid",width:140},{title:"动作",dataIndex:"action",width:120},{title:"奖品",minWidth:220,ellipsis:!0,render:(_,L)=>{var D;return((D=L.prize)==null?void 0:D.name)||VV(L.exchange).desc||""}},{title:"状态",width:90,render:(_,L)=>{var D;return px((D=L.exchange)==null?void 0:D.status,L.error)}},{title:"消息",render:(_,L)=>{var D,z,B;return L.error||((D=L.exchange)==null?void 0:D.msg)||WV(L.exchange).tip||((z=L.exchange)==null?void 0:z.order_id)||((B=L.exchange)==null?void 0:B.orderId)||""}}],[]);return Ye.jsxs("div",{className:"app-shell",children:[Ye.jsxs("aside",{className:"side-panel",children:[Ye.jsxs("div",{className:"brand-row",children:[Ye.jsxs("div",{children:[Ye.jsx(El.Title,{level:4,children:"虎牙抢购助手"}),Ye.jsx(El.Text,{type:"secondary",children:"Wails / React / Ant Design"})]}),Ye.jsx(ka,{color:o?"processing":"default",children:o?"运行中":"空闲"})]}),Ye.jsxs(Gn,{form:t,layout:"vertical",size:"small",className:"config-form",children:[Ye.jsxs(il,{gutter:8,children:[Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"transport",label:"传输",children:Ye.jsx($i,{options:[{value:"wss",label:"WSS"},{value:"http",label:"HTTP"}]})})}),Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"timeoutSec",label:"超时",children:Ye.jsx(ai,{min:1,max:120,addonAfter:"s",className:"full"})})})]}),Ye.jsx(Gn.Item,{name:"wssHost",label:"WSS Host",children:Ye.jsx(sa,{allowClear:!0})}),Ye.jsxs(il,{gutter:8,children:[Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"sid",label:"SID",children:Ye.jsx(ai,{min:1,className:"full"})})}),Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"pid",label:"PID",children:Ye.jsx(ai,{min:0,className:"full"})})})]}),Ye.jsx(Gn.Item,{name:"name",label:"名称",children:Ye.jsx(sa,{allowClear:!0})}),Ye.jsxs(il,{gutter:8,children:[Ye.jsx(Dr,{span:8,children:Ye.jsx(Gn.Item,{name:"loops",label:"轮次",children:Ye.jsx(ai,{min:1,max:9999,className:"full"})})}),Ye.jsx(Dr,{span:8,children:Ye.jsx(Gn.Item,{name:"delayMs",label:"间隔",children:Ye.jsx(ai,{min:10,max:6e4,addonAfter:"ms",className:"full"})})}),Ye.jsx(Dr,{span:8,children:Ye.jsx(Gn.Item,{name:"concurrency",label:"并发",children:Ye.jsx(ai,{min:1,max:100,className:"full"})})})]}),Ye.jsxs(il,{gutter:8,align:"middle",children:[Ye.jsx(Dr,{span:13,children:Ye.jsx(Gn.Item,{name:"startAt",label:"开始时间",children:Ye.jsx(sa,{placeholder:"YYYY-MM-DD HH:mm:ss",allowClear:!0})})}),Ye.jsx(Dr,{span:11,children:Ye.jsx(Gn.Item,{name:"stopAfterSuccess",label:"成功停止",valuePropName:"checked",children:Ye.jsx(fE,{})})})]}),Ye.jsx(Gn.Item,{name:"cookieText",label:"Cookie",children:Ye.jsx(sa.TextArea,{rows:8,spellCheck:!1,className:"cookie-box"})})]}),Ye.jsxs(qs,{wrap:!0,className:"action-bar",children:[Ye.jsx(pr,{icon:Ye.jsx(MV,{size:16}),onClick:$,children:"账号"}),Ye.jsx(pr,{icon:Ye.jsx(RV,{size:16}),onClick:I,children:"保存"}),Ye.jsx(pr,{icon:Ye.jsx(EV,{size:16}),loading:n==="list",onClick:()=>O("list",()=>DV(w()),_=>{const L=_;f((L==null?void 0:L.prizes)||[])}),children:"奖品"}),Ye.jsx(pr,{icon:Ye.jsx(IV,{size:16}),loading:n==="score",onClick:()=>O("score",()=>BV(w()),_=>{p(_||[])}),children:"积分"}),Ye.jsx(pr,{icon:Ye.jsx($V,{size:16}),loading:n==="records",onClick:()=>O("records",()=>jV(w()),_=>{h(_||[])}),children:"记录"}),Ye.jsx(pr,{danger:!0,icon:Ye.jsx(PV,{size:16}),loading:n==="exchange",onClick:()=>O("exchange",()=>_V(w()),_=>{C((_||[]).map(XV))}),children:"兑换"})]}),Ye.jsx(v3,{}),Ye.jsxs(qs,{className:"run-row",children:[Ye.jsx(pr,{type:"primary",icon:Ye.jsx(OV,{size:16}),disabled:o,onClick:()=>O("monitor",()=>AV(w()),()=>{i(!0)}),children:"开始"}),Ye.jsx(fa,{title:"停止监控",children:Ye.jsx(pr,{icon:Ye.jsx(NV,{size:16}),disabled:!o,onClick:async()=>{await FV(),i(!1)}})})]}),Ye.jsx("div",{className:"account-list",children:c.map(_=>Ye.jsx(ka,{color:_.valid?"blue":"error",children:_.valid?_.uid:`第${_.line}行`},_.line))})]}),Ye.jsxs("main",{className:"main-panel",children:[Ye.jsxs(il,{gutter:12,className:"stats-row",children:[Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"账号",value:c.filter(_=>_.valid).length})}),Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"奖品",value:d.length})}),Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"积分结果",value:v.length})}),Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"抢购结果",value:S.length})})]}),Ye.jsx(z$,{items:[{key:"prizes",label:"奖品",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.id,columns:P,dataSource:d,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:760}})},{key:"scores",label:"积分",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.uid,columns:M,dataSource:v,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:680}})},{key:"records",label:"记录",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.key,columns:R,dataSource:N,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:740}})},{key:"results",label:"结果",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.key||`${_.uid}-${_.loop}`,columns:j,dataSource:S,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:820}})},{key:"logs",label:"日志",children:Ye.jsx(qV,{logs:y})}]})]})]})}function qV({logs:e}){return Ye.jsx("div",{className:"log-view",children:e.map((t,n)=>Ye.jsxs("div",{className:`log-line level-${t.level}`,children:[Ye.jsx("span",{children:t.time}),Ye.jsx(ka,{children:t.level}),Ye.jsx("code",{children:t.message})]},`${t.time}-${n}`))})}function XV(e,t){return{key:`exchange-${e.uid}-${t}-${Date.now()}`,loop:0,uid:e.uid,action:"exchange",exchange:e.resp,error:e.error}}function YV(e){return{...e,key:`monitor-${e.loop||0}-${e.uid}-${Date.now()}-${Math.random()}`}}RI.createRoot(document.getElementById("root")).render(Ye.jsx(le.StrictMode,{children:Ye.jsx(Yo,{theme:{token:{borderRadius:6,colorPrimary:"#1677ff",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},components:{Button:{controlHeight:34},Table:{cellPaddingBlock:8,cellPaddingInline:10},Tabs:{horizontalMargin:"0 0 10px"}}},children:Ye.jsx(Ig,{children:Ye.jsx(GV,{})})})})); + */const MV=Wa("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);function TV(){return window.go.gui.App.DefaultConfig()}function _V(e){return window.go.gui.App.Exchange(e)}function zV(){return window.go.gui.App.GetLogs()}function jV(e){return window.go.gui.App.GetRecords(e)}function LV(){return window.go.gui.App.IsRunning()}function DV(e){return window.go.gui.App.ListPrizes(e)}function kV(e){return window.go.gui.App.PreviewAccounts(e)}function BV(e){return window.go.gui.App.QueryScores(e)}function AV(e){return window.go.gui.App.StartMonitor(e)}function FV(){return window.go.gui.App.StopMonitor()}function HV(e,t,n){return window.runtime.EventsOnMultiple(e,t,n)}function Rv(e,t){return HV(e,t,-1)}const KE="huya-go.gui.config";function VV(e){return(e==null?void 0:e.exchange_info)||(e==null?void 0:e.exchangeInfo)||{}}function WV(e){return(e==null?void 0:e.act_pre_condition)||(e==null?void 0:e.actPreCondition)||{}}function px(e,t){return t?Ye.jsx(ka,{color:"error",children:"失败"}):e===200?Ye.jsx(ka,{color:"success",children:"成功"}):e?Ye.jsx(ka,{color:"warning",children:e}):Ye.jsx(ka,{children:"等待"})}function KV(e){return{transport:e.transport||"http",wssHost:e.wssHost||"",sid:Number(e.sid||0),pid:Number(e.pid||0),name:e.name||"",cookieText:e.cookieText||"",loops:Number(e.loops||1),delayMs:Number(e.delayMs||150),concurrency:Number(e.concurrency||1),stopAfterSuccess:!!e.stopAfterSuccess,timeoutSec:Number(e.timeoutSec||15),startAt:e.startAt||""}}function UV(){try{return JSON.parse(localStorage.getItem(KE)||"{}")}catch{return{}}}function GV(){const{message:e}=Ig.useApp(),[t]=Gn.useForm(),[n,r]=s.useState(""),[o,i]=s.useState(!1),[c,u]=s.useState([]),[d,f]=s.useState([]),[v,p]=s.useState([]),[g,h]=s.useState([]),[S,C]=s.useState([]),[y,x]=s.useState([]);s.useEffect(()=>{let _=!0;Promise.all([TV(),zV(),LV()]).then(([B,k,A])=>{_&&(t.setFieldsValue({...B,...UV(),cookieText:""}),x(k||[]),i(!!A))}).catch(B=>e.error(String(B)));const L=Rv("gui:log",B=>{x(k=>[...k.slice(-499),B])}),D=Rv("gui:monitor-result",B=>{C(k=>[YV(B),...k].slice(0,300))}),z=Rv("gui:monitor-state",B=>{i(!!(B!=null&&B.running)),B!=null&&B.message&&e.info(B.message)});return()=>{_=!1,L(),D(),z()}},[t,e]);const w=()=>KV(t.getFieldsValue(!0)),$=async()=>{const _=await kV(t.getFieldValue("cookieText")||"");u(_||[])},O=async(_,L,D)=>{r(_);try{const z=await L();D==null||D(z),e.success("完成")}catch(z){e.error(String(z))}finally{r("")}},I=()=>{const _=w(),L={transport:_.transport,wssHost:_.wssHost,sid:_.sid,pid:_.pid,name:_.name,loops:_.loops,delayMs:_.delayMs,concurrency:_.concurrency,stopAfterSuccess:_.stopAfterSuccess,timeoutSec:_.timeoutSec,startAt:_.startAt};localStorage.setItem(KE,JSON.stringify(L)),e.success("已保存")},P=s.useMemo(()=>[{title:"PID",dataIndex:"id",width:92},{title:"名称",dataIndex:"name",minWidth:220,ellipsis:!0},{title:"积分",width:90,render:(_,L)=>L.new_score||L.score||0},{title:"总量",dataIndex:"num",width:84},{title:"剩余",dataIndex:"left_num",width:84},{title:"状态",dataIndex:"status",width:82},{title:"比例",dataIndex:"percent",width:88}],[]),M=s.useMemo(()=>[{title:"UID",dataIndex:"uid",width:140},{title:"可用积分",dataIndex:"score",width:110},{title:"状态",width:90,render:(_,L)=>{var D;return px((D=L.resp)==null?void 0:D.status,L.error)}},{title:"消息",render:(_,L)=>{var D;return L.error||((D=L.resp)==null?void 0:D.msg)||""}}],[]),N=s.useMemo(()=>{const _=[];return g.forEach(L=>{var D,z;if(!((D=L.records)!=null&&D.length)){_.push({key:`${L.uid}-empty`,uid:L.uid,name:L.error||((z=L.resp)==null?void 0:z.msg)||""});return}L.records.forEach((B,k)=>{_.push({key:`${L.uid}-${k}-${B.id||"record"}`,uid:L.uid,...B})})}),_},[g]),R=s.useMemo(()=>[{title:"UID",dataIndex:"uid",width:140},{title:"名称",dataIndex:"name",minWidth:220,ellipsis:!0},{title:"积分",width:90,render:(_,L)=>L.new_score||L.score||0},{title:"状态",dataIndex:"status",width:84},{title:"时间",dataIndex:"create_time",width:130}],[]),j=s.useMemo(()=>[{title:"轮次",dataIndex:"loop",width:70},{title:"UID",dataIndex:"uid",width:140},{title:"动作",dataIndex:"action",width:120},{title:"奖品",minWidth:220,ellipsis:!0,render:(_,L)=>{var D;return((D=L.prize)==null?void 0:D.name)||VV(L.exchange).desc||""}},{title:"状态",width:90,render:(_,L)=>{var D;return px((D=L.exchange)==null?void 0:D.status,L.error)}},{title:"消息",render:(_,L)=>{var D,z,B;return L.error||((D=L.exchange)==null?void 0:D.msg)||WV(L.exchange).tip||((z=L.exchange)==null?void 0:z.order_id)||((B=L.exchange)==null?void 0:B.orderId)||""}}],[]);return Ye.jsxs("div",{className:"app-shell",children:[Ye.jsxs("aside",{className:"side-panel",children:[Ye.jsxs("div",{className:"brand-row",children:[Ye.jsxs("div",{children:[Ye.jsx(El.Title,{level:4,children:"虎牙抢购助手"}),Ye.jsx(El.Text,{type:"secondary",children:"Wails / React / Ant Design"})]}),Ye.jsx(ka,{color:o?"processing":"default",children:o?"运行中":"空闲"})]}),Ye.jsxs(Gn,{form:t,layout:"vertical",size:"small",className:"config-form",children:[Ye.jsxs(il,{gutter:8,children:[Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"transport",label:"传输",children:Ye.jsx($i,{options:[{value:"http",label:"HTTP"},{value:"wss",label:"WSS 实验"}]})})}),Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"timeoutSec",label:"超时",children:Ye.jsx(ai,{min:1,max:120,addonAfter:"s",className:"full"})})})]}),Ye.jsx(Gn.Item,{name:"wssHost",label:"WSS Host",children:Ye.jsx(sa,{allowClear:!0})}),Ye.jsxs(il,{gutter:8,children:[Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"sid",label:"SID",children:Ye.jsx(ai,{min:1,className:"full"})})}),Ye.jsx(Dr,{span:12,children:Ye.jsx(Gn.Item,{name:"pid",label:"PID",children:Ye.jsx(ai,{min:0,className:"full"})})})]}),Ye.jsx(Gn.Item,{name:"name",label:"名称",children:Ye.jsx(sa,{allowClear:!0})}),Ye.jsxs(il,{gutter:8,children:[Ye.jsx(Dr,{span:8,children:Ye.jsx(Gn.Item,{name:"loops",label:"轮次",children:Ye.jsx(ai,{min:1,max:9999,className:"full"})})}),Ye.jsx(Dr,{span:8,children:Ye.jsx(Gn.Item,{name:"delayMs",label:"间隔",children:Ye.jsx(ai,{min:10,max:6e4,addonAfter:"ms",className:"full"})})}),Ye.jsx(Dr,{span:8,children:Ye.jsx(Gn.Item,{name:"concurrency",label:"并发",children:Ye.jsx(ai,{min:1,max:100,className:"full"})})})]}),Ye.jsxs(il,{gutter:8,align:"middle",children:[Ye.jsx(Dr,{span:13,children:Ye.jsx(Gn.Item,{name:"startAt",label:"开始时间",children:Ye.jsx(sa,{placeholder:"YYYY-MM-DD HH:mm:ss",allowClear:!0})})}),Ye.jsx(Dr,{span:11,children:Ye.jsx(Gn.Item,{name:"stopAfterSuccess",label:"成功停止",valuePropName:"checked",children:Ye.jsx(fE,{})})})]}),Ye.jsx(Gn.Item,{name:"cookieText",label:"Cookie",children:Ye.jsx(sa.TextArea,{rows:8,spellCheck:!1,className:"cookie-box"})})]}),Ye.jsxs(qs,{wrap:!0,className:"action-bar",children:[Ye.jsx(pr,{icon:Ye.jsx(MV,{size:16}),onClick:$,children:"账号"}),Ye.jsx(pr,{icon:Ye.jsx(RV,{size:16}),onClick:I,children:"保存"}),Ye.jsx(pr,{icon:Ye.jsx(EV,{size:16}),loading:n==="list",onClick:()=>O("list",()=>DV(w()),_=>{const L=_;f((L==null?void 0:L.prizes)||[])}),children:"奖品"}),Ye.jsx(pr,{icon:Ye.jsx(IV,{size:16}),loading:n==="score",onClick:()=>O("score",()=>BV(w()),_=>{p(_||[])}),children:"积分"}),Ye.jsx(pr,{icon:Ye.jsx($V,{size:16}),loading:n==="records",onClick:()=>O("records",()=>jV(w()),_=>{h(_||[])}),children:"记录"}),Ye.jsx(pr,{danger:!0,icon:Ye.jsx(PV,{size:16}),loading:n==="exchange",onClick:()=>O("exchange",()=>_V(w()),_=>{C((_||[]).map(XV))}),children:"兑换"})]}),Ye.jsx(v3,{}),Ye.jsxs(qs,{className:"run-row",children:[Ye.jsx(pr,{type:"primary",icon:Ye.jsx(OV,{size:16}),disabled:o,onClick:()=>O("monitor",()=>AV(w()),()=>{i(!0)}),children:"开始"}),Ye.jsx(fa,{title:"停止监控",children:Ye.jsx(pr,{icon:Ye.jsx(NV,{size:16}),disabled:!o,onClick:async()=>{await FV(),i(!1)}})})]}),Ye.jsx("div",{className:"account-list",children:c.map(_=>Ye.jsx(ka,{color:_.valid?"blue":"error",children:_.valid?_.uid:`第${_.line}行`},_.line))})]}),Ye.jsxs("main",{className:"main-panel",children:[Ye.jsxs(il,{gutter:12,className:"stats-row",children:[Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"账号",value:c.filter(_=>_.valid).length})}),Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"奖品",value:d.length})}),Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"积分结果",value:v.length})}),Ye.jsx(Dr,{span:6,children:Ye.jsx(ui,{title:"抢购结果",value:S.length})})]}),Ye.jsx(z$,{items:[{key:"prizes",label:"奖品",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.id,columns:P,dataSource:d,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:760}})},{key:"scores",label:"积分",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.uid,columns:M,dataSource:v,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:680}})},{key:"records",label:"记录",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.key,columns:R,dataSource:N,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:740}})},{key:"results",label:"结果",children:Ye.jsx(yo,{size:"small",rowKey:_=>_.key||`${_.uid}-${_.loop}`,columns:j,dataSource:S,pagination:{pageSize:12,showSizeChanger:!1},scroll:{x:820}})},{key:"logs",label:"日志",children:Ye.jsx(qV,{logs:y})}]})]})]})}function qV({logs:e}){return Ye.jsx("div",{className:"log-view",children:e.map((t,n)=>Ye.jsxs("div",{className:`log-line level-${t.level}`,children:[Ye.jsx("span",{children:t.time}),Ye.jsx(ka,{children:t.level}),Ye.jsx("code",{children:t.message})]},`${t.time}-${n}`))})}function XV(e,t){return{key:`exchange-${e.uid}-${t}-${Date.now()}`,loop:0,uid:e.uid,action:"exchange",exchange:e.resp,error:e.error}}function YV(e){return{...e,key:`monitor-${e.loop||0}-${e.uid}-${Date.now()}-${Math.random()}`}}RI.createRoot(document.getElementById("root")).render(Ye.jsx(le.StrictMode,{children:Ye.jsx(Yo,{theme:{token:{borderRadius:6,colorPrimary:"#1677ff",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},components:{Button:{controlHeight:34},Table:{cellPaddingBlock:8,cellPaddingInline:10},Tabs:{horizontalMargin:"0 0 10px"}}},children:Ye.jsx(Ig,{children:Ye.jsx(GV,{})})})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 6b69847..cb4c21d 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -4,7 +4,7 @@