import { defineComponent, ref, reactive, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderAttr, ssrInterpolate, ssrRenderStyle, ssrRenderClass } from 'vue/server-renderer'; import { u as useApi } from './useApi-B-E5eLsI.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { _ as _export_sfc, b as useRouter } from './server.mjs'; import './useLoading-D4zrSa2m.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "channels", __ssrInlineRender: true, setup(__props) { const CHANNELS = { 1: "华为", 2: "小米", 3: "OPPO", 4: "VIVO", 5: "荣耀", 100: "官方包", 101: "App Store", 102: "Google Play" }; function channelName(v) { return CHANNELS[v] ?? "渠道" + v; } const CHANNEL_GROUPS = [ { label: "中国厂商", icon: "📱", color: "#0369a1", bg: "#dbeafe", channels: [1, 2, 3, 4, 5] }, { label: "全球商店", icon: "🌍", color: "#c2410c", bg: "#fff7ed", channels: [101, 102] }, { label: "官方渠道", icon: "🏠", color: "#059669", bg: "#dcfce7", channels: [100] } ]; const STATUS = [ { v: 0, label: "草稿(不下发)", color: "#64748b", bg: "#f1f5f9" }, { v: 1, label: "已上架", color: "#059669", bg: "#dcfce7" }, { v: 2, label: "审核中", color: "#b45309", bg: "#fef9c3" }, { v: 3, label: "已下架", color: "#be123c", bg: "#ffe4e6" } ]; function statusLabel(v) { return STATUS.find((s) => s.v === v)?.label ?? "未知"; } function statusStyle(v) { const s = STATUS.find((x) => x.v === v); return s ? { background: s.bg, color: s.color } : {}; } const PAY_CHANNELS = [ { key: "wxpay", label: "微信支付", module: "wechatpay" }, { key: "alipay", label: "支付宝", module: "alipay" }, { key: "paypal", label: "PayPal", module: "paypal" }, { key: "apple", label: "Apple 内购", module: "appleiap" }, { key: "google", label: "Google 内购", module: "googleiap" } ]; function payLabel(k) { return PAY_CHANNELS.find((p) => p.key === k)?.label ?? k; } useApi(); useToast(); useRouter(); const scopeApp = ref(""); const scopeApps = ref([]); const items = ref([]); const payConfigured = ref([]); const payChecked_ = ref(false); const modalOpen = ref(false); const isEditing = ref(false); const submitting = ref(false); function emptyForm() { return { row_id: 0, app_name: "", channel: 0, version: "", min_version: "", force_update: false, changelog: "", address: "", review_version: "", status: 1, description: "", tourists: false, allowskipdevicebinding: false, paychannels: "", enable: true }; } const form = reactive(emptyForm()); const groups = computed( () => CHANNEL_GROUPS.map((g) => ({ ...g, items: items.value.filter((c) => g.channels.includes(c.channel)).sort((a, b) => a.channel - b.channel), missing: g.channels.filter((ch) => !items.value.some((c) => c.channel === ch)) })) ); function payList(c) { return (c.paychannels || "").split(",").map((x) => x.trim()).filter(Boolean); } function payMissing(key) { if (!payChecked_.value) return false; const mod = PAY_CHANNELS.find((p) => p.key === key)?.module; return !!mod && !payConfigured.value.includes(mod); } const payWarnings = computed(() => { if (!payChecked_.value) return []; const map = {}; for (const c of items.value) { if (!c.enable) continue; for (const p of payList(c)) { if (!payMissing(p)) continue; (map[p] = map[p] || []).push(channelName(c.channel)); } } return Object.keys(map).map((k) => ({ key: k, label: payLabel(k), channels: map[k] })); }); const versionWarn = computed(() => { if (form.force_update && !form.min_version.trim()) return "开启强制更新时必须填「最低支持版本」,否则挡不住任何人"; if (form.min_version.trim() && form.version.trim() && cmpVer(form.min_version, form.version) > 0) { return "「最低支持版本」高于「当前线上版本」,会把所有线上用户判定为需强更却无更高版本可更"; } return ""; }); function cmpVer(a, b) { const as = a.trim().split("."), bs = b.trim().split("."); const n = Math.max(as.length, bs.length); for (let i = 0; i < n; i++) { const x = parseInt(as[i] ?? "0") || 0; const y = parseInt(bs[i] ?? "0") || 0; if (x !== y) return x < y ? -1 : 1; } return 0; } function payChecked(key) { return payList(form).includes(key); } return (_ctx, _push, _parent, _attrs) => { _push(`

渠道分发

管理各应用在各分发渠道上的版本、强制更新与能力开关。支付渠道在这里控制「开放哪几种支付入口」,商户凭据在应用的业务功能配置里填。

应用
`); if (payWarnings.value.length) { _push(`
⚠
以下支付方式已在渠道里开放,但商户凭据还没配:
`); ssrRenderList(payWarnings.value, (w) => { _push(`${ssrInterpolate(w.label)}(${ssrInterpolate(w.channels.join("、"))})`); }); _push(`
`); } else { _push(``); } if (!scopeApp.value) { _push(`
当前是全局默认作用域:这里配的渠道对所有应用生效,应用自己配了同渠道则以应用的为准。
`); } else { _push(``); } _push(``); ssrRenderList(groups.value, (g) => { _push(`
${ssrInterpolate(g.icon)} ${ssrInterpolate(g.label)}${ssrInterpolate(g.items.length)} / ${ssrInterpolate(g.channels.length)} 已配置
`); ssrRenderList(g.items, (c) => { _push(`
${ssrInterpolate(channelName(c.channel))}
渠道号 ${ssrInterpolate(c.channel)}
${ssrInterpolate(statusLabel(c.status))}
线上版本${ssrInterpolate(c.version || "—")}
最低支持${ssrInterpolate(c.min_version || "—")}
`); if (c.review_version) { _push(`
审核中${ssrInterpolate(c.review_version)}
`); } else { _push(``); } _push(`
`); if (c.force_update) { _push(`强制更新`); } else { _push(``); } if (c.tourists) { _push(`游客登录`); } else { _push(``); } if (c.allowskipdevicebinding) { _push(`可跳过绑定`); } else { _push(``); } if (!c.enable) { _push(`已停用`); } else { _push(``); } _push(`
`); if (payList(c).length) { _push(`
`); ssrRenderList(payList(c), (p) => { _push(`${ssrInterpolate(payLabel(p))}${ssrInterpolate(payMissing(p) ? " ⚠" : "")}`); }); _push(`
`); } else { _push(``); } if (c.address) { _push(`
${ssrInterpolate(c.address)}
`); } else { _push(``); } _push(`
`); }); _push(``); ssrRenderList(g.missing, (ch) => { _push(`
${ssrInterpolate(channelName(ch))}
未配置 · 点击添加
`); }); _push(`
`); }); _push(`

${ssrInterpolate(isEditing.value ? "编辑渠道" : "添加渠道")}

${ssrInterpolate(scopeApp.value || "全局默认")}
渠道
分发渠道 *请选择渠道`); ssrRenderList(CHANNEL_GROUPS, (g) => { _push(``); ssrRenderList(g.channels, (ch) => { _push(`${ssrInterpolate(channelName(ch))}(${ssrInterpolate(ch)})`); }); _push(``); }); _push(`
上架状态
描述
版本
当前线上版本
最低支持版本
审核中版本
`); if (versionWarn.value) { _push(`

⚠ ${ssrInterpolate(versionWarn.value)}

`); } else { _push(``); } _push(`
下载地址
更新日志
能力开关
支付渠道
`); ssrRenderList(PAY_CHANNELS, (p) => { _push(``); }); _push(`

这里只决定「这个渠道开放哪几种支付入口」;商户号、密钥等凭据在 `); if (scopeApp.value) { _push(`应用「${ssrInterpolate(scopeApp.value)}」→ 业务功能配置 → 支付`); } else { _push(`各应用的「业务功能配置 → 支付」`); } _push(` 里填。

`); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/channels.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const channels = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6057a5c9"]]); export { channels as default }; //# sourceMappingURL=channels-CRuax8yi.mjs.map