You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
8.7 KiB

import{g as Z,j as $,B as ee,c as l,a as e,p as v,q as P,l as D,F as y,r as h,v as w,O as te,m as se,t as i,d as j,x as u,z as _,y as ne,o}from"./mElhLwm2.js";import{u as le}from"./C6twYRfy.js";import{u as oe}from"./FVTAbpot.js";import"./qig5Qp6S.js";const ae={class:"space-y-6"},ie={class:"bg-white rounded-xl shadow-sm border border-slate-100 p-4"},re={class:"flex items-end gap-3 flex-wrap"},de={class:"form-control"},ue={key:0,value:""},ce=["value"],pe={class:"form-control"},me={key:0,value:""},ve=["value"],be={class:"form-control"},fe=["onKeydown"],xe={key:0,class:"bg-white rounded-xl shadow-sm border border-slate-100 p-12 text-center text-slate-400"},ge={key:1,class:"space-y-5"},ye={class:"bg-white rounded-xl shadow-sm border border-slate-100 p-5 flex items-center gap-4"},he=["src"],we={key:1,class:"w-14 h-14 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center text-xl font-bold"},_e={class:"text-lg font-semibold text-slate-800"},ke={class:"text-xs text-slate-400 font-mono mt-0.5"},Ie={class:"ml-auto flex items-center gap-3"},Ae={class:"badge badge-primary badge-outline"},Ue={class:"px-5 py-3 border-b border-slate-50 text-sm font-semibold text-slate-700"},Ve={class:"px-5 py-3 grid grid-cols-1 md:grid-cols-2 gap-x-8"},Ce={class:"text-xs text-slate-400 shrink-0"},De={class:"text-sm text-slate-700 break-all text-right"},Ne={class:"modal-box max-w-md"},Me={class:"text-xs text-slate-400 mb-4"},Se={class:"font-mono text-slate-600"},Ge={class:"grid grid-cols-3 gap-3"},Be={class:"form-control"},Pe={class:"form-control"},je={class:"form-control"},Le=Z({__name:"users",setup(qe){const{webApi:N,consoleApi:q}=le(),{success:T,error:M,warn:c}=oe(),b=$(),E={cn:"中国",us:"美国",hw:"海外",ea:"东亚",sea:"东南亚",sa:"南亚",me:"中东",eu:"欧洲",ru:"俄罗斯",af:"非洲",sam:"南美",nam:"北美",oc:"大洋洲",br:"巴西",in:"印度"};function F(s){return E[s]||s||"默认"}const f=u([]),p=u(""),m=u(""),k=u(""),r=u(null),S=u("请输入查询条件后点击「搜索」"),I=u(""),x=u(""),K=_(()=>[1,2,3].includes(b.identity)),g=u(null),a=ne({vipday:0,trademin:0,meetmin:0}),A=_(()=>{const s=[];return f.value.forEach(t=>{s.includes(t.name)||s.push(t.name)}),s}),U=_(()=>f.value.filter(s=>s.name===p.value));function G(){const s=U.value;m.value=s.length?s[0].id:""}function L(s){return s?new Date(s*1e3).toLocaleString():"-"}function O(s){return s?"是":"否"}function R(s){return s===1?"男":s===2?"女":"未知"}function V(s){return s==null||s===""?"-":s}const z=[{title:"基本信息",rows:[["uid","UID"],["name","用户名"],["account","登录账号"],["mail","邮箱"],["phone","手机号"],["gender","性别","gender"],["language","语言"],["version","版本"],["channel","渠道"],["State","状态"],["country_code","国家码"],["continent_code","大洲码"],["servicetag","服务区"],["phonemodel","手机型号"],["phonemac","设备ID"]]},{title:"第三方登录",rows:[["wxopenid","微信 openid"],["googleopenid","Google openid"],["facebookopenid","Facebook openid"],["appleopenid","Apple openid"]]},{title:"会员与积分",rows:[["viplv","VIP等级"],["vipexptime","VIP到期","ts"],["aichatintegral","AI积分"],["aichattotalintegral","AI累计积分"],["tradeintegral","翻译积分"],["tradetotalintegral","翻译累计积分"],["meetintegral","会议积分"],["meettotalintegral","会议累计积分"],["lastbindproductid","最后绑定产品ID"],["isactivatecode","已领激活码","bool"],["isgiveaway","首次绑定赠送","bool"]]},{title:"时间",rows:[["createtime","注册时间","ts"],["lastsgintime","最后登录","ts"],["canceltime","注销时间","ts"]]}];function H(s,t){const n=t[2],d=s[t[0]];return n==="ts"?L(d):n==="bool"?O(d):n==="gender"?R(d):V(d)}const J=_(()=>{const s=r.value;return s?String(s.name||s.uid||"?").charAt(0).toUpperCase():"?"});async function C(){if(!p.value){c("请选择应用");return}if(!m.value){c("请选择区域");return}const s=k.value.trim();if(!s){c("请输入用户UID");return}const t=Number(m.value);I.value=t,x.value=s,b.setCurrentApp(t);try{const n=await N("getuserinfo",{uid:s});r.value=n||{}}catch(n){M(n?.message||"查询失败"),r.value=null,S.value=n?.message||"未找到该用户"}}function Q(){if(!x.value){c("请先查询用户");return}a.vipday=0,a.trademin=0,a.meetmin=0,g.value?.showModal()}function W(){g.value?.close()}async function X(){const s=Number(a.vipday)||0,t=Number(a.trademin)||0,n=Number(a.meetmin)||0;if(s<0||t<0||n<0){c("数量不能为负");return}if(!s&&!t&&!n){c("请至少填写一项");return}if(!I.value||!x.value){c("请先查询用户");return}b.setCurrentApp(Number(I.value));try{await N("giftuserresource",{uid:x.value,vipday:s,trademin:t,meetmin:n}),T("赠送成功"),g.value?.close(),C()}catch(d){M(d?.message||"赠送失败")}}function B(){const s=A.value;if(!s.length){p.value="",m.value="";return}p.value=s[0],G()}async function Y(){if(b.identity===3){f.value=(b.appbinds||[]).map(s=>({id:s.id,name:s.name,region:s.region,enabled:!0})),B();return}try{const s=await q("apps/list",{});f.value=(s||[]).filter(t=>t.enabled)}catch{f.value=[]}B()}return ee(Y),(s,t)=>(o(),l("div",ae,[e("div",ie,[e("div",re,[e("div",de,[t[6]||(t[6]=e("label",{class:"label py-1"},[e("span",{class:"label-text text-xs"},"应用")],-1)),v(e("select",{"onUpdate:modelValue":t[0]||(t[0]=n=>p.value=n),class:"select select-bordered select-sm",style:{"min-width":"180px"},onChange:G},[A.value.length?D("",!0):(o(),l("option",ue,"无可用应用")),(o(!0),l(y,null,h(A.value,n=>(o(),l("option",{key:n,value:n},i(n),9,ce))),128))],544),[[P,p.value]])]),e("div",pe,[t[7]||(t[7]=e("label",{class:"label py-1"},[e("span",{class:"label-text text-xs"},"区域")],-1)),v(e("select",{"onUpdate:modelValue":t[1]||(t[1]=n=>m.value=n),class:"select select-bordered select-sm",style:{"min-width":"140px"}},[U.value.length?D("",!0):(o(),l("option",me,"无可用区域")),(o(!0),l(y,null,h(U.value,n=>(o(),l("option",{key:n.id,value:n.id},i(F(n.region)),9,ve))),128))],512),[[P,m.value]])]),e("div",be,[t[8]||(t[8]=e("label",{class:"label py-1"},[e("span",{class:"label-text text-xs"},"用户UID")],-1)),v(e("input",{"onUpdate:modelValue":t[2]||(t[2]=n=>k.value=n),type:"text",class:"input input-bordered input-sm",style:{"min-width":"240px"},placeholder:"输入用户 UID",onKeydown:te(se(C,["prevent"]),["enter"])},null,40,fe),[[w,k.value]])]),e("button",{class:"btn btn-primary btn-sm text-white",onClick:C},"搜索")]),t[9]||(t[9]=e("p",{class:"text-xs text-slate-400 mt-2"},"选择应用与区域后输入 UID,直接查询该部署业务库中的用户信息。",-1))]),r.value?(o(),l("div",ge,[e("div",ye,[r.value.avatar?(o(),l("img",{key:0,src:r.value.avatar,class:"w-14 h-14 rounded-full object-cover border border-slate-100"},null,8,he)):(o(),l("div",we,i(J.value),1)),e("div",null,[e("div",_e,i(V(r.value.name)),1),e("div",ke,i(V(r.value.uid)),1)]),e("div",Ie,[e("span",Ae,"VIP "+i(r.value.viplv||0),1),K.value?(o(),l("button",{key:0,class:"btn btn-success btn-sm text-white",onClick:Q},"赠送资源点")):D("",!0)])]),(o(),l(y,null,h(z,n=>e("div",{key:n.title,class:"bg-white rounded-xl shadow-sm border border-slate-100 overflow-hidden"},[e("div",Ue,i(n.title),1),e("div",Ve,[(o(!0),l(y,null,h(n.rows,d=>(o(),l("div",{key:d[0],class:"flex justify-between gap-3 py-1.5 border-b border-slate-50"},[e("span",Ce,i(d[1]),1),e("span",De,i(H(r.value,d)),1)]))),128))])])),64))])):(o(),l("div",xe,i(S.value),1)),e("dialog",{ref_key:"giftModal",ref:g,class:"modal"},[e("div",Ne,[t[15]||(t[15]=e("h3",{class:"font-bold text-lg mb-1 text-slate-800"},"赠送资源点",-1)),e("p",Me,[t[10]||(t[10]=j("目标用户 UID:",-1)),e("span",Se,i(x.value),1),t[11]||(t[11]=j("。代理账号将从自己的资源点余额中扣减,超管/管理员无消耗。",-1))]),e("div",Ge,[e("div",Be,[t[12]||(t[12]=e("label",{class:"label py-1"},[e("span",{class:"label-text text-sm"},"VIP天数")],-1)),v(e("input",{"onUpdate:modelValue":t[3]||(t[3]=n=>a.vipday=n),type:"number",class:"input input-bordered",min:"0"},null,512),[[w,a.vipday,void 0,{number:!0}]])]),e("div",Pe,[t[13]||(t[13]=e("label",{class:"label py-1"},[e("span",{class:"label-text text-sm"},"翻译分钟")],-1)),v(e("input",{"onUpdate:modelValue":t[4]||(t[4]=n=>a.trademin=n),type:"number",class:"input input-bordered",min:"0"},null,512),[[w,a.trademin,void 0,{number:!0}]])]),e("div",je,[t[14]||(t[14]=e("label",{class:"label py-1"},[e("span",{class:"label-text text-sm"},"会议分钟")],-1)),v(e("input",{"onUpdate:modelValue":t[5]||(t[5]=n=>a.meetmin=n),type:"number",class:"input input-bordered",min:"0"},null,512),[[w,a.meetmin,void 0,{number:!0}]])])]),e("div",{class:"modal-action"},[e("button",{class:"btn btn-sm",onClick:W},"取消"),e("button",{class:"btn btn-success btn-sm text-white",onClick:X},"确认赠送")])]),t[16]||(t[16]=e("form",{method:"dialog",class:"modal-backdrop"},[e("button",null,"close")],-1))],512)]))}});export{Le as default};