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