feat(payment): 支付&付费菜单按参考主题重构并新增提现策略页
- 子菜单重组为知识付费/余额充值/VIP会员/创作分成/推广返佣/收款接口/提现策略 - 收款接口页 1:1 复刻 Zibll 双下拉结构,仅保留支付宝/微信/PayPal/Stripe/易支付 - 订单前缀/流水号前缀/提现单号前缀配置保留并移入收款接口页 - 知识付费/推广返佣按参考主题全字段复刻,余额充值并入充值卡配置 - 新增 tabbed/between_number/page_select 表单控件及后端 pages 搜索源 - 清理旧 SPA 组件、无消费者 REST 端点与废弃配置键(不写双路兼容) - 更新存量契约测试至新 schema 文件
This commit is contained in:
@@ -2,7 +2,6 @@ import { globalApiMethods } from './global.js'
|
|||||||
import { pageDisplayApiMethods } from './page-display.js'
|
import { pageDisplayApiMethods } from './page-display.js'
|
||||||
import { permissionsApiMethods } from './permissions.js'
|
import { permissionsApiMethods } from './permissions.js'
|
||||||
import { usersApiMethods } from './users.js'
|
import { usersApiMethods } from './users.js'
|
||||||
import { paymentApiMethods } from './payment.js'
|
|
||||||
import { extensionsApiMethods } from './extensions.js'
|
import { extensionsApiMethods } from './extensions.js'
|
||||||
import { toolsApiMethods } from './tools.js'
|
import { toolsApiMethods } from './tools.js'
|
||||||
import { schemaApiMethods } from './schema.js'
|
import { schemaApiMethods } from './schema.js'
|
||||||
@@ -13,7 +12,6 @@ export const apiMethods = {
|
|||||||
...pageDisplayApiMethods,
|
...pageDisplayApiMethods,
|
||||||
...permissionsApiMethods,
|
...permissionsApiMethods,
|
||||||
...usersApiMethods,
|
...usersApiMethods,
|
||||||
...paymentApiMethods,
|
|
||||||
...extensionsApiMethods,
|
...extensionsApiMethods,
|
||||||
...toolsApiMethods,
|
...toolsApiMethods,
|
||||||
...schemaApiMethods,
|
...schemaApiMethods,
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
export const paymentApiMethods = {
|
|
||||||
/* ================================================================
|
|
||||||
* 支付&付费 (Payment)
|
|
||||||
* ================================================================ */
|
|
||||||
|
|
||||||
getPaymentOverview() { return this.request('/payment/overview') },
|
|
||||||
}
|
|
||||||
@@ -142,6 +142,22 @@
|
|||||||
@update:value="emit('update:modelValue', $event)"
|
@update:value="emit('update:modelValue', $event)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Page Select (async page list) -->
|
||||||
|
<n-select
|
||||||
|
v-else-if="schema.type === 'page_select'"
|
||||||
|
:value="modelValue"
|
||||||
|
:options="pageOptions"
|
||||||
|
:loading="pageLoading"
|
||||||
|
:placeholder="schema.placeholder || '选择页面'"
|
||||||
|
:multiple="schema.multiple === true"
|
||||||
|
:filterable="true"
|
||||||
|
:remote="true"
|
||||||
|
:clearable="schema.clearable !== false"
|
||||||
|
:disabled="schema.disabled"
|
||||||
|
@search="handlePageSearch"
|
||||||
|
@update:value="emit('update:modelValue', $event)"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Radio group -->
|
<!-- Radio group -->
|
||||||
<n-radio-group
|
<n-radio-group
|
||||||
v-else-if="schema.type === 'radio'"
|
v-else-if="schema.type === 'radio'"
|
||||||
@@ -332,6 +348,32 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Between number (min/max pair, Zibll between_number) -->
|
||||||
|
<div v-else-if="schema.type === 'between_number'" class="aksrt-field__between">
|
||||||
|
<n-input-number
|
||||||
|
:value="betweenValue('min')"
|
||||||
|
:min="schema.min"
|
||||||
|
:max="schema.max"
|
||||||
|
:step="schema.step || 1"
|
||||||
|
:placeholder="schema.minPlaceholder || '最小'"
|
||||||
|
:disabled="schema.disabled"
|
||||||
|
style="flex: 1"
|
||||||
|
@update:value="updateBetween('min', $event)"
|
||||||
|
/>
|
||||||
|
<span class="aksrt-field__between-sep">—</span>
|
||||||
|
<n-input-number
|
||||||
|
:value="betweenValue('max')"
|
||||||
|
:min="schema.min"
|
||||||
|
:max="schema.max"
|
||||||
|
:step="schema.step || 1"
|
||||||
|
:placeholder="schema.maxPlaceholder || '最大'"
|
||||||
|
:disabled="schema.disabled"
|
||||||
|
style="flex: 1"
|
||||||
|
@update:value="updateBetween('max', $event)"
|
||||||
|
/>
|
||||||
|
<span v-if="schema.unit" class="aksrt-field__between-unit">{{ schema.unit }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Spacing (top right bottom left) -->
|
<!-- Spacing (top right bottom left) -->
|
||||||
<div v-else-if="schema.type === 'spacing'" class="aksrt-field__spacing">
|
<div v-else-if="schema.type === 'spacing'" class="aksrt-field__spacing">
|
||||||
<div class="aksrt-field__spacing-label">{{ schema.spacingLabels?.[0] || '上' }}</div>
|
<div class="aksrt-field__spacing-label">{{ schema.spacingLabels?.[0] || '上' }}</div>
|
||||||
@@ -807,6 +849,9 @@ onMounted(() => {
|
|||||||
if (props.schema.type === 'async_select') {
|
if (props.schema.type === 'async_select') {
|
||||||
loadAsyncOptions()
|
loadAsyncOptions()
|
||||||
}
|
}
|
||||||
|
if (props.schema.type === 'page_select') {
|
||||||
|
loadPages()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// ============ User Select (async search) ============
|
// ============ User Select (async search) ============
|
||||||
@@ -850,6 +895,31 @@ function handleUserSearch(query) {
|
|||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============ Page Select (async page list) ============
|
||||||
|
const pageOptions = ref([])
|
||||||
|
const pageLoading = ref(false)
|
||||||
|
let pageSearchTimer = null
|
||||||
|
|
||||||
|
async function loadPages(query = '') {
|
||||||
|
pageLoading.value = true
|
||||||
|
try {
|
||||||
|
const selected = props.modelValue ? [props.modelValue] : []
|
||||||
|
const res = await api.searchPageDisplayOptions('pages', query, query ? [] : selected)
|
||||||
|
const items = res?.data || res || []
|
||||||
|
pageOptions.value = Array.isArray(items) ? items : []
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[AksField] page load failed:', e)
|
||||||
|
pageOptions.value = []
|
||||||
|
} finally {
|
||||||
|
pageLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSearch(query) {
|
||||||
|
clearTimeout(pageSearchTimer)
|
||||||
|
pageSearchTimer = setTimeout(() => loadPages(query), 250)
|
||||||
|
}
|
||||||
|
|
||||||
const fieldClasses = computed(() => ({
|
const fieldClasses = computed(() => ({
|
||||||
'aksrt-field--disabled': props.schema.disabled,
|
'aksrt-field--disabled': props.schema.disabled,
|
||||||
'aksrt-field--inline': props.schema.inline,
|
'aksrt-field--inline': props.schema.inline,
|
||||||
@@ -870,6 +940,21 @@ function updateDimension(part, value) {
|
|||||||
emit('update:modelValue', { ...current, [part]: value })
|
emit('update:modelValue', { ...current, [part]: value })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============ Between Number (min/max pair) ============
|
||||||
|
function betweenValue(part) {
|
||||||
|
const current = props.modelValue && typeof props.modelValue === 'object' && !Array.isArray(props.modelValue)
|
||||||
|
? props.modelValue
|
||||||
|
: {}
|
||||||
|
return current[part] !== undefined ? current[part] : (props.schema.default?.[part] ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateBetween(part, value) {
|
||||||
|
const current = props.modelValue && typeof props.modelValue === 'object' && !Array.isArray(props.modelValue)
|
||||||
|
? props.modelValue
|
||||||
|
: {}
|
||||||
|
emit('update:modelValue', { ...current, [part]: value })
|
||||||
|
}
|
||||||
|
|
||||||
// ============ Spacing ============
|
// ============ Spacing ============
|
||||||
function updateSpacing(part, value) {
|
function updateSpacing(part, value) {
|
||||||
const current = props.modelValue || {}
|
const current = props.modelValue || {}
|
||||||
@@ -1115,6 +1200,25 @@ function confirmRepeaterModal() {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Between number (min/max) */
|
||||||
|
.aksrt-field__between {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
max-width: 360px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-field__between-sep {
|
||||||
|
color: var(--aksrt-color-border-strong);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-field__between-unit {
|
||||||
|
color: var(--aksrt-color-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
/* Spacing field */
|
/* Spacing field */
|
||||||
.aksrt-field__spacing {
|
.aksrt-field__spacing {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -56,8 +56,33 @@
|
|||||||
<template v-if="group.fields && !hasGroupSlot(group)">
|
<template v-if="group.fields && !hasGroupSlot(group)">
|
||||||
<template v-for="field in group.fields" :key="field.key">
|
<template v-for="field in group.fields" :key="field.key">
|
||||||
<template v-if="isFieldVisible(field)">
|
<template v-if="isFieldVisible(field)">
|
||||||
|
<!-- Tabbed: renders tabs whose sub-fields are flat top-level keys -->
|
||||||
|
<div
|
||||||
|
v-if="field.type === 'tabbed' && (field.tabs || []).length"
|
||||||
|
class="aksrt-form-renderer__tabbed"
|
||||||
|
>
|
||||||
|
<n-tabs type="line" animated>
|
||||||
|
<n-tab-pane
|
||||||
|
v-for="tab in field.tabs"
|
||||||
|
:key="tab.title || tab.key"
|
||||||
|
:name="tab.title || tab.key"
|
||||||
|
:tab="tab.title || tab.key"
|
||||||
|
>
|
||||||
|
<template v-for="sub in (tab.fields || [])" :key="sub.key">
|
||||||
|
<AksField
|
||||||
|
v-if="isFieldVisible(sub)"
|
||||||
|
:schema="sub"
|
||||||
|
:model-value="getFieldValue(sub.key)"
|
||||||
|
:error-message="errors?.[sub.key]"
|
||||||
|
@update:model-value="setFieldValue(sub.key, $event)"
|
||||||
|
@action="emit('field-action', $event)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</n-tab-pane>
|
||||||
|
</n-tabs>
|
||||||
|
</div>
|
||||||
<slot
|
<slot
|
||||||
v-if="field.type === 'custom'"
|
v-else-if="field.type === 'custom'"
|
||||||
:name="`field-${field.key}`"
|
:name="`field-${field.key}`"
|
||||||
v-bind="{ field, value: getFieldValue(field.key), setValue: (value) => setFieldValue(field.key, value), formData }"
|
v-bind="{ field, value: getFieldValue(field.key), setValue: (value) => setFieldValue(field.key, value), formData }"
|
||||||
>
|
>
|
||||||
@@ -268,6 +293,15 @@ const filteredSchema = computed(() => {
|
|||||||
// Filter fields by label, key, or help text matching query
|
// Filter fields by label, key, or help text matching query
|
||||||
const matchingFields = group.fields.filter(field => {
|
const matchingFields = group.fields.filter(field => {
|
||||||
if (groupMatch) return true
|
if (groupMatch) return true
|
||||||
|
if (field.type === 'tabbed' && Array.isArray(field.tabs)) {
|
||||||
|
return (field.label || '').toLowerCase().includes(q)
|
||||||
|
|| field.tabs.some(tab => (tab.fields || []).some(sub =>
|
||||||
|
(sub.label || '').toLowerCase().includes(q)
|
||||||
|
|| (sub.key || '').toLowerCase().includes(q)
|
||||||
|
|| (sub.help || '').toLowerCase().includes(q)
|
||||||
|
|| (sub.description || '').toLowerCase().includes(q)
|
||||||
|
))
|
||||||
|
}
|
||||||
return (field.label || '').toLowerCase().includes(q)
|
return (field.label || '').toLowerCase().includes(q)
|
||||||
|| (field.key || '').toLowerCase().includes(q)
|
|| (field.key || '').toLowerCase().includes(q)
|
||||||
|| (field.help || '').toLowerCase().includes(q)
|
|| (field.help || '').toLowerCase().includes(q)
|
||||||
@@ -318,6 +352,10 @@ const filteredSchema = computed(() => {
|
|||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aksrt-form-renderer__tabbed {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.aksrt-form-renderer__search {
|
.aksrt-form-renderer__search {
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
max-width: 280px;
|
max-width: 280px;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const SECTION_DEFAULT_CHILDREN = {
|
|||||||
'post-list': 'post-list-page',
|
'post-list': 'post-list-page',
|
||||||
permissions: 'permissions-comment',
|
permissions: 'permissions-comment',
|
||||||
users: 'users-auth',
|
users: 'users-auth',
|
||||||
payment: 'payment-recharge',
|
payment: 'payment-knowledge',
|
||||||
extensions: 'extensions-ip',
|
extensions: 'extensions-ip',
|
||||||
tools: 'tools-import-export',
|
tools: 'tools-import-export',
|
||||||
'theme-info': 'theme-info-dashboard',
|
'theme-info': 'theme-info-dashboard',
|
||||||
|
|||||||
@@ -1,11 +1,27 @@
|
|||||||
import { renderFaIcon, schemaPage, customPage } from './helpers'
|
import { renderFaIcon, schemaPage } from './helpers'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付&付费 — 子菜单按参考主题划分:
|
||||||
|
* 知识付费 / 余额充值 / VIP会员 / 创作分成 / 推广返佣 / 收款接口 / 提现策略。
|
||||||
|
* 收款接口为 schema 表单页(双下拉式接口选择 + 凭据配置 + 前缀配置)。
|
||||||
|
*/
|
||||||
export const paymentSection = {
|
export const paymentSection = {
|
||||||
key: 'payment',
|
key: 'payment',
|
||||||
label: '支付&付费',
|
label: '支付&付费',
|
||||||
icon: renderFaIcon('fa fas fa-credit-card'),
|
icon: renderFaIcon('fa fas fa-credit-card'),
|
||||||
route: '/payment',
|
route: '/payment',
|
||||||
children: [
|
children: [
|
||||||
|
schemaPage({
|
||||||
|
key: 'payment-knowledge',
|
||||||
|
name: 'PaymentKnowledge',
|
||||||
|
label: '知识付费',
|
||||||
|
route: '/payment/knowledge',
|
||||||
|
status: 'available',
|
||||||
|
title: '知识付费',
|
||||||
|
desc: '免登陆购买、模块显示位置、商品优惠码、客户服务、付费下载与商品预置参数。',
|
||||||
|
canonicalDomain: 'payment',
|
||||||
|
section: 'knowledge',
|
||||||
|
}),
|
||||||
schemaPage({
|
schemaPage({
|
||||||
key: 'payment-recharge',
|
key: 'payment-recharge',
|
||||||
name: 'PaymentRecharge',
|
name: 'PaymentRecharge',
|
||||||
@@ -13,7 +29,7 @@ export const paymentSection = {
|
|||||||
route: '/payment/recharge',
|
route: '/payment/recharge',
|
||||||
status: 'available',
|
status: 'available',
|
||||||
title: '余额充值',
|
title: '余额充值',
|
||||||
desc: '余额充值策略、记录和手动确认配置。',
|
desc: '余额功能、充值商品选项、卡密充值、充值卡与余额兑换积分。',
|
||||||
canonicalDomain: 'payment',
|
canonicalDomain: 'payment',
|
||||||
section: 'recharge',
|
section: 'recharge',
|
||||||
}),
|
}),
|
||||||
@@ -24,41 +40,18 @@ export const paymentSection = {
|
|||||||
route: '/payment/vip',
|
route: '/payment/vip',
|
||||||
status: 'available',
|
status: 'available',
|
||||||
title: 'VIP会员',
|
title: 'VIP会员',
|
||||||
desc: '会员套餐、会员特权和免扣策略。',
|
desc: '会员等级、会员权益、购买选项、卡密兑换与积分兑换。',
|
||||||
canonicalDomain: 'payment',
|
canonicalDomain: 'payment',
|
||||||
section: 'vip',
|
section: 'vip',
|
||||||
}),
|
}),
|
||||||
customPage({
|
|
||||||
key: 'payment-gateway',
|
|
||||||
name: 'PaymentGateway',
|
|
||||||
label: '收款接口',
|
|
||||||
route: '/payment/gateway',
|
|
||||||
component: 'PaymentGateway',
|
|
||||||
status: 'available',
|
|
||||||
title: '收款接口',
|
|
||||||
desc: '支付网关适配器、测试网关和手动确认配置。',
|
|
||||||
canonicalDomain: 'payment',
|
|
||||||
section: 'gateway',
|
|
||||||
}),
|
|
||||||
schemaPage({
|
|
||||||
key: 'payment-order',
|
|
||||||
name: 'PaymentOrder',
|
|
||||||
label: '订单设置',
|
|
||||||
route: '/payment/order',
|
|
||||||
status: 'available',
|
|
||||||
title: '订单设置',
|
|
||||||
desc: '订单前缀、有效期、展示字段和状态文案。',
|
|
||||||
canonicalDomain: 'payment',
|
|
||||||
section: 'order',
|
|
||||||
}),
|
|
||||||
schemaPage({
|
schemaPage({
|
||||||
key: 'payment-revenue',
|
key: 'payment-revenue',
|
||||||
name: 'PaymentRevenue',
|
name: 'PaymentRevenue',
|
||||||
label: '创作中心',
|
label: '创作分成',
|
||||||
route: '/payment/revenue',
|
route: '/payment/revenue',
|
||||||
status: 'available',
|
status: 'available',
|
||||||
title: '创作中心',
|
title: '创作分成',
|
||||||
desc: '独立配置现金与积分分成比例、结算周期和结算备注文案。',
|
desc: '现金与积分分成比例、结算周期、分成说明与详情页(分成工单在支付中心)。',
|
||||||
canonicalDomain: 'payment',
|
canonicalDomain: 'payment',
|
||||||
section: 'revenue',
|
section: 'revenue',
|
||||||
}),
|
}),
|
||||||
@@ -69,20 +62,20 @@ export const paymentSection = {
|
|||||||
route: '/payment/affiliate',
|
route: '/payment/affiliate',
|
||||||
status: 'available',
|
status: 'available',
|
||||||
title: '推广返佣',
|
title: '推广返佣',
|
||||||
desc: '返佣规则、邀请链路和结算策略(返佣工单在支付中心)。',
|
desc: '推广识别模式、分档返佣规则、文案与海报(返佣工单在支付中心)。',
|
||||||
canonicalDomain: 'payment',
|
canonicalDomain: 'payment',
|
||||||
section: 'affiliate',
|
section: 'affiliate',
|
||||||
}),
|
}),
|
||||||
schemaPage({
|
schemaPage({
|
||||||
key: 'payment-card-pass',
|
key: 'payment-gateway',
|
||||||
name: 'PaymentCardPass',
|
name: 'PaymentGateway',
|
||||||
label: '卡密设置',
|
label: '收款接口',
|
||||||
route: '/payment/card-pass',
|
route: '/payment/gateway',
|
||||||
status: 'available',
|
status: 'available',
|
||||||
title: '卡密设置',
|
title: '收款接口',
|
||||||
desc: '充值卡类型、卡号规则与兑换文案(卡密工单在支付中心)。',
|
desc: '微信/支付宝接口选择、PayPal/Stripe 开关、货币结算、显示顺序与订单编号前缀。',
|
||||||
canonicalDomain: 'payment',
|
canonicalDomain: 'payment',
|
||||||
section: 'card-pass',
|
section: 'gateway',
|
||||||
}),
|
}),
|
||||||
schemaPage({
|
schemaPage({
|
||||||
key: 'payment-withdrawal',
|
key: 'payment-withdrawal',
|
||||||
@@ -91,7 +84,7 @@ export const paymentSection = {
|
|||||||
route: '/payment/withdrawal',
|
route: '/payment/withdrawal',
|
||||||
status: 'available',
|
status: 'available',
|
||||||
title: '提现策略',
|
title: '提现策略',
|
||||||
desc: '最低提现、手续费与说明文案(提现工单在支付中心)。',
|
desc: '提现门槛、手续费、每日限制、收款渠道与提现协议(提现工单在支付中心)。',
|
||||||
canonicalDomain: 'payment',
|
canonicalDomain: 'payment',
|
||||||
section: 'withdrawal',
|
section: 'withdrawal',
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,529 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="aksrt-page-container">
|
|
||||||
<PageHeader title="充值卡管理" desc="按状态和时间筛选充值卡,支持单张创建、批量生成、详情查看和当前筛选导出。" />
|
|
||||||
|
|
||||||
<div class="aksrt-charge-card-page__stats">
|
|
||||||
<n-card v-for="card in statCards" :key="card.key" size="small">
|
|
||||||
<n-statistic :label="card.label" :value="stats[card.key] || 0" />
|
|
||||||
</n-card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<n-card size="small" title="操作台">
|
|
||||||
<n-space justify="space-between" wrap>
|
|
||||||
<n-space>
|
|
||||||
<n-button type="primary" @click="createVisible = true">创建充值卡</n-button>
|
|
||||||
<n-button @click="batchVisible = true">批量生成</n-button>
|
|
||||||
</n-space>
|
|
||||||
<n-button quaternary @click="handleExport">导出当前筛选</n-button>
|
|
||||||
</n-space>
|
|
||||||
</n-card>
|
|
||||||
|
|
||||||
<n-card class="aksrt-charge-card-page__card" size="small" title="充值卡台账">
|
|
||||||
<n-space vertical :size="12">
|
|
||||||
<n-grid cols="1 s:2 m:4" :x-gap="12" :y-gap="12" responsive="screen">
|
|
||||||
<n-grid-item>
|
|
||||||
<n-input v-model:value="filters.keyword" clearable placeholder="搜索卡号、备注、使用人" />
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-select v-model:value="filters.status" :options="statusOptions" placeholder="状态" />
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-date-picker v-model:value="filters.dateRange" type="daterange" clearable style="width: 100%;" />
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-space>
|
|
||||||
<n-button type="primary" @click="handleSearch">筛选</n-button>
|
|
||||||
<n-button @click="resetFilters">重置</n-button>
|
|
||||||
</n-space>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
|
|
||||||
<n-data-table
|
|
||||||
:columns="columns"
|
|
||||||
:data="rows"
|
|
||||||
:loading="loading"
|
|
||||||
:bordered="false"
|
|
||||||
:pagination="pagination"
|
|
||||||
:row-key="(row) => row.id"
|
|
||||||
/>
|
|
||||||
</n-space>
|
|
||||||
</n-card>
|
|
||||||
|
|
||||||
<n-modal v-model:show="createVisible" preset="card" title="创建充值卡" style="max-width: 520px;">
|
|
||||||
<n-form :model="createForm" label-placement="top">
|
|
||||||
<n-form-item label="卡类型">
|
|
||||||
<n-select v-model:value="createForm.type" :options="typeOptions" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item label="卡密">
|
|
||||||
<n-input v-model:value="createForm.password" placeholder="手动填写唯一卡密" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item v-if="createForm.type === 'balance'" label="面额">
|
|
||||||
<n-input v-model:value="createForm.amount" inputmode="decimal" placeholder="例如 10.00" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-grid v-if="createForm.type === 'vip'" cols="2" :x-gap="12">
|
|
||||||
<n-grid-item>
|
|
||||||
<n-form-item label="VIP 等级">
|
|
||||||
<n-select v-model:value="createForm.level" :options="levelOptions" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-form-item label="天数(0=永久)">
|
|
||||||
<n-input-number v-model:value="createForm.days" :min="0" :max="3650" style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
<n-form-item v-if="createForm.type === 'credits'" label="积分">
|
|
||||||
<n-input-number v-model:value="createForm.points" :min="1" style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item label="过期时间">
|
|
||||||
<n-date-picker v-model:value="createForm.expiresAt" type="datetime" clearable style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item label="备注">
|
|
||||||
<n-input v-model:value="createForm.note" type="textarea" :rows="3" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-space justify="end">
|
|
||||||
<n-button @click="createVisible = false">取消</n-button>
|
|
||||||
<n-button type="primary" :loading="submittingCreate" @click="handleCreate">创建</n-button>
|
|
||||||
</n-space>
|
|
||||||
</n-form>
|
|
||||||
</n-modal>
|
|
||||||
|
|
||||||
<n-modal v-model:show="batchVisible" preset="card" title="批量生成充值卡" style="max-width: 520px;">
|
|
||||||
<n-form :model="batchForm" label-placement="top">
|
|
||||||
<n-form-item label="卡类型">
|
|
||||||
<n-select v-model:value="batchForm.type" :options="typeOptions" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-grid cols="2" :x-gap="12">
|
|
||||||
<n-grid-item>
|
|
||||||
<n-form-item label="数量">
|
|
||||||
<n-input-number v-model:value="batchForm.count" :min="1" :max="100" style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item v-if="batchForm.type === 'balance'">
|
|
||||||
<n-form-item label="面额">
|
|
||||||
<n-input v-model:value="batchForm.amount" inputmode="decimal" placeholder="例如 10.00" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item v-if="batchForm.type === 'credits'">
|
|
||||||
<n-form-item label="积分">
|
|
||||||
<n-input-number v-model:value="batchForm.points" :min="1" style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
<n-grid v-if="batchForm.type === 'vip'" cols="2" :x-gap="12">
|
|
||||||
<n-grid-item>
|
|
||||||
<n-form-item label="VIP 等级">
|
|
||||||
<n-select v-model:value="batchForm.level" :options="levelOptions" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-form-item label="天数(0=永久)">
|
|
||||||
<n-input-number v-model:value="batchForm.days" :min="0" :max="3650" style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
<n-grid cols="2" :x-gap="12">
|
|
||||||
<n-grid-item>
|
|
||||||
<n-form-item label="前缀">
|
|
||||||
<n-input v-model:value="batchForm.prefix" placeholder="AK" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<n-form-item label="随机长度">
|
|
||||||
<n-input-number v-model:value="batchForm.length" :min="8" :max="32" style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
<n-form-item label="过期时间">
|
|
||||||
<n-date-picker v-model:value="batchForm.expiresAt" type="datetime" clearable style="width: 100%;" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-form-item label="备注">
|
|
||||||
<n-input v-model:value="batchForm.note" type="textarea" :rows="3" />
|
|
||||||
</n-form-item>
|
|
||||||
<n-space justify="end">
|
|
||||||
<n-button @click="batchVisible = false">取消</n-button>
|
|
||||||
<n-button type="primary" :loading="submittingBatch" @click="handleBatchCreate">批量生成</n-button>
|
|
||||||
</n-space>
|
|
||||||
</n-form>
|
|
||||||
</n-modal>
|
|
||||||
|
|
||||||
<ChargeCardDetailDrawer v-model:show="drawerVisible" :card-id="currentCardId" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed, h, onMounted, reactive, ref } from 'vue'
|
|
||||||
import { NButton, NSpace, NTag, useDialog, useMessage } from 'naive-ui'
|
|
||||||
import api from '@/api'
|
|
||||||
import PageHeader from '@/components/PageHeader.vue'
|
|
||||||
import ChargeCardDetailDrawer from './components/ChargeCardDetailDrawer.vue'
|
|
||||||
|
|
||||||
const message = useMessage()
|
|
||||||
const dialog = useDialog()
|
|
||||||
const loading = ref(false)
|
|
||||||
const rows = ref([])
|
|
||||||
const createVisible = ref(false)
|
|
||||||
const batchVisible = ref(false)
|
|
||||||
const drawerVisible = ref(false)
|
|
||||||
const currentCardId = ref(null)
|
|
||||||
const submittingCreate = ref(false)
|
|
||||||
const submittingBatch = ref(false)
|
|
||||||
|
|
||||||
const stats = reactive({
|
|
||||||
total: 0,
|
|
||||||
active: 0,
|
|
||||||
used: 0,
|
|
||||||
total_amount: 0,
|
|
||||||
used_amount: 0,
|
|
||||||
})
|
|
||||||
|
|
||||||
const filters = reactive({
|
|
||||||
keyword: '',
|
|
||||||
status: '',
|
|
||||||
dateRange: null,
|
|
||||||
})
|
|
||||||
|
|
||||||
const createForm = reactive({
|
|
||||||
type: 'balance',
|
|
||||||
password: '',
|
|
||||||
amount: '10.00',
|
|
||||||
level: 1,
|
|
||||||
days: 30,
|
|
||||||
points: 100,
|
|
||||||
expiresAt: null,
|
|
||||||
note: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
const batchForm = reactive({
|
|
||||||
type: 'balance',
|
|
||||||
count: 20,
|
|
||||||
amount: '10.00',
|
|
||||||
level: 1,
|
|
||||||
days: 30,
|
|
||||||
points: 100,
|
|
||||||
prefix: 'AK',
|
|
||||||
length: 12,
|
|
||||||
expiresAt: null,
|
|
||||||
note: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
const typeOptions = [
|
|
||||||
{ label: '余额卡', value: 'balance' },
|
|
||||||
{ label: '会员卡', value: 'vip' },
|
|
||||||
{ label: '积分卡', value: 'credits' },
|
|
||||||
]
|
|
||||||
|
|
||||||
const levelOptions = [
|
|
||||||
{ label: 'VIP1', value: 1 },
|
|
||||||
{ label: 'VIP2', value: 2 },
|
|
||||||
]
|
|
||||||
|
|
||||||
const pager = reactive({
|
|
||||||
page: 1,
|
|
||||||
pageSize: 20,
|
|
||||||
itemCount: 0,
|
|
||||||
})
|
|
||||||
|
|
||||||
const optionsState = reactive({
|
|
||||||
statuses: [],
|
|
||||||
})
|
|
||||||
|
|
||||||
const statCards = [
|
|
||||||
{ key: 'total', label: '总卡数' },
|
|
||||||
{ key: 'active', label: '未使用' },
|
|
||||||
{ key: 'used', label: '已使用' },
|
|
||||||
{ key: 'total_amount', label: '总面额' },
|
|
||||||
{ key: 'used_amount', label: '已兑换金额' },
|
|
||||||
]
|
|
||||||
|
|
||||||
const statusOptions = computed(() => optionsState.statuses.length
|
|
||||||
? optionsState.statuses
|
|
||||||
: [
|
|
||||||
{ label: '全部状态', value: '' },
|
|
||||||
{ label: '未使用', value: 'active' },
|
|
||||||
{ label: '已使用', value: 'used' },
|
|
||||||
{ label: '已过期', value: 'expired' },
|
|
||||||
{ label: '已禁用', value: 'disabled' },
|
|
||||||
])
|
|
||||||
|
|
||||||
const pagination = computed(() => ({
|
|
||||||
page: pager.page,
|
|
||||||
pageSize: pager.pageSize,
|
|
||||||
itemCount: pager.itemCount,
|
|
||||||
showSizePicker: true,
|
|
||||||
pageSizes: [10, 20, 50, 100],
|
|
||||||
onUpdatePage: (page) => {
|
|
||||||
pager.page = page
|
|
||||||
loadData()
|
|
||||||
},
|
|
||||||
onUpdatePageSize: (pageSize) => {
|
|
||||||
pager.pageSize = pageSize
|
|
||||||
pager.page = 1
|
|
||||||
loadData()
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
|
|
||||||
const columns = [
|
|
||||||
{ title: 'ID', key: 'id', width: 70 },
|
|
||||||
{ title: '卡密', key: 'password', minWidth: 170, ellipsis: { tooltip: true } },
|
|
||||||
{
|
|
||||||
title: '类型',
|
|
||||||
key: 'type_label',
|
|
||||||
width: 90,
|
|
||||||
render: (row) => row.type_label || row.type || '-',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '面额/权益',
|
|
||||||
key: 'amount',
|
|
||||||
width: 120,
|
|
||||||
render: (row) => {
|
|
||||||
if (row.type === 'vip') {
|
|
||||||
const days = Number(row.days || 0)
|
|
||||||
return `VIP${row.level || 1} / ${days > 0 ? `${days}天` : '永久'}`
|
|
||||||
}
|
|
||||||
if (row.type === 'credits') return `${row.points || row.amount || 0} 积分`
|
|
||||||
return row.amount
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '状态',
|
|
||||||
key: 'status_label',
|
|
||||||
width: 100,
|
|
||||||
render: (row) => {
|
|
||||||
const typeMap = { active: 'success', used: 'warning', expired: 'default', disabled: 'error' }
|
|
||||||
return h(NTag, { size: 'small', round: true, type: typeMap[row.status] || 'default' }, () => row.status_label)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '使用人',
|
|
||||||
key: 'used_by_user',
|
|
||||||
width: 160,
|
|
||||||
render: (row) => row.used_by_user?.display_name || '-',
|
|
||||||
},
|
|
||||||
{ title: '创建时间', key: 'created_at', width: 170 },
|
|
||||||
{
|
|
||||||
title: '过期时间',
|
|
||||||
key: 'expires_at',
|
|
||||||
width: 170,
|
|
||||||
render: (row) => row.expires_at || '-',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '备注',
|
|
||||||
key: 'note',
|
|
||||||
minWidth: 160,
|
|
||||||
ellipsis: { tooltip: true },
|
|
||||||
render: (row) => row.note || '-',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '操作',
|
|
||||||
key: 'actions',
|
|
||||||
width: 140,
|
|
||||||
render: (row) => h(NSpace, { size: 'small' }, () => {
|
|
||||||
const actions = [
|
|
||||||
h(NButton, {
|
|
||||||
size: 'tiny',
|
|
||||||
type: 'primary',
|
|
||||||
quaternary: true,
|
|
||||||
onClick: () => openDrawer(row.id),
|
|
||||||
}, () => '详情'),
|
|
||||||
]
|
|
||||||
|
|
||||||
if (row.status === 'active') {
|
|
||||||
actions.push(h(NButton, {
|
|
||||||
size: 'tiny',
|
|
||||||
type: 'warning',
|
|
||||||
quaternary: true,
|
|
||||||
onClick: () => handleDisable(row),
|
|
||||||
}, () => '禁用'))
|
|
||||||
}
|
|
||||||
|
|
||||||
return actions
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
loadData()
|
|
||||||
})
|
|
||||||
|
|
||||||
function formatDateValue(value) {
|
|
||||||
const date = new Date(value)
|
|
||||||
const year = date.getFullYear()
|
|
||||||
const month = `${date.getMonth() + 1}`.padStart(2, '0')
|
|
||||||
const day = `${date.getDate()}`.padStart(2, '0')
|
|
||||||
const hours = `${date.getHours()}`.padStart(2, '0')
|
|
||||||
const minutes = `${date.getMinutes()}`.padStart(2, '0')
|
|
||||||
const seconds = `${date.getSeconds()}`.padStart(2, '0')
|
|
||||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildParams(page = pager.page, pageSize = pager.pageSize) {
|
|
||||||
const params = {
|
|
||||||
page,
|
|
||||||
per_page: pageSize,
|
|
||||||
}
|
|
||||||
if (filters.keyword) params.keyword = filters.keyword
|
|
||||||
if (filters.status) params.status = filters.status
|
|
||||||
if (Array.isArray(filters.dateRange) && filters.dateRange.length === 2) {
|
|
||||||
const [start, end] = filters.dateRange
|
|
||||||
params.date_from = formatDateValue(start).slice(0, 10)
|
|
||||||
params.date_to = formatDateValue(end).slice(0, 10)
|
|
||||||
}
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadData() {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const res = await api.request('/payment/charge-cards', { params: buildParams() })
|
|
||||||
const data = res?.data || {}
|
|
||||||
rows.value = data.items || []
|
|
||||||
pager.itemCount = data.total || 0
|
|
||||||
Object.assign(stats, data.stats || {})
|
|
||||||
optionsState.statuses = data.options?.statuses || []
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error?.message || '加载充值卡台账失败')
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleSearch() {
|
|
||||||
pager.page = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetFilters() {
|
|
||||||
filters.keyword = ''
|
|
||||||
filters.status = ''
|
|
||||||
filters.dateRange = null
|
|
||||||
pager.page = 1
|
|
||||||
loadData()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleCreate() {
|
|
||||||
submittingCreate.value = true
|
|
||||||
try {
|
|
||||||
await api.request('/payment/charge-cards', {
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
type: createForm.type,
|
|
||||||
password: createForm.password,
|
|
||||||
amount: String(createForm.amount ?? ''),
|
|
||||||
level: createForm.level,
|
|
||||||
days: createForm.days,
|
|
||||||
points: createForm.points,
|
|
||||||
expires_at: createForm.expiresAt ? formatDateValue(createForm.expiresAt) : '',
|
|
||||||
note: createForm.note,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
message.success('充值卡已创建')
|
|
||||||
createVisible.value = false
|
|
||||||
createForm.password = ''
|
|
||||||
createForm.note = ''
|
|
||||||
await loadData()
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error?.message || '创建失败')
|
|
||||||
} finally {
|
|
||||||
submittingCreate.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleBatchCreate() {
|
|
||||||
submittingBatch.value = true
|
|
||||||
try {
|
|
||||||
await api.request('/payment/charge-cards/batch', {
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
type: batchForm.type,
|
|
||||||
count: batchForm.count,
|
|
||||||
amount: String(batchForm.amount ?? ''),
|
|
||||||
level: batchForm.level,
|
|
||||||
days: batchForm.days,
|
|
||||||
points: batchForm.points,
|
|
||||||
prefix: batchForm.prefix,
|
|
||||||
length: batchForm.length,
|
|
||||||
expires_at: batchForm.expiresAt ? formatDateValue(batchForm.expiresAt) : '',
|
|
||||||
note: batchForm.note,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
message.success('充值卡已批量生成')
|
|
||||||
batchVisible.value = false
|
|
||||||
await loadData()
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error?.message || '批量生成失败')
|
|
||||||
} finally {
|
|
||||||
submittingBatch.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleDisable(row) {
|
|
||||||
dialog.warning({
|
|
||||||
title: '确认禁用',
|
|
||||||
content: `确定要禁用充值卡 ${row.password} 吗?`,
|
|
||||||
positiveText: '禁用',
|
|
||||||
negativeText: '取消',
|
|
||||||
onPositiveClick: async () => {
|
|
||||||
try {
|
|
||||||
await api.request(`/payment/charge-cards/${row.id}/disable`, { method: 'POST' })
|
|
||||||
message.success('充值卡已禁用')
|
|
||||||
await loadData()
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error?.message || '禁用失败')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function openDrawer(id) {
|
|
||||||
currentCardId.value = id
|
|
||||||
drawerVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleExport() {
|
|
||||||
try {
|
|
||||||
const res = await api.request('/payment/charge-cards', { params: buildParams(1, 200) })
|
|
||||||
const items = res?.data?.items || []
|
|
||||||
const header = ['ID', '卡号', '面额', '余额', '状态', '使用人', '创建时间', '过期时间', '备注']
|
|
||||||
const lines = items.map((row) => [
|
|
||||||
row.id,
|
|
||||||
row.password,
|
|
||||||
row.amount,
|
|
||||||
row.balance,
|
|
||||||
row.status_label,
|
|
||||||
row.used_by_user?.display_name || '',
|
|
||||||
row.created_at || '',
|
|
||||||
row.expires_at || '',
|
|
||||||
row.note || '',
|
|
||||||
])
|
|
||||||
downloadCsv('charge-cards.csv', [header, ...lines])
|
|
||||||
message.success('导出完成')
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error?.message || '导出失败')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadCsv(filename, rows) {
|
|
||||||
const csv = `\uFEFF${rows.map((row) => row.map((cell) => `"${String(cell ?? '').replaceAll('"', '""')}"`).join(',')).join('\n')}`
|
|
||||||
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' })
|
|
||||||
const url = URL.createObjectURL(blob)
|
|
||||||
const link = document.createElement('a')
|
|
||||||
link.href = url
|
|
||||||
link.download = filename
|
|
||||||
link.click()
|
|
||||||
URL.revokeObjectURL(url)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.aksrt-charge-card-page__stats {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
||||||
gap: 12px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-charge-card-page__card {
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
<template>
|
|
||||||
<PaymentSectionPage
|
|
||||||
section="gateway"
|
|
||||||
title="收款接口"
|
|
||||||
desc="管理余额、支付宝、微信、PayPal、Stripe、易支付与卡密兑换通道。"
|
|
||||||
note="以渠道开关与凭据是否齐全为准;异步回调由各网关验签。卡密为兑换入口,不进入收银台。"
|
|
||||||
:links="[
|
|
||||||
{ label: '余额充值', path: '/payment/recharge' },
|
|
||||||
{ label: '充值卡', path: '/payment/card-pass' },
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<template #before-form>
|
|
||||||
<n-spin :show="loading">
|
|
||||||
<n-card class="aksrt-section-card" title="网关状态">
|
|
||||||
<n-grid :cols="3" :x-gap="12" :y-gap="12">
|
|
||||||
<n-grid-item v-for="gw in gateways" :key="gw.id">
|
|
||||||
<div class="aksrt-gateway__card">
|
|
||||||
<div class="aksrt-gateway__icon" :class="gw.configured ? 'aksrt-gateway__icon--active' : ''">
|
|
||||||
<i :class="iconFor(gw.id)"></i>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<strong>{{ gw.name }}</strong>
|
|
||||||
<p>{{ gw.configured ? '已配置' : '未配置' }}</p>
|
|
||||||
</div>
|
|
||||||
<n-tag :type="gw.configured ? 'success' : 'default'" size="small" round>
|
|
||||||
{{ gw.configured ? '可用' : '不可用' }}
|
|
||||||
</n-tag>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
<n-empty v-if="!loading && gateways.length === 0" description="暂无已注册的支付网关" />
|
|
||||||
</n-card>
|
|
||||||
|
|
||||||
<n-card v-if="overview.help_text" class="aksrt-section-card" title="运行说明">
|
|
||||||
<p class="aksrt-gateway__help">{{ overview.help_text }}</p>
|
|
||||||
</n-card>
|
|
||||||
</n-spin>
|
|
||||||
</template>
|
|
||||||
</PaymentSectionPage>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, onMounted } from 'vue'
|
|
||||||
import { useMessage } from 'naive-ui'
|
|
||||||
import PaymentSectionPage from '@/pages/payment/PaymentSectionPage.vue'
|
|
||||||
import api from '@/api'
|
|
||||||
|
|
||||||
const message = useMessage()
|
|
||||||
const gateways = ref([])
|
|
||||||
const overview = ref({})
|
|
||||||
const loading = ref(false)
|
|
||||||
|
|
||||||
function iconFor(id) {
|
|
||||||
if (id === 'balance') return 'fa fas fa-credit-card'
|
|
||||||
if (id === 'alipay' || id === 'epay_alipay') return 'fa fas fa-credit-card'
|
|
||||||
if (id === 'wechatpay' || id === 'epay_wxpay') return 'fa fab fa-weixin'
|
|
||||||
if (id === 'paypal') return 'fa fab fa-paypal'
|
|
||||||
if (id === 'stripe') return 'fa fab fa-cc-stripe'
|
|
||||||
return 'fa fas fa-credit-card'
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const [gwRes, ovRes] = await Promise.all([
|
|
||||||
api.request('/payment/overview').catch(() => null),
|
|
||||||
])
|
|
||||||
if (gwRes?.data?.gateway?.gateways) {
|
|
||||||
const gwList = Object.entries(gwRes.data.gateway.gateways).map(([id, enabled]) => ({ id, name: id, configured: !!enabled }))
|
|
||||||
gateways.value = gwList
|
|
||||||
}
|
|
||||||
if (ovRes?.data?.gateway) {
|
|
||||||
overview.value = ovRes.data.gateway
|
|
||||||
} else if (ovRes?.data) {
|
|
||||||
overview.value = ovRes.data
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
message.warning('部分支付接口暂不可用')
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.aksrt-gateway__card {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
padding: 14px;
|
|
||||||
border-radius: 8px;
|
|
||||||
background: var(--surface-2, #fafafa);
|
|
||||||
border: 1px solid var(--color-line, #f0f0f0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-gateway__icon {
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border-radius: 8px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: var(--surface-3, #f0f0f0);
|
|
||||||
color: var(--aksrt-color-muted);
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-gateway__icon--active {
|
|
||||||
background: var(--color-primary-soft, #f0f5ff);
|
|
||||||
color: var(--aksrt-color-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-gateway__card strong {
|
|
||||||
display: block;
|
|
||||||
font-size: 14px;
|
|
||||||
color: var(--aksrt-color-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-gateway__card p {
|
|
||||||
margin: 2px 0 0;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--aksrt-color-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-gateway__help {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--color-ink-3, #5c6370);
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,319 +0,0 @@
|
|||||||
<template>
|
|
||||||
<PaymentSectionPage
|
|
||||||
section="revenue"
|
|
||||||
title="创作中心"
|
|
||||||
desc="查看现金与积分收益统计及结算运营入口。"
|
|
||||||
:links="[
|
|
||||||
{ label: 'VIP 会员', path: '/payment/vip' },
|
|
||||||
{ label: '推广返佣', path: '/payment/affiliate' },
|
|
||||||
{ label: '创作分成运营', path: '/payment/income' },
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<template #before-form>
|
|
||||||
<n-card class="aksrt-section-card" title="收益统计">
|
|
||||||
<n-grid :cols="4" :x-gap="12" :y-gap="12">
|
|
||||||
<n-grid-item v-for="item in revenueSummary" :key="item.key">
|
|
||||||
<div class="aksrt-revenue__stat">
|
|
||||||
<strong>{{ item.value }}</strong>
|
|
||||||
<p>{{ item.label }}</p>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
</n-card>
|
|
||||||
|
|
||||||
<n-card class="aksrt-section-card" title="收益趋势">
|
|
||||||
<template #header-extra>
|
|
||||||
<n-space size="small">
|
|
||||||
<n-button :type="granularity === 'day' ? 'primary' : 'default'" size="tiny" quaternary @click="setGranularity('day')">日</n-button>
|
|
||||||
<n-button :type="granularity === 'week' ? 'primary' : 'default'" size="tiny" quaternary @click="setGranularity('week')">周</n-button>
|
|
||||||
<n-button :type="granularity === 'month' ? 'primary' : 'default'" size="tiny" quaternary @click="setGranularity('month')">月</n-button>
|
|
||||||
</n-space>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div v-if="hasTimeSeries" class="aksrt-revenue__charts">
|
|
||||||
<div v-for="group in timeSeriesGroups" :key="group.key" class="aksrt-revenue__chart">
|
|
||||||
<h4>{{ group.label }}</h4>
|
|
||||||
<div v-if="group.items.length > 0" class="aksrt-revenue__chart-bars">
|
|
||||||
<div
|
|
||||||
v-for="(item, index) in group.items"
|
|
||||||
:key="`${group.key}-${index}`"
|
|
||||||
class="aksrt-revenue__chart-bar-wrap"
|
|
||||||
:title="`${item.date}: ${formatAmount(item.amount, group.key)} (${item.count}笔)`"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="aksrt-revenue__chart-bar"
|
|
||||||
:style="{ height: getBarHeight(item.amount, group.items) + '%' }"
|
|
||||||
/>
|
|
||||||
<span class="aksrt-revenue__chart-label">{{ formatLabel(item.date) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<n-empty v-else size="small" description="暂无数据" />
|
|
||||||
<div class="aksrt-revenue__chart-summary">
|
|
||||||
<span>期间总计: <strong>{{ formatAmount(group.total, group.key) }}</strong></span>
|
|
||||||
<span>共 {{ group.count }} 笔</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<n-empty v-else description="暂无趋势数据" />
|
|
||||||
</n-card>
|
|
||||||
|
|
||||||
<n-card class="aksrt-section-card" title="提现统计">
|
|
||||||
<n-grid :cols="6" :x-gap="12" :y-gap="12">
|
|
||||||
<n-grid-item>
|
|
||||||
<div class="aksrt-revenue__stat">
|
|
||||||
<strong>{{ withdrawalStats.total }}</strong>
|
|
||||||
<p>提现笔数</p>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<div class="aksrt-revenue__stat">
|
|
||||||
<strong>{{ withdrawalStats.pending }}</strong>
|
|
||||||
<p>待处理</p>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<div class="aksrt-revenue__stat">
|
|
||||||
<strong>{{ withdrawalStats.processing }}</strong>
|
|
||||||
<p>处理中</p>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<div class="aksrt-revenue__stat">
|
|
||||||
<strong>{{ withdrawalStats.completed }}</strong>
|
|
||||||
<p>已完成</p>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<div class="aksrt-revenue__stat">
|
|
||||||
<strong>{{ withdrawalStats.rejected }}</strong>
|
|
||||||
<p>已拒绝</p>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
<n-grid-item>
|
|
||||||
<div class="aksrt-revenue__stat">
|
|
||||||
<strong>{{ formatAmount(withdrawalStats.total_paid, 'cash') }}</strong>
|
|
||||||
<p>已提现 (元)</p>
|
|
||||||
</div>
|
|
||||||
</n-grid-item>
|
|
||||||
</n-grid>
|
|
||||||
</n-card>
|
|
||||||
</template>
|
|
||||||
</PaymentSectionPage>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, computed, onMounted } from 'vue'
|
|
||||||
import PaymentSectionPage from '@/pages/payment/PaymentSectionPage.vue'
|
|
||||||
import api from '@/api'
|
|
||||||
|
|
||||||
const emptyCurrencyStats = (currency) => ({
|
|
||||||
total: currency === 'cash' ? '0.00' : 0,
|
|
||||||
pending: currency === 'cash' ? '0.00' : 0,
|
|
||||||
settled: currency === 'cash' ? '0.00' : 0,
|
|
||||||
count: 0,
|
|
||||||
})
|
|
||||||
const revenueStats = ref({ cash: emptyCurrencyStats('cash'), points: emptyCurrencyStats('points') })
|
|
||||||
const withdrawalStats = ref({ total: 0, pending: 0, processing: 0, completed: 0, rejected: 0, total_paid: '0.00' })
|
|
||||||
const timeSeries = ref({ cash: [], points: [] })
|
|
||||||
const granularity = ref('day')
|
|
||||||
|
|
||||||
const revenueSummary = computed(() => [
|
|
||||||
{ key: 'cash-total', value: `${formatAmount(revenueStats.value.cash.total, 'cash')} 元`, label: '现金总收益' },
|
|
||||||
{ key: 'cash-pending', value: `${formatAmount(revenueStats.value.cash.pending, 'cash')} 元`, label: '现金待结算' },
|
|
||||||
{ key: 'cash-settled', value: `${formatAmount(revenueStats.value.cash.settled, 'cash')} 元`, label: '现金已结算' },
|
|
||||||
{ key: 'cash-count', value: revenueStats.value.cash.count, label: '现金收益笔数' },
|
|
||||||
{ key: 'points-total', value: `${formatAmount(revenueStats.value.points.total, 'points')}`, label: '积分总收益' },
|
|
||||||
{ key: 'points-pending', value: `${formatAmount(revenueStats.value.points.pending, 'points')}`, label: '积分待结算' },
|
|
||||||
{ key: 'points-settled', value: `${formatAmount(revenueStats.value.points.settled, 'points')}`, label: '积分已结算' },
|
|
||||||
{ key: 'points-count', value: revenueStats.value.points.count, label: '积分收益笔数' },
|
|
||||||
])
|
|
||||||
|
|
||||||
const timeSeriesGroups = computed(() => [
|
|
||||||
{
|
|
||||||
key: 'cash',
|
|
||||||
label: '现金收益',
|
|
||||||
items: Array.isArray(timeSeries.value.cash) ? timeSeries.value.cash : [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'points',
|
|
||||||
label: '积分收益',
|
|
||||||
items: Array.isArray(timeSeries.value.points) ? timeSeries.value.points : [],
|
|
||||||
},
|
|
||||||
].map((group) => {
|
|
||||||
const totalMinor = group.items.reduce((sum, item) => sum + amountMinor(item.amount, group.key), 0n)
|
|
||||||
return {
|
|
||||||
...group,
|
|
||||||
total: formatMinor(totalMinor, group.key),
|
|
||||||
count: group.items.reduce((sum, item) => sum + Number(item.count || 0), 0),
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
const hasTimeSeries = computed(() => timeSeriesGroups.value.some((group) => group.items.length > 0))
|
|
||||||
|
|
||||||
function formatAmount(amount, currency) {
|
|
||||||
return currency === 'points'
|
|
||||||
? `${formatMinor(amountMinor(amount, currency), currency)} 积分`
|
|
||||||
: `¥${formatMinor(amountMinor(amount, currency), currency)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function amountMinor(amount, currency) {
|
|
||||||
const raw = String(amount ?? '').trim()
|
|
||||||
if (currency === 'points') return /^\d+$/.test(raw) ? BigInt(raw) : 0n
|
|
||||||
const match = /^(0|[1-9]\d*)(?:\.(\d{1,2}))?$/.exec(raw)
|
|
||||||
return match ? (BigInt(match[1]) * 100n) + BigInt((match[2] || '').padEnd(2, '0') || '0') : 0n
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatMinor(minor, currency) {
|
|
||||||
if (currency === 'points') return String(minor)
|
|
||||||
return `${minor / 100n}.${String(minor % 100n).padStart(2, '0')}`
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBarHeight(amount, items) {
|
|
||||||
const currency = items === timeSeries.value.points ? 'points' : 'cash'
|
|
||||||
const maxAmount = items.reduce((max, item) => {
|
|
||||||
const current = amountMinor(item.amount, currency)
|
|
||||||
return current > max ? current : max
|
|
||||||
}, 0n)
|
|
||||||
if (maxAmount <= 0n) return 2
|
|
||||||
const scaled = Number((amountMinor(amount, currency) * 10000n) / maxAmount) / 100
|
|
||||||
return Math.max(2, scaled)
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatLabel(date) {
|
|
||||||
return String(date || '').slice(5)
|
|
||||||
}
|
|
||||||
|
|
||||||
function setGranularity(nextGranularity) {
|
|
||||||
granularity.value = nextGranularity
|
|
||||||
loadRevenue()
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadRevenue() {
|
|
||||||
try {
|
|
||||||
const params = new URLSearchParams({
|
|
||||||
time_series: '1',
|
|
||||||
granularity: granularity.value,
|
|
||||||
})
|
|
||||||
const res = await api.request(`/payment/revenue?${params}`)
|
|
||||||
if (res?.data) {
|
|
||||||
if (res.data.revenue) {
|
|
||||||
revenueStats.value = {
|
|
||||||
cash: { ...emptyCurrencyStats('cash'), ...(res.data.revenue.cash || {}) },
|
|
||||||
points: { ...emptyCurrencyStats('points'), ...(res.data.revenue.points || {}) },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (res.data.withdrawal) {
|
|
||||||
withdrawalStats.value = {
|
|
||||||
total: Number(res.data.withdrawal.total || 0),
|
|
||||||
pending: Number(res.data.withdrawal.pending || 0),
|
|
||||||
processing: Number(res.data.withdrawal.processing || 0),
|
|
||||||
completed: Number(res.data.withdrawal.completed || 0),
|
|
||||||
rejected: Number(res.data.withdrawal.rejected || 0),
|
|
||||||
total_paid: String(res.data.withdrawal.total_paid || '0.00'),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
timeSeries.value = {
|
|
||||||
cash: res.data.time_series?.cash || [],
|
|
||||||
points: res.data.time_series?.points || [],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// silent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(loadRevenue)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.aksrt-revenue__stat {
|
|
||||||
text-align: center;
|
|
||||||
padding: 16px;
|
|
||||||
border-radius: 8px;
|
|
||||||
background: var(--surface-2, #fafafa);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__stat strong {
|
|
||||||
display: block;
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--aksrt-color-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__stat p {
|
|
||||||
margin: 4px 0 0;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--aksrt-color-muted);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__charts {
|
|
||||||
display: grid;
|
|
||||||
gap: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart {
|
|
||||||
min-height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart h4 {
|
|
||||||
margin: 0 0 10px;
|
|
||||||
color: var(--aksrt-color-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart-bars {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
|
||||||
gap: 2px;
|
|
||||||
height: 180px;
|
|
||||||
padding: 0 4px;
|
|
||||||
border-bottom: 1px solid var(--color-line, #e5e7eb);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart-bar-wrap {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
height: 100%;
|
|
||||||
min-width: 0;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart-bar {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 32px;
|
|
||||||
min-height: 2px;
|
|
||||||
background: var(--color-primary, #88abda);
|
|
||||||
border-radius: 3px 3px 0 0;
|
|
||||||
transition: height 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart-bar-wrap:hover .aksrt-revenue__chart-bar {
|
|
||||||
background: var(--color-primary-hover, #7099cc);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart-label {
|
|
||||||
font-size: 10px;
|
|
||||||
color: var(--aksrt-color-muted);
|
|
||||||
margin-top: 4px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
max-width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart-summary {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 12px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--color-ink-3, #525866);
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-revenue__chart-summary strong {
|
|
||||||
color: var(--aksrt-color-text);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="aksrt-page-container">
|
|
||||||
<PageHeader :title="title" :desc="desc">
|
|
||||||
<template #actions>
|
|
||||||
<n-space v-if="links.length">
|
|
||||||
<n-button v-for="link in links" :key="link.path" quaternary @click="go(link.path)">
|
|
||||||
{{ link.label }}
|
|
||||||
</n-button>
|
|
||||||
</n-space>
|
|
||||||
</template>
|
|
||||||
</PageHeader>
|
|
||||||
|
|
||||||
<n-card v-if="note" class="aksrt-section-card">
|
|
||||||
<n-alert type="info" :show-icon="false">
|
|
||||||
{{ note }}
|
|
||||||
</n-alert>
|
|
||||||
</n-card>
|
|
||||||
|
|
||||||
<slot name="before-form" />
|
|
||||||
|
|
||||||
<AksFormRenderer
|
|
||||||
:schema="pageMeta.groups"
|
|
||||||
:form-data="formData"
|
|
||||||
:dirty="dirty"
|
|
||||||
:loading="loading"
|
|
||||||
:saving="saving"
|
|
||||||
:load-error="loadError"
|
|
||||||
:show-search="false"
|
|
||||||
@update:form-data="formData = $event"
|
|
||||||
@save="handleSave"
|
|
||||||
@reload="handleReload"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { computed } from 'vue'
|
|
||||||
import { useRouter } from 'vue-router'
|
|
||||||
import { useMessage } from 'naive-ui'
|
|
||||||
import api from '@/api'
|
|
||||||
import PageHeader from '@/components/PageHeader.vue'
|
|
||||||
import AksFormRenderer from '@/components/form/AksFormRenderer.vue'
|
|
||||||
import { useSectionForm } from '@/composables/useSectionForm'
|
|
||||||
import { getSchema } from '@/schema'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
section: { type: String, required: true },
|
|
||||||
title: { type: String, required: true },
|
|
||||||
desc: { type: String, default: '' },
|
|
||||||
note: { type: String, default: '' },
|
|
||||||
links: { type: Array, default: () => [] },
|
|
||||||
})
|
|
||||||
|
|
||||||
const router = useRouter()
|
|
||||||
const message = useMessage()
|
|
||||||
|
|
||||||
const pageMeta = computed(() => getSchema('payment', props.section) || { groups: [] })
|
|
||||||
const defaults = computed(() => {
|
|
||||||
const result = {}
|
|
||||||
;(pageMeta.value.groups || []).forEach((group) => {
|
|
||||||
;(group.fields || []).forEach((field) => {
|
|
||||||
if (field.default !== undefined) {
|
|
||||||
result[field.key] = field.default
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
|
|
||||||
const {
|
|
||||||
formData,
|
|
||||||
loading,
|
|
||||||
saving,
|
|
||||||
loadError,
|
|
||||||
dirty,
|
|
||||||
save: doSave,
|
|
||||||
reload,
|
|
||||||
} = useSectionForm({
|
|
||||||
fetch: () => api.getSchemaPage('payment', props.section),
|
|
||||||
submit: (data) => api.saveSchemaPage('payment', props.section, data),
|
|
||||||
defaults: defaults.value,
|
|
||||||
onSaved: () => {
|
|
||||||
message.success('设置已保存')
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
function go(path) {
|
|
||||||
router.push(path)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleSave() {
|
|
||||||
try {
|
|
||||||
await doSave()
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error.message || '保存失败')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleReload() {
|
|
||||||
reload()
|
|
||||||
message.info('已放弃更改')
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
<template>
|
|
||||||
<n-drawer :show="show" :width="680" @update:show="$emit('update:show', $event)">
|
|
||||||
<n-drawer-content title="充值卡详情" closable>
|
|
||||||
<n-spin :show="loading">
|
|
||||||
<template v-if="detail.card">
|
|
||||||
<n-descriptions bordered :column="1" size="small" label-placement="left">
|
|
||||||
<n-descriptions-item label="卡密">{{ detail.card.password || '-' }}</n-descriptions-item>
|
|
||||||
<n-descriptions-item label="面额">{{ detail.card.amount || 0 }}</n-descriptions-item>
|
|
||||||
<n-descriptions-item label="余额">{{ detail.card.balance || 0 }}</n-descriptions-item>
|
|
||||||
<n-descriptions-item label="状态">{{ detail.card.status_label || detail.card.status }}</n-descriptions-item>
|
|
||||||
<n-descriptions-item label="创建时间">{{ detail.card.created_at || '-' }}</n-descriptions-item>
|
|
||||||
<n-descriptions-item label="过期时间">{{ detail.card.expires_at || '-' }}</n-descriptions-item>
|
|
||||||
<n-descriptions-item label="使用时间">{{ detail.card.used_at || '-' }}</n-descriptions-item>
|
|
||||||
<n-descriptions-item label="使用者">
|
|
||||||
{{ detail.card.used_by_user?.display_name || '-' }}
|
|
||||||
</n-descriptions-item>
|
|
||||||
</n-descriptions>
|
|
||||||
|
|
||||||
<div class="aksrt-charge-drawer__section">
|
|
||||||
<div class="aksrt-charge-drawer__title">备注</div>
|
|
||||||
<n-alert type="info" :show-icon="false">
|
|
||||||
{{ detail.card.note || '暂无备注' }}
|
|
||||||
</n-alert>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<n-empty v-else description="暂无充值卡详情" />
|
|
||||||
</n-spin>
|
|
||||||
</n-drawer-content>
|
|
||||||
</n-drawer>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, watch } from 'vue'
|
|
||||||
import { useMessage } from 'naive-ui'
|
|
||||||
import api from '@/api'
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
show: { type: Boolean, default: false },
|
|
||||||
cardId: { type: [Number, String], default: null },
|
|
||||||
})
|
|
||||||
|
|
||||||
defineEmits(['update:show'])
|
|
||||||
|
|
||||||
const message = useMessage()
|
|
||||||
const loading = ref(false)
|
|
||||||
const detail = ref({ card: null })
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => [props.show, props.cardId],
|
|
||||||
async ([visible, id]) => {
|
|
||||||
if (visible && id) {
|
|
||||||
await loadDetail()
|
|
||||||
}
|
|
||||||
if (!visible) {
|
|
||||||
detail.value = { card: null }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
async function loadDetail() {
|
|
||||||
if (!props.cardId) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
loading.value = true
|
|
||||||
try {
|
|
||||||
const res = await api.request(`/payment/charge-cards/${props.cardId}`)
|
|
||||||
detail.value = res?.data || { card: null }
|
|
||||||
} catch (error) {
|
|
||||||
message.error(error?.message || '加载充值卡详情失败')
|
|
||||||
} finally {
|
|
||||||
loading.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.aksrt-charge-drawer__section {
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-charge-drawer__title {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #1f2937;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
import { corePageLoaders } from './core'
|
import { corePageLoaders } from './core'
|
||||||
import { usersPageLoaders } from './users'
|
import { usersPageLoaders } from './users'
|
||||||
import { paymentPageLoaders } from './payment'
|
|
||||||
import { toolsPageLoaders } from './tools'
|
import { toolsPageLoaders } from './tools'
|
||||||
import { extensionsPageLoaders } from './extensions'
|
import { extensionsPageLoaders } from './extensions'
|
||||||
|
|
||||||
export const componentLoaders = {
|
export const componentLoaders = {
|
||||||
...corePageLoaders,
|
...corePageLoaders,
|
||||||
...usersPageLoaders,
|
...usersPageLoaders,
|
||||||
...paymentPageLoaders,
|
|
||||||
...toolsPageLoaders,
|
...toolsPageLoaders,
|
||||||
...extensionsPageLoaders,
|
...extensionsPageLoaders,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
export const paymentPageLoaders = {
|
|
||||||
PaymentGateway: () => import('@/pages/payment/PaymentGateway.vue'),
|
|
||||||
}
|
|
||||||
@@ -72,12 +72,10 @@ function createSectionRedirectRoutes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Old SPA ops routes → native WP admin pages (Phase 4 transition).
|
* Old SPA ops routes → native WP admin pages.
|
||||||
* Bookmarks under order-related paths land on NativeOpsRedirect.
|
* Bookmarks under order-related paths land on NativeOpsRedirect.
|
||||||
*/
|
*/
|
||||||
const NATIVE_OPS_REDIRECTS = [
|
const NATIVE_OPS_REDIRECTS = [
|
||||||
{ path: '/payment/charge-card', title: '充值卡', nativeAdminPath: 'admin.php?page=aksrt_charge_cards' },
|
|
||||||
{ path: '/payment/income', title: '创作分成运营', nativeAdminPath: 'admin.php?page=aksrt_income' },
|
|
||||||
{ path: '/users/messages', title: '消息中心', nativeAdminPath: 'users.php?page=aksrt_messages' },
|
{ path: '/users/messages', title: '消息中心', nativeAdminPath: 'users.php?page=aksrt_messages' },
|
||||||
{ path: '/users/referral-codes', title: '推广码运营', nativeAdminPath: 'users.php?page=aksrt_referral_codes' },
|
{ path: '/users/referral-codes', title: '推广码运营', nativeAdminPath: 'users.php?page=aksrt_referral_codes' },
|
||||||
{ path: '/users/ban', title: '禁封管理', nativeAdminPath: 'users.php?page=aksrt_user_ban&tab=restrictions' },
|
{ path: '/users/ban', title: '禁封管理', nativeAdminPath: 'users.php?page=aksrt_user_ban&tab=restrictions' },
|
||||||
|
|||||||
@@ -1,38 +1,183 @@
|
|||||||
|
/**
|
||||||
|
* 推广返佣 — 参考主题结构:开关、识别模式、自己推广自己、按用户类型分档的
|
||||||
|
* 返佣规则(tab)、文案、推广海报与推广让利标签。
|
||||||
|
*/
|
||||||
export const affiliateSchema = {
|
export const affiliateSchema = {
|
||||||
key: 'payment.affiliate',
|
key: 'payment.affiliate',
|
||||||
title: '推广返佣',
|
title: '推广返佣',
|
||||||
icon: 'fa fas fa-share-alt',
|
icon: 'fa fas fa-btc',
|
||||||
description: '配置推广归因、分级佣金比例和结算规则。',
|
description: '推广识别模式、分档返佣规则、返佣文案、推广海报与让利标签。',
|
||||||
defaults: {
|
defaults: {
|
||||||
affiliate_enabled: false,
|
pay_rebate_s: false,
|
||||||
affiliate_ratio_user: 5,
|
pay_rebate_judgment: 'all',
|
||||||
affiliate_ratio_vip_1: 5,
|
pay_rebate_show_users: true,
|
||||||
affiliate_ratio_vip_2: 5,
|
pay_rebate_self_s: true,
|
||||||
affiliate_order_types: ['membership', 'content'],
|
pay_rebate_user_s: [],
|
||||||
|
pay_rebate_ratio: 5,
|
||||||
|
pay_rebate_user_s_1: ['all'],
|
||||||
|
pay_rebate_ratio_vip_1: 10,
|
||||||
|
pay_rebate_user_s_2: ['all'],
|
||||||
|
pay_rebate_ratio_vip_2: 20,
|
||||||
affiliate_settlement_days: 7,
|
affiliate_settlement_days: 7,
|
||||||
affiliate_promotion_text: '',
|
pay_rebate_text_desc: '加入分享计划,获得高额奖励',
|
||||||
|
pay_rebate_text_details_title: '返佣详解',
|
||||||
|
pay_rebate_text_details: '<p>通过您的推广链接打开本站后,在本站购买商品即可获得佣金</p><p>通过您的推广链接注册后的用户今后购买的商品均可获得佣金</p><p>申请提现后,需后台人工处理,一般2-3小时,请耐心等待</p>',
|
||||||
|
pay_rebate_poster_s: true,
|
||||||
|
pay_rebate_poster_img: '',
|
||||||
|
pay_rebate_poster_title: '发现一个精品网站,快来看一看',
|
||||||
|
pay_rebate_poster_desc: '网站有超多精品资源和优惠福利,扫码进入网站还可享受诸多优惠哦',
|
||||||
|
pay_rebate_text_discount: '推荐购买 下单再减%discount%',
|
||||||
},
|
},
|
||||||
groups: [
|
groups: [
|
||||||
{
|
{
|
||||||
key: 'policy',
|
key: 'notice',
|
||||||
title: '返佣策略',
|
title: '说明',
|
||||||
icon: 'fa fas fa-sitemap',
|
icon: 'fa fas fa-info-circle',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'affiliate_enabled', label: '启用推广返佣', type: 'switch', default: false },
|
{
|
||||||
{ key: 'affiliate_ratio_user', label: '普通会员佣金比例(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'affiliate_enabled', value: true } },
|
key: 'affiliate_notice',
|
||||||
{ key: 'affiliate_ratio_vip_1', label: '一级会员佣金比例(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'affiliate_enabled', value: true } },
|
label: '',
|
||||||
{ key: 'affiliate_ratio_vip_2', label: '二级会员佣金比例(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'affiliate_enabled', value: true } },
|
type: 'content',
|
||||||
{ key: 'affiliate_order_types', label: '适用订单类型', type: 'checkbox', default: ['membership', 'content'], sanitize_type: 'array', options: [{ label: '会员订单', value: 'membership' }, { label: '付费内容', value: 'content' }, { label: '购买积分', value: 'credits' }], dependsOn: { key: 'affiliate_enabled', value: true } },
|
ui_only: true,
|
||||||
{ key: 'affiliate_settlement_days', label: '结算观察期(天)', type: 'number', default: 7, min: 0, max: 90, dependsOn: { key: 'affiliate_enabled', value: true } },
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>识别模式「绑定注册」:用户只要是通过任意推广链接注册的,今后此用户消费均会给推荐人返佣</li><li>识别模式「仅推广链接」:只有通过推广链接购买的才会给推荐人返佣,不会考虑是否是推荐注册的</li><li>开启的订单类型如果一个都不勾选,则代表该用户类型不参与此功能</li><li>您可以根据网站的VIP设置相互配合设置相应的规则</li><li>下面的设置为全局设置,还可以单独为每一个用户设置规则和比例</li></ul>',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'switch',
|
||||||
|
title: '推广返佣',
|
||||||
|
icon: 'fa fas fa-toggle-on',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_rebate_s', label: '启用推广返佣', type: 'switch', default: false },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'mode',
|
||||||
|
title: '推广识别模式',
|
||||||
|
icon: 'fa fas fa-link',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_rebate_judgment',
|
||||||
|
label: '推广识别模式',
|
||||||
|
type: 'radio',
|
||||||
|
default: 'all',
|
||||||
|
dependsOn: { key: 'pay_rebate_s', value: true },
|
||||||
|
options: [
|
||||||
|
{ label: '绑定注册', value: 'all' },
|
||||||
|
{ label: '仅推广链接', value: 'link' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'pay_rebate_show_users', label: '用户中心显示我推荐的用户', type: 'switch', default: true, dependsOn: { key: 'pay_rebate_judgment', value: 'all' } },
|
||||||
|
{ key: 'pay_rebate_self_s', label: '自己推广自己', type: 'switch', default: true, dependsOn: { key: 'pay_rebate_s', value: true }, help: '允许使用自己的推广链接购买商品并获得佣金' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'rules',
|
||||||
|
title: '返佣规则',
|
||||||
|
icon: 'fa fas fa-table',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'rebate_rule',
|
||||||
|
label: '为不同用户类型设置返佣规则',
|
||||||
|
type: 'tabbed',
|
||||||
|
tabs: [
|
||||||
|
{
|
||||||
|
key: 'ordinary',
|
||||||
|
title: '普通用户',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_rebate_user_s',
|
||||||
|
label: '返佣订单',
|
||||||
|
type: 'checkbox',
|
||||||
|
default: [],
|
||||||
|
dependsOn: { key: 'pay_rebate_s', value: true },
|
||||||
|
options: rebateTypeOptions,
|
||||||
|
help: '普通用户返利的订单类型,全部关闭,则代表普通用户不参与推广返佣',
|
||||||
|
},
|
||||||
|
{ key: 'pay_rebate_ratio', label: '普通用户返佣比例(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'pay_rebate_s', value: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'vip1',
|
||||||
|
title: '一级会员',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_rebate_user_s_1',
|
||||||
|
label: '返佣订单',
|
||||||
|
type: 'checkbox',
|
||||||
|
default: ['all'],
|
||||||
|
dependsOn: { key: 'pay_rebate_s', value: true },
|
||||||
|
options: rebateTypeOptions,
|
||||||
|
help: '一级会员返利的订单类型,全部关闭,则代表一级会员用户不参与推广返佣',
|
||||||
|
},
|
||||||
|
{ key: 'pay_rebate_ratio_vip_1', label: '一级会员返佣比例(%)', type: 'number', default: 10, min: 0, max: 100, dependsOn: { key: 'pay_rebate_s', value: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'vip2',
|
||||||
|
title: '二级会员',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_rebate_user_s_2',
|
||||||
|
label: '返佣订单',
|
||||||
|
type: 'checkbox',
|
||||||
|
default: ['all'],
|
||||||
|
dependsOn: { key: 'pay_rebate_s', value: true },
|
||||||
|
options: rebateTypeOptions,
|
||||||
|
help: '二级会员返利的订单类型,全部关闭,则代表二级会员用户不参与推广返佣',
|
||||||
|
},
|
||||||
|
{ key: 'pay_rebate_ratio_vip_2', label: '二级会员返佣比例(%)', type: 'number', default: 20, min: 0, max: 100, dependsOn: { key: 'pay_rebate_s', value: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'affiliate_settlement_days', label: '结算观察期(天)', type: 'number', default: 7, min: 0, max: 90, dependsOn: { key: 'pay_rebate_s', value: true }, help: '订单完成后经过观察期,佣金才会结算到可提现余额' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'text',
|
key: 'text',
|
||||||
title: '文案设置',
|
title: '返佣文案',
|
||||||
icon: 'fa fas fa-pen',
|
icon: 'fa fas fa-file-alt',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'affiliate_promotion_text', label: '推广说明', type: 'textarea', default: '', dependsOn: { key: 'affiliate_enabled', value: true } },
|
{ key: 'pay_rebate_text_desc', label: '返佣文案(一句话简介)', type: 'input', default: '加入分享计划,获得高额奖励', dependsOn: { key: 'pay_rebate_s', value: true } },
|
||||||
|
{ key: 'pay_rebate_text_details_title', label: '返佣详情标题', type: 'input', default: '返佣详解', dependsOn: { key: 'pay_rebate_s', value: true } },
|
||||||
|
{ key: 'pay_rebate_text_details', label: '返佣详情内容', type: 'textarea', sanitize_type: 'html', default: '<p>通过您的推广链接打开本站后,在本站购买商品即可获得佣金</p><p>通过您的推广链接注册后的用户今后购买的商品均可获得佣金</p><p>申请提现后,需后台人工处理,一般2-3小时,请耐心等待</p>', rows: 6, dependsOn: { key: 'pay_rebate_s', value: true }, help: '返佣详情介绍,建议为规则介绍或者其他说明,支持HTML代码' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'poster',
|
||||||
|
title: '推广海报',
|
||||||
|
icon: 'fa fas fa-image',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_rebate_poster_s', label: '推广海报', type: 'switch', default: true, dependsOn: { key: 'pay_rebate_s', value: true }, help: '在用户中心显示包含二维码的推广海报' },
|
||||||
|
{ key: 'pay_rebate_poster_img', label: '推广海报顶部图片', type: 'media', default: '', dependsOn: { key: 'pay_rebate_poster_s', value: true } },
|
||||||
|
{ key: 'pay_rebate_poster_title', label: '推广海报标题(20-30个字)', type: 'input', default: '发现一个精品网站,快来看一看', dependsOn: { key: 'pay_rebate_poster_s', value: true } },
|
||||||
|
{ key: 'pay_rebate_poster_desc', label: '推广海报简介(40-60个字)', type: 'input', default: '网站有超多精品资源和优惠福利,扫码进入网站还可享受诸多优惠哦', dependsOn: { key: 'pay_rebate_poster_s', value: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'discount',
|
||||||
|
title: '推广让利标签',
|
||||||
|
icon: 'fa fas fa-tags',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'discount_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
dependsOn: { key: 'pay_rebate_s', value: true },
|
||||||
|
content: '<p><b>推广让利标签配置详解:</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>可使用的变量:折扣 <code>%discount%</code>、推荐人姓名 <code>%referrer_name%</code></li><li>使用变量示例:<code>%referrer_name%推荐购买 下单再减%discount%元</code></li></ul>',
|
||||||
|
},
|
||||||
|
{ key: 'pay_rebate_text_discount', label: '推广让利标签', type: 'input', default: '推荐购买 下单再减%discount%', dependsOn: { key: 'pay_rebate_s', value: true }, help: '显示在购买模块,推广让利的标签文案' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
}
|
||||||
|
|
||||||
|
/** 返佣订单类型(与运行时 membership/content/credits 对齐)。 */
|
||||||
|
const rebateTypeOptions = [
|
||||||
|
{ label: '全部订单', value: 'all' },
|
||||||
|
{ label: '购买会员', value: 'membership' },
|
||||||
|
{ label: '付费内容', value: 'content' },
|
||||||
|
{ label: '购买积分', value: 'credits' },
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
export const cardPassSchema = {
|
|
||||||
key: 'payment.card-pass',
|
|
||||||
title: '充值卡',
|
|
||||||
icon: 'fa fas fa-ticket-alt',
|
|
||||||
description: '配置充值卡类型、卡号规则、批量生成和兑换逻辑。',
|
|
||||||
defaults: {
|
|
||||||
card_pass_enabled: false,
|
|
||||||
card_pass_desc: '',
|
|
||||||
card_pass_type: 'balance',
|
|
||||||
card_pass_prefix: 'AK',
|
|
||||||
card_pass_length: 16,
|
|
||||||
card_pass_batch_size: 50,
|
|
||||||
card_pass_max_redeem: 1,
|
|
||||||
card_pass_expiry: 0,
|
|
||||||
card_pass_amount: '10.00',
|
|
||||||
card_pass_vip_days: 30,
|
|
||||||
card_pass_credits: 0,
|
|
||||||
card_pass_redeem_page: '',
|
|
||||||
card_pass_success_msg: '兑换成功!',
|
|
||||||
card_pass_fail_msg: '卡号无效或已过期',
|
|
||||||
},
|
|
||||||
groups: [
|
|
||||||
{
|
|
||||||
key: 'basic',
|
|
||||||
title: '充值卡设置',
|
|
||||||
icon: 'fa fas fa-id-card',
|
|
||||||
fields: [
|
|
||||||
{ key: 'card_pass_enabled', label: '启用充值卡', type: 'switch', default: false },
|
|
||||||
{ key: 'card_pass_desc', label: '充值卡说明', type: 'textarea', default: '', dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_type', label: '充值卡类型', type: 'select', default: 'balance', options: [{ label: '余额卡', value: 'balance' }, { label: 'VIP卡', value: 'vip' }, { label: '积分卡', value: 'credits' }], dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_prefix', label: '卡号前缀', type: 'input', default: 'AK', dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_length', label: '卡号长度', type: 'number', default: 16, min: 8, max: 32, dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_batch_size', label: '批量生成数量', type: 'number', default: 50, min: 1, max: 500, dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'redeem',
|
|
||||||
title: '兑换设置',
|
|
||||||
icon: 'fa fas fa-exchange-alt',
|
|
||||||
fields: [
|
|
||||||
{ key: 'card_pass_max_redeem', label: '单卡最大兑换次数', type: 'number', default: 1, min: 1, max: 100, dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_expiry', label: '有效期(天)', type: 'number', default: 0, min: 0, help: '0为永久有效', dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_amount', label: '面额(元)', type: 'input', default: '10.00', min: 1, max: 9999, dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_vip_days', label: 'VIP天数', type: 'number', default: 30, min: 1, max: 3650, dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_credits', label: '赠送积分', type: 'number', default: 0, min: 0, max: 99999, dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'display',
|
|
||||||
title: '展示设置',
|
|
||||||
icon: 'fa fas fa-desktop',
|
|
||||||
fields: [
|
|
||||||
{ key: 'card_pass_redeem_page', label: '兑换页面', type: 'input', default: '', dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_success_msg', label: '兑换成功提示', type: 'input', default: '兑换成功!', dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
{ key: 'card_pass_fail_msg', label: '兑换失败提示', type: 'input', default: '卡号无效或已过期', dependsOn: { key: 'card_pass_enabled', value: true } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
@@ -1,42 +1,56 @@
|
|||||||
|
/**
|
||||||
|
* 收款接口 — 参考主题双下拉式重构:微信/支付宝接口选择(官方/易支付/关闭)、
|
||||||
|
* PayPal/Stripe 独立开关、货币与结算、订单与编号(含三个前缀)、
|
||||||
|
* 收款接口显示顺序,以及 5 个凭据配置块(支付宝/微信/PayPal/Stripe/易支付)。
|
||||||
|
*/
|
||||||
export const gatewaySchema = {
|
export const gatewaySchema = {
|
||||||
key: 'payment.gateway',
|
key: 'payment.gateway',
|
||||||
title: '收款接口',
|
title: '收款接口',
|
||||||
icon: 'fa fas fa-credit-card',
|
icon: 'fa fas fa-credit-card',
|
||||||
description: '管理已支持的收款通道:余额、支付宝、微信、PayPal、Stripe、易支付与卡密兑换。开启渠道后展开填写凭据。',
|
description: '配置收款通道:微信与支付宝可在官方/易支付之间选择,PayPal 与 Stripe 独立开关。订单前缀、流水号前缀、提现单号前缀在本页配置。',
|
||||||
defaults: {
|
defaults: {
|
||||||
payment_wechat_enabled: false,
|
pay_wechat_sdk_options: 'null',
|
||||||
payment_alipay_enabled: false,
|
pay_alipay_sdk_options: 'null',
|
||||||
payment_paypal_enabled: false,
|
pay_paypal_sdk_s: false,
|
||||||
payment_stripe_enabled: false,
|
pay_stripe_sdk_s: false,
|
||||||
payment_epay_enabled: false,
|
pay_currency_mark: '¥',
|
||||||
payment_balance_enabled: true,
|
pay_currency_unit: '元',
|
||||||
payment_card_pass_enabled: false,
|
pay_wechat_settle: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' },
|
||||||
wechat_merchantid: '',
|
pay_alipay_settle: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' },
|
||||||
wechat_appid: '',
|
pay_sdk_custom_title_s: false,
|
||||||
wechat_payment_type: 'native',
|
pay_sdk_custom_title: '',
|
||||||
wechat_api_v3_key: '',
|
payment_order_prefix: 'AKSRT',
|
||||||
wechat_private_key_path: '',
|
payment_flow_prefix: 'AK',
|
||||||
wechat_cert_path: '',
|
payment_withdrawal_prefix: 'TX',
|
||||||
|
payment_order_expiry: 30,
|
||||||
|
pay_wait_float_s: true,
|
||||||
|
pay_sdk_order: {},
|
||||||
alipay_appid: '',
|
alipay_appid: '',
|
||||||
alipay_privatekey: '',
|
alipay_privatekey: '',
|
||||||
alipay_payment_type: 'page',
|
alipay_payment_type: 'page',
|
||||||
alipay_app_public_cert_path: '',
|
alipay_app_public_cert_path: '',
|
||||||
alipay_public_cert_path: '',
|
alipay_public_cert_path: '',
|
||||||
alipay_root_cert_path: '',
|
alipay_root_cert_path: '',
|
||||||
|
wechat_merchantid: '',
|
||||||
|
wechat_appid: '',
|
||||||
|
wechat_payment_type: 'native',
|
||||||
|
wechat_api_v3_key: '',
|
||||||
|
wechat_private_key_path: '',
|
||||||
|
wechat_cert_path: '',
|
||||||
paypal_client_id: '',
|
paypal_client_id: '',
|
||||||
paypal_client_secret: '',
|
paypal_client_secret: '',
|
||||||
paypal_currency: 'USD',
|
paypal_currency: 'USD',
|
||||||
paypal_sandbox: true,
|
paypal_rates: '0.14',
|
||||||
|
paypal_sandbox: false,
|
||||||
stripe_secret_key: '',
|
stripe_secret_key: '',
|
||||||
stripe_publishable_key: '',
|
stripe_publishable_key: '',
|
||||||
stripe_webhook_secret: '',
|
stripe_webhook_secret: '',
|
||||||
stripe_currency: 'usd',
|
stripe_currency: 'USD',
|
||||||
stripe_test_mode: true,
|
stripe_rates: '0.14',
|
||||||
|
stripe_test_mode: false,
|
||||||
epay_apiurl: '',
|
epay_apiurl: '',
|
||||||
epay_pid: '',
|
epay_pid: '',
|
||||||
epay_key: '',
|
epay_key: '',
|
||||||
epay_channel_alipay: true,
|
|
||||||
epay_channel_wxpay: true,
|
|
||||||
epay_device: 'auto',
|
epay_device: 'auto',
|
||||||
},
|
},
|
||||||
groups: [
|
groups: [
|
||||||
@@ -46,122 +60,293 @@ export const gatewaySchema = {
|
|||||||
icon: 'fa fas fa-info-circle',
|
icon: 'fa fas fa-info-circle',
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
key: 'payment_gateway_notice',
|
key: 'gateway_notice',
|
||||||
label: '通道说明',
|
label: '',
|
||||||
type: 'notice',
|
type: 'content',
|
||||||
alertType: 'info',
|
ui_only: true,
|
||||||
alertContent: '以渠道开关 + 凭据是否齐全为准。异步回调由各网关验签(支付宝/微信/Stripe/易支付等),无需额外口令。卡密为兑换入口,不出现在收银台支付方式列表。',
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>以下收款接口,主题仅提供API接入服务,收款平台的可靠性请自行斟酌!</li><li>涉及到资金及信息安全,有相关执照的商家推荐使用官方接口</li><li>微信 / 支付宝接口可在「官方」与「易支付」之间选择;PayPal 与 Stripe 独立开关</li><li>异步回调由各网关验签,无需额外口令;回调地址固定为 /wp-json/aksrt/v1/payment/{gateway}/{notify|return}</li></ul>',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'gateways',
|
key: 'channels',
|
||||||
title: '支付渠道开关',
|
title: '收款接口选择',
|
||||||
icon: 'fa fas fa-toggle-on',
|
icon: 'fa fas fa-toggle-on',
|
||||||
description: '先开启渠道,下方对应配置卡片会展开;填写凭据后网关状态变为可用。余额与卡密无第三方凭据,仅开关即可。',
|
description: '微信与支付宝各选一种接入方式;选「易支付」后需在下方易支付配置块填写接口信息。',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'payment_balance_enabled', label: '余额支付', type: 'switch', default: true, help: '需同时在「余额充值」启用余额功能。关闭后用户中心仍可有钱包,但结账不可用余额支付。' },
|
{
|
||||||
{ key: 'payment_alipay_enabled', label: '支付宝', type: 'switch', default: false },
|
key: 'pay_wechat_sdk_options',
|
||||||
{ key: 'payment_wechat_enabled', label: '微信支付', type: 'switch', default: false },
|
label: '微信收款接口',
|
||||||
{ key: 'payment_paypal_enabled', label: 'PayPal', type: 'switch', default: false },
|
type: 'select',
|
||||||
{ key: 'payment_stripe_enabled', label: 'Stripe', type: 'switch', default: false },
|
default: 'null',
|
||||||
{ key: 'payment_epay_enabled', label: '易支付', type: 'switch', default: false, help: '兼容彩虹易支付协议的聚合收银台,可同时开启支付宝/微信子通道。' },
|
options: [
|
||||||
{ key: 'payment_card_pass_enabled', label: '卡密充值', type: 'switch', default: false, help: '仅控制卡密兑换入口是否开放;卡密规则与批量发卡在「充值卡」页。不进入结账支付方式列表。' },
|
{ label: '微信官方', value: 'official_wechat' },
|
||||||
|
{ label: '易支付-微信', value: 'epay' },
|
||||||
|
{ label: '关闭微信收款', value: 'null' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'pay_alipay_sdk_options',
|
||||||
|
label: '支付宝收款接口',
|
||||||
|
type: 'select',
|
||||||
|
default: 'null',
|
||||||
|
options: [
|
||||||
|
{ label: '支付宝企业支付/当面付', value: 'official_alipay' },
|
||||||
|
{ label: '易支付-支付宝', value: 'epay' },
|
||||||
|
{ label: '关闭支付宝收款', value: 'null' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'pay_paypal_sdk_s', label: 'PayPal支付(贝宝)', type: 'switch', default: false, help: '启用后请在下方配置参数' },
|
||||||
|
{ key: 'pay_stripe_sdk_s', label: 'Stripe支付', type: 'switch', default: false, help: '启用后请在下方配置参数' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'currency',
|
||||||
|
title: '货币与结算',
|
||||||
|
icon: 'fa fas fa-coins',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_currency_mark', label: '本地货币符号', type: 'input', default: '¥', help: '显示在金额前面(例如 $ 或 ¥)' },
|
||||||
|
{ key: 'pay_currency_unit', label: '本地货币单位名称', type: 'input', default: '元', help: '金额后缀,例如:人民币填「元」、美元填「dollars」' },
|
||||||
|
{
|
||||||
|
key: 'pay_wechat_settle',
|
||||||
|
label: '微信结算配置',
|
||||||
|
type: 'fieldset',
|
||||||
|
default: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' },
|
||||||
|
fields: [
|
||||||
|
{ key: 'settle_rate', label: '结算汇率', type: 'input', default: '1' },
|
||||||
|
{ key: 'settle_mark', label: '结算货币符号', type: 'input', default: '¥' },
|
||||||
|
{ key: 'settle_unit', label: '结算货币单位', type: 'input', default: '元' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'pay_alipay_settle',
|
||||||
|
label: '支付宝结算配置',
|
||||||
|
type: 'fieldset',
|
||||||
|
default: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' },
|
||||||
|
fields: [
|
||||||
|
{ key: 'settle_rate', label: '结算汇率', type: 'input', default: '1' },
|
||||||
|
{ key: 'settle_mark', label: '结算货币符号', type: 'input', default: '¥' },
|
||||||
|
{ key: 'settle_unit', label: '结算货币单位', type: 'input', default: '元', help: '如果接入的收款方式与本地的货币类型不同,则在此配置结算汇率及单位' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'pay_sdk_custom_title_s', label: '自定义收款标题', type: 'switch', default: false, help: '默认为付款类型加网站名,如需自定义请开启' },
|
||||||
|
{ key: 'pay_sdk_custom_title', label: '自定义收款标题', type: 'input', default: '', dependsOn: { key: 'pay_sdk_custom_title_s', value: true }, help: '可使用变量:订单类型 %order_type%,例如:%order_type%-AKSRT;注意控制总长度,太长会导致部分接口报错' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'order',
|
||||||
|
title: '订单与编号',
|
||||||
|
icon: 'fa fas fa-hashtag',
|
||||||
|
description: '订单号、流水号与提现单号的前缀配置(原名配置项保留于此)。',
|
||||||
|
fields: [
|
||||||
|
{ key: 'payment_order_prefix', label: '订单前缀', type: 'input', default: 'AKSRT', help: '订单号生成前缀' },
|
||||||
|
{ key: 'payment_flow_prefix', label: '流水号前缀', type: 'input', sanitize_type: 'business_prefix', default: 'AK', maxlength: 12, help: '仅允许字母、数字、下划线和短横线,最多 12 位。' },
|
||||||
|
{ key: 'payment_withdrawal_prefix', label: '提现单号前缀', type: 'input', sanitize_type: 'business_prefix', default: 'TX', maxlength: 12, help: '仅允许字母、数字、下划线和短横线,最多 12 位。' },
|
||||||
|
{ key: 'payment_order_expiry', label: '订单支付时效(分钟)', type: 'number', default: 30, min: 5, max: 1440, help: '用户下单后,最大支付时间,超过后订单将自动关闭(不能低于5分钟)' },
|
||||||
|
{ key: 'pay_wait_float_s', label: '浮窗显示待支付订单', type: 'switch', default: true, help: '将用户待支付订单一直显示在右上角,提醒用户付款' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'sdk-order',
|
||||||
|
title: '收款接口显示顺序',
|
||||||
|
icon: 'fa fas fa-sort-amount-down',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_sdk_order',
|
||||||
|
label: '显示顺序',
|
||||||
|
type: 'sortable',
|
||||||
|
default: {},
|
||||||
|
items: [
|
||||||
|
{ key: 'wechat', title: '微信', fields: [] },
|
||||||
|
{ key: 'alipay', title: '支付宝', fields: [] },
|
||||||
|
{ key: 'paypal', title: 'PayPal(贝宝)', fields: [] },
|
||||||
|
{ key: 'stripe', title: 'Stripe', fields: [] },
|
||||||
|
{ key: 'balance', title: '余额', fields: [] },
|
||||||
|
{ key: 'card_pass', title: '卡密', fields: [] },
|
||||||
|
],
|
||||||
|
help: '收银台支付方式显示顺序;仅显示已开启的接口',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'alipay',
|
||||||
|
title: '支付宝官方',
|
||||||
|
icon: 'fa fas fa-credit-card',
|
||||||
|
description: '支付宝官方接口(当面付 / 网站应用)。',
|
||||||
|
collapsible: true,
|
||||||
|
expandWhen: 'pay_alipay_sdk_options',
|
||||||
|
dependsOn: { key: 'pay_alipay_sdk_options', value: 'official_alipay' },
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'alipay_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>支付宝公钥为必填项目(公钥错误可以成功付款,但会回调失败)</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return}</li><li>同时填写了企业支付以及当面付参数,则优先使用当面付</li></ul>',
|
||||||
|
},
|
||||||
|
{ key: 'alipay_appid', label: '当面付:APPID', type: 'input', default: '' },
|
||||||
|
{ key: 'alipay_privatekey', label: '当面付:应用私钥', type: 'textarea', sanitize_type: 'code', default: '', rows: 4 },
|
||||||
|
{
|
||||||
|
key: 'alipay_payment_type',
|
||||||
|
label: '支付方式',
|
||||||
|
type: 'select',
|
||||||
|
default: 'page',
|
||||||
|
options: [
|
||||||
|
{ label: '电脑网站支付(web)', value: 'page' },
|
||||||
|
{ label: '手机网站支付(wap)', value: 'wap' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'alipay_app_public_cert_path', label: '应用公钥证书路径', type: 'input', default: '', help: 'appCertPublicKey.crt 绝对路径。' },
|
||||||
|
{ key: 'alipay_public_cert_path', label: '支付宝公钥证书路径', type: 'input', default: '', help: 'alipayCertPublicKey_RSA2.crt 绝对路径。' },
|
||||||
|
{ key: 'alipay_root_cert_path', label: '支付宝根证书路径', type: 'input', default: '', help: 'alipayRootCert.crt 绝对路径。' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'wechat',
|
key: 'wechat',
|
||||||
title: '微信支付配置',
|
title: '微信官方',
|
||||||
icon: 'fa fab fa-weixin',
|
icon: 'fa fab fa-weixin',
|
||||||
description: '开启「微信支付」后填写商户号与密钥。',
|
description: '微信企业支付官方接口。',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
expandWhen: 'payment_wechat_enabled',
|
expandWhen: 'pay_wechat_sdk_options',
|
||||||
dependsOn: { key: 'payment_wechat_enabled', value: true },
|
dependsOn: { key: 'pay_wechat_sdk_options', value: 'official_wechat' },
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'wechat_merchantid', label: '商户号', type: 'input', default: '' },
|
{
|
||||||
{ key: 'wechat_appid', label: 'AppID', type: 'input', default: '' },
|
key: 'wechat_notice',
|
||||||
{ key: 'wechat_payment_type', label: '支付方式', type: 'select', default: 'native', options: [
|
label: '',
|
||||||
{ label: '扫码支付(Native)', value: 'native' },
|
type: 'content',
|
||||||
{ label: 'H5支付', value: 'h5' },
|
ui_only: true,
|
||||||
] },
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>微信企业支付:官方接口,商家可申请,有年费,申请较为复杂</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/wechatpay/{notify|return},请配置 Native 支付回调链接</li></ul>',
|
||||||
{ key: 'wechat_api_v3_key', label: 'APIv3密钥', type: 'input', default: '', help: '微信商户平台设置的 APIv3 密钥(32位)。' },
|
},
|
||||||
|
{ key: 'wechat_merchantid', label: '商户号 PartnerID', type: 'input', default: '' },
|
||||||
|
{ key: 'wechat_appid', label: '授权绑定的AppID', type: 'input', default: '' },
|
||||||
|
{
|
||||||
|
key: 'wechat_payment_type',
|
||||||
|
label: '支付方式',
|
||||||
|
type: 'select',
|
||||||
|
default: 'native',
|
||||||
|
options: [
|
||||||
|
{ label: '扫码支付(Native)', value: 'native' },
|
||||||
|
{ label: 'H5支付', value: 'h5' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'wechat_api_v3_key', label: '支付APIv3密钥', type: 'input', default: '', help: '微信商户平台设置的 APIv3 密钥(32位)。' },
|
||||||
{ key: 'wechat_private_key_path', label: '商户私钥路径', type: 'input', default: '', help: 'apiclient_key.pem 绝对路径,用于签名。' },
|
{ key: 'wechat_private_key_path', label: '商户私钥路径', type: 'input', default: '', help: 'apiclient_key.pem 绝对路径,用于签名。' },
|
||||||
{ key: 'wechat_cert_path', label: '商户API证书路径', type: 'input', default: '', help: 'apiclient_cert.pem 绝对路径。' },
|
{ key: 'wechat_cert_path', label: '商户API证书路径', type: 'input', default: '', help: 'apiclient_cert.pem 绝对路径。' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'alipay',
|
|
||||||
title: '支付宝配置',
|
|
||||||
icon: 'fa fas fa-credit-card',
|
|
||||||
description: '开启「支付宝」后填写应用与证书。',
|
|
||||||
collapsible: true,
|
|
||||||
expandWhen: 'payment_alipay_enabled',
|
|
||||||
dependsOn: { key: 'payment_alipay_enabled', value: true },
|
|
||||||
fields: [
|
|
||||||
{ key: 'alipay_appid', label: 'AppID', type: 'input', default: '' },
|
|
||||||
{ key: 'alipay_privatekey', label: '应用私钥', type: 'textarea', rows: 3, default: '' },
|
|
||||||
{ key: 'alipay_payment_type', label: '支付方式', type: 'select', default: 'page', options: [
|
|
||||||
{ label: '电脑网站支付(web)', value: 'page' },
|
|
||||||
{ label: '手机网站支付(wap)', value: 'wap' },
|
|
||||||
] },
|
|
||||||
{ key: 'alipay_app_public_cert_path', label: '应用公钥证书路径', type: 'input', default: '', help: 'appCertPublicKey.crt 绝对路径。' },
|
|
||||||
{ key: 'alipay_public_cert_path', label: '支付宝公钥证书路径', type: 'input', default: '', help: 'alipayCertPublicKey_RSA2.crt 绝对路径。' },
|
|
||||||
{ key: 'alipay_root_cert_path', label: '支付宝根证书路径', type: 'input', default: '', help: 'alipayRootCert.crt 绝对路径。' },
|
|
||||||
{ key: 'alipay_notify_help', label: '回调地址说明', type: 'notice', alertType: 'info', alertContent: '异步通知 / 同步返回已固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return},无需在此填写。' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'paypal',
|
key: 'paypal',
|
||||||
title: 'PayPal 配置',
|
title: 'PayPal(贝宝)',
|
||||||
icon: 'fa fab fa-paypal',
|
icon: 'fa fab fa-paypal',
|
||||||
description: '开启「PayPal」后填写 Client 凭据。',
|
description: '常见的海外支付接口。',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
expandWhen: 'payment_paypal_enabled',
|
expandWhen: 'pay_paypal_sdk_s',
|
||||||
dependsOn: { key: 'payment_paypal_enabled', value: true },
|
dependsOn: { key: 'pay_paypal_sdk_s', value: true },
|
||||||
fields: [
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'paypal_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>PayPal(贝宝)是常见的海外支付接口</li><li>如果您的收款账户为中国大陆地区,则账户类型必须是企业,且只能收取非中国大陆区的PayPal付款</li><li>REST 应用申请:https://developer.paypal.com/dashboard/applications</li></ul>',
|
||||||
|
},
|
||||||
{ key: 'paypal_client_id', label: 'Client ID', type: 'input', default: '' },
|
{ key: 'paypal_client_id', label: 'Client ID', type: 'input', default: '' },
|
||||||
{ key: 'paypal_client_secret', label: 'Client Secret', type: 'input', default: '' },
|
{ key: 'paypal_client_secret', label: 'Client Secret', type: 'input', default: '' },
|
||||||
{ key: 'paypal_currency', label: '货币', type: 'input', default: 'USD' },
|
{ key: 'paypal_currency', label: '结算货币', type: 'select', default: 'USD', options: currencyOptions },
|
||||||
{ key: 'paypal_sandbox', label: '沙箱模式', type: 'switch', default: true },
|
{ key: 'paypal_rates', label: '货币汇率', type: 'input', default: '0.14', help: '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137' },
|
||||||
|
{ key: 'paypal_sandbox', label: '沙盒调试模式', type: 'switch', default: false, help: '沙箱模式(Sandbox)是PayPal支付的测试环境。开启后请使用沙箱环境生成的收款账户和付款账户进行测试。' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'stripe',
|
key: 'stripe',
|
||||||
title: 'Stripe 配置',
|
title: 'Stripe',
|
||||||
icon: 'fa fab fa-cc-stripe',
|
icon: 'fa fab fa-cc-stripe',
|
||||||
description: '开启「Stripe」后填写 API Key 与 Webhook。',
|
description: '常见的海外信用卡收款接口。',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
expandWhen: 'payment_stripe_enabled',
|
expandWhen: 'pay_stripe_sdk_s',
|
||||||
dependsOn: { key: 'payment_stripe_enabled', value: true },
|
dependsOn: { key: 'pay_stripe_sdk_s', value: true },
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'stripe_secret_key', label: 'Secret Key', type: 'input', default: '' },
|
{
|
||||||
|
key: 'stripe_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>Stripe 是常见的海外信用卡收款接口</li><li>API 密钥申请:https://dashboard.stripe.com/apikeys</li><li>Webhook 事件:checkout.session.completed</li><li>测试环境请使用 sk_test_ 开头的 Secret Key</li></ul>',
|
||||||
|
},
|
||||||
|
{ key: 'stripe_secret_key', label: '私钥Secret Key', type: 'input', default: '', help: 'Stripe Dashboard → Developers → API keys → Secret key' },
|
||||||
{ key: 'stripe_publishable_key', label: 'Publishable Key', type: 'input', default: '' },
|
{ key: 'stripe_publishable_key', label: 'Publishable Key', type: 'input', default: '' },
|
||||||
{ key: 'stripe_webhook_secret', label: 'Webhook Secret', type: 'input', default: '', help: 'Stripe Dashboard 配置 Webhook 后获得,用于验签。' },
|
{ key: 'stripe_webhook_secret', label: '签名密钥Webhook Secret', type: 'input', default: '', help: 'Developers → Webhooks → 端点 → Signing secret(whsec_ 开头)' },
|
||||||
{ key: 'stripe_currency', label: '货币', type: 'input', default: 'usd' },
|
{ key: 'stripe_currency', label: '结算货币', type: 'select', default: 'USD', options: currencyOptions },
|
||||||
{ key: 'stripe_test_mode', label: '测试模式', type: 'switch', default: true },
|
{ key: 'stripe_rates', label: '货币汇率', type: 'input', default: '0.14', help: '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137' },
|
||||||
|
{ key: 'stripe_test_mode', label: '测试模式', type: 'switch', default: false, help: '如果使用的测试开放模式,则请使用 sk_test_ 测试密钥与 Stripe 测试卡进行配置' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'epay',
|
key: 'epay',
|
||||||
title: '易支付配置',
|
title: '易支付',
|
||||||
icon: 'fa fas fa-university',
|
icon: 'fa fas fa-university',
|
||||||
description: '开启「易支付」后填写接口地址与商户信息,并选择支付宝/微信子通道。',
|
description: '易支付(彩虹协议)聚合收银台;通道由上方微信/支付宝接口选择控制。',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
expandWhen: 'payment_epay_enabled',
|
expandWhen: 'pay_wechat_sdk_options',
|
||||||
dependsOn: { key: 'payment_epay_enabled', value: true },
|
dependsOn: {
|
||||||
|
any: [
|
||||||
|
{ key: 'pay_wechat_sdk_options', value: 'epay' },
|
||||||
|
{ key: 'pay_alipay_sdk_options', value: 'epay' },
|
||||||
|
],
|
||||||
|
},
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'epay_apiurl', label: '接口地址', type: 'input', default: '', help: '易支付站点根地址,如 https://pay.example.com/(末尾斜杠可选)。' },
|
{
|
||||||
{ key: 'epay_pid', label: '商户ID', type: 'input', default: '' },
|
key: 'epay_notice',
|
||||||
{ key: 'epay_key', label: '商户密钥', type: 'input', default: '', help: 'MD5 通信密钥。' },
|
label: '',
|
||||||
{ key: 'epay_channel_alipay', label: '启用支付宝通道', type: 'switch', default: true },
|
type: 'content',
|
||||||
{ key: 'epay_channel_wxpay', label: '启用微信通道', type: 'switch', default: true },
|
ui_only: true,
|
||||||
{ key: 'epay_device', label: '下单终端', type: 'select', default: 'auto', options: [
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>易支付是一个常见的支付系统源码,任何人都可以下载并搭建</li><li>同时市面上多数的小规模支付平台都是由易支付修改而来,例如部分码支付、源支付等等</li><li>由于此接口服务商众多,主题只负责技术接入,平台可靠性请自行斟酌</li></ul>',
|
||||||
{ label: '自动(按 UA)', value: 'auto' },
|
},
|
||||||
{ label: '电脑端 submit', value: 'pc' },
|
{ key: 'epay_apiurl', label: 'API接口网址', type: 'input', default: '', help: '请填写接口地址,例如:https://pay.xxxxxxx.cn/' },
|
||||||
{ label: '移动端 mapi', value: 'mobile' },
|
{ key: 'epay_pid', label: '商户号', type: 'input', default: '' },
|
||||||
] },
|
{ key: 'epay_key', label: '商户秘钥', type: 'input', default: '', help: 'MD5 通信密钥。' },
|
||||||
{ key: 'epay_notify_help', label: '回调地址说明', type: 'notice', alertType: 'info', alertContent: '异步/同步回调固定为 /wp-json/aksrt/v1/payment/epay_alipay/{notify|return} 与 /payment/epay_wxpay/{notify|return},请在易支付后台放行对应 URL。' },
|
{
|
||||||
|
key: 'epay_device',
|
||||||
|
label: '下单终端',
|
||||||
|
type: 'select',
|
||||||
|
default: 'auto',
|
||||||
|
options: [
|
||||||
|
{ label: '自动(按 UA)', value: 'auto' },
|
||||||
|
{ label: '电脑端 submit', value: 'pc' },
|
||||||
|
{ label: '移动端 mapi', value: 'mobile' },
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** PayPal / Stripe 结算货币选项(参考主题同款 26 种)。 */
|
||||||
|
const currencyOptions = [
|
||||||
|
{ label: '澳元 (AUD)', value: 'AUD' },
|
||||||
|
{ label: '巴西雷亚尔 (BRL)', value: 'BRL' },
|
||||||
|
{ label: '加拿大元 (CAD)', value: 'CAD' },
|
||||||
|
{ label: '人民币 (CNY)', value: 'CNY' },
|
||||||
|
{ label: '克朗 (CZK)', value: 'CZK' },
|
||||||
|
{ label: '丹麦克朗 (DKK)', value: 'DKK' },
|
||||||
|
{ label: '欧元 (EUR)', value: 'EUR' },
|
||||||
|
{ label: '港币 (HKD)', value: 'HKD' },
|
||||||
|
{ label: '匈牙利福林 (HUF)', value: 'HUF' },
|
||||||
|
{ label: '印度卢比 (INR)', value: 'INR' },
|
||||||
|
{ label: '以色列新谢克尔 (ILS)', value: 'ILS' },
|
||||||
|
{ label: '日元 (JPY)', value: 'JPY' },
|
||||||
|
{ label: '马来西亚林吉特 (MYR)', value: 'MYR' },
|
||||||
|
{ label: '墨西哥比索 (MXN)', value: 'MXN' },
|
||||||
|
{ label: '新台币 (TWD)', value: 'TWD' },
|
||||||
|
{ label: '新西兰元 (NZD)', value: 'NZD' },
|
||||||
|
{ label: '挪威克朗 (NOK)', value: 'NOK' },
|
||||||
|
{ label: '菲律宾比索 (PHP)', value: 'PHP' },
|
||||||
|
{ label: '波兰兹罗提 (PLN)', value: 'PLN' },
|
||||||
|
{ label: '英镑 (GBP)', value: 'GBP' },
|
||||||
|
{ label: '俄罗斯卢布 (RUB)', value: 'RUB' },
|
||||||
|
{ label: '新加坡元 (SGD)', value: 'SGD' },
|
||||||
|
{ label: '瑞典克朗 (SEK)', value: 'SEK' },
|
||||||
|
{ label: '瑞士法郎 (CHF)', value: 'CHF' },
|
||||||
|
{ label: '泰铢 (THB)', value: 'THB' },
|
||||||
|
{ label: '美元 (USD)', value: 'USD' },
|
||||||
|
]
|
||||||
|
|||||||
@@ -2,23 +2,20 @@
|
|||||||
* Payment & Paid domain schemas.
|
* Payment & Paid domain schemas.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { knowledgeSchema } from './knowledge.js'
|
||||||
import { rechargeSchema } from './recharge.js'
|
import { rechargeSchema } from './recharge.js'
|
||||||
import { vipSchema } from './vip.js'
|
import { vipSchema } from './vip.js'
|
||||||
import { revenueSchema } from './revenue.js'
|
import { revenueSchema } from './revenue.js'
|
||||||
import { affiliateSchema } from './affiliate.js'
|
import { affiliateSchema } from './affiliate.js'
|
||||||
import { gatewaySchema } from './gateway.js'
|
import { gatewaySchema } from './gateway.js'
|
||||||
import { orderSchema } from './order.js'
|
|
||||||
import { cardPassSchema } from './cardPass.js'
|
|
||||||
import { withdrawalSchema } from './withdrawal.js'
|
import { withdrawalSchema } from './withdrawal.js'
|
||||||
|
|
||||||
export const paymentSchemas = {
|
export const paymentSchemas = {
|
||||||
|
knowledge: knowledgeSchema,
|
||||||
recharge: rechargeSchema,
|
recharge: rechargeSchema,
|
||||||
vip: vipSchema,
|
vip: vipSchema,
|
||||||
revenue: revenueSchema,
|
revenue: revenueSchema,
|
||||||
affiliate: affiliateSchema,
|
affiliate: affiliateSchema,
|
||||||
gateway: gatewaySchema,
|
gateway: gatewaySchema,
|
||||||
order: orderSchema,
|
|
||||||
'card-pass': cardPassSchema,
|
|
||||||
cardPass: cardPassSchema,
|
|
||||||
withdrawal: withdrawalSchema,
|
withdrawal: withdrawalSchema,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,238 @@
|
|||||||
|
/**
|
||||||
|
* 知识付费 — 1:1 复刻参考主题对应页面(免登陆购买 / 模块位置 / 优惠码 /
|
||||||
|
* 客户服务 / 付费下载 / 商品预置参数),并保留 AKSRT 订单展示与状态文案。
|
||||||
|
*/
|
||||||
|
export const knowledgeSchema = {
|
||||||
|
key: 'payment.knowledge',
|
||||||
|
title: '知识付费',
|
||||||
|
icon: 'fa fas fa-shopping-bag',
|
||||||
|
description: '付费内容总开关、免登陆购买、模块显示、优惠码与商品预置参数配置。',
|
||||||
|
defaults: {
|
||||||
|
pay_no_logged_in: true,
|
||||||
|
pay_cookie_day: 15,
|
||||||
|
pay_no_logged_remind: '您当前未登录!建议登陆后购买,可保存购买订单',
|
||||||
|
pay_box_position: 'top',
|
||||||
|
pay_free_logged_show: true,
|
||||||
|
pay_show_user: true,
|
||||||
|
pay_show_paycount: true,
|
||||||
|
coupon_post_s: false,
|
||||||
|
coupon_desc: '',
|
||||||
|
pay_mark: '付费',
|
||||||
|
payment_show_ip: false,
|
||||||
|
payment_show_device: false,
|
||||||
|
payment_show_order_no: true,
|
||||||
|
payment_show_create_time: true,
|
||||||
|
payment_show_pay_time: true,
|
||||||
|
payment_order_status_pending: '待支付',
|
||||||
|
payment_order_status_paid: '已支付',
|
||||||
|
payment_order_status_refunding: '退款中',
|
||||||
|
payment_order_status_refunded: '已退款',
|
||||||
|
payment_order_status_closed: '已关闭',
|
||||||
|
pay_service: [],
|
||||||
|
down_alone_page: false,
|
||||||
|
down_user_log: 50,
|
||||||
|
down_post_log: 50,
|
||||||
|
down_remote_to_local_s: true,
|
||||||
|
down_remote_to_local_size: 2048,
|
||||||
|
down_remote_to_local_ext: 'zip,rar,7z,text,png,jpg,jpeg,gif,mp3,mp4,avi,wmv,flv,swf,doc,docx,xls,xlsx,ppt,pptx,pdf',
|
||||||
|
down_verify_nonce: true,
|
||||||
|
pay_modo_default: '0',
|
||||||
|
points_price_default: 0,
|
||||||
|
vip_1_points_default: 0,
|
||||||
|
vip_2_points_default: 0,
|
||||||
|
pay_price_default: '0.01',
|
||||||
|
pay_original_price_default: '',
|
||||||
|
pay_promotion_tag_default: '<i class="fa fa-fw fa-bolt"></i> 限时特惠',
|
||||||
|
vip_1_price_default: '0',
|
||||||
|
vip_2_price_default: '0',
|
||||||
|
pay_rebate_discount: '0',
|
||||||
|
pay_cuont_default: { min: 0, max: 0 },
|
||||||
|
pay_details_default: '',
|
||||||
|
pay_extra_hide_default: '',
|
||||||
|
pay_attributes_default: [],
|
||||||
|
pay_gallery_show_default: 1,
|
||||||
|
},
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
key: 'notice',
|
||||||
|
title: '说明',
|
||||||
|
icon: 'fa fas fa-info-circle',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'knowledge_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '<p><b>知识付费</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>知识付费功能主要分为文章付费、付费会员、余额系统、推广返佣、创作分成等功能组成,您可以根据您的需要开启对应功能</li><li>使用支付功能请先在「收款接口」页配置好收款通道</li></ul>',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'guest-buy',
|
||||||
|
title: '免登陆购买',
|
||||||
|
icon: 'fa fas fa-user-clock',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_no_logged_in', label: '免登陆购买', type: 'switch', default: true, help: '开启后如果用户未登录则使用浏览器缓存验证是否购买' },
|
||||||
|
{ key: 'pay_cookie_day', label: 'Cookie时间(天)', type: 'number', default: 15, min: 1, max: 31, dependsOn: { key: 'pay_no_logged_in', value: true }, help: '免登陆购买的浏览器缓存有效时间' },
|
||||||
|
{ key: 'pay_no_logged_remind', label: '未登录提醒', type: 'textarea', default: '您当前未登录!建议登陆后购买,可保存购买订单', rows: 2, dependsOn: { key: 'pay_no_logged_in', value: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'box-position',
|
||||||
|
title: '模块显示位置',
|
||||||
|
icon: 'fa fas fa-arrows-alt',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_box_position',
|
||||||
|
label: '购买模块位置',
|
||||||
|
type: 'radio',
|
||||||
|
default: 'top',
|
||||||
|
options: [
|
||||||
|
{ label: '文章模块上方', value: 'box_top' },
|
||||||
|
{ label: '文章内容顶部', value: 'top' },
|
||||||
|
{ label: '文章内容底部', value: 'bottom' },
|
||||||
|
{ label: '文章模块下方', value: 'box_bottom' },
|
||||||
|
],
|
||||||
|
help: '在文章页面中购买模块的显示位置',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'display-basic',
|
||||||
|
title: '基础显示',
|
||||||
|
icon: 'fa fas fa-eye',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_free_logged_show', label: '免费资源登录可见', type: 'switch', default: true, help: '免费资源必须登录后才能查看' },
|
||||||
|
{ key: 'pay_show_user', label: '订单数据', type: 'switch', default: true, help: '在用户中心显示订单数据' },
|
||||||
|
{ key: 'pay_show_paycount', label: '销量显示', type: 'switch', default: true, help: '商品详情显示销售数量' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'coupon',
|
||||||
|
title: '商品优惠码',
|
||||||
|
icon: 'fa fas fa-ticket-alt',
|
||||||
|
fields: [
|
||||||
|
{ key: 'coupon_post_s', label: '为所有商品启用优惠券功能', type: 'switch', default: false, help: '开启后将为所有商品显示输入优惠码的功能;也可以单独给任意一个商品开启' },
|
||||||
|
{ key: 'coupon_desc', label: '优惠码默认说明', type: 'textarea', default: '', rows: 1, dependsOn: { key: 'coupon_post_s', value: true }, help: '用户填写优惠码时展示的提醒内容,支持HTML代码' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'display',
|
||||||
|
title: '展示设置',
|
||||||
|
icon: 'fa fas fa-list-alt',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_mark', label: '付费标记', type: 'input', default: '付费' },
|
||||||
|
{ key: 'payment_show_ip', label: '显示用户IP', type: 'switch', default: false },
|
||||||
|
{ key: 'payment_show_device', label: '显示设备信息', type: 'switch', default: false },
|
||||||
|
{ key: 'payment_show_order_no', label: '显示订单号', type: 'switch', default: true },
|
||||||
|
{ key: 'payment_show_create_time', label: '显示创建时间', type: 'switch', default: true },
|
||||||
|
{ key: 'payment_show_pay_time', label: '显示支付时间', type: 'switch', default: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'status',
|
||||||
|
title: '状态设置',
|
||||||
|
icon: 'fa fas fa-tags',
|
||||||
|
fields: [
|
||||||
|
{ key: 'payment_order_status_pending', label: '待支付状态文案', type: 'input', default: '待支付' },
|
||||||
|
{ key: 'payment_order_status_paid', label: '已支付状态文案', type: 'input', default: '已支付' },
|
||||||
|
{ key: 'payment_order_status_refunding', label: '退款中状态文案', type: 'input', default: '退款中' },
|
||||||
|
{ key: 'payment_order_status_refunded', label: '已退款状态文案', type: 'input', default: '已退款' },
|
||||||
|
{ key: 'payment_order_status_closed', label: '已关闭状态文案', type: 'input', default: '已关闭' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'service',
|
||||||
|
title: '客户服务',
|
||||||
|
icon: 'fa fas fa-headphones',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_service',
|
||||||
|
label: '用户服务内容',
|
||||||
|
type: 'group',
|
||||||
|
button_title: '添加服务项',
|
||||||
|
default: [],
|
||||||
|
fields: [
|
||||||
|
{ key: 'value', label: '服务内容', type: 'input', default: '' },
|
||||||
|
{ key: 'icon', label: '自定义图标', type: 'icon', default: '' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'feature',
|
||||||
|
title: '商品功能配置',
|
||||||
|
icon: 'fa fas fa-cubes',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_type_option',
|
||||||
|
label: '商品功能配置',
|
||||||
|
type: 'tabbed',
|
||||||
|
tabs: [
|
||||||
|
{
|
||||||
|
key: 'download',
|
||||||
|
title: '付费下载',
|
||||||
|
fields: [
|
||||||
|
{ key: 'down_alone_page', label: '独立下载页面', type: 'switch', default: false, help: '开启后,付费资源的下载链接会跳转独立页面显示' },
|
||||||
|
{ key: 'down_user_log', label: '保存用户下载记录(条)', type: 'number', default: 50, min: 0, help: '填0则不保存,注意记录量太大可能会影响网站性能' },
|
||||||
|
{ key: 'down_post_log', label: '保存文章下载记录(条)', type: 'number', default: 50, min: 0, help: '填0则不保存,注意记录量太大可能会影响网站性能' },
|
||||||
|
{ key: 'down_remote_to_local_s', label: '远程文件转本地文件下载', type: 'switch', default: true, help: '当下载地址为外链文件时,先将远程文件下载到本地服务器,再提供给用户下载,可完全隐藏远程下载地址' },
|
||||||
|
{ key: 'down_remote_to_local_size', label: '文件大小限制(Kb)', type: 'number', default: 2048, min: 0 },
|
||||||
|
{ key: 'down_remote_to_local_ext', label: '文件格式限制', type: 'input', default: 'zip,rar,7z,text,png,jpg,jpeg,gif,mp3,mp4,avi,wmv,flv,swf,doc,docx,xls,xlsx,ppt,pptx,pdf', help: '限制使用此功能的文件格式,多个用英文逗号隔开' },
|
||||||
|
{ key: 'down_verify_nonce', label: '下载前检测用户环境', type: 'switch', default: true, help: '防止机器批量扫描下载,有效防止跨站攻击' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'presets',
|
||||||
|
title: '商品预置参数配置',
|
||||||
|
icon: 'fa fas fa-sliders-h',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'presets_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '在下方配置的参数新建文章时候会自动填入,方便新建文章的设置。最终以文章配置为准',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'pay_modo_default',
|
||||||
|
label: '支付类型',
|
||||||
|
type: 'radio',
|
||||||
|
default: '0',
|
||||||
|
options: [
|
||||||
|
{ label: '普通商品(金钱购买)', value: '0' },
|
||||||
|
{ label: '积分商品(积分购买,依赖于用户积分功能)', value: 'points' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'points_price_default', label: '积分售价(积分)', type: 'number', default: 0, min: 0 },
|
||||||
|
{ key: 'vip_1_points_default', label: '一级会员积分售价(积分)', type: 'number', default: 0, min: 0 },
|
||||||
|
{ key: 'vip_2_points_default', label: '二级会员积分售价(积分)', type: 'number', default: 0, min: 0 },
|
||||||
|
{ key: 'pay_price_default', label: '执行价', type: 'input', sanitize_type: 'money_decimal', default: '0.01', suffix: '元' },
|
||||||
|
{ key: 'pay_original_price_default', label: '原价', type: 'input', sanitize_type: 'money_decimal', default: '', suffix: '元', help: '显示在执行价格前面,并划掉' },
|
||||||
|
{ key: 'pay_promotion_tag_default', label: '促销标签', type: 'textarea', sanitize_type: 'html', default: '<i class="fa fa-fw fa-bolt"></i> 限时特惠', rows: 1 },
|
||||||
|
{ key: 'vip_1_price_default', label: '一级会员价格', type: 'input', sanitize_type: 'money_decimal', default: '0', suffix: '元', help: '填0则为一级会员免费' },
|
||||||
|
{ key: 'vip_2_price_default', label: '二级会员价格', type: 'input', sanitize_type: 'money_decimal', default: '0', suffix: '元', help: '填0则为二级会员免费' },
|
||||||
|
{ key: 'pay_rebate_discount', label: '推广折扣', type: 'input', sanitize_type: 'money_decimal', default: '0', suffix: '元', help: '通过推广链接购买,额外优惠的金额;需开启推广返佣功能,且不能超过实际购买价' },
|
||||||
|
{ key: 'pay_cuont_default', label: '销量浮动', type: 'between_number', default: { min: 0, max: 0 }, help: '为真实销量增加或减少的数量,系统会根据此处设置的区间获取随机值作为预置参数' },
|
||||||
|
{ key: 'pay_details_default', label: '更多详情', type: 'textarea', sanitize_type: 'html', default: '', rows: 3, help: '可插入任意的HTML代码' },
|
||||||
|
{ key: 'pay_extra_hide_default', label: '额外隐藏内容', type: 'textarea', sanitize_type: 'html', default: '', rows: 3, help: '可插入任意的HTML代码' },
|
||||||
|
{
|
||||||
|
key: 'pay_attributes_default',
|
||||||
|
label: '资源属性',
|
||||||
|
type: 'group',
|
||||||
|
button_title: '添加属性',
|
||||||
|
default: [],
|
||||||
|
fields: [
|
||||||
|
{ key: 'key', label: '属性名称', type: 'input', default: '' },
|
||||||
|
{ key: 'value', label: '属性内容', type: 'input', default: '' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'pay_gallery_show_default', label: '付费图片免费查看数量(张)', type: 'number', default: 1, min: 0, help: '设置付费图片可免费查看前几张图片的数量的默认值' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
export const orderSchema = {
|
|
||||||
key: 'payment.order',
|
|
||||||
title: '订单设置',
|
|
||||||
icon: 'fa fas fa-file-alt',
|
|
||||||
description: '配置订单前缀、有效期、展示字段和状态文案。',
|
|
||||||
defaults: {
|
|
||||||
payment_order_prefix: 'AKSRT',
|
|
||||||
payment_flow_prefix: 'AK',
|
|
||||||
payment_withdrawal_prefix: 'TX',
|
|
||||||
payment_order_expiry: 30,
|
|
||||||
pay_show_user: true,
|
|
||||||
pay_show_paycount: true,
|
|
||||||
pay_no_logged_in: true,
|
|
||||||
pay_cookie_day: 15,
|
|
||||||
pay_no_logged_remind: '您当前未登录!建议登陆后购买,可保存购买订单',
|
|
||||||
pay_wait_float_s: true,
|
|
||||||
payment_order_max_minutes: 30,
|
|
||||||
pay_mark: '付费',
|
|
||||||
pay_box_position: 'top',
|
|
||||||
payment_show_ip: false,
|
|
||||||
payment_show_device: false,
|
|
||||||
payment_show_order_no: true,
|
|
||||||
payment_show_create_time: true,
|
|
||||||
payment_show_pay_time: true,
|
|
||||||
payment_order_status_pending: '待支付',
|
|
||||||
payment_order_status_paid: '已支付',
|
|
||||||
payment_order_status_refunding: '退款中',
|
|
||||||
payment_order_status_refunded: '已退款',
|
|
||||||
payment_order_status_closed: '已关闭',
|
|
||||||
pay_service: '',
|
|
||||||
pay_service_icon: '',
|
|
||||||
pay_service_value: '',
|
|
||||||
pay_service_qq: '',
|
|
||||||
pay_service_wechat: '',
|
|
||||||
},
|
|
||||||
groups: [
|
|
||||||
{
|
|
||||||
key: 'basic',
|
|
||||||
title: '订单基础',
|
|
||||||
icon: 'fa fas fa-cog',
|
|
||||||
fields: [
|
|
||||||
{ key: 'payment_order_prefix', label: '订单前缀', type: 'input', default: 'AKSRT' },
|
|
||||||
{ key: 'payment_flow_prefix', label: '流水号前缀', type: 'input', sanitize_type: 'business_prefix', default: 'AK', maxlength: 12, help: '仅允许字母、数字、下划线和短横线,最多 12 位。' },
|
|
||||||
{ key: 'payment_withdrawal_prefix', label: '提现单号前缀', type: 'input', sanitize_type: 'business_prefix', default: 'TX', maxlength: 12, help: '仅允许字母、数字、下划线和短横线,最多 12 位。' },
|
|
||||||
{ key: 'payment_order_expiry', label: '订单有效期(分钟)', type: 'number', default: 30, min: 5, max: 1440 },
|
|
||||||
{ key: 'pay_show_user', label: '显示用户信息', type: 'switch', default: true },
|
|
||||||
{ key: 'pay_show_paycount', label: '显示购买次数', type: 'switch', default: true },
|
|
||||||
{ key: 'pay_no_logged_in', label: '未登录提示', type: 'switch', default: true },
|
|
||||||
{ key: 'pay_cookie_day', label: 'Cookie有效期(天)', type: 'number', default: 15, min: 1, max: 31, help: '未登录购买 Cookie 有效时间,1-31 天' },
|
|
||||||
{ key: 'pay_no_logged_remind', label: '未登录提醒文案', type: 'textarea', default: '您当前未登录!建议登陆后购买,可保存购买订单', help: '未登录用户查看付费内容时的提醒文案' },
|
|
||||||
{ key: 'pay_wait_float_s', label: '订单等待浮动', type: 'switch', default: true },
|
|
||||||
{ key: 'payment_order_max_minutes', label: '订单最大支付时间(分钟)', type: 'number', default: 30, min: 5, max: 1440 },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'display',
|
|
||||||
title: '展示设置',
|
|
||||||
icon: 'fa fas fa-eye',
|
|
||||||
fields: [
|
|
||||||
{ key: 'pay_mark', label: '付费标记', type: 'input', default: '付费' },
|
|
||||||
{ key: 'pay_box_position', label: '付费框位置', type: 'radio', default: 'top', options: [{ label: '文章框顶部(封面后)', value: 'box_top' }, { label: '正文顶部', value: 'top' }, { label: '正文底部', value: 'bottom' }, { label: '文章框底部(相关前)', value: 'box_bottom' }] },
|
|
||||||
{ key: 'payment_show_ip', label: '显示用户IP', type: 'switch', default: false },
|
|
||||||
{ key: 'payment_show_device', label: '显示设备信息', type: 'switch', default: false },
|
|
||||||
{ key: 'payment_show_order_no', label: '显示订单号', type: 'switch', default: true },
|
|
||||||
{ key: 'payment_show_create_time', label: '显示创建时间', type: 'switch', default: true },
|
|
||||||
{ key: 'payment_show_pay_time', label: '显示支付时间', type: 'switch', default: true },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'status',
|
|
||||||
title: '状态设置',
|
|
||||||
icon: 'fa fas fa-tags',
|
|
||||||
fields: [
|
|
||||||
{ key: 'payment_order_status_pending', label: '待支付状态文案', type: 'input', default: '待支付' },
|
|
||||||
{ key: 'payment_order_status_paid', label: '已支付状态文案', type: 'input', default: '已支付' },
|
|
||||||
{ key: 'payment_order_status_refunding', label: '退款中状态文案', type: 'input', default: '退款中' },
|
|
||||||
{ key: 'payment_order_status_refunded', label: '已退款状态文案', type: 'input', default: '已退款' },
|
|
||||||
{ key: 'payment_order_status_closed', label: '已关闭状态文案', type: 'input', default: '已关闭' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'service',
|
|
||||||
title: '服务设置',
|
|
||||||
icon: 'fa fas fa-headphones',
|
|
||||||
fields: [
|
|
||||||
{ key: 'pay_service', label: '客服设置', type: 'textarea', default: '' },
|
|
||||||
{ key: 'pay_service_icon', label: '客服图标', type: 'icon', default: '' },
|
|
||||||
{ key: 'pay_service_value', label: '客服内容', type: 'input', default: '' },
|
|
||||||
{ key: 'pay_service_qq', label: 'QQ客服', type: 'input', default: '' },
|
|
||||||
{ key: 'pay_service_wechat', label: '微信客服', type: 'media', default: '' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
@@ -1,24 +1,44 @@
|
|||||||
|
/**
|
||||||
|
* 余额充值 — 参考主题结构:用户余额(含余额提现)、转账、充值商品选项、
|
||||||
|
* 卡密充值、充值卡(原「充值卡」页并入)与余额兑换积分。
|
||||||
|
*/
|
||||||
export const rechargeSchema = {
|
export const rechargeSchema = {
|
||||||
key: 'payment.recharge',
|
key: 'payment.recharge',
|
||||||
title: '余额充值',
|
title: '余额充值',
|
||||||
icon: 'fa fas fa-bolt',
|
icon: 'fa fas fa-bolt',
|
||||||
description: '配置余额充值套餐、转账与积分兑换。',
|
description: '配置余额功能、充值商品选项、卡密充值、充值卡规则与余额兑换积分。',
|
||||||
defaults: {
|
defaults: {
|
||||||
pay_balance_s: true,
|
pay_balance_s: true,
|
||||||
|
pay_balance_withdraw_s: false,
|
||||||
pay_balance_desc: '',
|
pay_balance_desc: '',
|
||||||
pay_balance_product: '30|30|入门包\n98|108|推荐包',
|
|
||||||
pay_balance_product_name: '',
|
|
||||||
pay_balance_price: 0,
|
|
||||||
pay_balance_tag: '元',
|
|
||||||
pay_balance_tag_class: '',
|
|
||||||
pay_balance_product_custom_s: true,
|
|
||||||
pay_balance_product_custom_limit: 9999,
|
|
||||||
pay_balance_transfer_s: false,
|
pay_balance_transfer_s: false,
|
||||||
pay_balance_transfer_service_charge: 0,
|
pay_balance_transfer_service_charge: 0,
|
||||||
pay_balance_transfer_desc: '',
|
pay_balance_transfer_desc: '',
|
||||||
|
pay_balance_product: [
|
||||||
|
{ price: 50, pay_price: 0, tag: '', tag_class: '' },
|
||||||
|
{ price: 100, pay_price: 98, tag: '', tag_class: '' },
|
||||||
|
{ price: 200, pay_price: 188, tag: '推荐', tag_class: 'jb-cyan' },
|
||||||
|
{ price: 500, pay_price: 468, tag: '特惠', tag_class: 'jb-pink' },
|
||||||
|
],
|
||||||
|
pay_balance_product_custom_s: true,
|
||||||
|
pay_balance_product_custom_limit: 9999,
|
||||||
pay_balance_pass_charge_s: false,
|
pay_balance_pass_charge_s: false,
|
||||||
pay_balance_pass_charge_desc: '',
|
pay_balance_pass_charge_desc: '',
|
||||||
pay_balance_pass_charge_only_password: false,
|
pay_balance_pass_charge_only_password: false,
|
||||||
|
card_pass_enabled: false,
|
||||||
|
card_pass_desc: '',
|
||||||
|
card_pass_type: 'balance',
|
||||||
|
card_pass_prefix: 'AK',
|
||||||
|
card_pass_length: 16,
|
||||||
|
card_pass_batch_size: 50,
|
||||||
|
card_pass_max_redeem: 1,
|
||||||
|
card_pass_expiry: 0,
|
||||||
|
card_pass_amount: '10.00',
|
||||||
|
card_pass_vip_days: 30,
|
||||||
|
card_pass_credits: 0,
|
||||||
|
card_pass_redeem_page: '',
|
||||||
|
card_pass_success_msg: '兑换成功!',
|
||||||
|
card_pass_fail_msg: '卡号无效或已过期',
|
||||||
pay_balance_points_exchange_s: false,
|
pay_balance_points_exchange_s: false,
|
||||||
pay_balance_points_exchange_rate: 100,
|
pay_balance_points_exchange_rate: 100,
|
||||||
pay_balance_points_exchange_min_points: 100,
|
pay_balance_points_exchange_min_points: 100,
|
||||||
@@ -26,34 +46,28 @@ export const rechargeSchema = {
|
|||||||
pay_balance_points_exchange_desc: '',
|
pay_balance_points_exchange_desc: '',
|
||||||
},
|
},
|
||||||
groups: [
|
groups: [
|
||||||
|
{
|
||||||
|
key: 'notice',
|
||||||
|
title: '说明',
|
||||||
|
icon: 'fa fas fa-info-circle',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'recharge_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '<p><b>用户余额功能:</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>开启后用户可充值到余额,余额可用于全站消费</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>可以在用户管理中,为某一个用户手动赠送余额</li></ul>',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'basic',
|
key: 'basic',
|
||||||
title: '充值开关',
|
title: '用户余额',
|
||||||
icon: 'fa fas fa-credit-card',
|
icon: 'fa fas fa-credit-card',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'pay_balance_s', label: '启用余额功能', type: 'switch', default: true, help: '开启后用户中心显示现金钱包,并默认允许余额支付(可在收款接口单独关闭)。充值需另配支付宝/微信等外部网关。' },
|
{ key: 'pay_balance_s', label: '启用余额充值/支付功能', type: 'switch', default: true, help: '开启后用户中心显示现金钱包,并可作为收银台支付方式' },
|
||||||
{ key: 'pay_balance_desc', label: '充值说明', type: 'textarea', default: '', dependsOn: { key: 'pay_balance_s', value: true } },
|
{ key: 'pay_balance_withdraw_s', label: '余额提现', type: 'switch', default: false, dependsOn: { key: 'pay_balance_s', value: true }, help: '允许将余额提现' },
|
||||||
],
|
{ key: 'pay_balance_desc', label: '充值说明', type: 'textarea', default: '', rows: 3, dependsOn: { key: 'pay_balance_s', value: true }, help: '用户充值时显示的内容,建议为提醒事项、充值协议等,支持HTML代码' },
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'packages',
|
|
||||||
title: '充值套餐',
|
|
||||||
icon: 'fa fas fa-folder-open',
|
|
||||||
fields: [
|
|
||||||
{ key: 'pay_balance_product', label: '套餐列表', type: 'textarea', default: '30|30|入门包\n98|108|推荐包', help: '每行一个套餐:支付金额|到账金额|标题', dependsOn: { key: 'pay_balance_s', value: true } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'product',
|
|
||||||
title: '充值产品',
|
|
||||||
icon: 'fa fas fa-archive',
|
|
||||||
fields: [
|
|
||||||
{ key: 'pay_balance_product_name', label: '充值产品', type: 'input', default: '', dependsOn: { key: 'pay_balance_s', value: true } },
|
|
||||||
{ key: 'pay_balance_price', label: '充值价格', type: 'number', default: 0, min: 0, max: 99999, dependsOn: { key: 'pay_balance_s', value: true } },
|
|
||||||
{ key: 'pay_balance_tag', label: '价格标签', type: 'input', default: '元', dependsOn: { key: 'pay_balance_s', value: true } },
|
|
||||||
{ key: 'pay_balance_tag_class', label: '标签样式', type: 'input', default: '', dependsOn: { key: 'pay_balance_s', value: true } },
|
|
||||||
{ key: 'pay_balance_product_custom_s', label: '自定义金额', type: 'switch', default: true, dependsOn: { key: 'pay_balance_s', value: true } },
|
|
||||||
{ key: 'pay_balance_product_custom_limit', label: '自定义金额限制', type: 'number', default: 9999, min: 1, max: 99999, dependsOn: { key: 'pay_balance_s', value: true } },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -61,23 +75,83 @@ export const rechargeSchema = {
|
|||||||
title: '余额转账',
|
title: '余额转账',
|
||||||
icon: 'fa fas fa-exchange-alt',
|
icon: 'fa fas fa-exchange-alt',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'pay_balance_transfer_s', label: '启用余额转账', type: 'switch', default: false },
|
{ key: 'pay_balance_transfer_s', label: '启用余额转账', type: 'switch', default: false, help: '允许用户转账给其他用户' },
|
||||||
{ key: 'pay_balance_transfer_service_charge', label: '转账手续费(%)', type: 'number', default: 0, min: 0, max: 50, dependsOn: { key: 'pay_balance_transfer_s', value: true } },
|
{ key: 'pay_balance_transfer_service_charge', label: '转账手续费(%)', type: 'number', default: 0, min: 0, max: 50, dependsOn: { key: 'pay_balance_transfer_s', value: true } },
|
||||||
{ key: 'pay_balance_transfer_desc', label: '转账说明', type: 'textarea', default: '', dependsOn: { key: 'pay_balance_transfer_s', value: true } },
|
{ key: 'pay_balance_transfer_desc', label: '转账说明', type: 'textarea', default: '', rows: 2, dependsOn: { key: 'pay_balance_transfer_s', value: true }, help: '用户转账时候显示的内容,建议为提醒事项、转账协议等,支持HTML代码' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'products',
|
||||||
|
title: '充值商品选项',
|
||||||
|
icon: 'fa fas fa-archive',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'pay_balance_product',
|
||||||
|
label: '充值金额选项',
|
||||||
|
type: 'group',
|
||||||
|
button_title: '添加充值金额选项',
|
||||||
|
default: [
|
||||||
|
{ price: 50, pay_price: 0, tag: '', tag_class: '' },
|
||||||
|
{ price: 100, pay_price: 98, tag: '', tag_class: '' },
|
||||||
|
{ price: 200, pay_price: 188, tag: '推荐', tag_class: 'jb-cyan' },
|
||||||
|
{ price: 500, pay_price: 468, tag: '特惠', tag_class: 'jb-pink' },
|
||||||
|
],
|
||||||
|
help: '用户充值时候,可快速选择的充值金额,同时支持设置折扣',
|
||||||
|
fields: [
|
||||||
|
{ key: 'price', label: '充值金额', type: 'number', default: 100, min: 0, suffix: '元' },
|
||||||
|
{ key: 'pay_price', label: '销售金额', type: 'number', default: 0, min: 0, suffix: '元', help: '选填,设置不同的销售金额实现充值折扣的功能,设置为0则与充值金额一致' },
|
||||||
|
{ key: 'tag', label: '小标签', type: 'input', default: '', help: '支持HTML,请注意控制长度' },
|
||||||
|
{ key: 'tag_class', label: '标签颜色类', type: 'input', default: '', help: '主题标签颜色类,如 jb-cyan / jb-pink' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'pay_balance_product_custom_s', label: '自定义充值金额', type: 'switch', default: true, help: '允许用户手动输入充值金额' },
|
||||||
|
{ key: 'pay_balance_product_custom_limit', label: '自定义充值金额上限', type: 'number', default: 9999, min: 1, max: 99999, dependsOn: { key: 'pay_balance_product_custom_s', value: true } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'pass-charge',
|
key: 'pass-charge',
|
||||||
title: '充值卡免扣',
|
title: '卡密充值',
|
||||||
icon: 'fa fas fa-ticket-alt',
|
icon: 'fa fas fa-ticket-alt',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'pay_balance_pass_charge_s', label: '启用余额卡密兑换', type: 'switch', default: false },
|
{ key: 'pay_balance_pass_charge_s', label: '启用卡密充值余额功能', type: 'switch', default: false },
|
||||||
{ key: 'pay_balance_pass_charge_desc', label: '卡密兑换说明', type: 'textarea', default: '', dependsOn: { key: 'pay_balance_pass_charge_s', value: true } },
|
{ key: 'pay_balance_pass_charge_desc', label: '卡密充值说明', type: 'textarea', default: '', rows: 2, dependsOn: { key: 'pay_balance_pass_charge_s', value: true }, help: '用户使用卡密充值时显示的内容,建议为提醒事项、充值协议等,支持HTML代码' },
|
||||||
{ key: 'pay_balance_pass_charge_only_password', label: '仅密码兑换', type: 'switch', default: false, dependsOn: { key: 'pay_balance_pass_charge_s', value: true } },
|
{ key: 'pay_balance_pass_charge_only_password', label: '单密码模式', type: 'switch', default: false, dependsOn: { key: 'pay_balance_pass_charge_s', value: true }, help: '仅需输入密码,不需要卡号' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'exchange',
|
key: 'charge-card',
|
||||||
|
title: '充值卡',
|
||||||
|
icon: 'fa fas fa-id-card',
|
||||||
|
fields: [
|
||||||
|
{ key: 'card_pass_enabled', label: '启用充值卡', type: 'switch', default: false, help: '充值卡规则与批量发卡配置;卡密兑换入口由上方「卡密充值」控制' },
|
||||||
|
{ key: 'card_pass_desc', label: '充值卡说明', type: 'textarea', default: '', dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{
|
||||||
|
key: 'card_pass_type',
|
||||||
|
label: '充值卡类型',
|
||||||
|
type: 'select',
|
||||||
|
default: 'balance',
|
||||||
|
dependsOn: { key: 'card_pass_enabled', value: true },
|
||||||
|
options: [
|
||||||
|
{ label: '余额卡', value: 'balance' },
|
||||||
|
{ label: 'VIP卡', value: 'vip' },
|
||||||
|
{ label: '积分卡', value: 'credits' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'card_pass_prefix', label: '卡号前缀', type: 'input', default: 'AK', dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_length', label: '卡号长度', type: 'number', default: 16, min: 8, max: 32, dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_batch_size', label: '批量生成数量', type: 'number', default: 50, min: 1, max: 500, dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_max_redeem', label: '单卡最大兑换次数', type: 'number', default: 1, min: 1, max: 100, dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_expiry', label: '有效期(天)', type: 'number', default: 0, min: 0, help: '0为永久有效', dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_amount', label: '面额(元)', type: 'input', sanitize_type: 'money_decimal', default: '10.00', min: 1, max: 9999, dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_vip_days', label: 'VIP天数', type: 'number', default: 30, min: 1, max: 3650, dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_credits', label: '赠送积分', type: 'number', default: 0, min: 0, max: 99999, dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_redeem_page', label: '兑换页面', type: 'input', default: '', dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_success_msg', label: '兑换成功提示', type: 'input', default: '兑换成功!', dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
{ key: 'card_pass_fail_msg', label: '兑换失败提示', type: 'input', default: '卡号无效或已过期', dependsOn: { key: 'card_pass_enabled', value: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'points-exchange',
|
||||||
title: '余额兑换积分',
|
title: '余额兑换积分',
|
||||||
icon: 'fa fas fa-database',
|
icon: 'fa fas fa-database',
|
||||||
fields: [
|
fields: [
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* 创作分成 — 现金/积分分成比例 + 创作分成说明与详情页配置。
|
||||||
|
*/
|
||||||
export const revenueSchema = {
|
export const revenueSchema = {
|
||||||
key: 'payment.revenue',
|
key: 'payment.revenue',
|
||||||
title: '创作中心',
|
title: '创作分成',
|
||||||
icon: 'fa fas fa-chart-line',
|
icon: 'fa fas fa-chart-line',
|
||||||
description: '分别配置现金收益和积分收益的会员分成比例,结算周期结束后自动入账。',
|
description: '分别配置现金收益和积分收益的会员分成比例,结算周期结束后自动入账。',
|
||||||
defaults: {
|
defaults: {
|
||||||
@@ -13,8 +16,25 @@ export const revenueSchema = {
|
|||||||
payment_revenue_points_ratio_user: 0,
|
payment_revenue_points_ratio_user: 0,
|
||||||
payment_revenue_points_ratio_vip_1: 0,
|
payment_revenue_points_ratio_vip_1: 0,
|
||||||
payment_revenue_points_ratio_vip_2: 0,
|
payment_revenue_points_ratio_vip_2: 0,
|
||||||
|
pay_income_desc_details: '<p>在本站发布付费内容,获得的收益将参与收入分成</p><p>普通用户分成比例为:60%</p><p>一级会员分成比例为:70%</p><p>二级会员分成比例为:80%</p><p>分成比例的计算方式为:(实收现金-推广佣金)x 分成比例</p><p>申请提现后,需后台人工处理,一般2-3小时,请耐心等待</p>',
|
||||||
|
pay_income_desc_page_s: false,
|
||||||
|
pay_income_desc_page: 0,
|
||||||
},
|
},
|
||||||
groups: [
|
groups: [
|
||||||
|
{
|
||||||
|
key: 'notice',
|
||||||
|
title: '说明',
|
||||||
|
icon: 'fa fas fa-info-circle',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'revenue_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>开启创作分成后,用户发布的付费内容则按设置的比例收入与用户分成</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>用户分成比例是按照订单实收现金并扣除推广佣金后,再按设置的比例分成</li><li>禁用此功能后,所有收款将不会与作者分成</li></ul>',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'basic',
|
key: 'basic',
|
||||||
title: '创作中心设置',
|
title: '创作中心设置',
|
||||||
@@ -30,7 +50,7 @@ export const revenueSchema = {
|
|||||||
title: '现金收益分成',
|
title: '现金收益分成',
|
||||||
icon: 'fa fas fa-credit-card',
|
icon: 'fa fas fa-credit-card',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'payment_revenue_cash_ratio_user', label: '普通用户分成比例(%)', type: 'number', default: 60, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
{ key: 'payment_revenue_cash_ratio_user', label: '普通用户分成比例(%)', type: 'number', default: 60, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true }, help: '为0则不参与分成' },
|
||||||
{ key: 'payment_revenue_cash_ratio_vip_1', label: '一级会员分成比例(%)', type: 'number', default: 70, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
{ key: 'payment_revenue_cash_ratio_vip_1', label: '一级会员分成比例(%)', type: 'number', default: 70, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
||||||
{ key: 'payment_revenue_cash_ratio_vip_2', label: '二级会员分成比例(%)', type: 'number', default: 80, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
{ key: 'payment_revenue_cash_ratio_vip_2', label: '二级会员分成比例(%)', type: 'number', default: 80, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
||||||
],
|
],
|
||||||
@@ -40,10 +60,20 @@ export const revenueSchema = {
|
|||||||
title: '积分收益分成',
|
title: '积分收益分成',
|
||||||
icon: 'fa fas fa-database',
|
icon: 'fa fas fa-database',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'payment_revenue_points_ratio_user', label: '普通用户分成比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
{ key: 'payment_revenue_points_ratio_user', label: '普通用户分成比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true }, help: '为0则不参与分成(用户采用积分支付的订单给与作者的分成比例)' },
|
||||||
{ key: 'payment_revenue_points_ratio_vip_1', label: '一级会员分成比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
{ key: 'payment_revenue_points_ratio_vip_1', label: '一级会员分成比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
||||||
{ key: 'payment_revenue_points_ratio_vip_2', label: '二级会员分成比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
{ key: 'payment_revenue_points_ratio_vip_2', label: '二级会员分成比例(%)', type: 'number', default: 0, min: 0, max: 100, dependsOn: { key: 'pay_income_s', value: true } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'detail',
|
||||||
|
title: '分成说明',
|
||||||
|
icon: 'fa fas fa-file-alt',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_income_desc_details', label: '创作分成说明', type: 'textarea', sanitize_type: 'html', default: '<p>在本站发布付费内容,获得的收益将参与收入分成</p><p>普通用户分成比例为:60%</p><p>一级会员分成比例为:70%</p><p>二级会员分成比例为:80%</p><p>分成比例的计算方式为:(实收现金-推广佣金)x 分成比例</p><p>申请提现后,需后台人工处理,一般2-3小时,请耐心等待</p>', rows: 8, dependsOn: { key: 'pay_income_s', value: true }, help: '显示在用户中心的说明,建议为发布协议或者其他说明(必填项,内容不易太少),支持HTML代码' },
|
||||||
|
{ key: 'pay_income_desc_page_s', label: '创作分成详情页面', type: 'switch', default: false, dependsOn: { key: 'pay_income_s', value: true }, help: '您可以新建一个页面写入更加详细的创作分成说明及协议内容,再开启此项并选择对应的页面' },
|
||||||
|
{ key: 'pay_income_desc_page', label: '选择页面', type: 'page_select', default: 0, dependsOn: { key: 'pay_income_desc_page_s', value: true } },
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* VIP会员 — 参考主题结构:会员等级、会员权益(普通/一级/二级 tab)、
|
||||||
|
* 会员购买选项(一级/二级/续费/升级 tab)、卡密兑换与积分兑换。
|
||||||
|
*/
|
||||||
export const vipSchema = {
|
export const vipSchema = {
|
||||||
key: 'payment.vip',
|
key: 'payment.vip',
|
||||||
title: 'VIP会员',
|
title: 'VIP会员',
|
||||||
icon: 'fa fas fa-gem',
|
icon: 'fa fas fa-gem',
|
||||||
description: '对齐 legacy 双级会员:分档套餐、权益、续费/升级与积分兑换。',
|
description: '双级会员:等级名称、权益(下载次数与限速)、套餐、续费/升级与积分兑换。',
|
||||||
defaults: {
|
defaults: {
|
||||||
nav_pay_vip: true,
|
nav_pay_vip: true,
|
||||||
nav_user_pay_vip: true,
|
nav_user_pay_vip: true,
|
||||||
@@ -10,27 +14,24 @@ export const vipSchema = {
|
|||||||
pay_user_vip_1_name: '一级会员',
|
pay_user_vip_1_name: '一级会员',
|
||||||
pay_user_vip_1_desc: '尊享一级会员特权',
|
pay_user_vip_1_desc: '尊享一级会员特权',
|
||||||
pay_user_vip_1_equity: '<li>免费下载部分资源</li><li>会员专属身份标识</li><li>付费内容会员价</li>',
|
pay_user_vip_1_equity: '<li>免费下载部分资源</li><li>会员专属身份标识</li><li>付费内容会员价</li>',
|
||||||
vip_1_product_s: true,
|
|
||||||
payment_vip_1_products: '30|59|1|month|限时|月卡\n98|199|3|month|特惠|季卡\n365|599|12|month|超值|年卡\n999|1299|0|day|永久|永久卡',
|
|
||||||
vip_1_img_icon: '',
|
vip_1_img_icon: '',
|
||||||
pay_user_vip_2_s: true,
|
pay_user_vip_2_s: true,
|
||||||
pay_user_vip_2_name: '二级会员',
|
pay_user_vip_2_name: '二级会员',
|
||||||
pay_user_vip_2_desc: '尊享二级会员特权',
|
pay_user_vip_2_desc: '尊享二级会员特权',
|
||||||
pay_user_vip_2_equity: '<li>更高免费下载额度</li><li>更高等级身份标识</li><li>更多付费内容会员价</li>',
|
pay_user_vip_2_equity: '<li>更高免费下载额度</li><li>更高等级身份标识</li><li>更多付费内容会员价</li>',
|
||||||
vip_2_product_s: true,
|
|
||||||
payment_vip_2_products: '58|99|1|month|限时|月卡\n168|299|3|month|特惠|季卡\n598|999|12|month|超值|年卡\n1299|1999|0|day|永久|永久卡',
|
|
||||||
vip_2_img_icon: '',
|
vip_2_img_icon: '',
|
||||||
pay_user_vip_desc: '',
|
pay_user_vip_desc: '',
|
||||||
pay_user_vip_more: '',
|
pay_user_vip_more: '',
|
||||||
pay_download_limit: 0,
|
pay_download_limit: 0,
|
||||||
|
pay_download_speed: 0,
|
||||||
pay_download_limit_vip_1: 0,
|
pay_download_limit_vip_1: 0,
|
||||||
|
pay_download_speed_vip_1: 0,
|
||||||
pay_download_limit_vip_2: 0,
|
pay_download_limit_vip_2: 0,
|
||||||
pay_vip_pass_charge_s: false,
|
pay_download_speed_vip_2: 0,
|
||||||
pay_vip_pass_charge_desc: '',
|
vip_1_product_s: true,
|
||||||
pay_vip_pass_charge_only_password: true,
|
payment_vip_1_products: '30|59|1|month|限时|月卡\n98|199|3|month|特惠|季卡\n365|599|12|month|超值|年卡\n999|1299|0|day|永久|永久卡',
|
||||||
pay_vip_points_exchange_s: false,
|
vip_2_product_s: true,
|
||||||
pay_vip_points_exchange_desc: '',
|
payment_vip_2_products: '58|99|1|month|限时|月卡\n168|299|3|month|特惠|季卡\n598|999|12|month|超值|年卡\n1299|1999|0|day|永久|永久卡',
|
||||||
payment_vip_points_packages: '1|500|30|积分月卡\n1|5000|0|积分永久',
|
|
||||||
vip_renew: true,
|
vip_renew: true,
|
||||||
vip_renew_desc: '',
|
vip_renew_desc: '',
|
||||||
vip_renew_price_type: 'discount',
|
vip_renew_price_type: 'discount',
|
||||||
@@ -39,8 +40,28 @@ export const vipSchema = {
|
|||||||
vip_upgrade: true,
|
vip_upgrade: true,
|
||||||
vip_upgrade_desc: '',
|
vip_upgrade_desc: '',
|
||||||
vip_upgrade_product: 'unit|1|按剩余天数升级\njump|199|升级永久二级会员\npermanent|299|永久一级升永久二级',
|
vip_upgrade_product: 'unit|1|按剩余天数升级\njump|199|升级永久二级会员\npermanent|299|永久一级升永久二级',
|
||||||
|
pay_vip_pass_charge_s: false,
|
||||||
|
pay_vip_pass_charge_desc: '',
|
||||||
|
pay_vip_pass_charge_only_password: true,
|
||||||
|
pay_vip_points_exchange_s: false,
|
||||||
|
payment_vip_points_packages: '1|500|30|积分月卡\n1|5000|0|积分永久',
|
||||||
|
pay_vip_points_exchange_desc: '',
|
||||||
},
|
},
|
||||||
groups: [
|
groups: [
|
||||||
|
{
|
||||||
|
key: 'notice',
|
||||||
|
title: '说明',
|
||||||
|
icon: 'fa fas fa-info-circle',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'vip_notice',
|
||||||
|
label: '',
|
||||||
|
type: 'content',
|
||||||
|
ui_only: true,
|
||||||
|
content: '<ul style="margin:0 0 0 18px;line-height:1.9"><li>开启付费会员功能之前,请先配置好收款接口,确保网站收款正常</li><li>会员功能的设置项目较多,请仔细核对,避免出现价格、时间的问题</li><li>配合设置名称、有效期等可搭配出不同类型的会员</li><li>管理员可在后台为用户单独开启会员</li></ul>',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: 'basic',
|
key: 'basic',
|
||||||
title: '会员等级',
|
title: '会员等级',
|
||||||
@@ -49,12 +70,12 @@ export const vipSchema = {
|
|||||||
{ key: 'nav_pay_vip', label: '导航栏购买按钮', type: 'switch', default: true, help: '在顶部导航栏显示开通会员按钮;请注意顶部导航的整体宽度。' },
|
{ key: 'nav_pay_vip', label: '导航栏购买按钮', type: 'switch', default: true, help: '在顶部导航栏显示开通会员按钮;请注意顶部导航的整体宽度。' },
|
||||||
{ key: 'nav_user_pay_vip', label: '用户框购买按钮', type: 'switch', default: true, help: '在导航栏用户框内显示开通会员按钮。' },
|
{ key: 'nav_user_pay_vip', label: '用户框购买按钮', type: 'switch', default: true, help: '在导航栏用户框内显示开通会员按钮。' },
|
||||||
{ key: 'pay_user_vip_1_s', label: '启用一级会员', type: 'switch', default: true },
|
{ key: 'pay_user_vip_1_s', label: '启用一级会员', type: 'switch', default: true },
|
||||||
{ key: 'pay_user_vip_1_name', label: '一级会员名称', type: 'input', default: '一级会员', dependsOn: { key: 'pay_user_vip_1_s', value: true } },
|
{ key: 'pay_user_vip_1_name', label: '一级会员显示名称', type: 'input', default: '一级会员', dependsOn: { key: 'pay_user_vip_1_s', value: true } },
|
||||||
{ key: 'pay_user_vip_1_desc', label: '一级会员一句话简介', type: 'input', default: '尊享一级会员特权', dependsOn: { key: 'pay_user_vip_1_s', value: true } },
|
{ key: 'pay_user_vip_1_desc', label: '一级会员一句话简介', type: 'input', default: '尊享一级会员特权', dependsOn: { key: 'pay_user_vip_1_s', value: true } },
|
||||||
{ key: 'pay_user_vip_1_equity', label: '一级会员权益 HTML', type: 'textarea', default: '<li>免费下载部分资源</li><li>会员专属身份标识</li><li>付费内容会员价</li>', dependsOn: { key: 'pay_user_vip_1_s', value: true }, help: '建议使用 <li> 列表项' },
|
{ key: 'pay_user_vip_1_equity', label: '一级会员权益 HTML', type: 'textarea', default: '<li>免费下载部分资源</li><li>会员专属身份标识</li><li>付费内容会员价</li>', dependsOn: { key: 'pay_user_vip_1_s', value: true }, help: '建议使用 <li> 列表项' },
|
||||||
{ key: 'vip_1_img_icon', label: '一级会员图标 URL', type: 'input', default: '', dependsOn: { key: 'pay_user_vip_1_s', value: true }, help: '留空使用内置 vip-1.svg 图标' },
|
{ key: 'vip_1_img_icon', label: '一级会员图标 URL', type: 'input', default: '', dependsOn: { key: 'pay_user_vip_1_s', value: true }, help: '留空使用内置 vip-1.svg 图标' },
|
||||||
{ key: 'pay_user_vip_2_s', label: '启用二级会员', type: 'switch', default: true },
|
{ key: 'pay_user_vip_2_s', label: '启用二级会员', type: 'switch', default: true },
|
||||||
{ key: 'pay_user_vip_2_name', label: '二级会员名称', type: 'input', default: '二级会员', dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
{ key: 'pay_user_vip_2_name', label: '二级会员显示名称', type: 'input', default: '二级会员', dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
||||||
{ key: 'pay_user_vip_2_desc', label: '二级会员一句话简介', type: 'input', default: '尊享二级会员特权', dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
{ key: 'pay_user_vip_2_desc', label: '二级会员一句话简介', type: 'input', default: '尊享二级会员特权', dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
||||||
{ key: 'pay_user_vip_2_equity', label: '二级会员权益 HTML', type: 'textarea', default: '<li>更高免费下载额度</li><li>更高等级身份标识</li><li>更多付费内容会员价</li>', dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
{ key: 'pay_user_vip_2_equity', label: '二级会员权益 HTML', type: 'textarea', default: '<li>更高免费下载额度</li><li>更高等级身份标识</li><li>更多付费内容会员价</li>', dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
||||||
{ key: 'vip_2_img_icon', label: '二级会员图标 URL', type: 'input', default: '', dependsOn: { key: 'pay_user_vip_2_s', value: true }, help: '留空使用内置 vip-2.svg 图标' },
|
{ key: 'vip_2_img_icon', label: '二级会员图标 URL', type: 'input', default: '', dependsOn: { key: 'pay_user_vip_2_s', value: true }, help: '留空使用内置 vip-2.svg 图标' },
|
||||||
@@ -63,32 +84,137 @@ export const vipSchema = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'packages',
|
key: 'benefit',
|
||||||
title: '分档套餐',
|
title: '会员权益',
|
||||||
icon: 'fa fas fa-gem',
|
icon: 'fa fas fa-gift',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'vip_1_product_s', label: '允许购买一级会员', type: 'switch', default: true, dependsOn: { key: 'pay_user_vip_1_s', value: true } },
|
|
||||||
{
|
{
|
||||||
key: 'payment_vip_1_products',
|
key: 'vip_benefit',
|
||||||
label: '一级会员套餐',
|
label: '会员权益',
|
||||||
type: 'textarea',
|
type: 'tabbed',
|
||||||
default: '30|59|1|month|限时|月卡\n98|199|3|month|特惠|季卡\n365|599|12|month|超值|年卡\n999|1299|0|day|永久|永久卡',
|
tabs: [
|
||||||
dependsOn: { key: 'vip_1_product_s', value: true },
|
{
|
||||||
help: '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久',
|
key: 'ordinary',
|
||||||
},
|
title: '普通用户',
|
||||||
{ key: 'vip_2_product_s', label: '允许购买二级会员', type: 'switch', default: true, dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
fields: [
|
||||||
{
|
{ key: 'pay_download_limit', label: '付费资源:免费资源每日可下载(个)', type: 'number', default: 0, min: 0, max: 9999, help: '普通用户每日最多可下载几个免费资源(为0则不限制)' },
|
||||||
key: 'payment_vip_2_products',
|
{ key: 'pay_download_speed', label: '付费资源:下载限速(KB/s)', type: 'number', default: 0, min: 0, help: '付费下载限制最大下载速度(为0则不限制);只对本地服务器文件有效' },
|
||||||
label: '二级会员套餐',
|
],
|
||||||
type: 'textarea',
|
},
|
||||||
default: '58|99|1|month|限时|月卡\n168|299|3|month|特惠|季卡\n598|999|12|month|超值|年卡\n1299|1999|0|day|永久|永久卡',
|
{
|
||||||
dependsOn: { key: 'vip_2_product_s', value: true },
|
key: 'vip1',
|
||||||
help: '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久',
|
title: '一级会员',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_download_limit_vip_1', label: '付费资源:免费资源每日可下载(个)', type: 'number', default: 0, min: 0, max: 9999, dependsOn: { key: 'pay_user_vip_1_s', value: true }, help: '一级会员每日最多可下载几个免费资源(为0则不限制)' },
|
||||||
|
{ key: 'pay_download_speed_vip_1', label: '付费资源:下载限速(KB/s)', type: 'number', default: 0, min: 0, dependsOn: { key: 'pay_user_vip_1_s', value: true }, help: '付费下载限制最大下载速度(为0则不限制);只对本地服务器文件有效' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'vip2',
|
||||||
|
title: '二级会员',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_download_limit_vip_2', label: '付费资源:免费资源每日可下载(个)', type: 'number', default: 0, min: 0, max: 9999, dependsOn: { key: 'pay_user_vip_2_s', value: true }, help: '二级会员每日最多可下载几个免费资源(为0则不限制)' },
|
||||||
|
{ key: 'pay_download_speed_vip_2', label: '付费资源:下载限速(KB/s)', type: 'number', default: 0, min: 0, dependsOn: { key: 'pay_user_vip_2_s', value: true }, help: '付费下载限制最大下载速度(为0则不限制);只对本地服务器文件有效' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'points_exchange',
|
key: 'opt',
|
||||||
|
title: '会员购买选项',
|
||||||
|
icon: 'fa fas fa-shopping-cart',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
key: 'vip_opt',
|
||||||
|
label: '会员购买选项',
|
||||||
|
type: 'tabbed',
|
||||||
|
tabs: [
|
||||||
|
{
|
||||||
|
key: 'vip1',
|
||||||
|
title: '一级会员',
|
||||||
|
fields: [
|
||||||
|
{ key: 'vip_1_product_s', label: '允许购买一级会员', type: 'switch', default: true, dependsOn: { key: 'pay_user_vip_1_s', value: true } },
|
||||||
|
{
|
||||||
|
key: 'payment_vip_1_products',
|
||||||
|
label: '一级会员套餐',
|
||||||
|
type: 'textarea',
|
||||||
|
default: '30|59|1|month|限时|月卡\n98|199|3|month|特惠|季卡\n365|599|12|month|超值|年卡\n999|1299|0|day|永久|永久卡',
|
||||||
|
dependsOn: { key: 'vip_1_product_s', value: true },
|
||||||
|
help: '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'vip2',
|
||||||
|
title: '二级会员',
|
||||||
|
fields: [
|
||||||
|
{ key: 'vip_2_product_s', label: '允许购买二级会员', type: 'switch', default: true, dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
||||||
|
{
|
||||||
|
key: 'payment_vip_2_products',
|
||||||
|
label: '二级会员套餐',
|
||||||
|
type: 'textarea',
|
||||||
|
default: '58|99|1|month|限时|月卡\n168|299|3|month|特惠|季卡\n598|999|12|month|超值|年卡\n1299|1999|0|day|永久|永久卡',
|
||||||
|
dependsOn: { key: 'vip_2_product_s', value: true },
|
||||||
|
help: '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'renew',
|
||||||
|
title: '会员续费',
|
||||||
|
fields: [
|
||||||
|
{ key: 'vip_renew', label: '允许续费', type: 'switch', default: true, help: '关闭后则不能续费,只能会员到期之后再购买。永久会员不需要续费' },
|
||||||
|
{ key: 'vip_renew_desc', label: '续费说明', type: 'textarea', default: '', dependsOn: { key: 'vip_renew', value: true } },
|
||||||
|
{
|
||||||
|
key: 'vip_renew_price_type',
|
||||||
|
label: '续费价格类型',
|
||||||
|
type: 'radio',
|
||||||
|
default: 'discount',
|
||||||
|
dependsOn: { key: 'vip_renew', value: true },
|
||||||
|
options: [
|
||||||
|
{ label: '相同价格', value: 'same' },
|
||||||
|
{ label: '折扣价格', value: 'discount' },
|
||||||
|
{ label: '优惠立减', value: 'reduce' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{ key: 'vip_renew_discount', label: '续费折扣(折,如 8=八折)', type: 'number', default: 8, min: 1, max: 100, dependsOn: { key: 'vip_renew_price_type', value: 'discount' } },
|
||||||
|
{ key: 'vip_renew_reduce', label: '续费减免金额', type: 'input', sanitize_type: 'money_decimal', default: '20.00', min: 0, max: 9999, dependsOn: { key: 'vip_renew_price_type', value: 'reduce' } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'upgrade',
|
||||||
|
title: '会员升级',
|
||||||
|
fields: [
|
||||||
|
{ key: 'vip_upgrade', label: '允许升级', type: 'switch', default: true },
|
||||||
|
{ key: 'vip_upgrade_desc', label: '升级说明', type: 'textarea', default: '', dependsOn: { key: 'vip_upgrade', value: true } },
|
||||||
|
{
|
||||||
|
key: 'vip_upgrade_product',
|
||||||
|
label: '升级产品',
|
||||||
|
type: 'textarea',
|
||||||
|
default: 'unit|1|按剩余天数升级\njump|199|升级永久二级会员\npermanent|299|永久一级升永久二级',
|
||||||
|
dependsOn: { key: 'vip_upgrade', value: true },
|
||||||
|
help: '每行一条。永久VIP1升级:permanent|价格|标题;按剩余天:unit|每日单价|标题;限时跳转永久:jump|价格|标题',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'pass-charge',
|
||||||
|
title: '卡密兑换会员',
|
||||||
|
icon: 'fa fas fa-ticket-alt',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_vip_pass_charge_s', label: '启用卡密兑换会员功能', type: 'switch', default: false },
|
||||||
|
{ key: 'pay_vip_pass_charge_desc', label: '卡密兑换说明', type: 'textarea', default: '', dependsOn: { key: 'pay_vip_pass_charge_s', value: true }, help: '用户使用卡密兑换时显示的内容,建议为提醒事项、充值协议等,支持HTML代码' },
|
||||||
|
{ key: 'pay_vip_pass_charge_only_password', label: '单密码模式', type: 'switch', default: true, dependsOn: { key: 'pay_vip_pass_charge_s', value: true }, help: '仅需输入密码,不需要卡号' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'points-exchange',
|
||||||
title: '积分兑换会员',
|
title: '积分兑换会员',
|
||||||
icon: 'fa fas fa-database',
|
icon: 'fa fas fa-database',
|
||||||
fields: [
|
fields: [
|
||||||
@@ -104,47 +230,5 @@ export const vipSchema = {
|
|||||||
{ key: 'pay_vip_points_exchange_desc', label: '兑换说明', type: 'textarea', default: '', dependsOn: { key: 'pay_vip_points_exchange_s', value: true } },
|
{ key: 'pay_vip_points_exchange_desc', label: '兑换说明', type: 'textarea', default: '', dependsOn: { key: 'pay_vip_points_exchange_s', value: true } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'benefit',
|
|
||||||
title: '下载权益',
|
|
||||||
icon: 'fa fas fa-gift',
|
|
||||||
fields: [
|
|
||||||
{ key: 'pay_download_limit', label: '普通用户下载限制', type: 'number', default: 0, min: 0, max: 9999, help: '0为不限制' },
|
|
||||||
{ key: 'pay_download_limit_vip_1', label: '一级会员下载限制', type: 'number', default: 0, min: 0, max: 9999, dependsOn: { key: 'pay_user_vip_1_s', value: true } },
|
|
||||||
{ key: 'pay_download_limit_vip_2', label: '二级会员下载限制', type: 'number', default: 0, min: 0, max: 9999, dependsOn: { key: 'pay_user_vip_2_s', value: true } },
|
|
||||||
{ key: 'pay_vip_pass_charge_s', label: '会员卡密兑换', type: 'switch', default: false },
|
|
||||||
{ key: 'pay_vip_pass_charge_desc', label: '卡密兑换说明', type: 'textarea', default: '', dependsOn: { key: 'pay_vip_pass_charge_s', value: true } },
|
|
||||||
{ key: 'pay_vip_pass_charge_only_password', label: '仅密码兑换', type: 'switch', default: true, dependsOn: { key: 'pay_vip_pass_charge_s', value: true }, help: '开启后只需输入卡密;关闭则需卡号+卡密。' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'renew',
|
|
||||||
title: '续费设置',
|
|
||||||
icon: 'fa fas fa-sync-alt',
|
|
||||||
fields: [
|
|
||||||
{ key: 'vip_renew', label: '允许续费', type: 'switch', default: true },
|
|
||||||
{ key: 'vip_renew_desc', label: '续费说明', type: 'textarea', default: '', dependsOn: { key: 'vip_renew', value: true } },
|
|
||||||
{ key: 'vip_renew_price_type', label: '续费价格类型', type: 'radio', default: 'discount', options: [{ label: '相同价格', value: 'same' }, { label: '折扣价格', value: 'discount' }, { label: '优惠立减', value: 'reduce' }], dependsOn: { key: 'vip_renew', value: true } },
|
|
||||||
{ key: 'vip_renew_discount', label: '续费折扣(折,如 8=八折)', type: 'number', default: 8, min: 1, max: 100, dependsOn: { key: 'vip_renew_price_type', value: 'discount' } },
|
|
||||||
{ key: 'vip_renew_reduce', label: '续费减免金额', type: 'input', sanitize_type: 'money_decimal', default: '20.00', min: 0, max: 9999, dependsOn: { key: 'vip_renew_price_type', value: 'reduce' } },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'upgrade',
|
|
||||||
title: '升级设置',
|
|
||||||
icon: 'fa fas fa-arrow-up',
|
|
||||||
fields: [
|
|
||||||
{ key: 'vip_upgrade', label: '允许升级', type: 'switch', default: true },
|
|
||||||
{ key: 'vip_upgrade_desc', label: '升级说明', type: 'textarea', default: '', dependsOn: { key: 'vip_upgrade', value: true } },
|
|
||||||
{
|
|
||||||
key: 'vip_upgrade_product',
|
|
||||||
label: '升级产品',
|
|
||||||
type: 'textarea',
|
|
||||||
default: 'unit|1|按剩余天数升级\njump|199|升级永久二级会员\npermanent|299|永久一级升永久二级',
|
|
||||||
dependsOn: { key: 'vip_upgrade', value: true },
|
|
||||||
help: '每行一条。永久VIP1升级:permanent|价格|标题;按剩余天:unit|每日单价|标题;限时跳转永久:jump|价格|标题',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,55 @@
|
|||||||
|
/**
|
||||||
|
* 提现策略 — 提现门槛、每日限制、收款渠道与提现协议。
|
||||||
|
*/
|
||||||
export const withdrawalSchema = {
|
export const withdrawalSchema = {
|
||||||
key: 'payment.withdrawal',
|
key: 'payment.withdrawal',
|
||||||
title: '提现策略',
|
title: '提现策略',
|
||||||
icon: 'fa fas fa-money-bill',
|
icon: 'fa fas fa-money-bill',
|
||||||
description: '配置提现门槛、手续费比例与每日限制。',
|
description: '配置提现门槛、手续费比例、每日限制、收款渠道与提现协议。',
|
||||||
defaults: {
|
defaults: {
|
||||||
affiliate_min_withdrawal: '50.00',
|
affiliate_min_withdrawal: '50.00',
|
||||||
affiliate_withdrawal_fee: 5,
|
affiliate_withdrawal_fee: 5,
|
||||||
affiliate_daily_withdrawal_count: 3,
|
affiliate_daily_withdrawal_count: 3,
|
||||||
affiliate_daily_withdrawal_limit: '500.00',
|
affiliate_daily_withdrawal_limit: '500.00',
|
||||||
affiliate_withdrawal_reset_time: '00:00',
|
affiliate_withdrawal_reset_time: '00:00',
|
||||||
affiliate_payout_channels: ['alipay', 'wechat'],
|
affiliate_payout_channels: ['alipay', 'wechat'],
|
||||||
|
pay_rebate_withdraw_text_details: '<div>可提现金额达到50元后即可发起提现</div><div>申请提现需后台人工处理,一般2-3小时,请耐心等待</div><div>如有其它疑问,请与客服联系</div>',
|
||||||
},
|
},
|
||||||
groups: [
|
groups: [
|
||||||
{
|
{
|
||||||
key: 'basic',
|
key: 'basic',
|
||||||
title: '提现设置',
|
title: '提现门槛',
|
||||||
icon: 'fa fas fa-sliders-h',
|
icon: 'fa fas fa-sliders-h',
|
||||||
fields: [
|
fields: [
|
||||||
{ key: 'affiliate_min_withdrawal', label: '最低提现金额', type: 'input', sanitize_type: 'money_decimal', default: '50.00', help: '仅接受最多两位小数的十进制字符串。' },
|
{ key: 'affiliate_min_withdrawal', label: '提现最低金额限制', type: 'input', sanitize_type: 'money_decimal', default: '50.00', help: '当用户可提现总金额(推广佣金、余额、创作分成)高于多少时候,才能发起提现' },
|
||||||
{ key: 'affiliate_withdrawal_fee', label: '提现手续费(%)', type: 'number', default: 5, min: 0, max: 100 },
|
{ key: 'affiliate_withdrawal_fee', label: '提现手续费(%)', type: 'number', default: 5, min: 0, max: 100 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'limits',
|
||||||
|
title: '每日限制',
|
||||||
|
icon: 'fa fas fa-clock',
|
||||||
|
fields: [
|
||||||
{ key: 'affiliate_daily_withdrawal_count', label: '每日可提现次数', type: 'number', default: 3, min: 0, max: 99999 },
|
{ key: 'affiliate_daily_withdrawal_count', label: '每日可提现次数', type: 'number', default: 3, min: 0, max: 99999 },
|
||||||
{ key: 'affiliate_daily_withdrawal_limit', label: '每日提现上限', type: 'input', sanitize_type: 'money_decimal', default: '500.00', help: '仅接受最多两位小数的十进制字符串。' },
|
{ key: 'affiliate_daily_withdrawal_limit', label: '每日提现上限', type: 'input', sanitize_type: 'money_decimal', default: '500.00' },
|
||||||
{ key: 'affiliate_withdrawal_reset_time', label: '重置时间', type: 'input', default: '00:00', help: '按站点 WordPress 时区重置,格式 HH:MM。' },
|
{ key: 'affiliate_withdrawal_reset_time', label: '重置时间', type: 'input', default: '00:00', help: '按站点 WordPress 时区重置,格式 HH:MM。' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'channels',
|
||||||
|
title: '收款渠道',
|
||||||
|
icon: 'fa fas fa-qrcode',
|
||||||
|
fields: [
|
||||||
{ key: 'affiliate_payout_channels', label: '可用收款渠道', type: 'checkbox', default: ['alipay', 'wechat'], sanitize_type: 'array', options: [{ label: '支付宝收款码', value: 'alipay' }, { label: '微信收款码', value: 'wechat' }] },
|
{ key: 'affiliate_payout_channels', label: '可用收款渠道', type: 'checkbox', default: ['alipay', 'wechat'], sanitize_type: 'array', options: [{ label: '支付宝收款码', value: 'alipay' }, { label: '微信收款码', value: 'wechat' }] },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'agreement',
|
||||||
|
title: '提现协议',
|
||||||
|
icon: 'fa fas fa-file-contract',
|
||||||
|
fields: [
|
||||||
|
{ key: 'pay_rebate_withdraw_text_details', label: '提现协议', type: 'textarea', sanitize_type: 'html', default: '<div>可提现金额达到50元后即可发起提现</div><div>申请提现需后台人工处理,一般2-3小时,请耐心等待</div><div>如有其它疑问,请与客服联系</div>', rows: 4, help: '用户申请提现时展示的内容,建议为提现须知等,支持HTML代码' },
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ class PageDisplayController extends ControllerBase {
|
|||||||
$query = sanitize_text_field((string) $request->get_param('query'));
|
$query = sanitize_text_field((string) $request->get_param('query'));
|
||||||
$include = array_values(array_filter(array_map('absint', (array) $request->get_param('include'))));
|
$include = array_values(array_filter(array_map('absint', (array) $request->get_param('include'))));
|
||||||
|
|
||||||
if ($source === 'posts') {
|
if ($source === 'posts' || $source === 'pages') {
|
||||||
$posts = get_posts([
|
$posts = get_posts([
|
||||||
'post_type' => 'post',
|
'post_type' => $source === 'pages' ? 'page' : 'post',
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'posts_per_page' => 20,
|
'posts_per_page' => 20,
|
||||||
's' => $query,
|
's' => $query,
|
||||||
|
|||||||
@@ -19,49 +19,6 @@ class PaymentController extends ControllerBase {
|
|||||||
public function register_routes(): void {
|
public function register_routes(): void {
|
||||||
$this->register_section_routes('payment', 'payment');
|
$this->register_section_routes('payment', 'payment');
|
||||||
|
|
||||||
register_rest_route(self::API_NAMESPACE, '/payment/overview', [
|
|
||||||
'methods' => 'GET',
|
|
||||||
'callback' => [$this, 'rest_payment_overview'],
|
|
||||||
'permission_callback' => [$this, 'check_permission'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Revenue stats (with optional time-series)
|
|
||||||
register_rest_route(self::API_NAMESPACE, '/payment/revenue', [
|
|
||||||
'methods' => 'GET',
|
|
||||||
'callback' => [$this, 'get_revenue'],
|
|
||||||
'permission_callback' => [$this, 'check_permission'],
|
|
||||||
'args' => [
|
|
||||||
'date_from' => ['default' => '', 'sanitize_callback' => 'sanitize_text_field'],
|
|
||||||
'date_to' => ['default' => '', 'sanitize_callback' => 'sanitize_text_field'],
|
|
||||||
'granularity' => ['default' => 'day', 'sanitize_callback' => 'sanitize_text_field'],
|
|
||||||
'time_series' => ['default' => false, 'sanitize_callback' => 'rest_sanitize_boolean'],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
register_rest_route(self::API_NAMESPACE, '/payment/creator-income', [
|
|
||||||
'methods' => 'GET',
|
|
||||||
'callback' => [$this, 'get_creator_income'],
|
|
||||||
'permission_callback' => [$this, 'check_permission'],
|
|
||||||
'args' => [
|
|
||||||
'page' => ['type' => 'integer', 'minimum' => 1, 'default' => 1],
|
|
||||||
'per_page' => ['type' => 'integer', 'minimum' => 1, 'maximum' => 100, 'default' => 20],
|
|
||||||
'status' => ['type' => 'string', 'enum' => ['', 'pending', 'settled']],
|
|
||||||
'user_id' => ['type' => 'integer', 'minimum' => 0, 'default' => 0],
|
|
||||||
'post_id' => ['type' => 'integer', 'minimum' => 0, 'default' => 0],
|
|
||||||
'currency' => ['type' => 'string', 'enum' => ['', 'CNY', 'cny', 'points']],
|
|
||||||
'order_status' => ['type' => 'string', 'sanitize_callback' => 'sanitize_key'],
|
|
||||||
'order_number' => ['type' => 'string', 'maxLength' => 64, 'sanitize_callback' => 'sanitize_text_field'],
|
|
||||||
'date_from' => ['type' => 'string', 'format' => 'date'],
|
|
||||||
'date_to' => ['type' => 'string', 'format' => 'date'],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
register_rest_route(self::API_NAMESPACE, '/payment/creator-income/(?P<id>\d+)/settle', [
|
|
||||||
'methods' => 'POST',
|
|
||||||
'callback' => [$this, 'settle_creator_income'],
|
|
||||||
'permission_callback' => [$this, 'check_permission'],
|
|
||||||
'args' => ['id' => ['type' => 'integer', 'minimum' => 1, 'required' => true]],
|
|
||||||
]);
|
|
||||||
|
|
||||||
register_rest_route(self::API_NAMESPACE, '/payment/withdrawals', [
|
register_rest_route(self::API_NAMESPACE, '/payment/withdrawals', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => [$this, 'get_withdrawals'],
|
'callback' => [$this, 'get_withdrawals'],
|
||||||
@@ -154,187 +111,6 @@ class PaymentController extends ControllerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function rest_payment_overview(\WP_REST_Request $request): \WP_REST_Response {
|
|
||||||
if (!class_exists('\AKSRT\Settings\Settings')) {
|
|
||||||
return $this->error('设置模块未初始化', 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
$paid = \AKSRT\Settings\Settings::get_paid_content_settings();
|
|
||||||
$recharge = \AKSRT\Settings\Settings::get_payment_recharge_settings();
|
|
||||||
$vip = \AKSRT\Settings\Settings::get_payment_vip_settings();
|
|
||||||
$revenue = \AKSRT\Settings\Settings::get_payment_revenue_settings();
|
|
||||||
$affiliate = \AKSRT\Settings\Settings::get_payment_affiliate_settings();
|
|
||||||
$gateway = \AKSRT\Settings\Settings::get_payment_gateway_settings();
|
|
||||||
|
|
||||||
return $this->success([
|
|
||||||
'data' => [
|
|
||||||
'paid' => $paid,
|
|
||||||
'recharge' => $recharge,
|
|
||||||
'vip' => $vip,
|
|
||||||
'revenue' => $revenue,
|
|
||||||
'affiliate' => $affiliate,
|
|
||||||
'gateway' => $gateway,
|
|
||||||
'currency_name' => \AKSRT\Settings\Settings::get_currency_name(),
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET /payment/revenue — revenue stats with optional time-series
|
|
||||||
*/
|
|
||||||
public function get_revenue(\WP_REST_Request $request): \WP_REST_Response {
|
|
||||||
$revenue_stats = [
|
|
||||||
'cash' => ['total' => '0.00', 'pending' => '0.00', 'settled' => '0.00', 'count' => 0],
|
|
||||||
'points' => ['total' => 0, 'pending' => 0, 'settled' => 0, 'count' => 0],
|
|
||||||
];
|
|
||||||
if (class_exists('\AKSRT\Payment\Revenue')) {
|
|
||||||
$revenue_stats = \AKSRT\Payment\Revenue::get_instance()->get_stats();
|
|
||||||
}
|
|
||||||
|
|
||||||
$withdrawal_stats = ['total' => 0, 'pending' => 0, 'processing' => 0, 'completed' => 0, 'rejected' => 0, 'total_paid' => '0.00'];
|
|
||||||
if (class_exists('\AKSRT\Payment\Withdrawal')) {
|
|
||||||
$withdrawal_stats = \AKSRT\Payment\Withdrawal::get_instance()->get_stats();
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = [
|
|
||||||
'revenue' => $revenue_stats,
|
|
||||||
'withdrawal' => $withdrawal_stats,
|
|
||||||
];
|
|
||||||
|
|
||||||
// Time-series data
|
|
||||||
if ($request->get_param('time_series')) {
|
|
||||||
$response['time_series'] = $this->get_revenue_time_series($request);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->success(['data' => $response]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build revenue time-series data.
|
|
||||||
*/
|
|
||||||
private function get_revenue_time_series(\WP_REST_Request $request): array {
|
|
||||||
global $wpdb;
|
|
||||||
$prefix = $wpdb->prefix;
|
|
||||||
|
|
||||||
$date_from = sanitize_text_field((string) $request->get_param('date_from'));
|
|
||||||
$date_to = sanitize_text_field((string) $request->get_param('date_to'));
|
|
||||||
$granularity = sanitize_text_field((string) $request->get_param('granularity'));
|
|
||||||
|
|
||||||
// Default: last 30 days in the WordPress site timezone.
|
|
||||||
$timezone = function_exists('wp_timezone') ? wp_timezone() : new \DateTimeZone('UTC');
|
|
||||||
$now = new \DateTimeImmutable('now', $timezone);
|
|
||||||
if (!$date_from) {
|
|
||||||
$date_from = $now->modify('-30 days')->format('Y-m-d');
|
|
||||||
}
|
|
||||||
if (!$date_to) {
|
|
||||||
$date_to = $now->format('Y-m-d');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Granularity: day, week, month
|
|
||||||
$date_format = '%Y-%m-%d';
|
|
||||||
if ($granularity === 'week') {
|
|
||||||
$date_format = '%x-W%v';
|
|
||||||
} elseif ($granularity === 'month') {
|
|
||||||
$date_format = '%Y-%m';
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = $prefix . 'aksrt_revenue';
|
|
||||||
$results = $wpdb->get_results($wpdb->prepare(
|
|
||||||
"SELECT currency, DATE_FORMAT(created_at, %s) AS period,
|
|
||||||
SUM(amount) AS total_amount,
|
|
||||||
COUNT(*) AS order_count
|
|
||||||
FROM {$table}
|
|
||||||
WHERE status IN ('pending', 'settled')
|
|
||||||
AND created_at >= %s AND created_at < DATE_ADD(%s, INTERVAL 1 DAY)
|
|
||||||
GROUP BY currency, period
|
|
||||||
ORDER BY period ASC",
|
|
||||||
$date_format,
|
|
||||||
$date_from,
|
|
||||||
$date_to
|
|
||||||
));
|
|
||||||
|
|
||||||
$series = ['cash' => [], 'points' => []];
|
|
||||||
foreach ((array) $results as $row) {
|
|
||||||
$key = (string) ($row->currency ?? '') === 'points' ? 'points' : 'cash';
|
|
||||||
$amount = (string) ($row->total_amount ?? '0');
|
|
||||||
if ($key === 'points') {
|
|
||||||
$amount = preg_match('/^(0|[1-9]\d*)(?:\.0+)?$/', $amount, $matches) ? (int) $matches[1] : 0;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
$amount = \AKSRT\Ledger\AssetAmount::balance($amount)->decimal();
|
|
||||||
} catch (\InvalidArgumentException $e) {
|
|
||||||
$amount = '0.00';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$series[$key][] = [
|
|
||||||
'date' => (string) $row->period,
|
|
||||||
'amount' => $amount,
|
|
||||||
'count' => (int) $row->order_count,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $series;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GET /payment/creator-income — creator income operations list.
|
|
||||||
*/
|
|
||||||
public function get_creator_income(\WP_REST_Request $request): \WP_REST_Response {
|
|
||||||
if (!class_exists('\AKSRT\Payment\Revenue')) {
|
|
||||||
return $this->error(__('创作分成模块未启用', 'aksrt'), 500);
|
|
||||||
}
|
|
||||||
$page = max(1, (int) $request->get_param('page'));
|
|
||||||
$per_page = max(1, min(100, (int) ($request->get_param('per_page') ?: 20)));
|
|
||||||
$result = \AKSRT\Payment\Revenue::get_instance()->get_list([
|
|
||||||
'limit' => $per_page,
|
|
||||||
'offset' => ($page - 1) * $per_page,
|
|
||||||
'status' => sanitize_key((string) $request->get_param('status')),
|
|
||||||
'user_id' => max(0, (int) $request->get_param('user_id')),
|
|
||||||
'post_id' => max(0, (int) $request->get_param('post_id')),
|
|
||||||
'currency' => sanitize_key((string) $request->get_param('currency')),
|
|
||||||
'order_status' => sanitize_key((string) $request->get_param('order_status')),
|
|
||||||
'order_number' => sanitize_text_field((string) $request->get_param('order_number')),
|
|
||||||
'date_from' => sanitize_text_field((string) $request->get_param('date_from')),
|
|
||||||
'date_to' => sanitize_text_field((string) $request->get_param('date_to')),
|
|
||||||
]);
|
|
||||||
$result['page'] = $page;
|
|
||||||
$result['per_page'] = $per_page;
|
|
||||||
return $this->success(['data' => $result]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* POST /payment/creator-income/{id}/settle — settle one income record.
|
|
||||||
*/
|
|
||||||
public function settle_creator_income(\WP_REST_Request $request): \WP_REST_Response {
|
|
||||||
if (!class_exists('\AKSRT\Payment\Revenue')) {
|
|
||||||
return $this->error(__('创作分成模块未启用', 'aksrt'), 500);
|
|
||||||
}
|
|
||||||
$id = (int) $request->get_param('id');
|
|
||||||
$operation_key = \AKSRT\Ledger\OperationKey::from_request($request, 'admin-revenue-settle', get_current_user_id());
|
|
||||||
if (is_wp_error($operation_key)) {
|
|
||||||
return $this->error($operation_key->get_error_message(), (int) ($operation_key->get_error_data()['status'] ?? 400));
|
|
||||||
}
|
|
||||||
$result = \AKSRT\Payment\Revenue::get_instance()->settle_result($id, get_current_user_id(), $operation_key);
|
|
||||||
if (is_wp_error($result)) {
|
|
||||||
$data = $result->get_error_data();
|
|
||||||
return $this->error($result->get_error_message(), is_array($data) ? (int) ($data['status'] ?? 400) : 400);
|
|
||||||
}
|
|
||||||
$entry = (array) ($result->entries[0] ?? []);
|
|
||||||
$asset = (string) ($entry['asset'] ?? \AKSRT\Ledger\AssetType::BALANCE->value);
|
|
||||||
$author_id = (int) ($entry['user_id'] ?? 0);
|
|
||||||
$balance_minor = $result->balance($author_id, $asset);
|
|
||||||
$balance = $asset === \AKSRT\Ledger\AssetType::BALANCE->value
|
|
||||||
? \AKSRT\Ledger\AssetAmount::decimal_from_minor($balance_minor)
|
|
||||||
: $balance_minor;
|
|
||||||
return $this->success([
|
|
||||||
'message' => __('创作分成已结算', 'aksrt'),
|
|
||||||
'transaction_id' => $result->transaction_id,
|
|
||||||
'replayed' => $result->replayed,
|
|
||||||
'asset' => $asset,
|
|
||||||
'balance' => $balance,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get_withdrawals(\WP_REST_Request $request): \WP_REST_Response {
|
public function get_withdrawals(\WP_REST_Request $request): \WP_REST_Response {
|
||||||
if (!class_exists('\AKSRT\Payment\Withdrawal')) {
|
if (!class_exists('\AKSRT\Payment\Withdrawal')) {
|
||||||
return $this->success(['data' => ['items' => [], 'total' => 0, 'page' => 1, 'total_pages' => 1, 'stats' => []]]);
|
return $this->success(['data' => ['items' => [], 'total' => 0, 'page' => 1, 'total_pages' => 1, 'stats' => []]]);
|
||||||
|
|||||||
+560
-316
@@ -7,323 +7,567 @@ namespace AKSRT\Admin\Schema;
|
|||||||
|
|
||||||
defined('ABSPATH') || exit;
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 「支付&付费」设置 schema。
|
||||||
|
*
|
||||||
|
* 页面结构 1:1 复刻参考主题 Zibll 的「支付&付费」section(知识付费 / 余额充值 /
|
||||||
|
* VIP会员 / 创作分成 / 推广返佣 / 收款接口),并按产品需求新增「提现策略」子页。
|
||||||
|
* 收款接口仅保留支付宝、微信、PayPal、Stripe、易支付;订单前缀 / 流水号前缀 /
|
||||||
|
* 提现单号前缀配置保留并收口在收款接口页。
|
||||||
|
*/
|
||||||
class SchemaPayment {
|
class SchemaPayment {
|
||||||
|
|
||||||
public static function build(): array {
|
public static function build(): array {
|
||||||
return [
|
return [
|
||||||
'domain' => 'payment',
|
'domain' => 'payment',
|
||||||
'title' => '支付&付费',
|
'title' => '支付&付费',
|
||||||
'sections' => [
|
'sections' => [
|
||||||
'recharge' => [
|
|
||||||
'key' => 'recharge',
|
/* ------------------------------------------------------------------
|
||||||
'title' => '余额充值',
|
* 知识付费
|
||||||
'version' => '1.0.0',
|
* ------------------------------------------------------------------ */
|
||||||
'option_key' => 'aksrt_settings',
|
'knowledge' => [
|
||||||
'groups' => [
|
'key' => 'knowledge',
|
||||||
['key' => 'basic', 'title' => '充值开关', 'fields' => [
|
'title' => '知识付费',
|
||||||
['key' => 'pay_balance_s', 'label' => '启用余额功能', 'type' => 'switch', 'default' => true],
|
'version' => '1.0.0',
|
||||||
['key' => 'pay_balance_desc', 'label' => '充值说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
'option_key' => 'aksrt_settings',
|
||||||
]],
|
'groups' => [
|
||||||
['key' => 'packages', 'title' => '充值套餐', 'fields' => [
|
['key' => 'notice', 'title' => '说明', 'fields' => [
|
||||||
['key' => 'pay_balance_product', 'label' => '套餐列表', 'type' => 'textarea', 'default' => "30|30|入门包\n98|108|推荐包", 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
['key' => 'knowledge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>知识付费</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>知识付费功能主要分为文章付费、付费会员、余额系统、推广返佣、创作分成等功能组成,您可以根据您的需要开启对应功能</li><li>使用支付功能请先在「收款接口」页配置好收款通道</li></ul>'],
|
||||||
]],
|
]],
|
||||||
['key' => 'product', 'title' => '充值产品', 'fields' => [
|
['key' => 'guest-buy', 'title' => '免登陆购买', 'fields' => [
|
||||||
['key' => 'pay_balance_product_name', 'label' => '充值产品', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
['key' => 'pay_no_logged_in', 'label' => '免登陆购买', 'type' => 'switch', 'default' => true, 'help' => '开启后如果用户未登录则使用浏览器缓存验证是否购买'],
|
||||||
['key' => 'pay_balance_price', 'label' => '充值价格', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 99999, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
['key' => 'pay_cookie_day', 'label' => 'Cookie时间(天)', 'type' => 'number', 'default' => 15, 'min' => 1, 'max' => 31, 'dependsOn' => ['key' => 'pay_no_logged_in', 'value' => true], 'help' => '免登陆购买的浏览器缓存有效时间'],
|
||||||
['key' => 'pay_balance_tag', 'label' => '价格标签', 'type' => 'input', 'default' => '元', 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
['key' => 'pay_no_logged_remind', 'label' => '未登录提醒', 'type' => 'textarea', 'default' => '您当前未登录!建议登陆后购买,可保存购买订单', 'rows' => 2, 'dependsOn' => ['key' => 'pay_no_logged_in', 'value' => true]],
|
||||||
['key' => 'pay_balance_tag_class', 'label' => '标签样式', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
]],
|
||||||
['key' => 'pay_balance_product_custom_s', 'label' => '自定义金额', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
['key' => 'box-position', 'title' => '模块显示位置', 'fields' => [
|
||||||
['key' => 'pay_balance_product_custom_limit', 'label' => '自定义金额限制', 'type' => 'number', 'default' => 9999, 'min' => 1, 'max' => 99999, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
['key' => 'pay_box_position', 'label' => '购买模块位置', 'type' => 'radio', 'default' => 'top', 'options' => [
|
||||||
]],
|
['label' => '文章模块上方', 'value' => 'box_top'],
|
||||||
['key' => 'transfer', 'title' => '余额转账', 'fields' => [
|
['label' => '文章内容顶部', 'value' => 'top'],
|
||||||
['key' => 'pay_balance_transfer_s', 'label' => '启用余额转账', 'type' => 'switch', 'default' => false],
|
['label' => '文章内容底部', 'value' => 'bottom'],
|
||||||
['key' => 'pay_balance_transfer_service_charge', 'label' => '转账手续费(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 50, 'dependsOn' => ['key' => 'pay_balance_transfer_s', 'value' => true]],
|
['label' => '文章模块下方', 'value' => 'box_bottom'],
|
||||||
['key' => 'pay_balance_transfer_desc', 'label' => '转账说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_transfer_s', 'value' => true]],
|
], 'help' => '在文章页面中购买模块的显示位置'],
|
||||||
]],
|
]],
|
||||||
['key' => 'pass-charge', 'title' => '充值卡免扣', 'fields' => [
|
['key' => 'display-basic', 'title' => '基础显示', 'fields' => [
|
||||||
['key' => 'pay_balance_pass_charge_s', 'label' => '启用余额卡密兑换', 'type' => 'switch', 'default' => false],
|
['key' => 'pay_free_logged_show', 'label' => '免费资源登录可见', 'type' => 'switch', 'default' => true, 'help' => '免费资源必须登录后才能查看'],
|
||||||
['key' => 'pay_balance_pass_charge_desc', 'label' => '卡密兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_pass_charge_s', 'value' => true]],
|
['key' => 'pay_show_user', 'label' => '订单数据', 'type' => 'switch', 'default' => true, 'help' => '在用户中心显示订单数据'],
|
||||||
['key' => 'pay_balance_pass_charge_only_password', 'label' => '仅密码兑换', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_balance_pass_charge_s', 'value' => true]],
|
['key' => 'pay_show_paycount', 'label' => '销量显示', 'type' => 'switch', 'default' => true, 'help' => '商品详情显示销售数量'],
|
||||||
]],
|
]],
|
||||||
['key' => 'points-exchange', 'title' => '余额兑换积分', 'fields' => [
|
['key' => 'coupon', 'title' => '商品优惠码', 'fields' => [
|
||||||
['key' => 'pay_balance_points_exchange_s', 'label' => '启用余额兑换积分', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
['key' => 'coupon_post_s', 'label' => '为所有商品启用优惠券功能', 'type' => 'switch', 'default' => false, 'help' => '开启后将为所有商品显示输入优惠码的功能;也可以单独给任意一个商品开启'],
|
||||||
['key' => 'pay_balance_points_exchange_rate', 'label' => '兑换比例', 'type' => 'number', 'default' => 100, 'min' => 1, 'max' => 10000, 'help' => '1 余额 = N 积分', 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
['key' => 'coupon_desc', 'label' => '优惠码默认说明', 'type' => 'textarea', 'default' => '', 'rows' => 1, 'dependsOn' => ['key' => 'coupon_post_s', 'value' => true], 'help' => '用户填写优惠码时展示的提醒内容,支持HTML代码'],
|
||||||
['key' => 'pay_balance_points_exchange_min_points', 'label' => '单笔最低购买积分', 'type' => 'number', 'default' => 100, 'min' => 1, 'max' => 10000000, 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
]],
|
||||||
['key' => 'pay_balance_points_exchange_daily_max_points', 'label' => '每日最高购买积分', 'type' => 'number', 'default' => 100000, 'min' => 1, 'max' => 10000000, 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
['key' => 'display', 'title' => '展示设置', 'fields' => [
|
||||||
['key' => 'pay_balance_points_exchange_desc', 'label' => '兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
['key' => 'pay_mark', 'label' => '付费标记', 'type' => 'input', 'default' => '付费'],
|
||||||
]],
|
['key' => 'payment_show_ip', 'label' => '显示用户IP', 'type' => 'switch', 'default' => false],
|
||||||
],
|
['key' => 'payment_show_device', 'label' => '显示设备信息', 'type' => 'switch', 'default' => false],
|
||||||
],
|
['key' => 'payment_show_order_no', 'label' => '显示订单号', 'type' => 'switch', 'default' => true],
|
||||||
'vip' => [
|
['key' => 'payment_show_create_time', 'label' => '显示创建时间', 'type' => 'switch', 'default' => true],
|
||||||
'key' => 'vip',
|
['key' => 'payment_show_pay_time', 'label' => '显示支付时间', 'type' => 'switch', 'default' => true],
|
||||||
'title' => 'VIP会员',
|
]],
|
||||||
'version' => '1.1.0',
|
['key' => 'status', 'title' => '状态设置', 'fields' => [
|
||||||
'option_key' => 'aksrt_settings',
|
['key' => 'payment_order_status_pending', 'label' => '待支付状态文案', 'type' => 'input', 'default' => '待支付'],
|
||||||
'groups' => [
|
['key' => 'payment_order_status_paid', 'label' => '已支付状态文案', 'type' => 'input', 'default' => '已支付'],
|
||||||
['key' => 'basic', 'title' => '会员等级', 'fields' => [
|
['key' => 'payment_order_status_refunding', 'label' => '退款中状态文案', 'type' => 'input', 'default' => '退款中'],
|
||||||
['key' => 'nav_pay_vip', 'label' => '导航栏购买按钮', 'type' => 'switch', 'default' => true, 'help' => '在顶部导航栏显示开通会员按钮;请注意顶部导航的整体宽度。'],
|
['key' => 'payment_order_status_refunded', 'label' => '已退款状态文案', 'type' => 'input', 'default' => '已退款'],
|
||||||
['key' => 'nav_user_pay_vip', 'label' => '用户框购买按钮', 'type' => 'switch', 'default' => true, 'help' => '在导航栏用户框内显示开通会员按钮。'],
|
['key' => 'payment_order_status_closed', 'label' => '已关闭状态文案', 'type' => 'input', 'default' => '已关闭'],
|
||||||
['key' => 'pay_user_vip_1_s', 'label' => '启用一级会员', 'type' => 'switch', 'default' => true],
|
]],
|
||||||
['key' => 'pay_user_vip_1_name', 'label' => '一级会员名称', 'type' => 'input', 'default' => '一级会员', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
['key' => 'service', 'title' => '客户服务', 'fields' => [
|
||||||
['key' => 'pay_user_vip_1_desc', 'label' => '一级会员一句话简介', 'type' => 'input', 'default' => '尊享一级会员特权', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
['key' => 'pay_service', 'label' => '用户服务内容', 'type' => 'group', 'button_title' => '添加服务项', 'default' => [], 'fields' => [
|
||||||
['key' => 'pay_user_vip_1_equity', 'label' => '一级会员权益 HTML', 'type' => 'textarea', 'default' => '<li>免费下载部分资源</li><li>会员专属身份标识</li><li>付费内容会员价</li>', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
['key' => 'value', 'label' => '服务内容', 'type' => 'input', 'default' => ''],
|
||||||
['key' => 'vip_1_img_icon', 'label' => '一级会员图标 URL', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true], 'help' => '留空使用内置 vip-1.svg 图标'],
|
['key' => 'icon', 'label' => '自定义图标', 'type' => 'icon', 'default' => ''],
|
||||||
['key' => 'pay_user_vip_2_s', 'label' => '启用二级会员', 'type' => 'switch', 'default' => true],
|
]],
|
||||||
['key' => 'pay_user_vip_2_name', 'label' => '二级会员名称', 'type' => 'input', 'default' => '二级会员', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
]],
|
||||||
['key' => 'pay_user_vip_2_desc', 'label' => '二级会员一句话简介', 'type' => 'input', 'default' => '尊享二级会员特权', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
['key' => 'feature', 'title' => '商品功能配置', 'fields' => [
|
||||||
['key' => 'pay_user_vip_2_equity', 'label' => '二级会员权益 HTML', 'type' => 'textarea', 'default' => '<li>更高免费下载额度</li><li>更高等级身份标识</li><li>更多付费内容会员价</li>', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
['key' => 'pay_type_option', 'label' => '商品功能配置', 'type' => 'tabbed', 'tabs' => [
|
||||||
['key' => 'vip_2_img_icon', 'label' => '二级会员图标 URL', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true], 'help' => '留空使用内置 vip-2.svg 图标'],
|
['key' => 'download', 'title' => '付费下载', 'fields' => [
|
||||||
['key' => 'pay_user_vip_desc', 'label' => '弹窗顶部会员说明', 'type' => 'textarea', 'default' => ''],
|
['key' => 'down_alone_page', 'label' => '独立下载页面', 'type' => 'switch', 'default' => false, 'help' => '开启后,付费资源的下载链接会跳转独立页面显示'],
|
||||||
['key' => 'pay_user_vip_more', 'label' => '弹窗底部补充说明 HTML', 'type' => 'textarea', 'default' => ''],
|
['key' => 'down_user_log', 'label' => '保存用户下载记录(条)', 'type' => 'number', 'default' => 50, 'min' => 0, 'help' => '填0则不保存,注意记录量太大可能会影响网站性能'],
|
||||||
]],
|
['key' => 'down_post_log', 'label' => '保存文章下载记录(条)', 'type' => 'number', 'default' => 50, 'min' => 0, 'help' => '填0则不保存,注意记录量太大可能会影响网站性能'],
|
||||||
['key' => 'packages', 'title' => '分档套餐', 'fields' => [
|
['key' => 'down_remote_to_local_s', 'label' => '远程文件转本地文件下载', 'type' => 'switch', 'default' => true, 'help' => '当下载地址为外链文件时,先将远程文件下载到本地服务器,再提供给用户下载,可完全隐藏远程下载地址'],
|
||||||
['key' => 'vip_1_product_s', 'label' => '允许购买一级会员', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
['key' => 'down_remote_to_local_size', 'label' => '文件大小限制(Kb)', 'type' => 'number', 'default' => 2048, 'min' => 0],
|
||||||
['key' => 'payment_vip_1_products', 'label' => '一级会员套餐', 'type' => 'textarea', 'default' => "30|59|1|month|限时|月卡\n98|199|3|month|特惠|季卡\n365|599|12|month|超值|年卡\n999|1299|0|day|永久|永久卡", 'dependsOn' => ['key' => 'vip_1_product_s', 'value' => true], 'help' => '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久'],
|
['key' => 'down_remote_to_local_ext', 'label' => '文件格式限制', 'type' => 'input', 'default' => 'zip,rar,7z,text,png,jpg,jpeg,gif,mp3,mp4,avi,wmv,flv,swf,doc,docx,xls,xlsx,ppt,pptx,pdf', 'help' => '限制使用此功能的文件格式,多个用英文逗号隔开'],
|
||||||
['key' => 'vip_2_product_s', 'label' => '允许购买二级会员', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
['key' => 'down_verify_nonce', 'label' => '下载前检测用户环境', 'type' => 'switch', 'default' => true, 'help' => '防止机器批量扫描下载,有效防止跨站攻击'],
|
||||||
['key' => 'payment_vip_2_products', 'label' => '二级会员套餐', 'type' => 'textarea', 'default' => "58|99|1|month|限时|月卡\n168|299|3|month|特惠|季卡\n598|999|12|month|超值|年卡\n1299|1999|0|day|永久|永久卡", 'dependsOn' => ['key' => 'vip_2_product_s', 'value' => true], 'help' => '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久'],
|
]],
|
||||||
]],
|
]],
|
||||||
['key' => 'points_exchange', 'title' => '积分兑换会员', 'fields' => [
|
]],
|
||||||
['key' => 'pay_vip_points_exchange_s', 'label' => '启用积分兑换', 'type' => 'switch', 'default' => false],
|
['key' => 'presets', 'title' => '商品预置参数配置', 'fields' => [
|
||||||
['key' => 'payment_vip_points_packages', 'label' => '兑换套餐', 'type' => 'textarea', 'default' => "1|500|30|积分月卡\n1|5000|0|积分永久", 'dependsOn' => ['key' => 'pay_vip_points_exchange_s', 'value' => true], 'help' => '每行:等级|积分|天数|标题(天数 0=永久;普通用户可开通,已有会员可续费同等级或升级更高等级)'],
|
['key' => 'presets_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '在下方配置的参数新建文章时候会自动填入,方便新建文章的设置。最终以文章配置为准'],
|
||||||
['key' => 'pay_vip_points_exchange_desc', 'label' => '兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_vip_points_exchange_s', 'value' => true]],
|
['key' => 'pay_modo_default', 'label' => '支付类型', 'type' => 'radio', 'default' => '0', 'options' => [
|
||||||
]],
|
['label' => '普通商品(金钱购买)', 'value' => '0'],
|
||||||
['key' => 'benefit', 'title' => '下载权益', 'fields' => [
|
['label' => '积分商品(积分购买,依赖于用户积分功能)', 'value' => 'points'],
|
||||||
['key' => 'pay_download_limit', 'label' => '普通用户下载限制', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 9999],
|
]],
|
||||||
['key' => 'pay_download_limit_vip_1', 'label' => '一级会员下载限制', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 9999, 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
['key' => 'points_price_default', 'label' => '积分售价(积分)', 'type' => 'number', 'default' => 0, 'min' => 0],
|
||||||
['key' => 'pay_download_limit_vip_2', 'label' => '二级会员下载限制', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 9999, 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
['key' => 'vip_1_points_default', 'label' => '一级会员积分售价(积分)', 'type' => 'number', 'default' => 0, 'min' => 0],
|
||||||
['key' => 'pay_vip_pass_charge_s', 'label' => '会员卡密兑换', 'type' => 'switch', 'default' => false],
|
['key' => 'vip_2_points_default', 'label' => '二级会员积分售价(积分)', 'type' => 'number', 'default' => 0, 'min' => 0],
|
||||||
['key' => 'pay_vip_pass_charge_desc', 'label' => '卡密兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_vip_pass_charge_s', 'value' => true]],
|
['key' => 'pay_price_default', 'label' => '执行价', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '0.01', 'suffix' => '元'],
|
||||||
['key' => 'pay_vip_pass_charge_only_password', 'label' => '仅密码兑换', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_vip_pass_charge_s', 'value' => true]],
|
['key' => 'pay_original_price_default', 'label' => '原价', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '', 'suffix' => '元', 'help' => '显示在执行价格前面,并划掉'],
|
||||||
]],
|
['key' => 'pay_promotion_tag_default', 'label' => '促销标签', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<i class="fa fa-fw fa-bolt"></i> 限时特惠', 'rows' => 1],
|
||||||
['key' => 'renew', 'title' => '续费设置', 'fields' => [
|
['key' => 'vip_1_price_default', 'label' => '一级会员价格', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '0', 'suffix' => '元', 'help' => '填0则为一级会员免费'],
|
||||||
['key' => 'vip_renew', 'label' => '允许续费', 'type' => 'switch', 'default' => true],
|
['key' => 'vip_2_price_default', 'label' => '二级会员价格', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '0', 'suffix' => '元', 'help' => '填0则为二级会员免费'],
|
||||||
['key' => 'vip_renew_desc', 'label' => '续费说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'vip_renew', 'value' => true]],
|
['key' => 'pay_rebate_discount', 'label' => '推广折扣', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '0', 'suffix' => '元', 'help' => '通过推广链接购买,额外优惠的金额;需开启推广返佣功能,且不能超过实际购买价'],
|
||||||
['key' => 'vip_renew_price_type', 'label' => '续费价格类型', 'type' => 'radio', 'default' => 'discount', 'dependsOn' => ['key' => 'vip_renew', 'value' => true], 'options' => [
|
['key' => 'pay_cuont_default', 'label' => '销量浮动', 'type' => 'between_number', 'default' => ['min' => 0, 'max' => 0], 'help' => '为真实销量增加或减少的数量,系统会根据此处设置的区间获取随机值作为预置参数'],
|
||||||
['label' => '相同价格', 'value' => 'same'],
|
['key' => 'pay_details_default', 'label' => '更多详情', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '', 'rows' => 3, 'help' => '可插入任意的HTML代码'],
|
||||||
['label' => '折扣价格', 'value' => 'discount'],
|
['key' => 'pay_extra_hide_default', 'label' => '额外隐藏内容', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '', 'rows' => 3, 'help' => '可插入任意的HTML代码'],
|
||||||
['label' => '优惠立减', 'value' => 'reduce'],
|
['key' => 'pay_attributes_default', 'label' => '资源属性', 'type' => 'group', 'button_title' => '添加属性', 'default' => [], 'fields' => [
|
||||||
]],
|
['key' => 'key', 'label' => '属性名称', 'type' => 'input', 'default' => ''],
|
||||||
['key' => 'vip_renew_discount', 'label' => '续费折扣(折,如 8=八折)', 'type' => 'number', 'default' => 8, 'min' => 1, 'max' => 100, 'dependsOn' => ['key' => 'vip_renew_price_type', 'value' => 'discount']],
|
['key' => 'value', 'label' => '属性内容', 'type' => 'input', 'default' => ''],
|
||||||
['key' => 'vip_renew_reduce', 'label' => '续费减免金额', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '20.00', 'min' => 0, 'max' => 9999, 'dependsOn' => ['key' => 'vip_renew_price_type', 'value' => 'reduce']],
|
]],
|
||||||
]],
|
['key' => 'pay_gallery_show_default', 'label' => '付费图片免费查看数量(张)', 'type' => 'number', 'default' => 1, 'min' => 0, 'help' => '设置付费图片可免费查看前几张图片的数量的默认值'],
|
||||||
['key' => 'upgrade', 'title' => '升级设置', 'fields' => [
|
]],
|
||||||
['key' => 'vip_upgrade', 'label' => '允许升级', 'type' => 'switch', 'default' => true],
|
],
|
||||||
['key' => 'vip_upgrade_desc', 'label' => '升级说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'vip_upgrade', 'value' => true]],
|
],
|
||||||
['key' => 'vip_upgrade_product', 'label' => '升级产品', 'type' => 'textarea', 'default' => "unit|1|按剩余天数升级\njump|199|升级永久二级会员\npermanent|299|永久一级升永久二级", 'dependsOn' => ['key' => 'vip_upgrade', 'value' => true], 'help' => '每行一条。永久VIP1:permanent|价格|标题;剩余天:unit|每日单价|标题;跳转永久:jump|价格|标题'],
|
|
||||||
]],
|
/* ------------------------------------------------------------------
|
||||||
],
|
* 余额充值
|
||||||
],
|
* ------------------------------------------------------------------ */
|
||||||
'revenue' => [
|
'recharge' => [
|
||||||
'key' => 'revenue',
|
'key' => 'recharge',
|
||||||
'title' => '创作中心',
|
'title' => '余额充值',
|
||||||
'version' => '2.0.0',
|
'version' => '1.1.0',
|
||||||
'option_key' => 'aksrt_settings',
|
'option_key' => 'aksrt_settings',
|
||||||
'groups' => [
|
'groups' => [
|
||||||
['key' => 'basic', 'title' => '创作中心设置', 'fields' => [
|
['key' => 'notice', 'title' => '说明', 'fields' => [
|
||||||
['key' => 'pay_income_s', 'label' => '启用创作分成', 'type' => 'switch', 'default' => false],
|
['key' => 'recharge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>用户余额功能:</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>开启后用户可充值到余额,余额可用于全站消费</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>可以在用户管理中,为某一个用户手动赠送余额</li></ul>'],
|
||||||
['key' => 'payment_revenue_cycle_days', 'label' => '结算周期(天)', 'type' => 'number', 'default' => 30, 'min' => 1, 'max' => 365, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
]],
|
||||||
['key' => 'payment_revenue_note', 'label' => '结算备注文案', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<p>订单完成并经过结算周期后,作者分成会自动转入对应的钱包。</p>', 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
['key' => 'basic', 'title' => '用户余额', 'fields' => [
|
||||||
]],
|
['key' => 'pay_balance_s', 'label' => '启用余额充值/支付功能', 'type' => 'switch', 'default' => true, 'help' => '开启后用户中心显示现金钱包,并可作为收银台支付方式'],
|
||||||
['key' => 'cash', 'title' => '现金收益分成', 'fields' => [
|
['key' => 'pay_balance_withdraw_s', 'label' => '余额提现', 'type' => 'switch', 'default' => false, 'help' => '允许将余额提现', 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
||||||
['key' => 'payment_revenue_cash_ratio_user', 'label' => '普通用户分成比例(%)', 'type' => 'number', 'default' => 60, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
['key' => 'pay_balance_desc', 'label' => '充值说明', 'type' => 'textarea', 'default' => '', 'rows' => 3, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true], 'help' => '用户充值时显示的内容,建议为提醒事项、充值协议等,支持HTML代码'],
|
||||||
['key' => 'payment_revenue_cash_ratio_vip_1', 'label' => '一级会员分成比例(%)', 'type' => 'number', 'default' => 70, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
]],
|
||||||
['key' => 'payment_revenue_cash_ratio_vip_2', 'label' => '二级会员分成比例(%)', 'type' => 'number', 'default' => 80, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
['key' => 'transfer', 'title' => '余额转账', 'fields' => [
|
||||||
]],
|
['key' => 'pay_balance_transfer_s', 'label' => '启用余额转账', 'type' => 'switch', 'default' => false, 'help' => '允许用户转账给其他用户'],
|
||||||
['key' => 'points', 'title' => '积分收益分成', 'fields' => [
|
['key' => 'pay_balance_transfer_service_charge', 'label' => '转账手续费(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 50, 'dependsOn' => ['key' => 'pay_balance_transfer_s', 'value' => true]],
|
||||||
['key' => 'payment_revenue_points_ratio_user', 'label' => '普通用户分成比例(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
['key' => 'pay_balance_transfer_desc', 'label' => '转账说明', 'type' => 'textarea', 'default' => '', 'rows' => 2, 'dependsOn' => ['key' => 'pay_balance_transfer_s', 'value' => true], 'help' => '用户转账时候显示的内容,建议为提醒事项、转账协议等,支持HTML代码'],
|
||||||
['key' => 'payment_revenue_points_ratio_vip_1', 'label' => '一级会员分成比例(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
]],
|
||||||
['key' => 'payment_revenue_points_ratio_vip_2', 'label' => '二级会员分成比例(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
['key' => 'products', 'title' => '充值商品选项', 'fields' => [
|
||||||
]],
|
['key' => 'pay_balance_product', 'label' => '充值金额选项', 'type' => 'group', 'button_title' => '添加充值金额选项', 'default' => [
|
||||||
],
|
['price' => 50, 'pay_price' => 0, 'tag' => '', 'tag_class' => ''],
|
||||||
],
|
['price' => 100, 'pay_price' => 98, 'tag' => '', 'tag_class' => ''],
|
||||||
'affiliate' => [
|
['price' => 200, 'pay_price' => 188, 'tag' => '推荐', 'tag_class' => 'jb-cyan'],
|
||||||
'key' => 'affiliate',
|
['price' => 500, 'pay_price' => 468, 'tag' => '特惠', 'tag_class' => 'jb-pink'],
|
||||||
'title' => '推广返佣',
|
], 'help' => '用户充值时候,可快速选择的充值金额,同时支持设置折扣', 'fields' => [
|
||||||
'version' => '1.0.0',
|
['key' => 'price', 'label' => '充值金额', 'type' => 'number', 'default' => 100, 'min' => 0, 'suffix' => '元'],
|
||||||
'option_key' => 'aksrt_settings',
|
['key' => 'pay_price', 'label' => '销售金额', 'type' => 'number', 'default' => 0, 'min' => 0, 'suffix' => '元', 'help' => '选填,设置不同的销售金额实现充值折扣的功能,设置为0则与充值金额一致'],
|
||||||
'groups' => [
|
['key' => 'tag', 'label' => '小标签', 'type' => 'input', 'default' => '', 'help' => '支持HTML,请注意控制长度'],
|
||||||
['key' => 'policy', 'title' => '返佣策略', 'fields' => [
|
['key' => 'tag_class', 'label' => '标签颜色类', 'type' => 'input', 'default' => '', 'help' => '主题标签颜色类,如 jb-cyan / jb-pink'],
|
||||||
['key' => 'affiliate_enabled', 'label' => '启用推广返佣', 'type' => 'switch', 'default' => false],
|
]],
|
||||||
['key' => 'affiliate_ratio_user', 'label' => '普通会员佣金比例(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
|
['key' => 'pay_balance_product_custom_s', 'label' => '自定义充值金额', 'type' => 'switch', 'default' => true, 'help' => '允许用户手动输入充值金额'],
|
||||||
['key' => 'affiliate_ratio_vip_1', 'label' => '一级会员佣金比例(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
|
['key' => 'pay_balance_product_custom_limit', 'label' => '自定义充值金额上限', 'type' => 'number', 'default' => 9999, 'min' => 1, 'max' => 99999, 'dependsOn' => ['key' => 'pay_balance_product_custom_s', 'value' => true]],
|
||||||
['key' => 'affiliate_ratio_vip_2', 'label' => '二级会员佣金比例(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
|
]],
|
||||||
['key' => 'affiliate_order_types', 'label' => '适用订单类型', 'type' => 'checkbox', 'options' => [['value' => 'membership', 'label' => '会员订单'], ['value' => 'content', 'label' => '付费内容'], ['value' => 'credits', 'label' => '购买积分']], 'default' => ['membership', 'content']],
|
['key' => 'pass-charge', 'title' => '卡密充值', 'fields' => [
|
||||||
['key' => 'affiliate_settlement_days', 'label' => '结算观察期(天)', 'type' => 'number', 'default' => 7, 'min' => 0, 'max' => 90],
|
['key' => 'pay_balance_pass_charge_s', 'label' => '启用卡密充值余额功能', 'type' => 'switch', 'default' => false],
|
||||||
]],
|
['key' => 'pay_balance_pass_charge_desc', 'label' => '卡密充值说明', 'type' => 'textarea', 'default' => '', 'rows' => 2, 'dependsOn' => ['key' => 'pay_balance_pass_charge_s', 'value' => true], 'help' => '用户使用卡密充值时显示的内容,建议为提醒事项、充值协议等,支持HTML代码'],
|
||||||
['key' => 'text', 'title' => '文案设置', 'fields' => [
|
['key' => 'pay_balance_pass_charge_only_password', 'label' => '单密码模式', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_balance_pass_charge_s', 'value' => true], 'help' => '仅需输入密码,不需要卡号'],
|
||||||
['key' => 'affiliate_promotion_text', 'label' => '推广说明', 'type' => 'textarea', 'default' => ''],
|
]],
|
||||||
]],
|
['key' => 'charge-card', 'title' => '充值卡', 'fields' => [
|
||||||
],
|
['key' => 'card_pass_enabled', 'label' => '启用充值卡', 'type' => 'switch', 'default' => false, 'help' => '充值卡规则与批量发卡配置;卡密兑换入口由上方「卡密充值」控制'],
|
||||||
],
|
['key' => 'card_pass_desc', 'label' => '充值卡说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
'gateway' => [
|
['key' => 'card_pass_type', 'label' => '充值卡类型', 'type' => 'select', 'default' => 'balance', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true], 'options' => [
|
||||||
'key' => 'gateway',
|
['label' => '余额卡', 'value' => 'balance'],
|
||||||
'title' => '收款接口',
|
['label' => 'VIP卡', 'value' => 'vip'],
|
||||||
'version' => '1.2.0',
|
['label' => '积分卡', 'value' => 'credits'],
|
||||||
'option_key' => 'aksrt_settings',
|
]],
|
||||||
'groups' => [
|
['key' => 'card_pass_prefix', 'label' => '卡号前缀', 'type' => 'input', 'default' => 'AK', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'notice', 'title' => '说明', 'fields' => [
|
['key' => 'card_pass_length', 'label' => '卡号长度', 'type' => 'number', 'default' => 16, 'min' => 8, 'max' => 32, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'payment_gateway_notice', 'label' => '通道说明', 'type' => 'notice', 'alertType' => 'info', 'alertContent' => '以渠道开关 + 凭据是否齐全为准。异步回调由各网关验签(支付宝/微信/Stripe/易支付等),无需额外口令。卡密为兑换入口,不出现在收银台支付方式列表。'],
|
['key' => 'card_pass_batch_size', 'label' => '批量生成数量', 'type' => 'number', 'default' => 50, 'min' => 1, 'max' => 500, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
]],
|
['key' => 'card_pass_max_redeem', 'label' => '单卡最大兑换次数', 'type' => 'number', 'default' => 1, 'min' => 1, 'max' => 100, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'gateways', 'title' => '支付渠道开关', 'fields' => [
|
['key' => 'card_pass_expiry', 'label' => '有效期(天)', 'type' => 'number', 'default' => 0, 'min' => 0, 'help' => '0为永久有效', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'payment_balance_enabled', 'label' => '余额支付', 'type' => 'switch', 'default' => true, 'help' => '需同时在「余额充值」启用余额功能。关闭后用户中心仍可有钱包,但结账不可用余额支付。'],
|
|
||||||
['key' => 'payment_alipay_enabled', 'label' => '支付宝', 'type' => 'switch', 'default' => false],
|
|
||||||
['key' => 'payment_wechat_enabled', 'label' => '微信支付', 'type' => 'switch', 'default' => false],
|
|
||||||
['key' => 'payment_paypal_enabled', 'label' => 'PayPal', 'type' => 'switch', 'default' => false],
|
|
||||||
['key' => 'payment_stripe_enabled', 'label' => 'Stripe', 'type' => 'switch', 'default' => false],
|
|
||||||
['key' => 'payment_epay_enabled', 'label' => '易支付', 'type' => 'switch', 'default' => false, 'help' => '兼容彩虹易支付协议的聚合收银台,可同时开启支付宝/微信子通道。'],
|
|
||||||
['key' => 'payment_card_pass_enabled', 'label' => '卡密充值', 'type' => 'switch', 'default' => false, 'help' => '仅控制卡密兑换入口是否开放;卡密规则与批量发卡在「充值卡」页。不进入结账支付方式列表。'],
|
|
||||||
]],
|
|
||||||
// Channel credential groups: SPA uses collapsible + expandWhen + group dependsOn.
|
|
||||||
// Field-level dependsOn kept for contract audit / non-SPA consumers.
|
|
||||||
['key' => 'wechat', 'title' => '微信支付配置', 'collapsible' => true, 'expandWhen' => 'payment_wechat_enabled', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true], 'fields' => [
|
|
||||||
['key' => 'wechat_merchantid', 'label' => '商户号', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]],
|
|
||||||
['key' => 'wechat_appid', 'label' => 'AppID', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]],
|
|
||||||
['key' => 'wechat_payment_type', 'label' => '支付方式', 'type' => 'select', 'default' => 'native', 'options' => [
|
|
||||||
['value' => 'native', 'label' => '扫码支付(Native)'],
|
|
||||||
['value' => 'h5', 'label' => 'H5支付'],
|
|
||||||
], 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]],
|
|
||||||
['key' => 'wechat_api_v3_key', 'label' => 'APIv3密钥', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]],
|
|
||||||
['key' => 'wechat_private_key_path', 'label' => '商户私钥路径', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]],
|
|
||||||
['key' => 'wechat_cert_path', 'label' => '商户API证书路径', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]],
|
|
||||||
]],
|
|
||||||
['key' => 'alipay', 'title' => '支付宝配置', 'collapsible' => true, 'expandWhen' => 'payment_alipay_enabled', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true], 'fields' => [
|
|
||||||
['key' => 'alipay_appid', 'label' => 'AppID', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]],
|
|
||||||
['key' => 'alipay_privatekey', 'label' => '应用私钥', 'type' => 'textarea', 'sanitize_type' => 'code', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]],
|
|
||||||
['key' => 'alipay_payment_type', 'label' => '支付方式', 'type' => 'select', 'default' => 'page', 'options' => [
|
|
||||||
['value' => 'page', 'label' => '电脑网站支付(web)'],
|
|
||||||
['value' => 'wap', 'label' => '手机网站支付(wap)'],
|
|
||||||
], 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]],
|
|
||||||
['key' => 'alipay_app_public_cert_path', 'label' => '应用公钥证书路径', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]],
|
|
||||||
['key' => 'alipay_public_cert_path', 'label' => '支付宝公钥证书路径', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]],
|
|
||||||
['key' => 'alipay_root_cert_path', 'label' => '支付宝根证书路径', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]],
|
|
||||||
['key' => 'alipay_notify_help', 'label' => '回调地址说明', 'type' => 'notice', 'alertType' => 'info', 'alertContent' => '异步通知 / 同步返回已固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return},无需在此填写。', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]],
|
|
||||||
]],
|
|
||||||
['key' => 'paypal', 'title' => 'PayPal配置', 'collapsible' => true, 'expandWhen' => 'payment_paypal_enabled', 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true], 'fields' => [
|
|
||||||
['key' => 'paypal_client_id', 'label' => 'Client ID', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]],
|
|
||||||
['key' => 'paypal_client_secret', 'label' => 'Client Secret', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]],
|
|
||||||
['key' => 'paypal_currency', 'label' => '货币', 'type' => 'input', 'default' => 'USD', 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]],
|
|
||||||
['key' => 'paypal_sandbox', 'label' => '沙箱模式', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]],
|
|
||||||
]],
|
|
||||||
['key' => 'stripe', 'title' => 'Stripe配置', 'collapsible' => true, 'expandWhen' => 'payment_stripe_enabled', 'dependsOn' => ['key' => 'payment_stripe_enabled', 'value' => true], 'fields' => [
|
|
||||||
['key' => 'stripe_secret_key', 'label' => 'Secret Key', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_stripe_enabled', 'value' => true]],
|
|
||||||
['key' => 'stripe_publishable_key', 'label' => 'Publishable Key', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_stripe_enabled', 'value' => true]],
|
|
||||||
['key' => 'stripe_webhook_secret', 'label' => 'Webhook Secret', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_stripe_enabled', 'value' => true]],
|
|
||||||
['key' => 'stripe_currency', 'label' => '货币', 'type' => 'input', 'default' => 'usd', 'dependsOn' => ['key' => 'payment_stripe_enabled', 'value' => true]],
|
|
||||||
['key' => 'stripe_test_mode', 'label' => '测试模式', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'payment_stripe_enabled', 'value' => true]],
|
|
||||||
]],
|
|
||||||
['key' => 'epay', 'title' => '易支付配置', 'collapsible' => true, 'expandWhen' => 'payment_epay_enabled', 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true], 'fields' => [
|
|
||||||
['key' => 'epay_apiurl', 'label' => '接口地址', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true], 'help' => '易支付站点根地址,如 https://pay.example.com/(末尾斜杠可选)。'],
|
|
||||||
['key' => 'epay_pid', 'label' => '商户ID', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true]],
|
|
||||||
['key' => 'epay_key', 'label' => '商户密钥', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true], 'help' => 'MD5 通信密钥。'],
|
|
||||||
['key' => 'epay_channel_alipay', 'label' => '启用支付宝通道', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true]],
|
|
||||||
['key' => 'epay_channel_wxpay', 'label' => '启用微信通道', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true]],
|
|
||||||
['key' => 'epay_device', 'label' => '下单终端', 'type' => 'select', 'default' => 'auto', 'options' => [
|
|
||||||
['value' => 'auto', 'label' => '自动(按 UA)'],
|
|
||||||
['value' => 'pc', 'label' => '电脑端 submit'],
|
|
||||||
['value' => 'mobile', 'label' => '移动端 mapi'],
|
|
||||||
], 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true]],
|
|
||||||
['key' => 'epay_notify_help', 'label' => '回调地址说明', 'type' => 'notice', 'alertType' => 'info', 'alertContent' => '异步/同步回调固定为 /wp-json/aksrt/v1/payment/epay_alipay/{notify|return} 与 /payment/epay_wxpay/{notify|return},请在易支付后台放行对应 URL。', 'dependsOn' => ['key' => 'payment_epay_enabled', 'value' => true]],
|
|
||||||
]],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'order' => [
|
|
||||||
'key' => 'order',
|
|
||||||
'title' => '订单设置',
|
|
||||||
'version' => '1.0.0',
|
|
||||||
'option_key' => 'aksrt_settings',
|
|
||||||
'groups' => [
|
|
||||||
['key' => 'basic', 'title' => '订单基础', 'fields' => [
|
|
||||||
['key' => 'payment_order_prefix', 'label' => '订单前缀', 'type' => 'input', 'default' => 'AKSRT'],
|
|
||||||
['key' => 'payment_flow_prefix', 'label' => '流水号前缀', 'type' => 'input', 'sanitize_type' => 'business_prefix', 'default' => 'AK', 'maxlength' => 12, 'help' => '仅允许字母、数字、下划线和短横线,最多 12 位。'],
|
|
||||||
['key' => 'payment_withdrawal_prefix', 'label' => '提现单号前缀', 'type' => 'input', 'sanitize_type' => 'business_prefix', 'default' => 'TX', 'maxlength' => 12, 'help' => '仅允许字母、数字、下划线和短横线,最多 12 位。'],
|
|
||||||
['key' => 'payment_order_expiry', 'label' => '订单有效期(分钟)', 'type' => 'number', 'default' => 30, 'min' => 5, 'max' => 1440],
|
|
||||||
['key' => 'pay_show_user', 'label' => '显示用户信息', 'type' => 'switch', 'default' => true],
|
|
||||||
['key' => 'pay_show_paycount', 'label' => '显示购买次数', 'type' => 'switch', 'default' => true],
|
|
||||||
['key' => 'pay_no_logged_in', 'label' => '未登录提示', 'type' => 'switch', 'default' => true],
|
|
||||||
['key' => 'pay_cookie_day', 'label' => 'Cookie有效期(天)', 'type' => 'number', 'default' => 15, 'min' => 1, 'max' => 31],
|
|
||||||
['key' => 'pay_no_logged_remind', 'label' => '未登录提醒文案', 'type' => 'textarea', 'default' => '您当前未登录!建议登陆后购买,可保存购买订单'],
|
|
||||||
['key' => 'pay_wait_float_s', 'label' => '订单等待浮动', 'type' => 'switch', 'default' => true],
|
|
||||||
['key' => 'payment_order_max_minutes', 'label' => '订单最大支付时间(分钟)', 'type' => 'number', 'default' => 30, 'min' => 5, 'max' => 1440],
|
|
||||||
]],
|
|
||||||
['key' => 'display', 'title' => '展示设置', 'fields' => [
|
|
||||||
['key' => 'pay_mark', 'label' => '付费标记', 'type' => 'input', 'default' => '付费'],
|
|
||||||
['key' => 'pay_box_position', 'label' => '付费框位置', 'type' => 'radio', 'default' => 'top', 'options' => [
|
|
||||||
['label' => '文章框顶部', 'value' => 'box_top'],
|
|
||||||
['label' => '正文顶部', 'value' => 'top'],
|
|
||||||
['label' => '正文底部', 'value' => 'bottom'],
|
|
||||||
['label' => '文章框底部', 'value' => 'box_bottom'],
|
|
||||||
]],
|
|
||||||
['key' => 'payment_show_ip', 'label' => '显示用户IP', 'type' => 'switch', 'default' => false],
|
|
||||||
['key' => 'payment_show_device', 'label' => '显示设备信息', 'type' => 'switch', 'default' => false],
|
|
||||||
['key' => 'payment_show_order_no', 'label' => '显示订单号', 'type' => 'switch', 'default' => true],
|
|
||||||
['key' => 'payment_show_create_time', 'label' => '显示创建时间', 'type' => 'switch', 'default' => true],
|
|
||||||
['key' => 'payment_show_pay_time', 'label' => '显示支付时间', 'type' => 'switch', 'default' => true],
|
|
||||||
]],
|
|
||||||
['key' => 'status', 'title' => '状态设置', 'fields' => [
|
|
||||||
['key' => 'payment_order_status_pending', 'label' => '待支付状态文案', 'type' => 'input', 'default' => '待支付'],
|
|
||||||
['key' => 'payment_order_status_paid', 'label' => '已支付状态文案', 'type' => 'input', 'default' => '已支付'],
|
|
||||||
['key' => 'payment_order_status_refunding', 'label' => '退款中状态文案', 'type' => 'input', 'default' => '退款中'],
|
|
||||||
['key' => 'payment_order_status_refunded', 'label' => '已退款状态文案', 'type' => 'input', 'default' => '已退款'],
|
|
||||||
['key' => 'payment_order_status_closed', 'label' => '已关闭状态文案', 'type' => 'input', 'default' => '已关闭'],
|
|
||||||
]],
|
|
||||||
['key' => 'service', 'title' => '服务设置', 'fields' => [
|
|
||||||
['key' => 'pay_service', 'label' => '客服设置', 'type' => 'textarea', 'default' => ''],
|
|
||||||
['key' => 'pay_service_icon', 'label' => '客服图标', 'type' => 'icon', 'default' => ''],
|
|
||||||
['key' => 'pay_service_value', 'label' => '客服内容', 'type' => 'input', 'default' => ''],
|
|
||||||
['key' => 'pay_service_qq', 'label' => 'QQ客服', 'type' => 'input', 'default' => ''],
|
|
||||||
['key' => 'pay_service_wechat', 'label' => '微信客服', 'type' => 'media', 'default' => ''],
|
|
||||||
]],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'card-pass' => [
|
|
||||||
'key' => 'card-pass',
|
|
||||||
'title' => '充值卡',
|
|
||||||
'version' => '1.0.0',
|
|
||||||
'option_key' => 'aksrt_settings',
|
|
||||||
'groups' => [
|
|
||||||
['key' => 'card-pass', 'title' => '充值卡', 'fields' => [
|
|
||||||
['key' => 'card_pass_enabled', 'label' => '启用充值卡', 'type' => 'switch', 'default' => false],
|
|
||||||
['key' => 'card_pass_desc', 'label' => '充值卡说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
|
||||||
['key' => 'card_pass_type', 'label' => '充值卡类型', 'type' => 'select', 'default' => 'balance', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true], 'options' => [
|
|
||||||
['label' => '余额卡', 'value' => 'balance'],
|
|
||||||
['label' => 'VIP卡', 'value' => 'vip'],
|
|
||||||
['label' => '积分卡', 'value' => 'credits'],
|
|
||||||
]],
|
|
||||||
['key' => 'card_pass_prefix', 'label' => '卡号前缀', 'type' => 'input', 'default' => 'AK', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
|
||||||
['key' => 'card_pass_length', 'label' => '卡号长度', 'type' => 'number', 'default' => 16, 'min' => 8, 'max' => 32, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
|
||||||
['key' => 'card_pass_batch_size', 'label' => '批量生成数量', 'type' => 'number', 'default' => 50, 'min' => 1, 'max' => 500, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
|
||||||
]],
|
|
||||||
['key' => 'redeem', 'title' => '兑换设置', 'fields' => [
|
|
||||||
['key' => 'card_pass_max_redeem', 'label' => '单卡最大兑换次数', 'type' => 'number', 'default' => 1, 'min' => 1, 'max' => 100, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
|
||||||
['key' => 'card_pass_expiry', 'label' => '有效期(天)', 'type' => 'number', 'default' => 0, 'min' => 0, 'help' => '0为永久有效', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
|
||||||
['key' => 'card_pass_amount', 'label' => '面额(元)', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '10.00', 'min' => 1, 'max' => 9999, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
['key' => 'card_pass_amount', 'label' => '面额(元)', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '10.00', 'min' => 1, 'max' => 9999, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'card_pass_vip_days', 'label' => 'VIP天数', 'type' => 'number', 'default' => 30, 'min' => 1, 'max' => 3650, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
['key' => 'card_pass_vip_days', 'label' => 'VIP天数', 'type' => 'number', 'default' => 30, 'min' => 1, 'max' => 3650, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'card_pass_credits', 'label' => '赠送积分', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 99999, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
['key' => 'card_pass_credits', 'label' => '赠送积分', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 99999, 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
]],
|
['key' => 'card_pass_redeem_page', 'label' => '兑换页面', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'display', 'title' => '展示设置', 'fields' => [
|
['key' => 'card_pass_success_msg', 'label' => '兑换成功提示', 'type' => 'input', 'default' => '兑换成功!', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'card_pass_redeem_page', 'label' => '兑换页面', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
['key' => 'card_pass_fail_msg', 'label' => '兑换失败提示', 'type' => 'input', 'default' => '卡号无效或已过期', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
||||||
['key' => 'card_pass_success_msg', 'label' => '兑换成功提示', 'type' => 'input', 'default' => '兑换成功!', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
]],
|
||||||
['key' => 'card_pass_fail_msg', 'label' => '兑换失败提示', 'type' => 'input', 'default' => '卡号无效或已过期', 'dependsOn' => ['key' => 'card_pass_enabled', 'value' => true]],
|
['key' => 'points-exchange', 'title' => '余额兑换积分', 'fields' => [
|
||||||
]],
|
['key' => 'pay_balance_points_exchange_s', 'label' => '启用余额兑换积分', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
|
||||||
],
|
['key' => 'pay_balance_points_exchange_rate', 'label' => '兑换比例', 'type' => 'number', 'default' => 100, 'min' => 1, 'max' => 10000, 'help' => '1 余额 = N 积分', 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
||||||
],
|
['key' => 'pay_balance_points_exchange_min_points', 'label' => '单笔最低购买积分', 'type' => 'number', 'default' => 100, 'min' => 1, 'max' => 10000000, 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
||||||
'withdrawal' => [
|
['key' => 'pay_balance_points_exchange_daily_max_points', 'label' => '每日最高购买积分', 'type' => 'number', 'default' => 100000, 'min' => 1, 'max' => 10000000, 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
||||||
'key' => 'withdrawal',
|
['key' => 'pay_balance_points_exchange_desc', 'label' => '兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
|
||||||
'title' => '提现策略',
|
]],
|
||||||
'version' => '1.0.0',
|
],
|
||||||
'option_key' => 'aksrt_settings',
|
],
|
||||||
'groups' => [
|
|
||||||
['key' => 'basic', 'title' => '提现设置', 'fields' => [
|
/* ------------------------------------------------------------------
|
||||||
['key' => 'affiliate_min_withdrawal', 'label' => '最低提现金额', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '50.00', 'desc' => '仅接受最多两位小数的十进制字符串。'],
|
* VIP会员
|
||||||
['key' => 'affiliate_withdrawal_fee', 'label' => '提现手续费(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
|
* ------------------------------------------------------------------ */
|
||||||
['key' => 'affiliate_daily_withdrawal_count', 'label' => '每日可提现次数', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 99999],
|
'vip' => [
|
||||||
['key' => 'affiliate_daily_withdrawal_limit', 'label' => '每日提现上限', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '500.00', 'desc' => '仅接受最多两位小数的十进制字符串。'],
|
'key' => 'vip',
|
||||||
['key' => 'affiliate_withdrawal_reset_time', 'label' => '重置时间', 'type' => 'input', 'default' => '00:00', 'help' => '按站点 WordPress 时区重置,格式 HH:MM。'],
|
'title' => 'VIP会员',
|
||||||
['key' => 'affiliate_payout_channels', 'label' => '可用收款渠道', 'type' => 'checkbox', 'options' => [['value' => 'alipay', 'label' => '支付宝收款码'], ['value' => 'wechat', 'label' => '微信收款码']], 'default' => ['alipay', 'wechat']],
|
'version' => '1.1.0',
|
||||||
]],
|
'option_key' => 'aksrt_settings',
|
||||||
],
|
'groups' => [
|
||||||
],
|
['key' => 'notice', 'title' => '说明', 'fields' => [
|
||||||
],
|
['key' => 'vip_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>开启付费会员功能之前,请先配置好收款接口,确保网站收款正常</li><li>会员功能的设置项目较多,请仔细核对,避免出现价格、时间的问题</li><li>配合设置名称、有效期等可搭配出不同类型的会员</li><li>管理员可在后台为用户单独开启会员</li></ul>'],
|
||||||
];
|
]],
|
||||||
}
|
['key' => 'basic', 'title' => '会员等级', 'fields' => [
|
||||||
|
['key' => 'nav_pay_vip', 'label' => '导航栏购买按钮', 'type' => 'switch', 'default' => true, 'help' => '在顶部导航栏显示开通会员按钮;请注意顶部导航的整体宽度。'],
|
||||||
|
['key' => 'nav_user_pay_vip', 'label' => '用户框购买按钮', 'type' => 'switch', 'default' => true, 'help' => '在导航栏用户框内显示开通会员按钮。'],
|
||||||
|
['key' => 'pay_user_vip_1_s', 'label' => '启用一级会员', 'type' => 'switch', 'default' => true],
|
||||||
|
['key' => 'pay_user_vip_1_name', 'label' => '一级会员显示名称', 'type' => 'input', 'default' => '一级会员', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
||||||
|
['key' => 'pay_user_vip_1_desc', 'label' => '一级会员一句话简介', 'type' => 'input', 'default' => '尊享一级会员特权', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
||||||
|
['key' => 'pay_user_vip_1_equity', 'label' => '一级会员权益 HTML', 'type' => 'textarea', 'default' => '<li>免费下载部分资源</li><li>会员专属身份标识</li><li>付费内容会员价</li>', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
||||||
|
['key' => 'vip_1_img_icon', 'label' => '一级会员图标 URL', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true], 'help' => '留空使用内置 vip-1.svg 图标'],
|
||||||
|
['key' => 'pay_user_vip_2_s', 'label' => '启用二级会员', 'type' => 'switch', 'default' => true],
|
||||||
|
['key' => 'pay_user_vip_2_name', 'label' => '二级会员显示名称', 'type' => 'input', 'default' => '二级会员', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
||||||
|
['key' => 'pay_user_vip_2_desc', 'label' => '二级会员一句话简介', 'type' => 'input', 'default' => '尊享二级会员特权', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
||||||
|
['key' => 'pay_user_vip_2_equity', 'label' => '二级会员权益 HTML', 'type' => 'textarea', 'default' => '<li>更高免费下载额度</li><li>更高等级身份标识</li><li>更多付费内容会员价</li>', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
||||||
|
['key' => 'vip_2_img_icon', 'label' => '二级会员图标 URL', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true], 'help' => '留空使用内置 vip-2.svg 图标'],
|
||||||
|
['key' => 'pay_user_vip_desc', 'label' => '弹窗顶部会员说明', 'type' => 'textarea', 'default' => ''],
|
||||||
|
['key' => 'pay_user_vip_more', 'label' => '弹窗底部补充说明 HTML', 'type' => 'textarea', 'default' => ''],
|
||||||
|
]],
|
||||||
|
['key' => 'benefit', 'title' => '会员权益', 'fields' => [
|
||||||
|
['key' => 'vip_benefit', 'label' => '会员权益', 'type' => 'tabbed', 'tabs' => [
|
||||||
|
['key' => 'ordinary', 'title' => '普通用户', 'fields' => [
|
||||||
|
['key' => 'pay_download_limit', 'label' => '付费资源:免费资源每日可下载(个)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 9999, 'help' => '普通用户每日最多可下载几个免费资源(为0则不限制)'],
|
||||||
|
['key' => 'pay_download_speed', 'label' => '付费资源:下载限速(KB/s)', 'type' => 'number', 'default' => 0, 'min' => 0, 'help' => '付费下载限制最大下载速度(为0则不限制);只对本地服务器文件有效'],
|
||||||
|
]],
|
||||||
|
['key' => 'vip1', 'title' => '一级会员', 'fields' => [
|
||||||
|
['key' => 'pay_download_limit_vip_1', 'label' => '付费资源:免费资源每日可下载(个)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 9999, 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true], 'help' => '一级会员每日最多可下载几个免费资源(为0则不限制)'],
|
||||||
|
['key' => 'pay_download_speed_vip_1', 'label' => '付费资源:下载限速(KB/s)', 'type' => 'number', 'default' => 0, 'min' => 0, 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true], 'help' => '付费下载限制最大下载速度(为0则不限制);只对本地服务器文件有效'],
|
||||||
|
]],
|
||||||
|
['key' => 'vip2', 'title' => '二级会员', 'fields' => [
|
||||||
|
['key' => 'pay_download_limit_vip_2', 'label' => '付费资源:免费资源每日可下载(个)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 9999, 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true], 'help' => '二级会员每日最多可下载几个免费资源(为0则不限制)'],
|
||||||
|
['key' => 'pay_download_speed_vip_2', 'label' => '付费资源:下载限速(KB/s)', 'type' => 'number', 'default' => 0, 'min' => 0, 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true], 'help' => '付费下载限制最大下载速度(为0则不限制);只对本地服务器文件有效'],
|
||||||
|
]],
|
||||||
|
]],
|
||||||
|
]],
|
||||||
|
['key' => 'opt', 'title' => '会员购买选项', 'fields' => [
|
||||||
|
['key' => 'vip_opt', 'label' => '会员购买选项', 'type' => 'tabbed', 'tabs' => [
|
||||||
|
['key' => 'vip1', 'title' => '一级会员', 'fields' => [
|
||||||
|
['key' => 'vip_1_product_s', 'label' => '允许购买一级会员', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_user_vip_1_s', 'value' => true]],
|
||||||
|
['key' => 'payment_vip_1_products', 'label' => '一级会员套餐', 'type' => 'textarea', 'default' => "30|59|1|month|限时|月卡\n98|199|3|month|特惠|季卡\n365|599|12|month|超值|年卡\n999|1299|0|day|永久|永久卡", 'dependsOn' => ['key' => 'vip_1_product_s', 'value' => true], 'help' => '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久'],
|
||||||
|
]],
|
||||||
|
['key' => 'vip2', 'title' => '二级会员', 'fields' => [
|
||||||
|
['key' => 'vip_2_product_s', 'label' => '允许购买二级会员', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_user_vip_2_s', 'value' => true]],
|
||||||
|
['key' => 'payment_vip_2_products', 'label' => '二级会员套餐', 'type' => 'textarea', 'default' => "58|99|1|month|限时|月卡\n168|299|3|month|特惠|季卡\n598|999|12|month|超值|年卡\n1299|1999|0|day|永久|永久卡", 'dependsOn' => ['key' => 'vip_2_product_s', 'value' => true], 'help' => '每行:执行价|原价|时长|单位(day|month)|标签|标题;时长 0=永久'],
|
||||||
|
]],
|
||||||
|
['key' => 'renew', 'title' => '会员续费', 'fields' => [
|
||||||
|
['key' => 'vip_renew', 'label' => '允许续费', 'type' => 'switch', 'default' => true, 'help' => '关闭后则不能续费,只能会员到期之后再购买。永久会员不需要续费'],
|
||||||
|
['key' => 'vip_renew_desc', 'label' => '续费说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'vip_renew', 'value' => true]],
|
||||||
|
['key' => 'vip_renew_price_type', 'label' => '续费价格类型', 'type' => 'radio', 'default' => 'discount', 'dependsOn' => ['key' => 'vip_renew', 'value' => true], 'options' => [
|
||||||
|
['label' => '相同价格', 'value' => 'same'],
|
||||||
|
['label' => '折扣价格', 'value' => 'discount'],
|
||||||
|
['label' => '优惠立减', 'value' => 'reduce'],
|
||||||
|
]],
|
||||||
|
['key' => 'vip_renew_discount', 'label' => '续费折扣(折,如 8=八折)', 'type' => 'number', 'default' => 8, 'min' => 1, 'max' => 100, 'dependsOn' => ['key' => 'vip_renew_price_type', 'value' => 'discount']],
|
||||||
|
['key' => 'vip_renew_reduce', 'label' => '续费减免金额', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '20.00', 'min' => 0, 'max' => 9999, 'dependsOn' => ['key' => 'vip_renew_price_type', 'value' => 'reduce']],
|
||||||
|
]],
|
||||||
|
['key' => 'upgrade', 'title' => '会员升级', 'fields' => [
|
||||||
|
['key' => 'vip_upgrade', 'label' => '允许升级', 'type' => 'switch', 'default' => true],
|
||||||
|
['key' => 'vip_upgrade_desc', 'label' => '升级说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'vip_upgrade', 'value' => true]],
|
||||||
|
['key' => 'vip_upgrade_product', 'label' => '升级产品', 'type' => 'textarea', 'default' => "unit|1|按剩余天数升级\njump|199|升级永久二级会员\npermanent|299|永久一级升永久二级", 'dependsOn' => ['key' => 'vip_upgrade', 'value' => true], 'help' => '每行一条。永久VIP1:permanent|价格|标题;剩余天:unit|每日单价|标题;跳转永久:jump|价格|标题'],
|
||||||
|
]],
|
||||||
|
]],
|
||||||
|
]],
|
||||||
|
['key' => 'pass-charge', 'title' => '卡密兑换会员', 'fields' => [
|
||||||
|
['key' => 'pay_vip_pass_charge_s', 'label' => '启用卡密兑换会员功能', 'type' => 'switch', 'default' => false],
|
||||||
|
['key' => 'pay_vip_pass_charge_desc', 'label' => '卡密兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_vip_pass_charge_s', 'value' => true], 'help' => '用户使用卡密兑换时显示的内容,建议为提醒事项、充值协议等,支持HTML代码'],
|
||||||
|
['key' => 'pay_vip_pass_charge_only_password', 'label' => '单密码模式', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_vip_pass_charge_s', 'value' => true], 'help' => '仅需输入密码,不需要卡号'],
|
||||||
|
]],
|
||||||
|
['key' => 'points-exchange', 'title' => '积分兑换会员', 'fields' => [
|
||||||
|
['key' => 'pay_vip_points_exchange_s', 'label' => '启用积分兑换', 'type' => 'switch', 'default' => false],
|
||||||
|
['key' => 'payment_vip_points_packages', 'label' => '兑换套餐', 'type' => 'textarea', 'default' => "1|500|30|积分月卡\n1|5000|0|积分永久", 'dependsOn' => ['key' => 'pay_vip_points_exchange_s', 'value' => true], 'help' => '每行:等级|积分|天数|标题(天数 0=永久;普通用户可开通,已有会员可续费同等级或升级更高等级)'],
|
||||||
|
['key' => 'pay_vip_points_exchange_desc', 'label' => '兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_vip_points_exchange_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------
|
||||||
|
* 创作分成
|
||||||
|
* ------------------------------------------------------------------ */
|
||||||
|
'revenue' => [
|
||||||
|
'key' => 'revenue',
|
||||||
|
'title' => '创作分成',
|
||||||
|
'version' => '2.1.0',
|
||||||
|
'option_key' => 'aksrt_settings',
|
||||||
|
'groups' => [
|
||||||
|
['key' => 'notice', 'title' => '说明', 'fields' => [
|
||||||
|
['key' => 'revenue_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>开启创作分成后,用户发布的付费内容则按设置的比例收入与用户分成</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>用户分成比例是按照订单实收现金并扣除推广佣金后,再按设置的比例分成</li><li>禁用此功能后,所有收款将不会与作者分成</li></ul>'],
|
||||||
|
]],
|
||||||
|
['key' => 'basic', 'title' => '创作中心设置', 'fields' => [
|
||||||
|
['key' => 'pay_income_s', 'label' => '启用创作分成', 'type' => 'switch', 'default' => false],
|
||||||
|
['key' => 'payment_revenue_cycle_days', 'label' => '结算周期(天)', 'type' => 'number', 'default' => 30, 'min' => 1, 'max' => 365, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
||||||
|
['key' => 'payment_revenue_note', 'label' => '结算备注文案', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<p>订单完成并经过结算周期后,作者分成会自动转入对应的钱包。</p>', 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
['key' => 'cash', 'title' => '现金收益分成', 'fields' => [
|
||||||
|
['key' => 'payment_revenue_cash_ratio_user', 'label' => '普通用户分成比例(%)', 'type' => 'number', 'default' => 60, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true], 'help' => '为0则不参与分成'],
|
||||||
|
['key' => 'payment_revenue_cash_ratio_vip_1', 'label' => '一级会员分成比例(%)', 'type' => 'number', 'default' => 70, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
||||||
|
['key' => 'payment_revenue_cash_ratio_vip_2', 'label' => '二级会员分成比例(%)', 'type' => 'number', 'default' => 80, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
['key' => 'points', 'title' => '积分收益分成', 'fields' => [
|
||||||
|
['key' => 'payment_revenue_points_ratio_user', 'label' => '普通用户分成比例(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true], 'help' => '为0则不参与分成(用户采用积分支付的订单给与作者的分成比例)'],
|
||||||
|
['key' => 'payment_revenue_points_ratio_vip_1', 'label' => '一级会员分成比例(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
||||||
|
['key' => 'payment_revenue_points_ratio_vip_2', 'label' => '二级会员分成比例(%)', 'type' => 'number', 'default' => 0, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
['key' => 'detail', 'title' => '分成说明', 'fields' => [
|
||||||
|
['key' => 'pay_income_desc_details', 'label' => '创作分成说明', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<p>在本站发布付费内容,获得的收益将参与收入分成</p><p>普通用户分成比例为:60%</p><p>一级会员分成比例为:70%</p><p>二级会员分成比例为:80%</p><p>分成比例的计算方式为:(实收现金-推广佣金)x 分成比例</p><p>申请提现后,需后台人工处理,一般2-3小时,请耐心等待</p>', 'rows' => 8, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true], 'help' => '显示在用户中心的说明,建议为发布协议或者其他说明(必填项,内容不易太少),支持HTML代码'],
|
||||||
|
['key' => 'pay_income_desc_page_s', 'label' => '创作分成详情页面', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true], 'help' => '您可以新建一个页面写入更加详细的创作分成说明及协议内容,再开启此项并选择对应的页面'],
|
||||||
|
['key' => 'pay_income_desc_page', 'label' => '选择页面', 'type' => 'page_select', 'default' => 0, 'dependsOn' => ['key' => 'pay_income_desc_page_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------
|
||||||
|
* 推广返佣
|
||||||
|
* ------------------------------------------------------------------ */
|
||||||
|
'affiliate' => [
|
||||||
|
'key' => 'affiliate',
|
||||||
|
'title' => '推广返佣',
|
||||||
|
'version' => '1.1.0',
|
||||||
|
'option_key' => 'aksrt_settings',
|
||||||
|
'groups' => [
|
||||||
|
['key' => 'notice', 'title' => '说明', 'fields' => [
|
||||||
|
['key' => 'affiliate_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>识别模式「绑定注册」:用户只要是通过任意推广链接注册的,今后此用户消费均会给推荐人返佣</li><li>识别模式「仅推广链接」:只有通过推广链接购买的才会给推荐人返佣,不会考虑是否是推荐注册的</li><li>开启的订单类型如果一个都不勾选,则代表该用户类型不参与此功能</li><li>您可以根据网站的VIP设置相互配合设置相应的规则</li><li>下面的设置为全局设置,还可以单独为每一个用户设置规则和比例</li></ul>'],
|
||||||
|
]],
|
||||||
|
['key' => 'switch', 'title' => '推广返佣', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_s', 'label' => '启用推广返佣', 'type' => 'switch', 'default' => false],
|
||||||
|
]],
|
||||||
|
['key' => 'mode', 'title' => '推广识别模式', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_judgment', 'label' => '推广识别模式', 'type' => 'radio', 'default' => 'all', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'options' => [
|
||||||
|
['label' => '绑定注册', 'value' => 'all'],
|
||||||
|
['label' => '仅推广链接', 'value' => 'link'],
|
||||||
|
]],
|
||||||
|
['key' => 'pay_rebate_show_users', 'label' => '用户中心显示我推荐的用户', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_rebate_judgment', 'value' => 'all']],
|
||||||
|
['key' => 'pay_rebate_self_s', 'label' => '自己推广自己', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'help' => '允许使用自己的推广链接购买商品并获得佣金'],
|
||||||
|
]],
|
||||||
|
['key' => 'rules', 'title' => '返佣规则', 'fields' => [
|
||||||
|
['key' => 'rebate_rule', 'label' => '为不同用户类型设置返佣规则', 'type' => 'tabbed', 'tabs' => [
|
||||||
|
['key' => 'ordinary', 'title' => '普通用户', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_user_s', 'label' => '返佣订单', 'type' => 'checkbox', 'default' => [], 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'options' => [
|
||||||
|
['label' => '全部订单', 'value' => 'all'],
|
||||||
|
['label' => '购买会员', 'value' => 'membership'],
|
||||||
|
['label' => '付费内容', 'value' => 'content'],
|
||||||
|
['label' => '购买积分', 'value' => 'credits'],
|
||||||
|
], 'help' => '普通用户返利的订单类型,全部关闭,则代表普通用户不参与推广返佣'],
|
||||||
|
['key' => 'pay_rebate_ratio', 'label' => '普通用户返佣比例(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
['key' => 'vip1', 'title' => '一级会员', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_user_s_1', 'label' => '返佣订单', 'type' => 'checkbox', 'default' => ['all'], 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'options' => [
|
||||||
|
['label' => '全部订单', 'value' => 'all'],
|
||||||
|
['label' => '购买会员', 'value' => 'membership'],
|
||||||
|
['label' => '付费内容', 'value' => 'content'],
|
||||||
|
['label' => '购买积分', 'value' => 'credits'],
|
||||||
|
], 'help' => '一级会员返利的订单类型,全部关闭,则代表一级会员用户不参与推广返佣'],
|
||||||
|
['key' => 'pay_rebate_ratio_vip_1', 'label' => '一级会员返佣比例(%)', 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
['key' => 'vip2', 'title' => '二级会员', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_user_s_2', 'label' => '返佣订单', 'type' => 'checkbox', 'default' => ['all'], 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'options' => [
|
||||||
|
['label' => '全部订单', 'value' => 'all'],
|
||||||
|
['label' => '购买会员', 'value' => 'membership'],
|
||||||
|
['label' => '付费内容', 'value' => 'content'],
|
||||||
|
['label' => '购买积分', 'value' => 'credits'],
|
||||||
|
], 'help' => '二级会员返利的订单类型,全部关闭,则代表二级会员用户不参与推广返佣'],
|
||||||
|
['key' => 'pay_rebate_ratio_vip_2', 'label' => '二级会员返佣比例(%)', 'type' => 'number', 'default' => 20, 'min' => 0, 'max' => 100, 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
]],
|
||||||
|
['key' => 'affiliate_settlement_days', 'label' => '结算观察期(天)', 'type' => 'number', 'default' => 7, 'min' => 0, 'max' => 90, 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'help' => '订单完成后经过观察期,佣金才会结算到可提现余额'],
|
||||||
|
]],
|
||||||
|
['key' => 'text', 'title' => '返佣文案', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_text_desc', 'label' => '返佣文案(一句话简介)', 'type' => 'input', 'default' => '加入分享计划,获得高额奖励', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
|
||||||
|
['key' => 'pay_rebate_text_details_title', 'label' => '返佣详情标题', 'type' => 'input', 'default' => '返佣详解', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
|
||||||
|
['key' => 'pay_rebate_text_details', 'label' => '返佣详情内容', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<p>通过您的推广链接打开本站后,在本站购买商品即可获得佣金</p><p>通过您的推广链接注册后的用户今后购买的商品均可获得佣金</p><p>申请提现后,需后台人工处理,一般2-3小时,请耐心等待</p>', 'rows' => 6, 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'help' => '返佣详情介绍,建议为规则介绍或者其他说明,支持HTML代码'],
|
||||||
|
]],
|
||||||
|
['key' => 'poster', 'title' => '推广海报', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_poster_s', 'label' => '推广海报', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'help' => '在用户中心显示包含二维码的推广海报'],
|
||||||
|
['key' => 'pay_rebate_poster_img', 'label' => '推广海报顶部图片', 'type' => 'media', 'default' => '', 'dependsOn' => ['key' => 'pay_rebate_poster_s', 'value' => true]],
|
||||||
|
['key' => 'pay_rebate_poster_title', 'label' => '推广海报标题(20-30个字)', 'type' => 'input', 'default' => '发现一个精品网站,快来看一看', 'dependsOn' => ['key' => 'pay_rebate_poster_s', 'value' => true]],
|
||||||
|
['key' => 'pay_rebate_poster_desc', 'label' => '推广海报简介(40-60个字)', 'type' => 'input', 'default' => '网站有超多精品资源和优惠福利,扫码进入网站还可享受诸多优惠哦', 'dependsOn' => ['key' => 'pay_rebate_poster_s', 'value' => true]],
|
||||||
|
]],
|
||||||
|
['key' => 'discount', 'title' => '推广让利标签', 'fields' => [
|
||||||
|
['key' => 'discount_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>推广让利标签配置详解:</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>可使用的变量:折扣 <code>%discount%</code>、推荐人姓名 <code>%referrer_name%</code></li><li>使用变量示例:<code>%referrer_name%推荐购买 下单再减%discount%元</code></li></ul>', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
|
||||||
|
['key' => 'pay_rebate_text_discount', 'label' => '推广让利标签', 'type' => 'input', 'default' => '推荐购买 下单再减%discount%', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'help' => '显示在购买模块,推广让利的标签文案'],
|
||||||
|
]],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------
|
||||||
|
* 收款接口(支付宝 / 微信 / PayPal / Stripe / 易支付)
|
||||||
|
* ------------------------------------------------------------------ */
|
||||||
|
'gateway' => [
|
||||||
|
'key' => 'gateway',
|
||||||
|
'title' => '收款接口',
|
||||||
|
'version' => '2.0.0',
|
||||||
|
'option_key' => 'aksrt_settings',
|
||||||
|
'groups' => [
|
||||||
|
['key' => 'notice', 'title' => '说明', 'fields' => [
|
||||||
|
['key' => 'gateway_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>以下收款接口,主题仅提供API接入服务,收款平台的可靠性请自行斟酌!</li><li>涉及到资金及信息安全,有相关执照的商家推荐使用官方接口</li><li>微信 / 支付宝接口可在「官方」与「易支付」之间选择;PayPal 与 Stripe 独立开关</li><li>异步回调由各网关验签,无需额外口令;回调地址固定为 /wp-json/aksrt/v1/payment/{gateway}/{notify|return}</li></ul>'],
|
||||||
|
]],
|
||||||
|
['key' => 'channels', 'title' => '收款接口选择', 'fields' => [
|
||||||
|
['key' => 'pay_wechat_sdk_options', 'label' => '微信收款接口', 'type' => 'select', 'default' => 'null', 'options' => [
|
||||||
|
['label' => '微信官方', 'value' => 'official_wechat'],
|
||||||
|
['label' => '易支付-微信', 'value' => 'epay'],
|
||||||
|
['label' => '关闭微信收款', 'value' => 'null'],
|
||||||
|
]],
|
||||||
|
['key' => 'pay_alipay_sdk_options', 'label' => '支付宝收款接口', 'type' => 'select', 'default' => 'null', 'options' => [
|
||||||
|
['label' => '支付宝企业支付/当面付', 'value' => 'official_alipay'],
|
||||||
|
['label' => '易支付-支付宝', 'value' => 'epay'],
|
||||||
|
['label' => '关闭支付宝收款', 'value' => 'null'],
|
||||||
|
]],
|
||||||
|
['key' => 'pay_paypal_sdk_s', 'label' => 'PayPal支付(贝宝)', 'type' => 'switch', 'default' => false, 'help' => '启用后请在下方配置参数'],
|
||||||
|
['key' => 'pay_stripe_sdk_s', 'label' => 'Stripe支付', 'type' => 'switch', 'default' => false, 'help' => '启用后请在下方配置参数'],
|
||||||
|
]],
|
||||||
|
['key' => 'currency', 'title' => '货币与结算', 'fields' => [
|
||||||
|
['key' => 'pay_currency_mark', 'label' => '本地货币符号', 'type' => 'input', 'default' => '¥', 'help' => '显示在金额前面(例如 $ 或 ¥)'],
|
||||||
|
['key' => 'pay_currency_unit', 'label' => '本地货币单位名称', 'type' => 'input', 'default' => '元', 'help' => '金额后缀,例如:人民币填「元」、美元填「dollars」'],
|
||||||
|
['key' => 'pay_wechat_settle', 'label' => '微信结算配置', 'type' => 'fieldset', 'default' => ['settle_rate' => '1', 'settle_mark' => '¥', 'settle_unit' => '元'], 'fields' => [
|
||||||
|
['key' => 'settle_rate', 'label' => '结算汇率', 'type' => 'input', 'default' => '1'],
|
||||||
|
['key' => 'settle_mark', 'label' => '结算货币符号', 'type' => 'input', 'default' => '¥'],
|
||||||
|
['key' => 'settle_unit', 'label' => '结算货币单位', 'type' => 'input', 'default' => '元'],
|
||||||
|
]],
|
||||||
|
['key' => 'pay_alipay_settle', 'label' => '支付宝结算配置', 'type' => 'fieldset', 'default' => ['settle_rate' => '1', 'settle_mark' => '¥', 'settle_unit' => '元'], 'fields' => [
|
||||||
|
['key' => 'settle_rate', 'label' => '结算汇率', 'type' => 'input', 'default' => '1'],
|
||||||
|
['key' => 'settle_mark', 'label' => '结算货币符号', 'type' => 'input', 'default' => '¥'],
|
||||||
|
['key' => 'settle_unit', 'label' => '结算货币单位', 'type' => 'input', 'default' => '元', 'help' => '如果接入的收款方式与本地的货币类型不同,则在此配置结算汇率及单位'],
|
||||||
|
]],
|
||||||
|
['key' => 'pay_sdk_custom_title_s', 'label' => '自定义收款标题', 'type' => 'switch', 'default' => false, 'help' => '默认为付款类型加网站名,如需自定义请开启'],
|
||||||
|
['key' => 'pay_sdk_custom_title', 'label' => '自定义收款标题', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'pay_sdk_custom_title_s', 'value' => true], 'help' => '可使用变量:订单类型 %order_type%,例如:%order_type%-AKSRT;注意控制总长度,太长会导致部分接口报错'],
|
||||||
|
]],
|
||||||
|
['key' => 'order', 'title' => '订单与编号', 'fields' => [
|
||||||
|
['key' => 'payment_order_prefix', 'label' => '订单前缀', 'type' => 'input', 'default' => 'AKSRT', 'help' => '订单号生成前缀'],
|
||||||
|
['key' => 'payment_flow_prefix', 'label' => '流水号前缀', 'type' => 'input', 'sanitize_type' => 'business_prefix', 'default' => 'AK', 'maxlength' => 12, 'help' => '仅允许字母、数字、下划线和短横线,最多 12 位。'],
|
||||||
|
['key' => 'payment_withdrawal_prefix', 'label' => '提现单号前缀', 'type' => 'input', 'sanitize_type' => 'business_prefix', 'default' => 'TX', 'maxlength' => 12, 'help' => '仅允许字母、数字、下划线和短横线,最多 12 位。'],
|
||||||
|
['key' => 'payment_order_expiry', 'label' => '订单支付时效(分钟)', 'type' => 'number', 'default' => 30, 'min' => 5, 'max' => 1440, 'help' => '用户下单后,最大支付时间,超过后订单将自动关闭(不能低于5分钟)'],
|
||||||
|
['key' => 'pay_wait_float_s', 'label' => '浮窗显示待支付订单', 'type' => 'switch', 'default' => true, 'help' => '将用户待支付订单一直显示在右上角,提醒用户付款'],
|
||||||
|
]],
|
||||||
|
['key' => 'sdk-order', 'title' => '收款接口显示顺序', 'fields' => [
|
||||||
|
['key' => 'pay_sdk_order', 'label' => '显示顺序', 'type' => 'sortable', 'default' => [], 'items' => [
|
||||||
|
['key' => 'wechat', 'title' => '微信', 'fields' => []],
|
||||||
|
['key' => 'alipay', 'title' => '支付宝', 'fields' => []],
|
||||||
|
['key' => 'paypal', 'title' => 'PayPal(贝宝)', 'fields' => []],
|
||||||
|
['key' => 'stripe', 'title' => 'Stripe', 'fields' => []],
|
||||||
|
['key' => 'balance', 'title' => '余额', 'fields' => []],
|
||||||
|
['key' => 'card_pass', 'title' => '卡密', 'fields' => []],
|
||||||
|
], 'help' => '收银台支付方式显示顺序;仅显示已开启的接口'],
|
||||||
|
]],
|
||||||
|
['key' => 'alipay', 'title' => '支付宝官方', 'collapsible' => true, 'expandWhen' => 'pay_alipay_sdk_options', 'dependsOn' => ['key' => 'pay_alipay_sdk_options', 'value' => 'official_alipay'], 'fields' => [
|
||||||
|
['key' => 'alipay_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>支付宝公钥为必填项目(公钥错误可以成功付款,但会回调失败)</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return}</li><li>同时填写了企业支付以及当面付参数,则优先使用当面付</li></ul>'],
|
||||||
|
['key' => 'alipay_appid', 'label' => '当面付:APPID', 'type' => 'input', 'default' => ''],
|
||||||
|
['key' => 'alipay_privatekey', 'label' => '当面付:应用私钥', 'type' => 'textarea', 'sanitize_type' => 'code', 'default' => '', 'rows' => 4],
|
||||||
|
['key' => 'alipay_payment_type', 'label' => '支付方式', 'type' => 'select', 'default' => 'page', 'options' => [
|
||||||
|
['label' => '电脑网站支付(web)', 'value' => 'page'],
|
||||||
|
['label' => '手机网站支付(wap)', 'value' => 'wap'],
|
||||||
|
]],
|
||||||
|
['key' => 'alipay_app_public_cert_path', 'label' => '应用公钥证书路径', 'type' => 'input', 'default' => '', 'help' => 'appCertPublicKey.crt 绝对路径。'],
|
||||||
|
['key' => 'alipay_public_cert_path', 'label' => '支付宝公钥证书路径', 'type' => 'input', 'default' => '', 'help' => 'alipayCertPublicKey_RSA2.crt 绝对路径。'],
|
||||||
|
['key' => 'alipay_root_cert_path', 'label' => '支付宝根证书路径', 'type' => 'input', 'default' => '', 'help' => 'alipayRootCert.crt 绝对路径。'],
|
||||||
|
]],
|
||||||
|
['key' => 'wechat', 'title' => '微信官方', 'collapsible' => true, 'expandWhen' => 'pay_wechat_sdk_options', 'dependsOn' => ['key' => 'pay_wechat_sdk_options', 'value' => 'official_wechat'], 'fields' => [
|
||||||
|
['key' => 'wechat_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>微信企业支付:官方接口,商家可申请,有年费,申请较为复杂</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/wechatpay/{notify|return},请配置 Native 支付回调链接</li></ul>'],
|
||||||
|
['key' => 'wechat_merchantid', 'label' => '商户号 PartnerID', 'type' => 'input', 'default' => ''],
|
||||||
|
['key' => 'wechat_appid', 'label' => '授权绑定的AppID', 'type' => 'input', 'default' => ''],
|
||||||
|
['key' => 'wechat_payment_type', 'label' => '支付方式', 'type' => 'select', 'default' => 'native', 'options' => [
|
||||||
|
['label' => '扫码支付(Native)', 'value' => 'native'],
|
||||||
|
['label' => 'H5支付', 'value' => 'h5'],
|
||||||
|
]],
|
||||||
|
['key' => 'wechat_api_v3_key', 'label' => '支付APIv3密钥', 'type' => 'input', 'default' => '', 'help' => '微信商户平台设置的 APIv3 密钥(32位)。'],
|
||||||
|
['key' => 'wechat_private_key_path', 'label' => '商户私钥路径', 'type' => 'input', 'default' => '', 'help' => 'apiclient_key.pem 绝对路径,用于签名。'],
|
||||||
|
['key' => 'wechat_cert_path', 'label' => '商户API证书路径', 'type' => 'input', 'default' => '', 'help' => 'apiclient_cert.pem 绝对路径。'],
|
||||||
|
]],
|
||||||
|
['key' => 'paypal', 'title' => 'PayPal(贝宝)', 'collapsible' => true, 'expandWhen' => 'pay_paypal_sdk_s', 'dependsOn' => ['key' => 'pay_paypal_sdk_s', 'value' => true], 'fields' => [
|
||||||
|
['key' => 'paypal_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>PayPal(贝宝)是常见的海外支付接口</li><li>如果您的收款账户为中国大陆地区,则账户类型必须是企业,且只能收取非中国大陆区的PayPal付款</li><li>REST 应用申请:https://developer.paypal.com/dashboard/applications</li></ul>'],
|
||||||
|
['key' => 'paypal_client_id', 'label' => 'Client ID', 'type' => 'input', 'default' => ''],
|
||||||
|
['key' => 'paypal_client_secret', 'label' => 'Client Secret', 'type' => 'input', 'default' => ''],
|
||||||
|
['key' => 'paypal_currency', 'label' => '结算货币', 'type' => 'select', 'default' => 'USD', 'options' => self::currency_options()],
|
||||||
|
['key' => 'paypal_rates', 'label' => '货币汇率', 'type' => 'input', 'default' => '0.14', 'help' => '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137'],
|
||||||
|
['key' => 'paypal_sandbox', 'label' => '沙盒调试模式', 'type' => 'switch', 'default' => false, 'help' => '沙箱模式(Sandbox)是PayPal支付的测试环境。开启后请使用沙箱环境生成的收款账户和付款账户进行测试。'],
|
||||||
|
]],
|
||||||
|
['key' => 'stripe', 'title' => 'Stripe', 'collapsible' => true, 'expandWhen' => 'pay_stripe_sdk_s', 'dependsOn' => ['key' => 'pay_stripe_sdk_s', 'value' => true], 'fields' => [
|
||||||
|
['key' => 'stripe_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>Stripe 是常见的海外信用卡收款接口</li><li>API 密钥申请:https://dashboard.stripe.com/apikeys</li><li>Webhook 事件:checkout.session.completed</li><li>测试环境请使用 sk_test_ 开头的 Secret Key</li></ul>'],
|
||||||
|
['key' => 'stripe_secret_key', 'label' => '私钥Secret Key', 'type' => 'input', 'default' => '', 'help' => 'Stripe Dashboard → Developers → API keys → Secret key'],
|
||||||
|
['key' => 'stripe_publishable_key', 'label' => 'Publishable Key', 'type' => 'input', 'default' => ''],
|
||||||
|
['key' => 'stripe_webhook_secret', 'label' => '签名密钥Webhook Secret', 'type' => 'input', 'default' => '', 'help' => 'Developers → Webhooks → 端点 → Signing secret(whsec_ 开头)'],
|
||||||
|
['key' => 'stripe_currency', 'label' => '结算货币', 'type' => 'select', 'default' => 'USD', 'options' => self::currency_options()],
|
||||||
|
['key' => 'stripe_rates', 'label' => '货币汇率', 'type' => 'input', 'default' => '0.14', 'help' => '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137'],
|
||||||
|
['key' => 'stripe_test_mode', 'label' => '测试模式', 'type' => 'switch', 'default' => false, 'help' => '如果使用的测试开放模式,则请使用 sk_test_ 测试密钥与 Stripe 测试卡进行配置'],
|
||||||
|
]],
|
||||||
|
['key' => 'epay', 'title' => '易支付', 'collapsible' => true, 'expandWhen' => 'pay_wechat_sdk_options', 'dependsOn' => ['any' => [
|
||||||
|
['key' => 'pay_wechat_sdk_options', 'value' => 'epay'],
|
||||||
|
['key' => 'pay_alipay_sdk_options', 'value' => 'epay'],
|
||||||
|
]], 'fields' => [
|
||||||
|
['key' => 'epay_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>易支付是一个常见的支付系统源码,任何人都可以下载并搭建</li><li>同时市面上多数的小规模支付平台都是由易支付修改而来,例如部分码支付、源支付等等</li><li>由于此接口服务商众多,主题只负责技术接入,平台可靠性请自行斟酌</li></ul>'],
|
||||||
|
['key' => 'epay_apiurl', 'label' => 'API接口网址', 'type' => 'input', 'default' => '', 'help' => '请填写接口地址,例如:https://pay.xxxxxxx.cn/'],
|
||||||
|
['key' => 'epay_pid', 'label' => '商户号', 'type' => 'input', 'default' => ''],
|
||||||
|
['key' => 'epay_key', 'label' => '商户秘钥', 'type' => 'input', 'default' => '', 'help' => 'MD5 通信密钥。'],
|
||||||
|
['key' => 'epay_device', 'label' => '下单终端', 'type' => 'select', 'default' => 'auto', 'options' => [
|
||||||
|
['label' => '自动(按 UA)', 'value' => 'auto'],
|
||||||
|
['label' => '电脑端 submit', 'value' => 'pc'],
|
||||||
|
['label' => '移动端 mapi', 'value' => 'mobile'],
|
||||||
|
]],
|
||||||
|
]],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------
|
||||||
|
* 提现策略
|
||||||
|
* ------------------------------------------------------------------ */
|
||||||
|
'withdrawal' => [
|
||||||
|
'key' => 'withdrawal',
|
||||||
|
'title' => '提现策略',
|
||||||
|
'version' => '1.1.0',
|
||||||
|
'option_key' => 'aksrt_settings',
|
||||||
|
'groups' => [
|
||||||
|
['key' => 'basic', 'title' => '提现门槛', 'fields' => [
|
||||||
|
['key' => 'affiliate_min_withdrawal', 'label' => '提现最低金额限制', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '50.00', 'help' => '当用户可提现总金额(推广佣金、余额、创作分成)高于多少时候,才能发起提现'],
|
||||||
|
['key' => 'affiliate_withdrawal_fee', 'label' => '提现手续费(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
|
||||||
|
]],
|
||||||
|
['key' => 'limits', 'title' => '每日限制', 'fields' => [
|
||||||
|
['key' => 'affiliate_daily_withdrawal_count', 'label' => '每日可提现次数', 'type' => 'number', 'default' => 3, 'min' => 0, 'max' => 99999],
|
||||||
|
['key' => 'affiliate_daily_withdrawal_limit', 'label' => '每日提现上限', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '500.00'],
|
||||||
|
['key' => 'affiliate_withdrawal_reset_time', 'label' => '重置时间', 'type' => 'input', 'default' => '00:00', 'help' => '按站点 WordPress 时区重置,格式 HH:MM。'],
|
||||||
|
]],
|
||||||
|
['key' => 'channels', 'title' => '收款渠道', 'fields' => [
|
||||||
|
['key' => 'affiliate_payout_channels', 'label' => '可用收款渠道', 'type' => 'checkbox', 'options' => [['value' => 'alipay', 'label' => '支付宝收款码'], ['value' => 'wechat', 'label' => '微信收款码']], 'default' => ['alipay', 'wechat']],
|
||||||
|
]],
|
||||||
|
['key' => 'agreement', 'title' => '提现协议', 'fields' => [
|
||||||
|
['key' => 'pay_rebate_withdraw_text_details', 'label' => '提现协议', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<div>可提现金额达到50元后即可发起提现</div><div>申请提现需后台人工处理,一般2-3小时,请耐心等待</div><div>如有其它疑问,请与客服联系</div>', 'rows' => 4, 'help' => '用户申请提现时展示的内容,建议为提现须知等,支持HTML代码'],
|
||||||
|
]],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PayPal / Stripe 结算货币选项(参考主题同款 26 种)。
|
||||||
|
*
|
||||||
|
* @return array<int,array{label:string,value:string}>
|
||||||
|
*/
|
||||||
|
private static function currency_options(): array {
|
||||||
|
$currencies = [
|
||||||
|
'AUD' => '澳元 (AUD)',
|
||||||
|
'BRL' => '巴西雷亚尔 (BRL)',
|
||||||
|
'CAD' => '加拿大元 (CAD)',
|
||||||
|
'CNY' => '人民币 (CNY)',
|
||||||
|
'CZK' => '克朗 (CZK)',
|
||||||
|
'DKK' => '丹麦克朗 (DKK)',
|
||||||
|
'EUR' => '欧元 (EUR)',
|
||||||
|
'HKD' => '港币 (HKD)',
|
||||||
|
'HUF' => '匈牙利福林 (HUF)',
|
||||||
|
'INR' => '印度卢比 (INR)',
|
||||||
|
'ILS' => '以色列新谢克尔 (ILS)',
|
||||||
|
'JPY' => '日元 (JPY)',
|
||||||
|
'MYR' => '马来西亚林吉特 (MYR)',
|
||||||
|
'MXN' => '墨西哥比索 (MXN)',
|
||||||
|
'TWD' => '新台币 (TWD)',
|
||||||
|
'NZD' => '新西兰元 (NZD)',
|
||||||
|
'NOK' => '挪威克朗 (NOK)',
|
||||||
|
'PHP' => '菲律宾比索 (PHP)',
|
||||||
|
'PLN' => '波兰兹罗提 (PLN)',
|
||||||
|
'GBP' => '英镑 (GBP)',
|
||||||
|
'RUB' => '俄罗斯卢布 (RUB)',
|
||||||
|
'SGD' => '新加坡元 (SGD)',
|
||||||
|
'SEK' => '瑞典克朗 (SEK)',
|
||||||
|
'CHF' => '瑞士法郎 (CHF)',
|
||||||
|
'THB' => '泰铢 (THB)',
|
||||||
|
'USD' => '美元 (USD)',
|
||||||
|
];
|
||||||
|
$options = [];
|
||||||
|
foreach ($currencies as $code => $label) {
|
||||||
|
$options[] = ['label' => $label, 'value' => $code];
|
||||||
|
}
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class SchemaProvider {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($type, ['fieldset', 'accordion', 'sortable', 'link'], true) && !is_array($value)) {
|
if (in_array($type, ['fieldset', 'accordion', 'sortable', 'link', 'between_number'], true) && !is_array($value)) {
|
||||||
$errors[] = sprintf('%s must be an object', $field['label'] ?? $key);
|
$errors[] = sprintf('%s must be an object', $field['label'] ?? $key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -732,23 +732,46 @@ class SchemaProvider {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($group['fields'] ?? [] as $field) {
|
foreach ($group['fields'] ?? [] as $field) {
|
||||||
if (!is_array($field) || empty($field['key'])) {
|
$fields = array_merge($fields, $this->collect_persisted_fields(is_array($field) ? $field : []));
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// UI-only controls never become persisted settings keys.
|
|
||||||
if (!empty($field['ui_only'])) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Notice/help-only rows are UI chrome, not stored settings keys.
|
|
||||||
if (($field['type'] ?? '') === 'notice') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$fields[] = $field;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flatten one field definition into persisted keys. Tabbed is a UI-only
|
||||||
|
* container: its sub-fields are flat top-level option keys, so they are
|
||||||
|
* expanded into the persisted field list (notice / ui_only rows skipped).
|
||||||
|
*
|
||||||
|
* @return array<int,array<string,mixed>>
|
||||||
|
*/
|
||||||
|
private function collect_persisted_fields(array $field): array {
|
||||||
|
if (($field['type'] ?? '') === 'tabbed') {
|
||||||
|
$fields = [];
|
||||||
|
foreach ((array) ($field['tabs'] ?? []) as $tab) {
|
||||||
|
if (!is_array($tab)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foreach ((array) ($tab['fields'] ?? []) as $sub) {
|
||||||
|
$fields = array_merge($fields, $this->collect_persisted_fields(is_array($sub) ? $sub : []));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
if (empty($field['key'])) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
// UI-only controls never become persisted settings keys.
|
||||||
|
if (!empty($field['ui_only'])) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
// Notice/help-only rows are UI chrome, not stored settings keys.
|
||||||
|
if (($field['type'] ?? '') === 'notice') {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [$field];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalize legacy numeric money settings without accepting lossy precision.
|
* Normalize legacy numeric money settings without accepting lossy precision.
|
||||||
*
|
*
|
||||||
@@ -848,6 +871,17 @@ class SchemaProvider {
|
|||||||
return $this->sanitize_object_fields($value, (array) ($field['fields'] ?? []));
|
return $this->sanitize_object_fields($value, (array) ($field['fields'] ?? []));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($type === 'between_number') {
|
||||||
|
$defaults = is_array($field['default'] ?? null) ? $field['default'] : ['min' => 0, 'max' => 0];
|
||||||
|
if (!is_array($value)) {
|
||||||
|
return ['min' => (int) ($defaults['min'] ?? 0), 'max' => (int) ($defaults['max'] ?? 0)];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'min' => is_numeric($value['min'] ?? null) ? (int) $value['min'] : (int) ($defaults['min'] ?? 0),
|
||||||
|
'max' => is_numeric($value['max'] ?? null) ? (int) $value['max'] : (int) ($defaults['max'] ?? 0),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if (in_array($type, ['group', 'repeater'], true)) {
|
if (in_array($type, ['group', 'repeater'], true)) {
|
||||||
if (!is_array($value)) {
|
if (!is_array($value)) {
|
||||||
return [];
|
return [];
|
||||||
@@ -1006,6 +1040,8 @@ class SchemaProvider {
|
|||||||
'accordion'=> 'array',
|
'accordion'=> 'array',
|
||||||
'sortable' => 'array',
|
'sortable' => 'array',
|
||||||
'link' => 'array',
|
'link' => 'array',
|
||||||
|
'between_number' => 'array',
|
||||||
|
'page_select' => 'int',
|
||||||
'async_select' => 'array',
|
'async_select' => 'array',
|
||||||
'json' => 'array',
|
'json' => 'array',
|
||||||
// 自定义面板(验证码服务商等)按对象存储
|
// 自定义面板(验证码服务商等)按对象存储
|
||||||
|
|||||||
@@ -179,8 +179,13 @@ trait ScriptsPart1c {
|
|||||||
'www' => home_url('/'),
|
'www' => home_url('/'),
|
||||||
'uri' => $runtime_uri,
|
'uri' => $runtime_uri,
|
||||||
'ver' => $runtime_version,
|
'ver' => $runtime_version,
|
||||||
'pay_mark' => '¥',
|
// 货币符号 / 单位来自「收款接口」页配置(pay_currency_mark / pay_currency_unit)。
|
||||||
'pay_currency_unit' => __('元', 'aksrt'),
|
'pay_mark' => class_exists('\AKSRT\Settings\Settings') && class_exists('\AKSRT\Settings\PaymentRuntime')
|
||||||
|
? \AKSRT\Settings\PaymentRuntime::get_paid_content_settings()['display']['currency_symbol']
|
||||||
|
: '¥',
|
||||||
|
'pay_currency_unit' => class_exists('\AKSRT\Settings\Settings') && class_exists('\AKSRT\Settings\PaymentRuntime')
|
||||||
|
? \AKSRT\Settings\PaymentRuntime::get_paid_content_settings()['display']['currency_unit']
|
||||||
|
: __('元', 'aksrt'),
|
||||||
'imgbox' => $lightbox_on,
|
'imgbox' => $lightbox_on,
|
||||||
'imgbox_type' => 'group',
|
'imgbox_type' => 'group',
|
||||||
'imgbox_thumbs' => $lightbox_on && (!isset($post_page_settings['lightbox_thumbs']) || !empty($post_page_settings['lightbox_thumbs'])),
|
'imgbox_thumbs' => $lightbox_on && (!isset($post_page_settings['lightbox_thumbs']) || !empty($post_page_settings['lightbox_thumbs'])),
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ final class CommissionLedger {
|
|||||||
$map = ['vip' => 'membership', 'resource' => 'content'];
|
$map = ['vip' => 'membership', 'resource' => 'content'];
|
||||||
$order_type = $map[$type] ?? $type;
|
$order_type = $map[$type] ?? $type;
|
||||||
$settings = \AKSRT\Settings\Settings::get_affiliate_settings();
|
$settings = \AKSRT\Settings\Settings::get_affiliate_settings();
|
||||||
if (!in_array($order_type, (array) $settings['order_types'], true)) return 0;
|
|
||||||
$order_no = sanitize_text_field((string) ($order['order_number'] ?? ''));
|
$order_no = sanitize_text_field((string) ($order['order_number'] ?? ''));
|
||||||
$buyer = (int) ($order['user_id'] ?? 0);
|
$buyer = (int) ($order['user_id'] ?? 0);
|
||||||
try {
|
try {
|
||||||
@@ -58,6 +57,9 @@ final class CommissionLedger {
|
|||||||
if ($order_no === '' || $buyer <= 0 || $amount->minor() <= 0) return 0;
|
if ($order_no === '' || $buyer <= 0 || $amount->minor() <= 0) return 0;
|
||||||
$promoter = ReferralAttribution::get_instance()->resolve($buyer);
|
$promoter = ReferralAttribution::get_instance()->resolve($buyer);
|
||||||
if ($promoter <= 0) return 0;
|
if ($promoter <= 0) return 0;
|
||||||
|
// 返佣订单类型按推广者会员等级分档(参考主题:每档独立勾选)。
|
||||||
|
$promoter_level = function_exists('aksrt_get_user_vip_level') ? (int) aksrt_get_user_vip_level($promoter) : 0;
|
||||||
|
if (!in_array($order_type, \AKSRT\Settings\PaymentRuntime::affiliate_order_types_for_level($promoter_level), true)) return 0;
|
||||||
$ratio = \AKSRT\Settings\PaymentRuntime::affiliate_ratio_for_user($promoter);
|
$ratio = \AKSRT\Settings\PaymentRuntime::affiliate_ratio_for_user($promoter);
|
||||||
$commission_minor = (intdiv($amount->minor(), 100) * $ratio)
|
$commission_minor = (intdiv($amount->minor(), 100) * $ratio)
|
||||||
+ intdiv((($amount->minor() % 100) * $ratio) + 50, 100);
|
+ intdiv((($amount->minor() % 100) * $ratio) + 50, 100);
|
||||||
|
|||||||
+44
-3
@@ -45,7 +45,7 @@ class Gateway {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取可用网关列表(已配置的)
|
* 获取可用网关列表(已配置的),按「收款接口显示顺序」配置排序。
|
||||||
*/
|
*/
|
||||||
public function get_available(): array {
|
public function get_available(): array {
|
||||||
$available = [];
|
$available = [];
|
||||||
@@ -54,7 +54,48 @@ class Gateway {
|
|||||||
$available[$id] = $gateway;
|
$available[$id] = $gateway;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $available;
|
return $this->apply_sdk_order($available);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按 pay_sdk_order(收款接口显示顺序)重排可用网关。
|
||||||
|
* 易支付子通道跟随对应渠道槽位(epay_wxpay 跟随 wechat、epay_alipay 跟随 alipay);
|
||||||
|
* 未配置顺序时保持注册顺序,未纳入槽位的扩展网关保持在末尾。
|
||||||
|
*
|
||||||
|
* @param array<string,GatewayInterface> $available
|
||||||
|
* @return array<string,GatewayInterface>
|
||||||
|
*/
|
||||||
|
private function apply_sdk_order(array $available): array {
|
||||||
|
$settings = \AKSRT\Settings\Settings::get_all();
|
||||||
|
$configured = (array) ($settings['pay_sdk_order'] ?? []);
|
||||||
|
$order = array_values(array_filter(array_map('sanitize_key', array_keys($configured))));
|
||||||
|
if (!$order) {
|
||||||
|
return $available;
|
||||||
|
}
|
||||||
|
|
||||||
|
$slot_map = [
|
||||||
|
'wechat' => ['wechatpay', 'epay_wxpay'],
|
||||||
|
'alipay' => ['alipay', 'epay_alipay'],
|
||||||
|
'paypal' => ['paypal'],
|
||||||
|
'stripe' => ['stripe'],
|
||||||
|
'balance' => ['balance'],
|
||||||
|
'card_pass' => ['card_pass'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$sorted = [];
|
||||||
|
foreach ($order as $slot) {
|
||||||
|
foreach (($slot_map[$slot] ?? []) as $id) {
|
||||||
|
if (isset($available[$id]) && !isset($sorted[$id])) {
|
||||||
|
$sorted[$id] = $available[$id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($available as $id => $gateway) {
|
||||||
|
if (!isset($sorted[$id])) {
|
||||||
|
$sorted[$id] = $gateway;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $sorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -311,7 +352,7 @@ class Gateway {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$gateway_id = sanitize_key((string) ($order['payment_method'] ?? ''));
|
$gateway_id = sanitize_key((string) ($order['payment_method'] ?? ''));
|
||||||
if ($gateway_id === '' || in_array($gateway_id, ['balance', 'points', 'manual_review'], true)) {
|
if ($gateway_id === '' || in_array($gateway_id, ['balance', 'points'], true)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$gateway = $this->get_gateway($gateway_id);
|
$gateway = $this->get_gateway($gateway_id);
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class UserOrders {
|
|||||||
$image = $this->resolve_image($meta, $product_id);
|
$image = $this->resolve_image($meta, $product_id);
|
||||||
$group = $this->status_group($status);
|
$group = $this->status_group($status);
|
||||||
$payment_method = sanitize_key((string) ($order['payment_method'] ?? ''));
|
$payment_method = sanitize_key((string) ($order['payment_method'] ?? ''));
|
||||||
$can_pay = $group === OrderCenterQuery::STATUS_PENDING && $payment_method !== 'manual_review';
|
$can_pay = $group === OrderCenterQuery::STATUS_PENDING;
|
||||||
$can_cancel = $group === OrderCenterQuery::STATUS_PENDING;
|
$can_cancel = $group === OrderCenterQuery::STATUS_PENDING;
|
||||||
$order_number = (string) ($order['order_number'] ?? '');
|
$order_number = (string) ($order['order_number'] ?? '');
|
||||||
$updated_at = $this->resolve_updated_at($order);
|
$updated_at = $this->resolve_updated_at($order);
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ trait CreditsPaymentGroups {
|
|||||||
public static function get_settlement_settings(): array { return PaymentRuntime::get_settlement_settings(); }
|
public static function get_settlement_settings(): array { return PaymentRuntime::get_settlement_settings(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array{mode:string,test_enabled:bool,manual_review:bool,callback_secret:string,help_text:string}
|
* @return array<string,mixed>
|
||||||
*/
|
*/
|
||||||
public static function get_payment_gateway_settings(): array {
|
public static function get_payment_gateway_settings(): array {
|
||||||
return PaymentRuntime::get_payment_gateway_settings();
|
return PaymentRuntime::get_payment_gateway_settings();
|
||||||
@@ -169,7 +169,7 @@ trait CreditsPaymentGroups {
|
|||||||
/**
|
/**
|
||||||
* 获取订单设置
|
* 获取订单设置
|
||||||
*
|
*
|
||||||
* @return array{prefix:string,flow_prefix:string,withdrawal_prefix:string,expiry:int,show_user:bool,show_paycount:bool,no_logged_in:bool,cookie_day:int,no_logged_remind:bool,wait_float:bool,order_max_minutes:int,mark:string,box_position:string,show_ip:bool,show_device:bool,show_order_no:bool,show_create_time:bool,show_pay_time:bool,status_texts:array,service:array}
|
* @return array{prefix:string,flow_prefix:string,withdrawal_prefix:string,expiry:int,show_user:bool,show_paycount:bool,no_logged_in:bool,cookie_day:int,no_logged_remind:bool,wait_float:bool,mark:string,box_position:string,show_ip:bool,show_device:bool,show_order_no:bool,show_create_time:bool,show_pay_time:bool,status_texts:array,service:array}
|
||||||
*/
|
*/
|
||||||
public static function get_order_settings(): array {
|
public static function get_order_settings(): array {
|
||||||
return PaymentRuntime::get_order_settings();
|
return PaymentRuntime::get_order_settings();
|
||||||
|
|||||||
+173
-82
@@ -34,27 +34,29 @@ class PaymentRuntime {
|
|||||||
'catalog_note' => '',
|
'catalog_note' => '',
|
||||||
'manual_delivery_note' => __('付费或人工确认内容请在订单备注中记录交付方式。', 'aksrt'),
|
'manual_delivery_note' => __('付费或人工确认内容请在订单备注中记录交付方式。', 'aksrt'),
|
||||||
'no_logged_in' => !isset($settings['pay_no_logged_in']) || !empty($settings['pay_no_logged_in']),
|
'no_logged_in' => !isset($settings['pay_no_logged_in']) || !empty($settings['pay_no_logged_in']),
|
||||||
'down_alone_page' => false,
|
'free_logged_show' => !isset($settings['pay_free_logged_show']) || !empty($settings['pay_free_logged_show']),
|
||||||
|
'down_alone_page' => !empty($settings['down_alone_page']),
|
||||||
'display' => [
|
'display' => [
|
||||||
'mark' => sanitize_text_field((string) ($settings['pay_mark'] ?? '付费')),
|
'mark' => sanitize_text_field((string) ($settings['pay_mark'] ?? '付费')),
|
||||||
'currency_symbol' => '¥',
|
'currency_symbol' => sanitize_text_field((string) ($settings['pay_currency_mark'] ?? '¥')),
|
||||||
|
'currency_unit' => sanitize_text_field((string) ($settings['pay_currency_unit'] ?? '元')),
|
||||||
'show_user' => !isset($settings['pay_show_user']) || !empty($settings['pay_show_user']),
|
'show_user' => !isset($settings['pay_show_user']) || !empty($settings['pay_show_user']),
|
||||||
'show_paycount' => !isset($settings['pay_show_paycount']) || !empty($settings['pay_show_paycount']),
|
'show_paycount' => !isset($settings['pay_show_paycount']) || !empty($settings['pay_show_paycount']),
|
||||||
'box_position' => $box_position,
|
'box_position' => $box_position,
|
||||||
],
|
],
|
||||||
'download' => [
|
'download' => [
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'remote' => true,
|
'remote' => !isset($settings['down_remote_to_local_s']) || !empty($settings['down_remote_to_local_s']),
|
||||||
'verify_nonce' => true,
|
'verify_nonce' => !isset($settings['down_verify_nonce']) || !empty($settings['down_verify_nonce']),
|
||||||
'user_log' => 50,
|
'user_log' => max(0, (int) ($settings['down_user_log'] ?? 50)),
|
||||||
'post_log' => 50,
|
'post_log' => max(0, (int) ($settings['down_post_log'] ?? 50)),
|
||||||
'remote_size' => 2048,
|
'remote_size' => max(0, (int) ($settings['down_remote_to_local_size'] ?? 2048)),
|
||||||
'remote_ext' => 'zip,rar,7z',
|
'remote_ext' => sanitize_text_field((string) ($settings['down_remote_to_local_ext'] ?? 'zip,rar,7z')),
|
||||||
'alone_page' => false,
|
'alone_page' => !empty($settings['down_alone_page']),
|
||||||
],
|
],
|
||||||
// 内容收银台优惠码:不再提供全局开关,默认关闭。
|
// 内容收银台优惠码:全局开关 + 默认说明。
|
||||||
'coupon_post_s' => false,
|
'coupon_post_s' => !empty($settings['coupon_post_s']),
|
||||||
'coupon_desc' => '',
|
'coupon_desc' => sanitize_textarea_field((string) ($settings['coupon_desc'] ?? '')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +89,7 @@ class PaymentRuntime {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'enabled' => !empty($settings['pay_balance_s']),
|
'enabled' => !empty($settings['pay_balance_s']),
|
||||||
|
'withdraw_enabled' => !empty($settings['pay_balance_withdraw_s']),
|
||||||
'desc' => $desc,
|
'desc' => $desc,
|
||||||
'packages_raw' => $packages,
|
'packages_raw' => $packages,
|
||||||
'package_count' => self::count_structured_lines($packages),
|
'package_count' => self::count_structured_lines($packages),
|
||||||
@@ -279,28 +282,64 @@ class PaymentRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Affiliate policy. Layout follows the reference theme: one rebate rule
|
||||||
|
* set per user tier (pay_rebate_user_s / _1 / _2 + pay_rebate_ratio*).
|
||||||
|
*
|
||||||
* @return array<string,mixed>
|
* @return array<string,mixed>
|
||||||
*/
|
*/
|
||||||
public static function get_payment_affiliate_settings(): array {
|
public static function get_payment_affiliate_settings(): array {
|
||||||
$settings = Settings::get_all();
|
$settings = Settings::get_all();
|
||||||
$clamp_ratio = static fn($value): int => max(0, min(100, (int) $value));
|
$clamp_ratio = static fn($value): int => max(0, min(100, (int) $value));
|
||||||
$types = (array) ($settings['affiliate_order_types'] ?? ['membership', 'content']);
|
|
||||||
$types = array_values(array_intersect(['membership', 'content', 'credits'], array_map('sanitize_key', $types)));
|
$resolve_types = static function (array $types): array {
|
||||||
if (!$types) { $types = ['membership', 'content']; }
|
$types = array_values(array_intersect(['all', 'membership', 'content', 'credits'], array_map('sanitize_key', $types)));
|
||||||
|
// 「全部订单」展开为全部可返佣订单类型。
|
||||||
|
if (in_array('all', $types, true)) {
|
||||||
|
return ['membership', 'content', 'credits'];
|
||||||
|
}
|
||||||
|
return $types;
|
||||||
|
};
|
||||||
|
|
||||||
|
$types_by_level = [
|
||||||
|
0 => $resolve_types((array) ($settings['pay_rebate_user_s'] ?? [])),
|
||||||
|
1 => $resolve_types((array) ($settings['pay_rebate_user_s_1'] ?? ['all'])),
|
||||||
|
2 => $resolve_types((array) ($settings['pay_rebate_user_s_2'] ?? ['all'])),
|
||||||
|
];
|
||||||
|
|
||||||
|
$judgment = sanitize_key((string) ($settings['pay_rebate_judgment'] ?? 'all'));
|
||||||
|
if (!in_array($judgment, ['all', 'link'], true)) {
|
||||||
|
$judgment = 'all';
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'enabled' => !empty($settings['affiliate_enabled']),
|
'enabled' => !empty($settings['pay_rebate_s']),
|
||||||
|
'judgment' => $judgment,
|
||||||
|
'show_users' => !isset($settings['pay_rebate_show_users']) || !empty($settings['pay_rebate_show_users']),
|
||||||
|
'self_rebate' => !isset($settings['pay_rebate_self_s']) || !empty($settings['pay_rebate_self_s']),
|
||||||
'ratios' => [
|
'ratios' => [
|
||||||
'user' => $clamp_ratio($settings['affiliate_ratio_user'] ?? 5),
|
'user' => $clamp_ratio($settings['pay_rebate_ratio'] ?? 5),
|
||||||
'vip_1' => $clamp_ratio($settings['affiliate_ratio_vip_1'] ?? 5),
|
'vip_1' => $clamp_ratio($settings['pay_rebate_ratio_vip_1'] ?? 10),
|
||||||
'vip_2' => $clamp_ratio($settings['affiliate_ratio_vip_2'] ?? 5),
|
'vip_2' => $clamp_ratio($settings['pay_rebate_ratio_vip_2'] ?? 20),
|
||||||
],
|
],
|
||||||
'order_types' => $types,
|
'order_types' => $types_by_level[0],
|
||||||
|
'order_types_by_level' => $types_by_level,
|
||||||
'window_days' => (int) CreditsRuntime::get_referral_settings()['window_days'],
|
'window_days' => (int) CreditsRuntime::get_referral_settings()['window_days'],
|
||||||
'settlement_days' => max(0, min(90, (int) ($settings['affiliate_settlement_days'] ?? 7))),
|
'settlement_days' => max(0, min(90, (int) ($settings['affiliate_settlement_days'] ?? 7))),
|
||||||
'promotion_text' => sanitize_textarea_field((string) ($settings['affiliate_promotion_text'] ?? '')),
|
'promotion_text' => sanitize_textarea_field((string) ($settings['pay_rebate_text_details'] ?? '')),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 某等级推广者可获返佣的订单类型;空数组代表该等级用户不参与推广返佣。
|
||||||
|
*
|
||||||
|
* @return array<int,string>
|
||||||
|
*/
|
||||||
|
public static function affiliate_order_types_for_level(int $level): array {
|
||||||
|
$settings = self::get_payment_affiliate_settings();
|
||||||
|
$key = $level >= 2 ? 2 : ($level >= 1 ? 1 : 0);
|
||||||
|
return (array) ($settings['order_types_by_level'][$key] ?? []);
|
||||||
|
}
|
||||||
|
|
||||||
public static function affiliate_enabled(): bool { return !empty(self::get_payment_affiliate_settings()['enabled']); }
|
public static function affiliate_enabled(): bool { return !empty(self::get_payment_affiliate_settings()['enabled']); }
|
||||||
public static function affiliate_ratio_for_user(int $user_id): int {
|
public static function affiliate_ratio_for_user(int $user_id): int {
|
||||||
$level = function_exists('aksrt_get_user_vip_level') ? (int) aksrt_get_user_vip_level($user_id) : 0;
|
$level = function_exists('aksrt_get_user_vip_level') ? (int) aksrt_get_user_vip_level($user_id) : 0;
|
||||||
@@ -318,26 +357,55 @@ class PaymentRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Gateway channel selection. WeChat / Alipay each pick between the
|
||||||
|
* official SDK and 易支付; PayPal / Stripe are standalone toggles.
|
||||||
|
*
|
||||||
* @return array<string,mixed>
|
* @return array<string,mixed>
|
||||||
*/
|
*/
|
||||||
public static function get_payment_gateway_settings(): array {
|
public static function get_payment_gateway_settings(): array {
|
||||||
$settings = Settings::get_all();
|
$settings = Settings::get_all();
|
||||||
$gateway_keys = ['wechat', 'alipay', 'paypal', 'stripe', 'balance', 'card_pass', 'epay'];
|
|
||||||
$gateways = [];
|
$wechat = sanitize_key((string) ($settings['pay_wechat_sdk_options'] ?? 'null'));
|
||||||
foreach ($gateway_keys as $gw) {
|
if (!in_array($wechat, ['official_wechat', 'epay', 'null'], true)) {
|
||||||
$gateways[$gw] = !empty($settings["payment_{$gw}_enabled"]);
|
$wechat = 'null';
|
||||||
}
|
}
|
||||||
|
$alipay = sanitize_key((string) ($settings['pay_alipay_sdk_options'] ?? 'null'));
|
||||||
|
if (!in_array($alipay, ['official_alipay', 'epay', 'null'], true)) {
|
||||||
|
$alipay = 'null';
|
||||||
|
}
|
||||||
|
$paypal_enabled = !empty($settings['pay_paypal_sdk_s']);
|
||||||
|
$stripe_enabled = !empty($settings['pay_stripe_sdk_s']);
|
||||||
|
$balance_enabled = !empty($settings['pay_balance_s']);
|
||||||
|
$card_pass_enabled = !empty($settings['pay_balance_pass_charge_s']);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'help_text' => __('以渠道开关与凭据是否齐全为准;异步回调由各网关验签。卡密为兑换入口,不进入收银台。', 'aksrt'),
|
'help_text' => __('微信 / 支付宝可在官方与易支付之间选择;PayPal、Stripe 独立开关。异步回调由各网关验签。', 'aksrt'),
|
||||||
'gateways' => $gateways,
|
'wechat_sdk_options' => $wechat,
|
||||||
'epay' => [
|
'alipay_sdk_options' => $alipay,
|
||||||
'apiurl' => esc_url_raw((string) ($settings['epay_apiurl'] ?? '')),
|
'paypal_enabled' => $paypal_enabled,
|
||||||
'pid' => sanitize_text_field((string) ($settings['epay_pid'] ?? '')),
|
'stripe_enabled' => $stripe_enabled,
|
||||||
'key' => sanitize_text_field((string) ($settings['epay_key'] ?? '')),
|
'balance_enabled' => $balance_enabled,
|
||||||
'channel_alipay' => !array_key_exists('epay_channel_alipay', $settings) || !empty($settings['epay_channel_alipay']),
|
'card_pass_enabled' => $card_pass_enabled,
|
||||||
'channel_wxpay' => !array_key_exists('epay_channel_wxpay', $settings) || !empty($settings['epay_channel_wxpay']),
|
'gateways' => [
|
||||||
'device' => sanitize_key((string) ($settings['epay_device'] ?? 'auto')),
|
'wechat' => $wechat === 'official_wechat',
|
||||||
|
'alipay' => $alipay === 'official_alipay',
|
||||||
|
'paypal' => $paypal_enabled,
|
||||||
|
'stripe' => $stripe_enabled,
|
||||||
|
'balance' => $balance_enabled,
|
||||||
|
'card_pass' => $card_pass_enabled,
|
||||||
|
'epay' => $wechat === 'epay' || $alipay === 'epay',
|
||||||
|
],
|
||||||
|
'currency' => [
|
||||||
|
'mark' => sanitize_text_field((string) ($settings['pay_currency_mark'] ?? '¥')),
|
||||||
|
'unit' => sanitize_text_field((string) ($settings['pay_currency_unit'] ?? '元')),
|
||||||
|
],
|
||||||
|
'custom_title_s' => !empty($settings['pay_sdk_custom_title_s']),
|
||||||
|
'custom_title' => sanitize_text_field((string) ($settings['pay_sdk_custom_title'] ?? '')),
|
||||||
|
'epay' => [
|
||||||
|
'apiurl' => esc_url_raw((string) ($settings['epay_apiurl'] ?? '')),
|
||||||
|
'pid' => sanitize_text_field((string) ($settings['epay_pid'] ?? '')),
|
||||||
|
'key' => sanitize_text_field((string) ($settings['epay_key'] ?? '')),
|
||||||
|
'device' => sanitize_key((string) ($settings['epay_device'] ?? 'auto')),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -352,7 +420,6 @@ class PaymentRuntime {
|
|||||||
|
|
||||||
$expiry = max(5, min(1440, (int) ($s['payment_order_expiry'] ?? 30)));
|
$expiry = max(5, min(1440, (int) ($s['payment_order_expiry'] ?? 30)));
|
||||||
$cookie_day = max(1, min(31, (int) ($s['pay_cookie_day'] ?? 15)));
|
$cookie_day = max(1, min(31, (int) ($s['pay_cookie_day'] ?? 15)));
|
||||||
$max_minutes = max(5, min(1440, (int) ($s['payment_order_max_minutes'] ?? 30)));
|
|
||||||
|
|
||||||
$box_position = sanitize_key((string) ($s['pay_box_position'] ?? 'top'));
|
$box_position = sanitize_key((string) ($s['pay_box_position'] ?? 'top'));
|
||||||
if (!in_array($box_position, ['box_top', 'top', 'bottom', 'box_bottom'], true)) {
|
if (!in_array($box_position, ['box_top', 'top', 'bottom', 'box_bottom'], true)) {
|
||||||
@@ -378,7 +445,6 @@ class PaymentRuntime {
|
|||||||
'cookie_day' => $cookie_day,
|
'cookie_day' => $cookie_day,
|
||||||
'no_logged_remind' => sanitize_textarea_field((string) ($s['pay_no_logged_remind'] ?? '')),
|
'no_logged_remind' => sanitize_textarea_field((string) ($s['pay_no_logged_remind'] ?? '')),
|
||||||
'wait_float' => !isset($s['pay_wait_float_s']) || !empty($s['pay_wait_float_s']),
|
'wait_float' => !isset($s['pay_wait_float_s']) || !empty($s['pay_wait_float_s']),
|
||||||
'order_max_minutes' => $max_minutes,
|
|
||||||
'mark' => sanitize_text_field((string) ($s['pay_mark'] ?? '付费')),
|
'mark' => sanitize_text_field((string) ($s['pay_mark'] ?? '付费')),
|
||||||
'box_position' => $box_position,
|
'box_position' => $box_position,
|
||||||
'show_ip' => !empty($s['payment_show_ip']),
|
'show_ip' => !empty($s['payment_show_ip']),
|
||||||
@@ -387,13 +453,39 @@ class PaymentRuntime {
|
|||||||
'show_create_time' => !isset($s['payment_show_create_time']) || !empty($s['payment_show_create_time']),
|
'show_create_time' => !isset($s['payment_show_create_time']) || !empty($s['payment_show_create_time']),
|
||||||
'show_pay_time' => !isset($s['payment_show_pay_time']) || !empty($s['payment_show_pay_time']),
|
'show_pay_time' => !isset($s['payment_show_pay_time']) || !empty($s['payment_show_pay_time']),
|
||||||
'status_texts' => $status_texts,
|
'status_texts' => $status_texts,
|
||||||
'service' => [
|
'service' => self::format_service_items((array) ($s['pay_service'] ?? [])),
|
||||||
'text' => sanitize_textarea_field((string) ($s['pay_service'] ?? '')),
|
];
|
||||||
'icon' => sanitize_text_field((string) ($s['pay_service_icon'] ?? '')),
|
}
|
||||||
'value' => sanitize_text_field((string) ($s['pay_service_value'] ?? '')),
|
|
||||||
'qq' => sanitize_text_field((string) ($s['pay_service_qq'] ?? '')),
|
/**
|
||||||
'wechat' => esc_url_raw((string) ($s['pay_service_wechat'] ?? '')),
|
* 客户服务:参考主题为 {value, icon} 数组;首项同时回填旧单值键,兼容既有消费方。
|
||||||
],
|
*
|
||||||
|
* @param array<int,mixed> $items
|
||||||
|
* @return array<string,mixed>
|
||||||
|
*/
|
||||||
|
private static function format_service_items(array $items): array {
|
||||||
|
$clean = [];
|
||||||
|
foreach ($items as $row) {
|
||||||
|
if (!is_array($row)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = sanitize_textarea_field((string) ($row['value'] ?? ''));
|
||||||
|
if ($value === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$clean[] = [
|
||||||
|
'value' => $value,
|
||||||
|
'icon' => sanitize_text_field((string) ($row['icon'] ?? '')),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$first = $clean[0] ?? [];
|
||||||
|
return [
|
||||||
|
'items' => $clean,
|
||||||
|
'text' => (string) ($first['value'] ?? ''),
|
||||||
|
'icon' => (string) ($first['icon'] ?? ''),
|
||||||
|
'value' => (string) ($first['value'] ?? ''),
|
||||||
|
'qq' => '',
|
||||||
|
'wechat' => '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,48 +554,43 @@ class PaymentRuntime {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether a registered adapter is admin-enabled.
|
* Whether a registered adapter is admin-enabled.
|
||||||
* Maps gateway ids (wechatpay) to schema toggles (payment_wechat_enabled).
|
* Gateway ids (wechatpay) map to the reference-theme channel selectors:
|
||||||
|
* pay_wechat_sdk_options / pay_alipay_sdk_options / pay_paypal_sdk_s / pay_stripe_sdk_s.
|
||||||
*/
|
*/
|
||||||
public static function is_gateway_enabled(string $gateway_id): bool {
|
public static function is_gateway_enabled(string $gateway_id): bool {
|
||||||
$settings = Settings::get_all();
|
$settings = Settings::get_all();
|
||||||
$gateway_id = sanitize_key($gateway_id);
|
$gateway_id = sanitize_key($gateway_id);
|
||||||
$map = [
|
|
||||||
'alipay' => 'payment_alipay_enabled',
|
$wechat = sanitize_key((string) ($settings['pay_wechat_sdk_options'] ?? 'null'));
|
||||||
'wechatpay' => 'payment_wechat_enabled',
|
if (!in_array($wechat, ['official_wechat', 'epay', 'null'], true)) {
|
||||||
'paypal' => 'payment_paypal_enabled',
|
$wechat = 'null';
|
||||||
'stripe' => 'payment_stripe_enabled',
|
|
||||||
'balance' => 'payment_balance_enabled',
|
|
||||||
'card_pass' => 'payment_card_pass_enabled',
|
|
||||||
'epay' => 'payment_epay_enabled',
|
|
||||||
'epay_alipay' => 'payment_epay_enabled',
|
|
||||||
'epay_wxpay' => 'payment_epay_enabled',
|
|
||||||
];
|
|
||||||
$key = $map[$gateway_id] ?? '';
|
|
||||||
if ($key === '') {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if ($gateway_id === 'balance') {
|
$alipay = sanitize_key((string) ($settings['pay_alipay_sdk_options'] ?? 'null'));
|
||||||
// Master: 余额充值 → 启用余额功能. Optional kill-switch: payment_balance_enabled=false.
|
if (!in_array($alipay, ['official_alipay', 'epay', 'null'], true)) {
|
||||||
// Missing key (legacy sites) follows pay_balance_s so "open wallet" alone enables pay.
|
$alipay = 'null';
|
||||||
if (empty($settings['pay_balance_s'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (array_key_exists('payment_balance_enabled', $settings) && empty($settings['payment_balance_enabled'])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if (empty($settings[$key])) {
|
|
||||||
return false;
|
switch ($gateway_id) {
|
||||||
|
case 'alipay':
|
||||||
|
return $alipay === 'official_alipay';
|
||||||
|
case 'wechatpay':
|
||||||
|
return $wechat === 'official_wechat';
|
||||||
|
case 'paypal':
|
||||||
|
return !empty($settings['pay_paypal_sdk_s']);
|
||||||
|
case 'stripe':
|
||||||
|
return !empty($settings['pay_stripe_sdk_s']);
|
||||||
|
case 'balance':
|
||||||
|
return !empty($settings['pay_balance_s']);
|
||||||
|
case 'card_pass':
|
||||||
|
return !empty($settings['pay_balance_pass_charge_s']);
|
||||||
|
case 'epay':
|
||||||
|
return $wechat === 'epay' || $alipay === 'epay';
|
||||||
|
case 'epay_alipay':
|
||||||
|
return $alipay === 'epay';
|
||||||
|
case 'epay_wxpay':
|
||||||
|
return $wechat === 'epay';
|
||||||
}
|
}
|
||||||
// Epay sub-channels require the matching channel switch (default on when key missing).
|
return false;
|
||||||
if ($gateway_id === 'epay_alipay') {
|
|
||||||
return !array_key_exists('epay_channel_alipay', $settings) || !empty($settings['epay_channel_alipay']);
|
|
||||||
}
|
|
||||||
if ($gateway_id === 'epay_wxpay') {
|
|
||||||
return !array_key_exists('epay_channel_wxpay', $settings) || !empty($settings['epay_channel_wxpay']);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function count_structured_lines(string $raw): int {
|
private static function count_structured_lines(string $raw): int {
|
||||||
@@ -530,6 +617,9 @@ class PaymentRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Format recharge product rows (reference-theme group shape:
|
||||||
|
* price 充值金额 / pay_price 销售金额 / tag 小标签) into "支付|到账|标题" lines.
|
||||||
|
*
|
||||||
* @param array<int,mixed> $products
|
* @param array<int,mixed> $products
|
||||||
*/
|
*/
|
||||||
private static function format_product_lines(array $products): string {
|
private static function format_product_lines(array $products): string {
|
||||||
@@ -538,10 +628,11 @@ class PaymentRuntime {
|
|||||||
if (!is_array($row)) {
|
if (!is_array($row)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$price = $row['pay_price'] ?? $row['price'] ?? '';
|
$price = max(0, (float) ($row['price'] ?? 0));
|
||||||
$value = $row['value'] ?? $row['balance'] ?? $price;
|
$pay_price = max(0, (float) ($row['pay_price'] ?? 0));
|
||||||
$title = $row['title'] ?? $row['name'] ?? '';
|
$pay = $pay_price > 0 ? $pay_price : $price;
|
||||||
$lines[] = $price . '|' . $value . '|' . $title;
|
$title = trim((string) ($row['tag'] ?? ''));
|
||||||
|
$lines[] = $pay . '|' . $price . '|' . $title;
|
||||||
}
|
}
|
||||||
return implode("\n", $lines);
|
return implode("\n", $lines);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ test('asset purchases share the order center and refresh every wallet surface',
|
|||||||
const adminRepository = fs.readFileSync(path.join(root, 'src', 'Payment', 'OrderRepositoryAdmin.php'), 'utf8')
|
const adminRepository = fs.readFileSync(path.join(root, 'src', 'Payment', 'OrderRepositoryAdmin.php'), 'utf8')
|
||||||
const payOrders = fs.readFileSync(path.join(root, 'src', 'Admin', 'Native', 'PayOrders.php'), 'utf8')
|
const payOrders = fs.readFileSync(path.join(root, 'src', 'Admin', 'Native', 'PayOrders.php'), 'utf8')
|
||||||
const paymentRuntime = fs.readFileSync(path.join(root, 'src', 'Settings', 'PaymentRuntime.php'), 'utf8')
|
const paymentRuntime = fs.readFileSync(path.join(root, 'src', 'Settings', 'PaymentRuntime.php'), 'utf8')
|
||||||
const paymentSchema = fs.readFileSync(path.join(root, 'assets', 'admin', 'src', 'schema', 'sections', 'payment', 'order.js'), 'utf8')
|
const paymentSchema = fs.readFileSync(path.join(root, 'assets', 'admin', 'src', 'schema', 'sections', 'payment', 'knowledge.js'), 'utf8')
|
||||||
const balanceRest = fs.readFileSync(path.join(root, 'src', 'Credits', 'BalanceServiceRest.php'), 'utf8')
|
const balanceRest = fs.readFileSync(path.join(root, 'src', 'Credits', 'BalanceServiceRest.php'), 'utf8')
|
||||||
const chargeCard = fs.readFileSync(path.join(root, 'src', 'Payment', 'ChargeCard.php'), 'utf8')
|
const chargeCard = fs.readFileSync(path.join(root, 'src', 'Payment', 'ChargeCard.php'), 'utf8')
|
||||||
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
|
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ test('financial flow and withdrawal numbers use the new-only schema', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('order settings expose strict flow and withdrawal prefixes', () => {
|
test('order settings expose strict flow and withdrawal prefixes', () => {
|
||||||
const schema = read('assets/admin/src/schema/sections/payment/order.js')
|
const schema = read('assets/admin/src/schema/sections/payment/gateway.js')
|
||||||
const provider = read('src/Admin/SchemaProvider.php')
|
const provider = read('src/Admin/SchemaProvider.php')
|
||||||
assert.match(schema, /key:\s*'payment_flow_prefix'[^{\n]*sanitize_type:\s*'business_prefix'[^{\n]*default:\s*'AK'/)
|
assert.match(schema, /key:\s*'payment_flow_prefix'[^{\n]*sanitize_type:\s*'business_prefix'[^{\n]*default:\s*'AK'/)
|
||||||
assert.match(schema, /key:\s*'payment_withdrawal_prefix'[^{\n]*sanitize_type:\s*'business_prefix'[^{\n]*default:\s*'TX'/)
|
assert.match(schema, /key:\s*'payment_withdrawal_prefix'[^{\n]*sanitize_type:\s*'business_prefix'[^{\n]*default:\s*'TX'/)
|
||||||
|
|||||||
Reference in New Issue
Block a user