Files
Sub-Router/dist/assets/Home-rZKtrvPB.js
T
abingyydsandClaude Opus 4.6 23920eb635 fix: 自定义价格真正参与计费 + 修复价格显示翻倍
1. 计费核心改动 (relay/helper/price.go):
   - applyDistributorMarkup 新增自定义价格支持
   - 自定义价格转 USD 后与平台底价对比,计算等效加价倍率
   - 保底机制:自定义价格不得低于平台底价,防止平台亏损
   - 优先级:全站加价 > 自定义价格 > 单模型加价比例

2. 分站价格显示修复 (controller/dist_site.go):
   - 自定义价格跟随商家币种(CNY),发送前需转 USD
   - 修复 ¥6.8 显示为 ¥46.24 的翻倍问题

3. 管理页面改进 (DistributorModels.jsx):
   - 全站加价模式下展示含加价的价格
   - 自定义价格输入框显示正确的币种单位

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 17:53:22 +09:00

2 lines
8.4 KiB
JavaScript

import{u as y,a as w,d as M,r as m,h as q,m as C,j as e,L as a,Q as D}from"./index-DZXnuqaY.js";import{c as L,R as S}from"./RotatingEquiv-gD83PqDY.js";import{C as h}from"./CountUp-DtJMqT_7.js";import{F as i}from"./FadeContent-44eYdeQE.js";import{u as F}from"./useTranslation-C6aAveL4.js";function A(){const{t:s}=F(),{user:n}=y(),{site:c}=w(),{symbol:u,rate:j}=M(),[v,N]=m.useState([]),[p,f]=m.useState([]);m.useEffect(()=>{q().then(t=>{t.data.success&&N(t.data.data||[])}).catch(()=>{}),C().then(t=>{t.data.success&&f(t.data.data||[])}).catch(()=>{})},[]);const l=v.filter(t=>t.enabled!==!1);return e.jsxs("div",{children:[e.jsxs("section",{className:"max-w-6xl mx-auto px-6 lg:px-8 pt-32 pb-20",children:[e.jsx(i,{blur:!0,duration:800,delay:100,children:e.jsxs("div",{className:"max-w-3xl",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-slate-900 leading-[1.1] tracking-tight",children:(c==null?void 0:c.name)||s("home.defaultHeroTitle")}),e.jsx("p",{className:"text-lg text-slate-500 mt-6 leading-relaxed max-w-xl",children:s("home.heroSubtitle")}),e.jsx("div",{className:"flex items-center gap-4 mt-10",children:n?e.jsxs(a,{to:"/dashboard",className:"px-7 py-3 rounded-lg bg-slate-900 text-white font-medium text-sm hover:bg-slate-800 transition-colors",children:[s("home.goToDashboard")," →"]}):e.jsxs(e.Fragment,{children:[e.jsx(a,{to:"/register",className:"px-7 py-3 rounded-lg bg-slate-900 text-white font-medium text-sm hover:bg-slate-800 transition-colors",children:s("home.getStarted")}),e.jsxs(a,{to:"/pricing",className:"px-7 py-3 text-slate-500 font-medium text-sm hover:text-slate-900 transition-colors",children:[s("home.viewPricing")," →"]})]})})]})}),e.jsx(i,{blur:!0,duration:800,delay:400,children:e.jsxs("div",{className:"flex items-center divide-x divide-slate-200 mt-20 pt-10 border-t border-slate-200",children:[e.jsxs("div",{className:"pr-12",children:[e.jsxs("div",{className:"text-2xl font-bold text-slate-900",children:[e.jsx(h,{from:0,to:l.length||50,duration:2}),"+"]}),e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:s("home.aiModels")})]}),e.jsxs("div",{className:"px-12",children:[e.jsxs("div",{className:"text-2xl font-bold text-slate-900",children:[e.jsx(h,{from:0,to:99.9,duration:2.5}),"%"]}),e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:s("home.uptime")})]}),e.jsxs("div",{className:"pl-12",children:[e.jsxs("div",{className:"text-2xl font-bold text-slate-900",children:["<",e.jsx(h,{from:200,to:50,duration:2,direction:"down"}),"ms"]}),e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:s("home.latency")})]})]})})]}),e.jsx("section",{className:"bg-slate-50 border-y border-slate-200",children:e.jsx("div",{className:"max-w-6xl mx-auto px-6 lg:px-8 py-20",children:e.jsxs(i,{blur:!0,duration:800,delay:100,children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:s("home.whyChooseUs")}),e.jsx("p",{className:"text-slate-500 mb-10",children:s("home.whyChooseUsDesc")}),e.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:[{title:s("home.lightningFast"),desc:s("home.lightningFastDesc"),icon:e.jsx("svg",{className:"w-5 h-5 text-slate-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M13 10V3L4 14h7v7l9-11h-7z"})})},{title:s("home.securePrivate"),desc:s("home.securePrivateDesc"),icon:e.jsx("svg",{className:"w-5 h-5 text-slate-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})},{title:s("home.payAsYouGo"),desc:s("home.payAsYouGoDesc"),icon:e.jsx("svg",{className:"w-5 h-5 text-slate-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}].map((t,o)=>e.jsxs("div",{className:"p-6 rounded-xl bg-white border border-slate-200 hover:shadow-sm transition-all",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-slate-100 flex items-center justify-center mb-4",children:t.icon}),e.jsx("h3",{className:"text-base font-semibold text-slate-900 mb-2",children:t.title}),e.jsx("p",{className:"text-sm text-slate-500 leading-relaxed",children:t.desc})]},o))})]})})}),l.length>0&&e.jsx("section",{className:"max-w-6xl mx-auto px-6 lg:px-8 py-20",children:e.jsxs(i,{blur:!0,duration:800,delay:100,children:[e.jsxs("div",{className:"flex items-end justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:s("home.availableModels")}),e.jsx("p",{className:"text-slate-500",children:s("home.availableModelsDesc",{count:l.length})})]}),l.length>8&&e.jsxs(a,{to:"/pricing",className:"text-sm text-slate-600 hover:text-slate-900 transition-colors font-medium",children:[s("home.viewAllModels",{count:l.length})," →"]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:l.slice(0,8).map((t,o)=>e.jsx("div",{className:"px-4 py-3 rounded-lg border border-slate-200 hover:border-slate-300 transition-colors",children:e.jsx("span",{className:"text-sm text-slate-600 font-mono",children:t.display_name||t.model_name})},t.id||o))})]})}),p.length>0&&e.jsx("section",{className:"max-w-6xl mx-auto px-6 lg:px-8 py-20",children:e.jsxs(i,{blur:!0,duration:800,delay:100,children:[e.jsx("h2",{className:"text-2xl font-bold text-slate-900 mb-2",children:s("home.plansPackages")}),e.jsx("p",{className:"text-slate-500 mb-10",children:s("home.choosePlan")}),e.jsx("div",{className:"grid md:grid-cols-3 gap-5 max-w-4xl",children:p.filter(t=>t.enabled).slice(0,3).map((t,o)=>{const x=t.quota_amount>0?t.quota_amount/D:0,d=t.quota_reset_period||"never";let b=x;if(d!=="never"&&t.duration>0&&x>0){let r=d==="daily"?t.duration:d==="weekly"?Math.floor(t.duration/7):d==="monthly"?Math.floor(t.duration/30):1;r<1&&(r=1),b=x*r}const g=L(l,b);return e.jsxs("div",{className:`rounded-xl p-6 flex flex-col border transition-all ${o===1?"border-slate-900 shadow-sm":"border-slate-200 hover:border-slate-300"}`,children:[o===1&&e.jsx("span",{className:"text-xs text-slate-900 font-semibold mb-2 uppercase tracking-wider",children:s("home.popular")||"Popular"}),e.jsx("h3",{className:"text-base font-semibold text-slate-900",children:t.name}),t.description&&e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:t.description}),e.jsxs("div",{className:"mt-auto pt-6",children:[e.jsxs("span",{className:"text-3xl font-bold text-slate-900",children:[u,(Number(t.price)*j).toFixed(2)]}),t.original_price>t.price&&e.jsxs("span",{className:"text-sm text-slate-500 line-through ml-2",children:[u,(Number(t.original_price)*j).toFixed(2)]}),t.duration>0&&e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:s("home.days",{count:t.duration})})]}),g.length>0&&e.jsxs("p",{className:"text-xs text-amber-600 mt-2",children:["🔥 ",e.jsx(S,{items:g,text:r=>s("packages.officialEquiv",{model:r.label,amount:r.equivDollars})})]}),e.jsx(a,{to:n?"/packages":"/register",className:`mt-4 py-2.5 rounded-lg font-medium text-sm text-center transition-colors ${o===1?"bg-slate-900 text-white hover:bg-slate-800":"bg-slate-100 text-slate-700 hover:bg-slate-200"}`,children:s(n?"home.subscribe":"home.getStarted")})]},t.id)})})]})}),e.jsx("section",{className:"bg-slate-900",children:e.jsx("div",{className:"max-w-6xl mx-auto px-6 lg:px-8 py-20 text-center",children:e.jsxs(i,{blur:!0,duration:800,delay:100,children:[e.jsx("h2",{className:"text-2xl font-bold text-white mb-3",children:s("home.readyToStart")}),e.jsx("p",{className:"text-slate-400 mb-8 max-w-md mx-auto",children:s("home.readyToStartDesc")}),e.jsx("div",{className:"flex items-center justify-center gap-4",children:n?e.jsxs(a,{to:"/dashboard",className:"px-7 py-3 rounded-lg bg-white text-slate-900 font-medium text-sm hover:bg-slate-100 transition-colors",children:[s("home.goToDashboard")," →"]}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{to:"/register",className:"px-7 py-3 rounded-lg bg-white text-slate-900 font-medium text-sm hover:bg-slate-100 transition-colors",children:[s("home.createFreeAccount")," →"]}),e.jsx(a,{to:"/login",className:"px-7 py-3 text-slate-400 font-medium text-sm hover:text-white transition-colors",children:s("home.signIn")})]})})]})})})]})}export{A as default};