PageSourceSearch

https://igrowth.cc/_next/static/chunks/9301.bbaeea82fc623b0b.js

js igrowth.cc collected 2026-10-02 01:20:08 UTC 13,144 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9301],{49301:(e,t,s)=>{"use strict";s.r(t),s.d(t,{AdminInvites:()=>j});var n=s(71588),r=s(48360),i=s(38933),a=s(75800);function c(e,t=0){return{...e.query.trim()?{query:e.query.trim()}:{},..."all"!==e.status?{status:e.status}:{},...e.batch.trim()?{batch:e.batch.trim()}:{},limit:50,offset:Math.max(0,50*Math.floor(t/50))}}var l=s(74561),d=s(81399),o=s.n(d);let u={list:a.TxM,generate:a.GWb,voidCode:a.gKl,voidBatch:a.blC},h={query:"",status:"all",batch:""},m={count:"25",batch:"",expiry:"7"},x={unused:"待用",used:"已用",void:"已作废"},f=i.CK;function j({refreshSignal:e=0,onError:t,api:s=u}){var i;let[a,d]=(0,r.useState)(h),[b,p]=(0,r.useState)(()=>c(h)),[v,_]=(0,r.useState)(null),[g,y]=(0,r.useState)(!0),[C,N]=(0,r.useState)(""),[w,A]=(0,r.useState)(0),[I,E]=(0,r.useState)(!1),[S,k]=(0,r.useState)(m),[Q,$]=(0,r.useState)(""),[q,H]=(0,r.useState)(!1),[M,D]=(0,r.useState)(null),[B,z]=(0,r.useState)(""),[L,O]=(0,r.useState)(null),[F,G]=(0,r.useState)(""),[R,W]=(0,r.useState)(!1),[J,K]=(0,r.useState)(null),P=(0,r.useRef)(0),T=(0,r.useRef)(!1),V=(0,r.useRef)(!1),X=(0,r.useRef)(t);X.current=t;let Z=(0,r.useRef)(M);Z.current=M,(0,r.useEffect)(()=>(V.current=!0,()=>{V.current=!1,P.current++}),[]),(0,r.useEffect)(()=>{let e=++P.current;return y(!0),N(""),s.list(b).then(t=>{if(e===P.current){if(t.offset!==b.offset||t.limit!==b.limit||!Number.isSafeInteger(t.total)||t.total<0)throw Error("内测码分页回执不完整,请重新读取。");if(b.offset>0&&b.offset>=t.total)return void p({...b,offset:Math.max(0,Math.floor((t.total-1)/b.limit)*b.limit)});_({query:b,data:t})}}).catch(t=>{e===P.current&&N(t instanceof Error?t.message:"内测码读取失败")}).finally(()=>{e===P.current&&y(!1)}),()=>{P.current++}},[s,b,e,w]);let U=v?.query===b?v.data:null,Y=U?(i=U.total,b.batch&&i>0?Object.freeze({kind:"batch",batch:b.batch}):null):null,ee=async()=>{let e;if(!T.current&&!q){try{e=function(e){if(!/^[1-9]\d{0,2}$/.test(e.count)||Number(e.count)>200)throw Error("请输入 1 至 200 之间的整数数量。");let t=e.batch.trim();if(t.length>128)throw Error("批次名不能超过 128 个字符。");if(!["7","14","30","none"].includes(e.expiry))throw Error("请选择支持的有效期。");return Object.freeze({count:Number(e.count),batch:t,expiresDays:"none"===e.expiry?null:Number(e.expiry)})}(S)}catch(e){$(e instanceof Error?e.message:"请检查生成条件。");return}T.current=!0,W(!0),$(""),X.current?.("");try{let t=await s.generate(e.count,e.batch,e.expiresDays),n=function(e,t){if(!Array.isArray(t.codes)||t.codes.some(e=>"string"!=typeof e||!e.trim())||t.count!==t.codes.length||new Set(t.codes).size!==t.codes.length||t.count>e.count)throw Error("生成回执不完整,请先刷新内测码列表核对,避免重复生成。");return Object.freeze({batch:e.batch,expiresDays:e.expiresDays,requestedCount:e.count,generatedCount:t.count,codes:Object.freeze([...t.codes])})}(e,t);if(!V.current)return;D(n),z(""),E(!1),K({tone:n.generatedCount===n.requestedCount?"success":"warning",title:`服务端已生成 ${n.generatedCount} 个内测码${n.generatedCount<n.requestedCount?`,本次申请 ${n.requestedCount} 个`:""}。`}),A(e=>e+1)}catch(t){if(!V.current)return;let e=t instanceof Error?t.message:"生成请求未确认";$(`${e} 请先查看列表核对,再决定是否重新生成。`),H(!0),K({tone:"warning",title:"生成结果尚未确认,请先刷新列表核对,避免重复生成。"})}finally{T.current=!1,V.current&&W(!1)}}},et=async()=>{if(L&&!T.current){T.current=!0,W(!0),G(""),X.current?.("");try{let e;if("code"===L.kind){let t=await s.voidCode(L.code);if("boolean"!=typeof t.success)throw Error("作废回执不完整");e=+!!t.success}else{let t=await s.voidBatch(L.batch);if(!0!==t.success||!Number.isSafeInteger(t.voided)||t.voided<0)throw Error("批次作废回执不完整");e=t.voided}if(!V.current)return;K({tone:e>0?"success":"warning",title:e>0?"code"===L.kind?`内测码 ${L.code} 已作废。`:`批次「${L.batch}」已作废 ${e} 个待用码。`:"没有内测码被作废。记录可能已使用或已作废,请以刷新后的列表为准。"}),O(null),A(e=>e+1)}catch(e){V.current&&G(`${e instanceof Error?e.message:"作废请求未确认"}。请关闭弹窗并刷新列表核对,已用码不会被作废。`)}finally{T.current=!1,V.current&&W(!1)}}},es=async()=>
1{if(M?.codes.length)try{await navigator.clipboard.writeText(M.codes.join("\n")),V.current&&Z.current===M&&z("已复制全部新码")}catch{V.current&&Z.current===M&&z("复制失败,可在下方手动选择复制")}};return(0,n.jsxs)("div",{className:o().root,children:[(0,n.jsx)(l.wc,{title:"内测码",description:"一次性使用,1 个码对应 1 次注册。生成、发放范围与作废结果分开核对。",actions:(0,n.jsx)(l.QH,{variant:"primary",disabled:R,onClick:()=>{E(!0),$(""),H(!1)},children:"生成内测码"})}),J&&(0,n.jsx)(l.Qj,{tone:J.tone,title:J.title}),C&&(0,n.jsx)(l.Qj,{tone:"error",title:U?"列表刷新失败,保留上次成功数据":"内测码列表读取失败",action:(0,n.jsx)(l.QH,{disabled:g,onClick:()=>A(e=>e+1),children:"重新加载"}),children:C}),U&&(0,n.jsx)("div",{className:o().stats,children:[[U.stats.total,"累计生成"],[U.stats.unused,"未兑换(含过期)"],[U.stats.used,"已注册使用"],[U.stats.void,"已作废"]].map(([e,t])=>(0,n.jsxs)("div",{className:o().stat,children:[(0,n.jsx)("strong",{children:e}),(0,n.jsxs)("span",{children:[t," \xb7 全部批次"]})]},t))}),M&&(0,n.jsxs)(l.IE,{title:`本次生成 ${M.generatedCount} 个内测码`,description:`批次:${M.batch||"未命名"} \xb7 ${null==M.expiresDays?"长期有效":`有效期 ${M.expiresDays} 天`};精确到期时间见列表。`,actions:M.codes.length>0?(0,n.jsx)(l.QH,{onClick:()=>void es(),children:"复制本次新码"}):void 0,children:[B&&(0,n.jsx)("p",{className:o().muted,role:"status",children:B}),(0,n.jsx)("div",{className:o().codeList,children:M.codes.map(e=>(0,n.jsx)("code",{children:e},e))}),M.generatedCount<M.requestedCount&&(0,n.jsxs)("p",{className:o().muted,children:["本次申请 ",M.requestedCount," 个,实际生成 ",M.generatedCount," 个;只展示服务端返回的新码。"]})]}),(0,n.jsxs)(l.IE,{title:"内测码列表",children:[(0,n.jsxs)("form",{className:o().filters,onSubmit:e=>{e.preventDefault(),p(c(a))},children:[(0,n.jsxs)("label",{className:o().field,children:["搜索",(0,n.jsx)("input",{type:"search",value:a.query,onChange:e=>d(t=>({...t,query:e.target.value})),placeholder:"内测码、批次或兑换用户"})]}),(0,n.jsxs)("label",{className:o().field,children:["状态",(0,n.jsxs)("select",{value:a.status,onChange:e=>d(t=>({...t,status:e.target.value})),children:[(0,n.jsx)("option",{value:"all",children:"全部状态"}),(0,n.jsx)("option",{value:"unused",children:"待用"}),(0,n.jsx)("option",{value:"used",children:"已用"}),(0,n.jsx)("option",{value:"void",children:"已作废"})]})]}),(0,n.jsxs)("label",{className:o().field,children:["精确批次",(0,n.jsx)("input",{value:a.batch,maxLength:128,onChange:e=>d(t=>({...t,batch:e.target.value})),placeholder:"输入完整批次名",list:"admin-invite-batches"}),(0,n.jsx)("datalist",{id:"admin-invite-batches",children:Array.from(new Set(U?.invites.flatMap(e=>e.batch?[e.batch]:[])??[])).map(e=>(0,n.jsx)("option",{value:e},e))})]}),(0,n.jsxs)("div",{className:o().actions,children:[(0,n.jsx)(l.QH,{type:"submit",disabled:g,children:"查询"}),(0,n.jsx)(l.QH,{variant:"ghost",onClick:()=>{d(h),p(c(h))},children:"重置"})]})]}),(0,n.jsxs)("div",{className:`${o().row} ${o().sectionGap}`,children:[(0,n.jsxs)("p",{className:o().muted,children:["当前结果:",b.batch?`批次「${b.batch}」`:"全部批次"," \xb7 ",b.status?x[b.status]:"全部状态",b.query?` \xb7 搜索「${b.query}」`:""]}),Y&&(0,n.jsx)(l.QH,{variant:"danger",compact:!0,disabled:R||g,onClick:()=>{G(""),O(Y)},children:"作废该批次待用码"})]}),g&&!U?(0,n.jsx)(l.eA,{label:"正在读取内测码…"}):U?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:o().tableWrap,children:(0,n.jsxs)("table",{className:o().table,children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{scope:"col",children:"内测码"}),(0,n.jsx)("th",{scope:"col",children:"批次"}),(0,n.jsx)("th",{scope:"col",children:"状态"}),(0,n.jsx)("th",{scope:"col",children:"有效期 / 生成时间"}),(0,n.jsx)("th",{scope:"col",children:"兑换用户 / 时间"}),(0,n.jsx)("th",{scope:"col",children:"操作"})]})}),(0,n.jsx)("tbody",{children:U.invites.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:o().code,children:e.code}),(0,n.jsx)("td",{children:e.batch||"未命名"}),(0,n.jsx)("td",{children:(0,n.jsx)(l.lB,{tone:"used"===e.status?"success":"neutral",children:x[e.status]})}),(0,n.jsxs)("td",{children:[e.expires_at?f(e.expires_at):"长期有效",(0,n.jsxs)("small",{children:["生成于 ",f(e.created_at)]})]}),(0,n.jsxs)("td",{children:[e.used_by||"—",(0,n.jsx)("small",{children:e.used_at?f(e.used_at):""})]}),(0,n.jsx)("td",{children:"unused"===e.status&&(0,n.jsx)(l.QH,{variant:"ghost",compact:!0,disabled:R||g,onClick:()=>{G(""),O("unused"===e.status?Object.freeze({kind:"code",code:e.code,batch:e.batch}):null)},children:"作废"})})]},e.code))})]})}),!U.invites.length&&(0,n.jsx)(l.tc,{title:"当前范围没有内测码",description:"可以调整查询条件,或生成新的一批内测码。"}),(0,n.jsxs)("div",{className:o().pagination,children:[(0,n.jsxs)("span",{children:["符合查询 ",U.total," 个 \xb7 每页 ",b.limit," 个 \xb7 第 ",Math.floor(b.offset/b.limit)+1," 页"]}),(0,n.jsx)(l.QH,{compact:!0,disabled:g||0===b.offset,onClick:()=>p(e=>
1({...e,offset:Math.max(0,e.offset-e.limit)})),children:"上一页"}),(0,n.jsx)(l.QH,{compact:!0,disabled:g||b.offset+b.limit>=U.total,onClick:()=>p(e=>({...e,offset:e.offset+e.limit})),children:"下一页"})]})]}):null]}),I&&(0,n.jsx)(l.Ql,{title:"生成内测码",description:"只生成内测码;由运营自行定向发放。批次名用于后续准确查询与作废。",onClose:()=>{T.current||E(!1)},busy:R,footer:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.QH,{disabled:R,onClick:()=>{E(!1),q&&A(e=>e+1)},children:q?"返回列表核对":"取消"}),(0,n.jsx)(l.QH,{type:"submit",form:"admin-invite-generate",variant:"primary",disabled:R||q,children:R?"正在生成…":"确认生成"})]}),children:(0,n.jsxs)("form",{id:"admin-invite-generate",className:o().form,onSubmit:e=>{e.preventDefault(),ee()},children:[(0,n.jsxs)("label",{className:o().field,children:["数量(1–200)",(0,n.jsx)("input",{inputMode:"numeric",value:S.count,onChange:e=>k(t=>({...t,count:e.target.value})),disabled:R,"aria-invalid":!!Q})]}),(0,n.jsxs)("label",{className:o().field,children:["批次名 / 发放对象(可选)",(0,n.jsx)("input",{maxLength:128,value:S.batch,onChange:e=>k(t=>({...t,batch:e.target.value})),disabled:R,placeholder:"如:9 月深访"})]}),(0,n.jsxs)("label",{className:o().field,children:["有效期",(0,n.jsxs)("select",{value:S.expiry,onChange:e=>k(t=>({...t,expiry:e.target.value})),disabled:R,children:[(0,n.jsx)("option",{value:"7",children:"7 天"}),(0,n.jsx)("option",{value:"14",children:"14 天"}),(0,n.jsx)("option",{value:"30",children:"30 天"}),(0,n.jsx)("option",{value:"none",children:"长期有效"})]})]}),Q&&(0,n.jsx)("p",{className:o().formError,role:"alert",children:Q})]})}),L&&(0,n.jsxs)(l.Ql,{title:"code"===L.kind?"确认作废内测码":"确认作废批次待用码",onClose:()=>{T.current||O(null)},busy:R,footer:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.QH,{disabled:R,onClick:()=>{O(null),F&&A(e=>e+1)},children:F?"关闭并核对":"取消"}),(0,n.jsx)(l.QH,{variant:"danger",disabled:R||!!F,onClick:()=>void et(),children:R?"正在作废…":"确认作废"})]}),children:["code"===L.kind?(0,n.jsxs)("p",{children:["作废内测码 ",(0,n.jsx)("strong",{className:o().code,children:L.code}),"?批次:",L.batch||"未命名","。"]}):(0,n.jsxs)("p",{children:["作废批次 ",(0,n.jsx)("strong",{className:o().exactBatch,children:L.batch})," 当前所有待用内测码?范围包含当前搜索、状态筛选和分页之外的同批次码。"]}),(0,n.jsx)("p",{className:o().muted,children:"已使用的码与已注册用户不受影响。作废后的码不能再注册,不能恢复为待用。"}),F&&(0,n.jsx)("p",{className:o().formError,role:"alert",children:F})]})]})}},81399:e=>{e.exports={root:"AdminInvites_root__ivbBe",stats:"AdminInvites_stats__inCEN",stat:"AdminInvites_stat__fFP7d",filters:"AdminInvites_filters__nJ0Ku",field:"AdminInvites_field__qxFa4",form:"AdminInvites_form__VXCQ7",row:"AdminInvites_row__UAh21",actions:"AdminInvites_actions__yiv_J",muted:"AdminInvites_muted__opJDl",tableWrap:"AdminInvites_tableWrap__nBPiY",table:"AdminInvites_table__TVMfX",code:"AdminInvites_code__n91wf",codeList:"AdminInvites_codeList__W8L9C",pagination:"AdminInvites_pagination__Jh0Z8",exactBatch:"AdminInvites_exactBatch__49OyC",formError:"AdminInvites_formError__Zg_fN",sectionGap:"AdminInvites_sectionGap__7bPs0",empty:"AdminInvites_empty__uy0Gg"}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.