diff --git a/assets/admin/src/api/modules/index.js b/assets/admin/src/api/modules/index.js
index 9aeb8de0..9e9d622f 100644
--- a/assets/admin/src/api/modules/index.js
+++ b/assets/admin/src/api/modules/index.js
@@ -2,7 +2,6 @@ import { globalApiMethods } from './global.js'
import { pageDisplayApiMethods } from './page-display.js'
import { permissionsApiMethods } from './permissions.js'
import { usersApiMethods } from './users.js'
-import { paymentApiMethods } from './payment.js'
import { extensionsApiMethods } from './extensions.js'
import { toolsApiMethods } from './tools.js'
import { schemaApiMethods } from './schema.js'
@@ -13,7 +12,6 @@ export const apiMethods = {
...pageDisplayApiMethods,
...permissionsApiMethods,
...usersApiMethods,
- ...paymentApiMethods,
...extensionsApiMethods,
...toolsApiMethods,
...schemaApiMethods,
diff --git a/assets/admin/src/api/modules/payment.js b/assets/admin/src/api/modules/payment.js
deleted file mode 100644
index 0707c187..00000000
--- a/assets/admin/src/api/modules/payment.js
+++ /dev/null
@@ -1,7 +0,0 @@
-export const paymentApiMethods = {
- /* ================================================================
- * 支付&付费 (Payment)
- * ================================================================ */
-
- getPaymentOverview() { return this.request('/payment/overview') },
-}
diff --git a/assets/admin/src/components/form/AksField.vue b/assets/admin/src/components/form/AksField.vue
index 0169deb4..148c0858 100644
--- a/assets/admin/src/components/form/AksField.vue
+++ b/assets/admin/src/components/form/AksField.vue
@@ -142,6 +142,22 @@
@update:value="emit('update:modelValue', $event)"
/>
+
+
+
+
+
+
+ —
+
+ {{ schema.unit }}
+
+
{{ schema.spacingLabels?.[0] || '上' }}
@@ -807,6 +849,9 @@ onMounted(() => {
if (props.schema.type === 'async_select') {
loadAsyncOptions()
}
+ if (props.schema.type === 'page_select') {
+ loadPages()
+ }
})
// ============ User Select (async search) ============
@@ -850,6 +895,31 @@ function handleUserSearch(query) {
}, 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(() => ({
'aksrt-field--disabled': props.schema.disabled,
'aksrt-field--inline': props.schema.inline,
@@ -870,6 +940,21 @@ function updateDimension(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 ============
function updateSpacing(part, value) {
const current = props.modelValue || {}
@@ -1115,6 +1200,25 @@ function confirmRepeaterModal() {
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 */
.aksrt-field__spacing {
display: grid;
diff --git a/assets/admin/src/components/form/AksFormRenderer.vue b/assets/admin/src/components/form/AksFormRenderer.vue
index 94eda249..9d7ea2b9 100644
--- a/assets/admin/src/components/form/AksFormRenderer.vue
+++ b/assets/admin/src/components/form/AksFormRenderer.vue
@@ -56,8 +56,33 @@
+
+
@@ -268,6 +293,15 @@ const filteredSchema = computed(() => {
// Filter fields by label, key, or help text matching query
const matchingFields = group.fields.filter(field => {
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)
|| (field.key || '').toLowerCase().includes(q)
|| (field.help || '').toLowerCase().includes(q)
@@ -318,6 +352,10 @@ const filteredSchema = computed(() => {
line-height: 1.6;
}
+.aksrt-form-renderer__tabbed {
+ margin-bottom: 8px;
+}
+
.aksrt-form-renderer__search {
min-width: 200px;
max-width: 280px;
diff --git a/assets/admin/src/constants/sections/index.js b/assets/admin/src/constants/sections/index.js
index ce969f51..147b197e 100644
--- a/assets/admin/src/constants/sections/index.js
+++ b/assets/admin/src/constants/sections/index.js
@@ -15,7 +15,7 @@ const SECTION_DEFAULT_CHILDREN = {
'post-list': 'post-list-page',
permissions: 'permissions-comment',
users: 'users-auth',
- payment: 'payment-recharge',
+ payment: 'payment-knowledge',
extensions: 'extensions-ip',
tools: 'tools-import-export',
'theme-info': 'theme-info-dashboard',
diff --git a/assets/admin/src/constants/sections/payment.js b/assets/admin/src/constants/sections/payment.js
index eb8f3d73..13a804bb 100644
--- a/assets/admin/src/constants/sections/payment.js
+++ b/assets/admin/src/constants/sections/payment.js
@@ -1,11 +1,27 @@
-import { renderFaIcon, schemaPage, customPage } from './helpers'
+import { renderFaIcon, schemaPage } from './helpers'
+/**
+ * 支付&付费 — 子菜单按参考主题划分:
+ * 知识付费 / 余额充值 / VIP会员 / 创作分成 / 推广返佣 / 收款接口 / 提现策略。
+ * 收款接口为 schema 表单页(双下拉式接口选择 + 凭据配置 + 前缀配置)。
+ */
export const paymentSection = {
key: 'payment',
label: '支付&付费',
icon: renderFaIcon('fa fas fa-credit-card'),
route: '/payment',
children: [
+ schemaPage({
+ key: 'payment-knowledge',
+ name: 'PaymentKnowledge',
+ label: '知识付费',
+ route: '/payment/knowledge',
+ status: 'available',
+ title: '知识付费',
+ desc: '免登陆购买、模块显示位置、商品优惠码、客户服务、付费下载与商品预置参数。',
+ canonicalDomain: 'payment',
+ section: 'knowledge',
+ }),
schemaPage({
key: 'payment-recharge',
name: 'PaymentRecharge',
@@ -13,7 +29,7 @@ export const paymentSection = {
route: '/payment/recharge',
status: 'available',
title: '余额充值',
- desc: '余额充值策略、记录和手动确认配置。',
+ desc: '余额功能、充值商品选项、卡密充值、充值卡与余额兑换积分。',
canonicalDomain: 'payment',
section: 'recharge',
}),
@@ -24,41 +40,18 @@ export const paymentSection = {
route: '/payment/vip',
status: 'available',
title: 'VIP会员',
- desc: '会员套餐、会员特权和免扣策略。',
+ desc: '会员等级、会员权益、购买选项、卡密兑换与积分兑换。',
canonicalDomain: 'payment',
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({
key: 'payment-revenue',
name: 'PaymentRevenue',
- label: '创作中心',
+ label: '创作分成',
route: '/payment/revenue',
status: 'available',
- title: '创作中心',
- desc: '独立配置现金与积分分成比例、结算周期和结算备注文案。',
+ title: '创作分成',
+ desc: '现金与积分分成比例、结算周期、分成说明与详情页(分成工单在支付中心)。',
canonicalDomain: 'payment',
section: 'revenue',
}),
@@ -69,20 +62,20 @@ export const paymentSection = {
route: '/payment/affiliate',
status: 'available',
title: '推广返佣',
- desc: '返佣规则、邀请链路和结算策略(返佣工单在支付中心)。',
+ desc: '推广识别模式、分档返佣规则、文案与海报(返佣工单在支付中心)。',
canonicalDomain: 'payment',
section: 'affiliate',
}),
schemaPage({
- key: 'payment-card-pass',
- name: 'PaymentCardPass',
- label: '卡密设置',
- route: '/payment/card-pass',
+ key: 'payment-gateway',
+ name: 'PaymentGateway',
+ label: '收款接口',
+ route: '/payment/gateway',
status: 'available',
- title: '卡密设置',
- desc: '充值卡类型、卡号规则与兑换文案(卡密工单在支付中心)。',
+ title: '收款接口',
+ desc: '微信/支付宝接口选择、PayPal/Stripe 开关、货币结算、显示顺序与订单编号前缀。',
canonicalDomain: 'payment',
- section: 'card-pass',
+ section: 'gateway',
}),
schemaPage({
key: 'payment-withdrawal',
@@ -91,7 +84,7 @@ export const paymentSection = {
route: '/payment/withdrawal',
status: 'available',
title: '提现策略',
- desc: '最低提现、手续费与说明文案(提现工单在支付中心)。',
+ desc: '提现门槛、手续费、每日限制、收款渠道与提现协议(提现工单在支付中心)。',
canonicalDomain: 'payment',
section: 'withdrawal',
}),
diff --git a/assets/admin/src/pages/payment/PaymentChargeCard.vue b/assets/admin/src/pages/payment/PaymentChargeCard.vue
deleted file mode 100644
index cbd4032c..00000000
--- a/assets/admin/src/pages/payment/PaymentChargeCard.vue
+++ /dev/null
@@ -1,529 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 创建充值卡
- 批量生成
-
- 导出当前筛选
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 筛选
- 重置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 取消
- 创建
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 取消
- 批量生成
-
-
-
-
-
-
-
-
-
-
-
diff --git a/assets/admin/src/pages/payment/PaymentGateway.vue b/assets/admin/src/pages/payment/PaymentGateway.vue
deleted file mode 100644
index 579e936f..00000000
--- a/assets/admin/src/pages/payment/PaymentGateway.vue
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ gw.name }}
-
{{ gw.configured ? '已配置' : '未配置' }}
-
-
- {{ gw.configured ? '可用' : '不可用' }}
-
-
-
-
-
-
-
-
- {{ overview.help_text }}
-
-
-
-
-
-
-
-
-
diff --git a/assets/admin/src/pages/payment/PaymentRevenue.vue b/assets/admin/src/pages/payment/PaymentRevenue.vue
deleted file mode 100644
index 22aedd20..00000000
--- a/assets/admin/src/pages/payment/PaymentRevenue.vue
+++ /dev/null
@@ -1,319 +0,0 @@
-
-
-
-
-
-
-
-
{{ item.value }}
-
{{ item.label }}
-
-
-
-
-
-
-
-
- 日
- 周
- 月
-
-
-
-
-
-
{{ group.label }}
-
-
-
-
{{ formatLabel(item.date) }}
-
-
-
-
- 期间总计: {{ formatAmount(group.total, group.key) }}
- 共 {{ group.count }} 笔
-
-
-
-
-
-
-
-
-
-
-
{{ withdrawalStats.total }}
-
提现笔数
-
-
-
-
-
{{ withdrawalStats.pending }}
-
待处理
-
-
-
-
-
{{ withdrawalStats.processing }}
-
处理中
-
-
-
-
-
{{ withdrawalStats.completed }}
-
已完成
-
-
-
-
-
{{ withdrawalStats.rejected }}
-
已拒绝
-
-
-
-
-
{{ formatAmount(withdrawalStats.total_paid, 'cash') }}
-
已提现 (元)
-
-
-
-
-
-
-
-
-
-
-
diff --git a/assets/admin/src/pages/payment/PaymentSectionPage.vue b/assets/admin/src/pages/payment/PaymentSectionPage.vue
deleted file mode 100644
index 83cbbd75..00000000
--- a/assets/admin/src/pages/payment/PaymentSectionPage.vue
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
- {{ link.label }}
-
-
-
-
-
-
-
- {{ note }}
-
-
-
-
-
-
-
-
-
-
diff --git a/assets/admin/src/pages/payment/components/ChargeCardDetailDrawer.vue b/assets/admin/src/pages/payment/components/ChargeCardDetailDrawer.vue
deleted file mode 100644
index d0094a87..00000000
--- a/assets/admin/src/pages/payment/components/ChargeCardDetailDrawer.vue
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
- {{ detail.card.password || '-' }}
- {{ detail.card.amount || 0 }}
- {{ detail.card.balance || 0 }}
- {{ detail.card.status_label || detail.card.status }}
- {{ detail.card.created_at || '-' }}
- {{ detail.card.expires_at || '-' }}
- {{ detail.card.used_at || '-' }}
-
- {{ detail.card.used_by_user?.display_name || '-' }}
-
-
-
-
-
备注
-
- {{ detail.card.note || '暂无备注' }}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/assets/admin/src/router/component-loaders/index.js b/assets/admin/src/router/component-loaders/index.js
index c38c9c28..11230ac7 100644
--- a/assets/admin/src/router/component-loaders/index.js
+++ b/assets/admin/src/router/component-loaders/index.js
@@ -1,13 +1,11 @@
import { corePageLoaders } from './core'
import { usersPageLoaders } from './users'
-import { paymentPageLoaders } from './payment'
import { toolsPageLoaders } from './tools'
import { extensionsPageLoaders } from './extensions'
export const componentLoaders = {
...corePageLoaders,
...usersPageLoaders,
- ...paymentPageLoaders,
...toolsPageLoaders,
...extensionsPageLoaders,
}
diff --git a/assets/admin/src/router/component-loaders/payment.js b/assets/admin/src/router/component-loaders/payment.js
deleted file mode 100644
index bef47b42..00000000
--- a/assets/admin/src/router/component-loaders/payment.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export const paymentPageLoaders = {
- PaymentGateway: () => import('@/pages/payment/PaymentGateway.vue'),
-}
diff --git a/assets/admin/src/router/index.js b/assets/admin/src/router/index.js
index 168ac263..9d86559e 100644
--- a/assets/admin/src/router/index.js
+++ b/assets/admin/src/router/index.js
@@ -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.
*/
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/referral-codes', title: '推广码运营', nativeAdminPath: 'users.php?page=aksrt_referral_codes' },
{ path: '/users/ban', title: '禁封管理', nativeAdminPath: 'users.php?page=aksrt_user_ban&tab=restrictions' },
diff --git a/assets/admin/src/schema/sections/payment/affiliate.js b/assets/admin/src/schema/sections/payment/affiliate.js
index 959135b8..0e650627 100644
--- a/assets/admin/src/schema/sections/payment/affiliate.js
+++ b/assets/admin/src/schema/sections/payment/affiliate.js
@@ -1,38 +1,183 @@
+/**
+ * 推广返佣 — 参考主题结构:开关、识别模式、自己推广自己、按用户类型分档的
+ * 返佣规则(tab)、文案、推广海报与推广让利标签。
+ */
export const affiliateSchema = {
key: 'payment.affiliate',
title: '推广返佣',
- icon: 'fa fas fa-share-alt',
- description: '配置推广归因、分级佣金比例和结算规则。',
+ icon: 'fa fas fa-btc',
+ description: '推广识别模式、分档返佣规则、返佣文案、推广海报与让利标签。',
defaults: {
- affiliate_enabled: false,
- affiliate_ratio_user: 5,
- affiliate_ratio_vip_1: 5,
- affiliate_ratio_vip_2: 5,
- affiliate_order_types: ['membership', 'content'],
+ pay_rebate_s: false,
+ pay_rebate_judgment: 'all',
+ pay_rebate_show_users: true,
+ pay_rebate_self_s: true,
+ 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_promotion_text: '',
+ pay_rebate_text_desc: '加入分享计划,获得高额奖励',
+ pay_rebate_text_details_title: '返佣详解',
+ pay_rebate_text_details: '通过您的推广链接打开本站后,在本站购买商品即可获得佣金
通过您的推广链接注册后的用户今后购买的商品均可获得佣金
申请提现后,需后台人工处理,一般2-3小时,请耐心等待
',
+ pay_rebate_poster_s: true,
+ pay_rebate_poster_img: '',
+ pay_rebate_poster_title: '发现一个精品网站,快来看一看',
+ pay_rebate_poster_desc: '网站有超多精品资源和优惠福利,扫码进入网站还可享受诸多优惠哦',
+ pay_rebate_text_discount: '推荐购买 下单再减%discount%',
},
groups: [
{
- key: 'policy',
- title: '返佣策略',
- icon: 'fa fas fa-sitemap',
+ key: 'notice',
+ title: '说明',
+ icon: 'fa fas fa-info-circle',
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_ratio_vip_1', label: '一级会员佣金比例(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'affiliate_enabled', value: true } },
- { key: 'affiliate_ratio_vip_2', label: '二级会员佣金比例(%)', type: 'number', default: 5, min: 0, max: 100, dependsOn: { key: 'affiliate_enabled', value: true } },
- { 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 } },
- { key: 'affiliate_settlement_days', label: '结算观察期(天)', type: 'number', default: 7, min: 0, max: 90, dependsOn: { key: 'affiliate_enabled', value: true } },
+ {
+ key: 'affiliate_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '- 识别模式「绑定注册」:用户只要是通过任意推广链接注册的,今后此用户消费均会给推荐人返佣
- 识别模式「仅推广链接」:只有通过推广链接购买的才会给推荐人返佣,不会考虑是否是推荐注册的
- 开启的订单类型如果一个都不勾选,则代表该用户类型不参与此功能
- 您可以根据网站的VIP设置相互配合设置相应的规则
- 下面的设置为全局设置,还可以单独为每一个用户设置规则和比例
',
+ },
+ ],
+ },
+ {
+ 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',
- title: '文案设置',
- icon: 'fa fas fa-pen',
+ title: '返佣文案',
+ icon: 'fa fas fa-file-alt',
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: '通过您的推广链接打开本站后,在本站购买商品即可获得佣金
通过您的推广链接注册后的用户今后购买的商品均可获得佣金
申请提现后,需后台人工处理,一般2-3小时,请耐心等待
', 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: '推广让利标签配置详解:
- 可使用的变量:折扣
%discount%、推荐人姓名 %referrer_name% - 使用变量示例:
%referrer_name%推荐购买 下单再减%discount%元
',
+ },
+ { 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' },
+]
diff --git a/assets/admin/src/schema/sections/payment/cardPass.js b/assets/admin/src/schema/sections/payment/cardPass.js
deleted file mode 100644
index d3b16fae..00000000
--- a/assets/admin/src/schema/sections/payment/cardPass.js
+++ /dev/null
@@ -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 } },
- ],
- },
- ],
-}
diff --git a/assets/admin/src/schema/sections/payment/gateway.js b/assets/admin/src/schema/sections/payment/gateway.js
index 6147a516..0e75b484 100644
--- a/assets/admin/src/schema/sections/payment/gateway.js
+++ b/assets/admin/src/schema/sections/payment/gateway.js
@@ -1,42 +1,56 @@
+/**
+ * 收款接口 — 参考主题双下拉式重构:微信/支付宝接口选择(官方/易支付/关闭)、
+ * PayPal/Stripe 独立开关、货币与结算、订单与编号(含三个前缀)、
+ * 收款接口显示顺序,以及 5 个凭据配置块(支付宝/微信/PayPal/Stripe/易支付)。
+ */
export const gatewaySchema = {
key: 'payment.gateway',
title: '收款接口',
icon: 'fa fas fa-credit-card',
- description: '管理已支持的收款通道:余额、支付宝、微信、PayPal、Stripe、易支付与卡密兑换。开启渠道后展开填写凭据。',
+ description: '配置收款通道:微信与支付宝可在官方/易支付之间选择,PayPal 与 Stripe 独立开关。订单前缀、流水号前缀、提现单号前缀在本页配置。',
defaults: {
- payment_wechat_enabled: false,
- payment_alipay_enabled: false,
- payment_paypal_enabled: false,
- payment_stripe_enabled: false,
- payment_epay_enabled: false,
- payment_balance_enabled: true,
- payment_card_pass_enabled: false,
- wechat_merchantid: '',
- wechat_appid: '',
- wechat_payment_type: 'native',
- wechat_api_v3_key: '',
- wechat_private_key_path: '',
- wechat_cert_path: '',
+ pay_wechat_sdk_options: 'null',
+ pay_alipay_sdk_options: 'null',
+ pay_paypal_sdk_s: false,
+ pay_stripe_sdk_s: false,
+ pay_currency_mark: '¥',
+ pay_currency_unit: '元',
+ pay_wechat_settle: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' },
+ pay_alipay_settle: { settle_rate: '1', settle_mark: '¥', settle_unit: '元' },
+ pay_sdk_custom_title_s: false,
+ pay_sdk_custom_title: '',
+ payment_order_prefix: 'AKSRT',
+ payment_flow_prefix: 'AK',
+ payment_withdrawal_prefix: 'TX',
+ payment_order_expiry: 30,
+ pay_wait_float_s: true,
+ pay_sdk_order: {},
alipay_appid: '',
alipay_privatekey: '',
alipay_payment_type: 'page',
alipay_app_public_cert_path: '',
alipay_public_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_secret: '',
paypal_currency: 'USD',
- paypal_sandbox: true,
+ paypal_rates: '0.14',
+ paypal_sandbox: false,
stripe_secret_key: '',
stripe_publishable_key: '',
stripe_webhook_secret: '',
- stripe_currency: 'usd',
- stripe_test_mode: true,
+ stripe_currency: 'USD',
+ stripe_rates: '0.14',
+ stripe_test_mode: false,
epay_apiurl: '',
epay_pid: '',
epay_key: '',
- epay_channel_alipay: true,
- epay_channel_wxpay: true,
epay_device: 'auto',
},
groups: [
@@ -46,122 +60,293 @@ export const gatewaySchema = {
icon: 'fa fas fa-info-circle',
fields: [
{
- key: 'payment_gateway_notice',
- label: '通道说明',
- type: 'notice',
- alertType: 'info',
- alertContent: '以渠道开关 + 凭据是否齐全为准。异步回调由各网关验签(支付宝/微信/Stripe/易支付等),无需额外口令。卡密为兑换入口,不出现在收银台支付方式列表。',
+ key: 'gateway_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '- 以下收款接口,主题仅提供API接入服务,收款平台的可靠性请自行斟酌!
- 涉及到资金及信息安全,有相关执照的商家推荐使用官方接口
- 微信 / 支付宝接口可在「官方」与「易支付」之间选择;PayPal 与 Stripe 独立开关
- 异步回调由各网关验签,无需额外口令;回调地址固定为 /wp-json/aksrt/v1/payment/{gateway}/{notify|return}
',
},
],
},
{
- key: 'gateways',
- title: '支付渠道开关',
+ key: 'channels',
+ title: '收款接口选择',
icon: 'fa fas fa-toggle-on',
- description: '先开启渠道,下方对应配置卡片会展开;填写凭据后网关状态变为可用。余额与卡密无第三方凭据,仅开关即可。',
+ description: '微信与支付宝各选一种接入方式;选「易支付」后需在下方易支付配置块填写接口信息。',
fields: [
- { 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: '仅控制卡密兑换入口是否开放;卡密规则与批量发卡在「充值卡」页。不进入结账支付方式列表。' },
+ {
+ 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: '货币与结算',
+ 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: '- 支付宝公钥为必填项目(公钥错误可以成功付款,但会回调失败)
- 回调地址固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return}
- 同时填写了企业支付以及当面付参数,则优先使用当面付
',
+ },
+ { 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: '微信支付配置',
+ title: '微信官方',
icon: 'fa fab fa-weixin',
- description: '开启「微信支付」后填写商户号与密钥。',
+ description: '微信企业支付官方接口。',
collapsible: true,
- expandWhen: 'payment_wechat_enabled',
- dependsOn: { key: 'payment_wechat_enabled', value: true },
+ expandWhen: 'pay_wechat_sdk_options',
+ dependsOn: { key: 'pay_wechat_sdk_options', value: 'official_wechat' },
fields: [
- { key: 'wechat_merchantid', label: '商户号', 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_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '- 微信企业支付:官方接口,商家可申请,有年费,申请较为复杂
- 回调地址固定为 /wp-json/aksrt/v1/payment/wechatpay/{notify|return},请配置 Native 支付回调链接
',
+ },
+ { 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: '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',
- title: 'PayPal 配置',
+ title: 'PayPal(贝宝)',
icon: 'fa fab fa-paypal',
- description: '开启「PayPal」后填写 Client 凭据。',
+ description: '常见的海外支付接口。',
collapsible: true,
- expandWhen: 'payment_paypal_enabled',
- dependsOn: { key: 'payment_paypal_enabled', value: 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: '- PayPal(贝宝)是常见的海外支付接口
- 如果您的收款账户为中国大陆地区,则账户类型必须是企业,且只能收取非中国大陆区的PayPal付款
- REST 应用申请:https://developer.paypal.com/dashboard/applications
',
+ },
{ 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: 'input', default: 'USD' },
- { key: 'paypal_sandbox', label: '沙箱模式', type: 'switch', default: true },
+ { key: 'paypal_currency', label: '结算货币', type: 'select', default: 'USD', options: currencyOptions },
+ { 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 配置',
+ title: 'Stripe',
icon: 'fa fab fa-cc-stripe',
- description: '开启「Stripe」后填写 API Key 与 Webhook。',
+ description: '常见的海外信用卡收款接口。',
collapsible: true,
- expandWhen: 'payment_stripe_enabled',
- dependsOn: { key: 'payment_stripe_enabled', value: true },
+ expandWhen: 'pay_stripe_sdk_s',
+ dependsOn: { key: 'pay_stripe_sdk_s', value: true },
fields: [
- { key: 'stripe_secret_key', label: 'Secret Key', type: 'input', default: '' },
+ {
+ key: 'stripe_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '- Stripe 是常见的海外信用卡收款接口
- API 密钥申请:https://dashboard.stripe.com/apikeys
- Webhook 事件:checkout.session.completed
- 测试环境请使用 sk_test_ 开头的 Secret Key
',
+ },
+ { 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: 'Stripe Dashboard 配置 Webhook 后获得,用于验签。' },
- { key: 'stripe_currency', label: '货币', type: 'input', default: 'usd' },
- { key: 'stripe_test_mode', label: '测试模式', type: 'switch', default: true },
+ { 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: currencyOptions },
+ { 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: '易支付配置',
+ title: '易支付',
icon: 'fa fas fa-university',
- description: '开启「易支付」后填写接口地址与商户信息,并选择支付宝/微信子通道。',
+ description: '易支付(彩虹协议)聚合收银台;通道由上方微信/支付宝接口选择控制。',
collapsible: true,
- expandWhen: 'payment_epay_enabled',
- dependsOn: { key: 'payment_epay_enabled', value: 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_apiurl', label: '接口地址', type: 'input', default: '', help: '易支付站点根地址,如 https://pay.example.com/(末尾斜杠可选)。' },
- { key: 'epay_pid', label: '商户ID', type: 'input', default: '' },
- { key: 'epay_key', label: '商户密钥', type: 'input', default: '', help: 'MD5 通信密钥。' },
- { key: 'epay_channel_alipay', label: '启用支付宝通道', type: 'switch', default: true },
- { key: 'epay_channel_wxpay', label: '启用微信通道', type: 'switch', default: true },
- { key: 'epay_device', label: '下单终端', type: 'select', default: 'auto', options: [
- { label: '自动(按 UA)', value: 'auto' },
- { label: '电脑端 submit', value: 'pc' },
- { label: '移动端 mapi', value: 'mobile' },
- ] },
- { 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_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '- 易支付是一个常见的支付系统源码,任何人都可以下载并搭建
- 同时市面上多数的小规模支付平台都是由易支付修改而来,例如部分码支付、源支付等等
- 由于此接口服务商众多,主题只负责技术接入,平台可靠性请自行斟酌
',
+ },
+ { 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' },
+ ],
+ },
],
},
],
}
+
+/** 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' },
+]
diff --git a/assets/admin/src/schema/sections/payment/index.js b/assets/admin/src/schema/sections/payment/index.js
index d16780ab..18a612a4 100644
--- a/assets/admin/src/schema/sections/payment/index.js
+++ b/assets/admin/src/schema/sections/payment/index.js
@@ -2,23 +2,20 @@
* Payment & Paid domain schemas.
*/
+import { knowledgeSchema } from './knowledge.js'
import { rechargeSchema } from './recharge.js'
import { vipSchema } from './vip.js'
import { revenueSchema } from './revenue.js'
import { affiliateSchema } from './affiliate.js'
import { gatewaySchema } from './gateway.js'
-import { orderSchema } from './order.js'
-import { cardPassSchema } from './cardPass.js'
import { withdrawalSchema } from './withdrawal.js'
export const paymentSchemas = {
+ knowledge: knowledgeSchema,
recharge: rechargeSchema,
vip: vipSchema,
revenue: revenueSchema,
affiliate: affiliateSchema,
gateway: gatewaySchema,
- order: orderSchema,
- 'card-pass': cardPassSchema,
- cardPass: cardPassSchema,
withdrawal: withdrawalSchema,
}
diff --git a/assets/admin/src/schema/sections/payment/knowledge.js b/assets/admin/src/schema/sections/payment/knowledge.js
new file mode 100644
index 00000000..6712d6db
--- /dev/null
+++ b/assets/admin/src/schema/sections/payment/knowledge.js
@@ -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: ' 限时特惠',
+ 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: '知识付费
- 知识付费功能主要分为文章付费、付费会员、余额系统、推广返佣、创作分成等功能组成,您可以根据您的需要开启对应功能
- 使用支付功能请先在「收款接口」页配置好收款通道
',
+ },
+ ],
+ },
+ {
+ 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: ' 限时特惠', 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: '设置付费图片可免费查看前几张图片的数量的默认值' },
+ ],
+ },
+ ],
+}
diff --git a/assets/admin/src/schema/sections/payment/order.js b/assets/admin/src/schema/sections/payment/order.js
deleted file mode 100644
index 520d5639..00000000
--- a/assets/admin/src/schema/sections/payment/order.js
+++ /dev/null
@@ -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: '' },
- ],
- },
- ],
-}
diff --git a/assets/admin/src/schema/sections/payment/recharge.js b/assets/admin/src/schema/sections/payment/recharge.js
index 95e450c6..ef4e1678 100644
--- a/assets/admin/src/schema/sections/payment/recharge.js
+++ b/assets/admin/src/schema/sections/payment/recharge.js
@@ -1,24 +1,44 @@
+/**
+ * 余额充值 — 参考主题结构:用户余额(含余额提现)、转账、充值商品选项、
+ * 卡密充值、充值卡(原「充值卡」页并入)与余额兑换积分。
+ */
export const rechargeSchema = {
key: 'payment.recharge',
title: '余额充值',
icon: 'fa fas fa-bolt',
- description: '配置余额充值套餐、转账与积分兑换。',
+ description: '配置余额功能、充值商品选项、卡密充值、充值卡规则与余额兑换积分。',
defaults: {
pay_balance_s: true,
+ pay_balance_withdraw_s: false,
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_service_charge: 0,
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_desc: '',
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_rate: 100,
pay_balance_points_exchange_min_points: 100,
@@ -26,34 +46,28 @@ export const rechargeSchema = {
pay_balance_points_exchange_desc: '',
},
groups: [
+ {
+ key: 'notice',
+ title: '说明',
+ icon: 'fa fas fa-info-circle',
+ fields: [
+ {
+ key: 'recharge_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '用户余额功能:
- 开启后用户可充值到余额,余额可用于全站消费
- 在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例
- 可以在用户管理中,为某一个用户手动赠送余额
',
+ },
+ ],
+ },
{
key: 'basic',
- title: '充值开关',
+ title: '用户余额',
icon: 'fa fas fa-credit-card',
fields: [
- { 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: '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 } },
+ { key: 'pay_balance_s', label: '启用余额充值/支付功能', type: 'switch', default: true, help: '开启后用户中心显示现金钱包,并可作为收银台支付方式' },
+ { 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代码' },
],
},
{
@@ -61,23 +75,83 @@ export const rechargeSchema = {
title: '余额转账',
icon: 'fa fas fa-exchange-alt',
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_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',
- title: '充值卡免扣',
+ title: '卡密充值',
icon: 'fa fas fa-ticket-alt',
fields: [
- { 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_only_password', label: '仅密码兑换', type: 'switch', default: false, dependsOn: { key: 'pay_balance_pass_charge_s', value: true } },
+ { 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: '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: '余额兑换积分',
icon: 'fa fas fa-database',
fields: [
diff --git a/assets/admin/src/schema/sections/payment/revenue.js b/assets/admin/src/schema/sections/payment/revenue.js
index 2a7415c1..8cf092bd 100644
--- a/assets/admin/src/schema/sections/payment/revenue.js
+++ b/assets/admin/src/schema/sections/payment/revenue.js
@@ -1,6 +1,9 @@
+/**
+ * 创作分成 — 现金/积分分成比例 + 创作分成说明与详情页配置。
+ */
export const revenueSchema = {
key: 'payment.revenue',
- title: '创作中心',
+ title: '创作分成',
icon: 'fa fas fa-chart-line',
description: '分别配置现金收益和积分收益的会员分成比例,结算周期结束后自动入账。',
defaults: {
@@ -13,8 +16,25 @@ export const revenueSchema = {
payment_revenue_points_ratio_user: 0,
payment_revenue_points_ratio_vip_1: 0,
payment_revenue_points_ratio_vip_2: 0,
+ pay_income_desc_details: '在本站发布付费内容,获得的收益将参与收入分成
普通用户分成比例为:60%
一级会员分成比例为:70%
二级会员分成比例为:80%
分成比例的计算方式为:(实收现金-推广佣金)x 分成比例
申请提现后,需后台人工处理,一般2-3小时,请耐心等待
',
+ pay_income_desc_page_s: false,
+ pay_income_desc_page: 0,
},
groups: [
+ {
+ key: 'notice',
+ title: '说明',
+ icon: 'fa fas fa-info-circle',
+ fields: [
+ {
+ key: 'revenue_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '- 开启创作分成后,用户发布的付费内容则按设置的比例收入与用户分成
- 在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例
- 用户分成比例是按照订单实收现金并扣除推广佣金后,再按设置的比例分成
- 禁用此功能后,所有收款将不会与作者分成
',
+ },
+ ],
+ },
{
key: 'basic',
title: '创作中心设置',
@@ -30,7 +50,7 @@ export const revenueSchema = {
title: '现金收益分成',
icon: 'fa fas fa-credit-card',
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_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: '积分收益分成',
icon: 'fa fas fa-database',
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_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: '在本站发布付费内容,获得的收益将参与收入分成
普通用户分成比例为:60%
一级会员分成比例为:70%
二级会员分成比例为:80%
分成比例的计算方式为:(实收现金-推广佣金)x 分成比例
申请提现后,需后台人工处理,一般2-3小时,请耐心等待
', 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 } },
+ ],
+ },
],
}
diff --git a/assets/admin/src/schema/sections/payment/vip.js b/assets/admin/src/schema/sections/payment/vip.js
index 167c1ac1..4ac2a4ef 100644
--- a/assets/admin/src/schema/sections/payment/vip.js
+++ b/assets/admin/src/schema/sections/payment/vip.js
@@ -1,8 +1,12 @@
+/**
+ * VIP会员 — 参考主题结构:会员等级、会员权益(普通/一级/二级 tab)、
+ * 会员购买选项(一级/二级/续费/升级 tab)、卡密兑换与积分兑换。
+ */
export const vipSchema = {
key: 'payment.vip',
title: 'VIP会员',
icon: 'fa fas fa-gem',
- description: '对齐 legacy 双级会员:分档套餐、权益、续费/升级与积分兑换。',
+ description: '双级会员:等级名称、权益(下载次数与限速)、套餐、续费/升级与积分兑换。',
defaults: {
nav_pay_vip: true,
nav_user_pay_vip: true,
@@ -10,27 +14,24 @@ export const vipSchema = {
pay_user_vip_1_name: '一级会员',
pay_user_vip_1_desc: '尊享一级会员特权',
pay_user_vip_1_equity: '免费下载部分资源会员专属身份标识付费内容会员价',
- 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: '',
pay_user_vip_2_s: true,
pay_user_vip_2_name: '二级会员',
pay_user_vip_2_desc: '尊享二级会员特权',
pay_user_vip_2_equity: '更高免费下载额度更高等级身份标识更多付费内容会员价',
- 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: '',
pay_user_vip_desc: '',
pay_user_vip_more: '',
pay_download_limit: 0,
+ pay_download_speed: 0,
pay_download_limit_vip_1: 0,
+ pay_download_speed_vip_1: 0,
pay_download_limit_vip_2: 0,
- pay_vip_pass_charge_s: false,
- pay_vip_pass_charge_desc: '',
- pay_vip_pass_charge_only_password: true,
- pay_vip_points_exchange_s: false,
- pay_vip_points_exchange_desc: '',
- payment_vip_points_packages: '1|500|30|积分月卡\n1|5000|0|积分永久',
+ pay_download_speed_vip_2: 0,
+ 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_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_renew: true,
vip_renew_desc: '',
vip_renew_price_type: 'discount',
@@ -39,8 +40,28 @@ export const vipSchema = {
vip_upgrade: true,
vip_upgrade_desc: '',
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: [
+ {
+ key: 'notice',
+ title: '说明',
+ icon: 'fa fas fa-info-circle',
+ fields: [
+ {
+ key: 'vip_notice',
+ label: '',
+ type: 'content',
+ ui_only: true,
+ content: '- 开启付费会员功能之前,请先配置好收款接口,确保网站收款正常
- 会员功能的设置项目较多,请仔细核对,避免出现价格、时间的问题
- 配合设置名称、有效期等可搭配出不同类型的会员
- 管理员可在后台为用户单独开启会员
',
+ },
+ ],
+ },
{
key: 'basic',
title: '会员等级',
@@ -49,12 +70,12 @@ export const vipSchema = {
{ 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_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: '免费下载部分资源会员专属身份标识付费内容会员价', dependsOn: { key: 'pay_user_vip_1_s', value: true }, help: '建议使用 列表项' },
{ 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_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: '更高免费下载额度更高等级身份标识更多付费内容会员价', 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 图标' },
@@ -63,32 +84,137 @@ export const vipSchema = {
],
},
{
- key: 'packages',
- title: '分档套餐',
- icon: 'fa fas fa-gem',
+ key: 'benefit',
+ title: '会员权益',
+ icon: 'fa fas fa-gift',
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: '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: '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: '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: '积分兑换会员',
icon: 'fa fas fa-database',
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: '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|价格|标题',
- },
- ],
- },
],
}
diff --git a/assets/admin/src/schema/sections/payment/withdrawal.js b/assets/admin/src/schema/sections/payment/withdrawal.js
index 07747b20..b5891db4 100644
--- a/assets/admin/src/schema/sections/payment/withdrawal.js
+++ b/assets/admin/src/schema/sections/payment/withdrawal.js
@@ -1,29 +1,55 @@
+/**
+ * 提现策略 — 提现门槛、每日限制、收款渠道与提现协议。
+ */
export const withdrawalSchema = {
key: 'payment.withdrawal',
title: '提现策略',
icon: 'fa fas fa-money-bill',
- description: '配置提现门槛、手续费比例与每日限制。',
+ description: '配置提现门槛、手续费比例、每日限制、收款渠道与提现协议。',
defaults: {
- affiliate_min_withdrawal: '50.00',
+ affiliate_min_withdrawal: '50.00',
affiliate_withdrawal_fee: 5,
affiliate_daily_withdrawal_count: 3,
- affiliate_daily_withdrawal_limit: '500.00',
+ affiliate_daily_withdrawal_limit: '500.00',
affiliate_withdrawal_reset_time: '00:00',
affiliate_payout_channels: ['alipay', 'wechat'],
+ pay_rebate_withdraw_text_details: '可提现金额达到50元后即可发起提现
申请提现需后台人工处理,一般2-3小时,请耐心等待
如有其它疑问,请与客服联系
',
},
groups: [
{
key: 'basic',
- title: '提现设置',
+ title: '提现门槛',
icon: 'fa fas fa-sliders-h',
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: '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_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: '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: 'agreement',
+ title: '提现协议',
+ icon: 'fa fas fa-file-contract',
+ fields: [
+ { key: 'pay_rebate_withdraw_text_details', label: '提现协议', type: 'textarea', sanitize_type: 'html', default: '可提现金额达到50元后即可发起提现
申请提现需后台人工处理,一般2-3小时,请耐心等待
如有其它疑问,请与客服联系
', rows: 4, help: '用户申请提现时展示的内容,建议为提现须知等,支持HTML代码' },
+ ],
+ },
],
}
diff --git a/src/Admin/PageDisplayController.php b/src/Admin/PageDisplayController.php
index e189ab1f..207689cb 100644
--- a/src/Admin/PageDisplayController.php
+++ b/src/Admin/PageDisplayController.php
@@ -37,9 +37,9 @@ class PageDisplayController extends ControllerBase {
$query = sanitize_text_field((string) $request->get_param('query'));
$include = array_values(array_filter(array_map('absint', (array) $request->get_param('include'))));
- if ($source === 'posts') {
+ if ($source === 'posts' || $source === 'pages') {
$posts = get_posts([
- 'post_type' => 'post',
+ 'post_type' => $source === 'pages' ? 'page' : 'post',
'post_status' => 'publish',
'posts_per_page' => 20,
's' => $query,
diff --git a/src/Admin/PaymentController.php b/src/Admin/PaymentController.php
index 107f015a..5efc2813 100644
--- a/src/Admin/PaymentController.php
+++ b/src/Admin/PaymentController.php
@@ -19,49 +19,6 @@ class PaymentController extends ControllerBase {
public function register_routes(): void {
$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\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', [
'methods' => 'GET',
'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 {
if (!class_exists('\AKSRT\Payment\Withdrawal')) {
return $this->success(['data' => ['items' => [], 'total' => 0, 'page' => 1, 'total_pages' => 1, 'stats' => []]]);
diff --git a/src/Admin/Schema/SchemaPayment.php b/src/Admin/Schema/SchemaPayment.php
index 807afe92..63cbe9da 100644
--- a/src/Admin/Schema/SchemaPayment.php
+++ b/src/Admin/Schema/SchemaPayment.php
@@ -7,323 +7,567 @@ namespace AKSRT\Admin\Schema;
defined('ABSPATH') || exit;
+/**
+ * 「支付&付费」设置 schema。
+ *
+ * 页面结构 1:1 复刻参考主题 Zibll 的「支付&付费」section(知识付费 / 余额充值 /
+ * VIP会员 / 创作分成 / 推广返佣 / 收款接口),并按产品需求新增「提现策略」子页。
+ * 收款接口仅保留支付宝、微信、PayPal、Stripe、易支付;订单前缀 / 流水号前缀 /
+ * 提现单号前缀配置保留并收口在收款接口页。
+ */
class SchemaPayment {
- public static function build(): array {
- return [
- 'domain' => 'payment',
- 'title' => '支付&付费',
- 'sections' => [
- 'recharge' => [
- 'key' => 'recharge',
- 'title' => '余额充值',
- 'version' => '1.0.0',
- 'option_key' => 'aksrt_settings',
- 'groups' => [
- ['key' => 'basic', 'title' => '充值开关', 'fields' => [
- ['key' => 'pay_balance_s', 'label' => '启用余额功能', 'type' => 'switch', 'default' => true],
- ['key' => 'pay_balance_desc', 'label' => '充值说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
- ]],
- ['key' => 'packages', 'title' => '充值套餐', 'fields' => [
- ['key' => 'pay_balance_product', 'label' => '套餐列表', 'type' => 'textarea', 'default' => "30|30|入门包\n98|108|推荐包", 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
- ]],
- ['key' => 'product', 'title' => '充值产品', '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]],
- ]],
- ['key' => 'transfer', 'title' => '余额转账', 'fields' => [
- ['key' => 'pay_balance_transfer_s', 'label' => '启用余额转账', 'type' => 'switch', 'default' => false],
- ['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' => 'pass-charge', 'title' => '充值卡免扣', 'fields' => [
- ['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_only_password', 'label' => '仅密码兑换', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_balance_pass_charge_s', '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]],
- ['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' => 'pay_balance_points_exchange_desc', 'label' => '兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
- ]],
- ],
- ],
- 'vip' => [
- 'key' => 'vip',
- 'title' => 'VIP会员',
- 'version' => '1.1.0',
- 'option_key' => 'aksrt_settings',
- 'groups' => [
- ['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' => '免费下载部分资源会员专属身份标识付费内容会员价', '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' => '更高免费下载额度更高等级身份标识更多付费内容会员价', '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' => 'packages', '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' => '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' => '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]],
- ]],
- ['key' => 'benefit', 'title' => '下载权益', 'fields' => [
- ['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' => '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]],
- ]],
- ['key' => 'renew', 'title' => '续费设置', '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', '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|价格|标题'],
- ]],
- ],
- ],
- 'revenue' => [
- 'key' => 'revenue',
- 'title' => '创作中心',
- 'version' => '2.0.0',
- 'option_key' => 'aksrt_settings',
- 'groups' => [
- ['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' => '订单完成并经过结算周期后,作者分成会自动转入对应的钱包。
', '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]],
- ['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]],
- ['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]],
- ]],
- ],
- ],
- 'affiliate' => [
- 'key' => 'affiliate',
- 'title' => '推广返佣',
- 'version' => '1.0.0',
- 'option_key' => 'aksrt_settings',
- 'groups' => [
- ['key' => 'policy', 'title' => '返佣策略', 'fields' => [
- ['key' => 'affiliate_enabled', 'label' => '启用推广返佣', 'type' => 'switch', 'default' => false],
- ['key' => 'affiliate_ratio_user', 'label' => '普通会员佣金比例(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
- ['key' => 'affiliate_ratio_vip_1', 'label' => '一级会员佣金比例(%)', 'type' => 'number', 'default' => 5, 'min' => 0, 'max' => 100],
- ['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' => 'affiliate_settlement_days', 'label' => '结算观察期(天)', 'type' => 'number', 'default' => 7, 'min' => 0, 'max' => 90],
- ]],
- ['key' => 'text', 'title' => '文案设置', 'fields' => [
- ['key' => 'affiliate_promotion_text', 'label' => '推广说明', 'type' => 'textarea', 'default' => ''],
- ]],
- ],
- ],
- 'gateway' => [
- 'key' => 'gateway',
- 'title' => '收款接口',
- 'version' => '1.2.0',
- 'option_key' => 'aksrt_settings',
- 'groups' => [
- ['key' => 'notice', 'title' => '说明', 'fields' => [
- ['key' => 'payment_gateway_notice', 'label' => '通道说明', 'type' => 'notice', 'alertType' => 'info', 'alertContent' => '以渠道开关 + 凭据是否齐全为准。异步回调由各网关验签(支付宝/微信/Stripe/易支付等),无需额外口令。卡密为兑换入口,不出现在收银台支付方式列表。'],
- ]],
- ['key' => 'gateways', 'title' => '支付渠道开关', 'fields' => [
- ['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]],
+ public static function build(): array {
+ return [
+ 'domain' => 'payment',
+ 'title' => '支付&付费',
+ 'sections' => [
+
+ /* ------------------------------------------------------------------
+ * 知识付费
+ * ------------------------------------------------------------------ */
+ 'knowledge' => [
+ 'key' => 'knowledge',
+ 'title' => '知识付费',
+ 'version' => '1.0.0',
+ 'option_key' => 'aksrt_settings',
+ 'groups' => [
+ ['key' => 'notice', 'title' => '说明', 'fields' => [
+ ['key' => 'knowledge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '知识付费
- 知识付费功能主要分为文章付费、付费会员、余额系统、推广返佣、创作分成等功能组成,您可以根据您的需要开启对应功能
- 使用支付功能请先在「收款接口」页配置好收款通道
'],
+ ]],
+ ['key' => 'guest-buy', 'title' => '免登陆购买', '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' => '模块显示位置', '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' => '基础显示', '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' => '商品优惠码', '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' => '展示设置', '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' => '状态设置', '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' => 'group', 'button_title' => '添加服务项', 'default' => [], 'fields' => [
+ ['key' => 'value', 'label' => '服务内容', 'type' => 'input', 'default' => ''],
+ ['key' => 'icon', 'label' => '自定义图标', 'type' => 'icon', 'default' => ''],
+ ]],
+ ]],
+ ['key' => 'feature', 'title' => '商品功能配置', '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' => '商品预置参数配置', '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' => ' 限时特惠', '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' => '设置付费图片可免费查看前几张图片的数量的默认值'],
+ ]],
+ ],
+ ],
+
+ /* ------------------------------------------------------------------
+ * 余额充值
+ * ------------------------------------------------------------------ */
+ 'recharge' => [
+ 'key' => 'recharge',
+ 'title' => '余额充值',
+ 'version' => '1.1.0',
+ 'option_key' => 'aksrt_settings',
+ 'groups' => [
+ ['key' => 'notice', 'title' => '说明', 'fields' => [
+ ['key' => 'recharge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '用户余额功能:
- 开启后用户可充值到余额,余额可用于全站消费
- 在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例
- 可以在用户管理中,为某一个用户手动赠送余额
'],
+ ]],
+ ['key' => 'basic', 'title' => '用户余额', 'fields' => [
+ ['key' => 'pay_balance_s', 'label' => '启用余额充值/支付功能', 'type' => 'switch', 'default' => true, 'help' => '开启后用户中心显示现金钱包,并可作为收银台支付方式'],
+ ['key' => 'pay_balance_withdraw_s', 'label' => '余额提现', 'type' => 'switch', 'default' => false, 'help' => '允许将余额提现', 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true]],
+ ['key' => 'pay_balance_desc', 'label' => '充值说明', 'type' => 'textarea', 'default' => '', 'rows' => 3, 'dependsOn' => ['key' => 'pay_balance_s', 'value' => true], 'help' => '用户充值时显示的内容,建议为提醒事项、充值协议等,支持HTML代码'],
+ ]],
+ ['key' => 'transfer', 'title' => '余额转账', 'fields' => [
+ ['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_desc', 'label' => '转账说明', 'type' => 'textarea', 'default' => '', 'rows' => 2, 'dependsOn' => ['key' => 'pay_balance_transfer_s', 'value' => true], 'help' => '用户转账时候显示的内容,建议为提醒事项、转账协议等,支持HTML代码'],
+ ]],
+ ['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' => ''],
+ ['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', 'title' => '卡密充值', 'fields' => [
+ ['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' => 'pay_balance_pass_charge_only_password', 'label' => '单密码模式', 'type' => 'switch', 'default' => false, 'dependsOn' => ['key' => 'pay_balance_pass_charge_s', 'value' => true], 'help' => '仅需输入密码,不需要卡号'],
+ ]],
+ ['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]],
+ ['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' => 'display', 'title' => '展示设置', '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]],
- ]],
- ],
- ],
- 'withdrawal' => [
- 'key' => 'withdrawal',
- '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' => '仅接受最多两位小数的十进制字符串。'],
- ['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],
- ['key' => 'affiliate_daily_withdrawal_limit', 'label' => '每日提现上限', 'type' => 'input', 'sanitize_type' => 'money_decimal', 'default' => '500.00', 'desc' => '仅接受最多两位小数的十进制字符串。'],
- ['key' => 'affiliate_withdrawal_reset_time', 'label' => '重置时间', 'type' => 'input', 'default' => '00:00', 'help' => '按站点 WordPress 时区重置,格式 HH:MM。'],
- ['key' => 'affiliate_payout_channels', 'label' => '可用收款渠道', 'type' => 'checkbox', 'options' => [['value' => 'alipay', 'label' => '支付宝收款码'], ['value' => 'wechat', 'label' => '微信收款码']], 'default' => ['alipay', 'wechat']],
- ]],
- ],
- ],
- ],
- ];
- }
+ ['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' => '余额兑换积分', '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]],
+ ['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' => 'pay_balance_points_exchange_desc', 'label' => '兑换说明', 'type' => 'textarea', 'default' => '', 'dependsOn' => ['key' => 'pay_balance_points_exchange_s', 'value' => true]],
+ ]],
+ ],
+ ],
+
+ /* ------------------------------------------------------------------
+ * VIP会员
+ * ------------------------------------------------------------------ */
+ 'vip' => [
+ 'key' => 'vip',
+ 'title' => 'VIP会员',
+ 'version' => '1.1.0',
+ 'option_key' => 'aksrt_settings',
+ 'groups' => [
+ ['key' => 'notice', 'title' => '说明', 'fields' => [
+ ['key' => 'vip_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '- 开启付费会员功能之前,请先配置好收款接口,确保网站收款正常
- 会员功能的设置项目较多,请仔细核对,避免出现价格、时间的问题
- 配合设置名称、有效期等可搭配出不同类型的会员
- 管理员可在后台为用户单独开启会员
'],
+ ]],
+ ['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' => '免费下载部分资源会员专属身份标识付费内容会员价', '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' => '更高免费下载额度更高等级身份标识更多付费内容会员价', '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' => '- 开启创作分成后,用户发布的付费内容则按设置的比例收入与用户分成
- 在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例
- 用户分成比例是按照订单实收现金并扣除推广佣金后,再按设置的比例分成
- 禁用此功能后,所有收款将不会与作者分成
'],
+ ]],
+ ['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' => '订单完成并经过结算周期后,作者分成会自动转入对应的钱包。
', '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' => '在本站发布付费内容,获得的收益将参与收入分成
普通用户分成比例为:60%
一级会员分成比例为:70%
二级会员分成比例为:80%
分成比例的计算方式为:(实收现金-推广佣金)x 分成比例
申请提现后,需后台人工处理,一般2-3小时,请耐心等待
', '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' => '- 识别模式「绑定注册」:用户只要是通过任意推广链接注册的,今后此用户消费均会给推荐人返佣
- 识别模式「仅推广链接」:只有通过推广链接购买的才会给推荐人返佣,不会考虑是否是推荐注册的
- 开启的订单类型如果一个都不勾选,则代表该用户类型不参与此功能
- 您可以根据网站的VIP设置相互配合设置相应的规则
- 下面的设置为全局设置,还可以单独为每一个用户设置规则和比例
'],
+ ]],
+ ['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' => '通过您的推广链接打开本站后,在本站购买商品即可获得佣金
通过您的推广链接注册后的用户今后购买的商品均可获得佣金
申请提现后,需后台人工处理,一般2-3小时,请耐心等待
', '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' => '推广让利标签配置详解:
- 可使用的变量:折扣
%discount%、推荐人姓名 %referrer_name% - 使用变量示例:
%referrer_name%推荐购买 下单再减%discount%元
', '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' => '- 以下收款接口,主题仅提供API接入服务,收款平台的可靠性请自行斟酌!
- 涉及到资金及信息安全,有相关执照的商家推荐使用官方接口
- 微信 / 支付宝接口可在「官方」与「易支付」之间选择;PayPal 与 Stripe 独立开关
- 异步回调由各网关验签,无需额外口令;回调地址固定为 /wp-json/aksrt/v1/payment/{gateway}/{notify|return}
'],
+ ]],
+ ['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' => '- 支付宝公钥为必填项目(公钥错误可以成功付款,但会回调失败)
- 回调地址固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return}
- 同时填写了企业支付以及当面付参数,则优先使用当面付
'],
+ ['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' => '- 微信企业支付:官方接口,商家可申请,有年费,申请较为复杂
- 回调地址固定为 /wp-json/aksrt/v1/payment/wechatpay/{notify|return},请配置 Native 支付回调链接
'],
+ ['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' => '- PayPal(贝宝)是常见的海外支付接口
- 如果您的收款账户为中国大陆地区,则账户类型必须是企业,且只能收取非中国大陆区的PayPal付款
- REST 应用申请:https://developer.paypal.com/dashboard/applications
'],
+ ['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' => '- Stripe 是常见的海外信用卡收款接口
- API 密钥申请:https://dashboard.stripe.com/apikeys
- Webhook 事件:checkout.session.completed
- 测试环境请使用 sk_test_ 开头的 Secret Key
'],
+ ['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' => '- 易支付是一个常见的支付系统源码,任何人都可以下载并搭建
- 同时市面上多数的小规模支付平台都是由易支付修改而来,例如部分码支付、源支付等等
- 由于此接口服务商众多,主题只负责技术接入,平台可靠性请自行斟酌
'],
+ ['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' => '可提现金额达到50元后即可发起提现
申请提现需后台人工处理,一般2-3小时,请耐心等待
如有其它疑问,请与客服联系
', 'rows' => 4, 'help' => '用户申请提现时展示的内容,建议为提现须知等,支持HTML代码'],
+ ]],
+ ],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * PayPal / Stripe 结算货币选项(参考主题同款 26 种)。
+ *
+ * @return array
+ */
+ 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;
+ }
}
diff --git a/src/Admin/SchemaProvider.php b/src/Admin/SchemaProvider.php
index ebdd5aa3..a761fb74 100644
--- a/src/Admin/SchemaProvider.php
+++ b/src/Admin/SchemaProvider.php
@@ -192,7 +192,7 @@ class SchemaProvider {
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);
continue;
}
@@ -732,23 +732,46 @@ class SchemaProvider {
continue;
}
foreach ($group['fields'] ?? [] as $field) {
- if (!is_array($field) || empty($field['key'])) {
- 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;
+ $fields = array_merge($fields, $this->collect_persisted_fields(is_array($field) ? $field : []));
}
}
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>
+ */
+ 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.
*
@@ -848,6 +871,17 @@ class SchemaProvider {
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 (!is_array($value)) {
return [];
@@ -1006,6 +1040,8 @@ class SchemaProvider {
'accordion'=> 'array',
'sortable' => 'array',
'link' => 'array',
+ 'between_number' => 'array',
+ 'page_select' => 'int',
'async_select' => 'array',
'json' => 'array',
// 自定义面板(验证码服务商等)按对象存储
diff --git a/src/Core/ScriptsPart1c.php b/src/Core/ScriptsPart1c.php
index 485a315d..300d95f5 100644
--- a/src/Core/ScriptsPart1c.php
+++ b/src/Core/ScriptsPart1c.php
@@ -179,8 +179,13 @@ trait ScriptsPart1c {
'www' => home_url('/'),
'uri' => $runtime_uri,
'ver' => $runtime_version,
- 'pay_mark' => '¥',
- 'pay_currency_unit' => __('元', 'aksrt'),
+ // 货币符号 / 单位来自「收款接口」页配置(pay_currency_mark / pay_currency_unit)。
+ '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_type' => 'group',
'imgbox_thumbs' => $lightbox_on && (!isset($post_page_settings['lightbox_thumbs']) || !empty($post_page_settings['lightbox_thumbs'])),
diff --git a/src/Payment/CommissionLedger.php b/src/Payment/CommissionLedger.php
index 4b4c188e..09c7c5a3 100644
--- a/src/Payment/CommissionLedger.php
+++ b/src/Payment/CommissionLedger.php
@@ -47,7 +47,6 @@ final class CommissionLedger {
$map = ['vip' => 'membership', 'resource' => 'content'];
$order_type = $map[$type] ?? $type;
$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'] ?? ''));
$buyer = (int) ($order['user_id'] ?? 0);
try {
@@ -58,6 +57,9 @@ final class CommissionLedger {
if ($order_no === '' || $buyer <= 0 || $amount->minor() <= 0) return 0;
$promoter = ReferralAttribution::get_instance()->resolve($buyer);
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);
$commission_minor = (intdiv($amount->minor(), 100) * $ratio)
+ intdiv((($amount->minor() % 100) * $ratio) + 50, 100);
diff --git a/src/Payment/Gateway.php b/src/Payment/Gateway.php
index 4abf0609..6382f6bb 100644
--- a/src/Payment/Gateway.php
+++ b/src/Payment/Gateway.php
@@ -45,7 +45,7 @@ class Gateway {
}
/**
- * 获取可用网关列表(已配置的)
+ * 获取可用网关列表(已配置的),按「收款接口显示顺序」配置排序。
*/
public function get_available(): array {
$available = [];
@@ -54,7 +54,48 @@ class Gateway {
$available[$id] = $gateway;
}
}
- return $available;
+ return $this->apply_sdk_order($available);
+ }
+
+ /**
+ * 按 pay_sdk_order(收款接口显示顺序)重排可用网关。
+ * 易支付子通道跟随对应渠道槽位(epay_wxpay 跟随 wechat、epay_alipay 跟随 alipay);
+ * 未配置顺序时保持注册顺序,未纳入槽位的扩展网关保持在末尾。
+ *
+ * @param array $available
+ * @return array
+ */
+ 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'] ?? ''));
- if ($gateway_id === '' || in_array($gateway_id, ['balance', 'points', 'manual_review'], true)) {
+ if ($gateway_id === '' || in_array($gateway_id, ['balance', 'points'], true)) {
return null;
}
$gateway = $this->get_gateway($gateway_id);
diff --git a/src/Payment/UserOrders.php b/src/Payment/UserOrders.php
index b4211273..2a62688b 100644
--- a/src/Payment/UserOrders.php
+++ b/src/Payment/UserOrders.php
@@ -186,7 +186,7 @@ class UserOrders {
$image = $this->resolve_image($meta, $product_id);
$group = $this->status_group($status);
$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;
$order_number = (string) ($order['order_number'] ?? '');
$updated_at = $this->resolve_updated_at($order);
diff --git a/src/Settings/CreditsPaymentGroups.php b/src/Settings/CreditsPaymentGroups.php
index 2e193edb..f555f4c8 100644
--- a/src/Settings/CreditsPaymentGroups.php
+++ b/src/Settings/CreditsPaymentGroups.php
@@ -160,7 +160,7 @@ trait CreditsPaymentGroups {
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
*/
public static function get_payment_gateway_settings(): array {
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 {
return PaymentRuntime::get_order_settings();
diff --git a/src/Settings/PaymentRuntime.php b/src/Settings/PaymentRuntime.php
index 1961dc81..1cc3fb42 100644
--- a/src/Settings/PaymentRuntime.php
+++ b/src/Settings/PaymentRuntime.php
@@ -34,27 +34,29 @@ class PaymentRuntime {
'catalog_note' => '',
'manual_delivery_note' => __('付费或人工确认内容请在订单备注中记录交付方式。', 'aksrt'),
'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' => [
'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_paycount' => !isset($settings['pay_show_paycount']) || !empty($settings['pay_show_paycount']),
'box_position' => $box_position,
],
'download' => [
'enabled' => true,
- 'remote' => true,
- 'verify_nonce' => true,
- 'user_log' => 50,
- 'post_log' => 50,
- 'remote_size' => 2048,
- 'remote_ext' => 'zip,rar,7z',
- 'alone_page' => false,
+ 'remote' => !isset($settings['down_remote_to_local_s']) || !empty($settings['down_remote_to_local_s']),
+ 'verify_nonce' => !isset($settings['down_verify_nonce']) || !empty($settings['down_verify_nonce']),
+ 'user_log' => max(0, (int) ($settings['down_user_log'] ?? 50)),
+ 'post_log' => max(0, (int) ($settings['down_post_log'] ?? 50)),
+ 'remote_size' => max(0, (int) ($settings['down_remote_to_local_size'] ?? 2048)),
+ 'remote_ext' => sanitize_text_field((string) ($settings['down_remote_to_local_ext'] ?? 'zip,rar,7z')),
+ 'alone_page' => !empty($settings['down_alone_page']),
],
- // 内容收银台优惠码:不再提供全局开关,默认关闭。
- 'coupon_post_s' => false,
- 'coupon_desc' => '',
+ // 内容收银台优惠码:全局开关 + 默认说明。
+ 'coupon_post_s' => !empty($settings['coupon_post_s']),
+ 'coupon_desc' => sanitize_textarea_field((string) ($settings['coupon_desc'] ?? '')),
];
}
@@ -87,6 +89,7 @@ class PaymentRuntime {
return [
'enabled' => !empty($settings['pay_balance_s']),
+ 'withdraw_enabled' => !empty($settings['pay_balance_withdraw_s']),
'desc' => $desc,
'packages_raw' => $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
*/
public static function get_payment_affiliate_settings(): array {
$settings = Settings::get_all();
$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)));
- if (!$types) { $types = ['membership', 'content']; }
+
+ $resolve_types = static function (array $types): array {
+ $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 [
- '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' => [
- 'user' => $clamp_ratio($settings['affiliate_ratio_user'] ?? 5),
- 'vip_1' => $clamp_ratio($settings['affiliate_ratio_vip_1'] ?? 5),
- 'vip_2' => $clamp_ratio($settings['affiliate_ratio_vip_2'] ?? 5),
+ 'user' => $clamp_ratio($settings['pay_rebate_ratio'] ?? 5),
+ 'vip_1' => $clamp_ratio($settings['pay_rebate_ratio_vip_1'] ?? 10),
+ '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'],
'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
+ */
+ 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_ratio_for_user(int $user_id): int {
$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
*/
public static function get_payment_gateway_settings(): array {
$settings = Settings::get_all();
- $gateway_keys = ['wechat', 'alipay', 'paypal', 'stripe', 'balance', 'card_pass', 'epay'];
- $gateways = [];
- foreach ($gateway_keys as $gw) {
- $gateways[$gw] = !empty($settings["payment_{$gw}_enabled"]);
+
+ $wechat = sanitize_key((string) ($settings['pay_wechat_sdk_options'] ?? 'null'));
+ if (!in_array($wechat, ['official_wechat', 'epay', 'null'], true)) {
+ $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 [
- 'help_text' => __('以渠道开关与凭据是否齐全为准;异步回调由各网关验签。卡密为兑换入口,不进入收银台。', 'aksrt'),
- 'gateways' => $gateways,
- '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'] ?? '')),
- 'channel_alipay' => !array_key_exists('epay_channel_alipay', $settings) || !empty($settings['epay_channel_alipay']),
- 'channel_wxpay' => !array_key_exists('epay_channel_wxpay', $settings) || !empty($settings['epay_channel_wxpay']),
- 'device' => sanitize_key((string) ($settings['epay_device'] ?? 'auto')),
+ 'help_text' => __('微信 / 支付宝可在官方与易支付之间选择;PayPal、Stripe 独立开关。异步回调由各网关验签。', 'aksrt'),
+ 'wechat_sdk_options' => $wechat,
+ 'alipay_sdk_options' => $alipay,
+ 'paypal_enabled' => $paypal_enabled,
+ 'stripe_enabled' => $stripe_enabled,
+ 'balance_enabled' => $balance_enabled,
+ 'card_pass_enabled' => $card_pass_enabled,
+ 'gateways' => [
+ '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)));
$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'));
if (!in_array($box_position, ['box_top', 'top', 'bottom', 'box_bottom'], true)) {
@@ -378,7 +445,6 @@ class PaymentRuntime {
'cookie_day' => $cookie_day,
'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']),
- 'order_max_minutes' => $max_minutes,
'mark' => sanitize_text_field((string) ($s['pay_mark'] ?? '付费')),
'box_position' => $box_position,
'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_pay_time' => !isset($s['payment_show_pay_time']) || !empty($s['payment_show_pay_time']),
'status_texts' => $status_texts,
- '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'] ?? '')),
- ],
+ 'service' => self::format_service_items((array) ($s['pay_service'] ?? [])),
+ ];
+ }
+
+ /**
+ * 客户服务:参考主题为 {value, icon} 数组;首项同时回填旧单值键,兼容既有消费方。
+ *
+ * @param array $items
+ * @return array
+ */
+ 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.
- * 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 {
$settings = Settings::get_all();
$gateway_id = sanitize_key($gateway_id);
- $map = [
- 'alipay' => 'payment_alipay_enabled',
- 'wechatpay' => 'payment_wechat_enabled',
- 'paypal' => 'payment_paypal_enabled',
- '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;
+
+ $wechat = sanitize_key((string) ($settings['pay_wechat_sdk_options'] ?? 'null'));
+ if (!in_array($wechat, ['official_wechat', 'epay', 'null'], true)) {
+ $wechat = 'null';
}
- if ($gateway_id === 'balance') {
- // Master: 余额充值 → 启用余额功能. Optional kill-switch: payment_balance_enabled=false.
- // Missing key (legacy sites) follows pay_balance_s so "open wallet" alone enables pay.
- 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;
+ $alipay = sanitize_key((string) ($settings['pay_alipay_sdk_options'] ?? 'null'));
+ if (!in_array($alipay, ['official_alipay', 'epay', 'null'], true)) {
+ $alipay = 'null';
}
- 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).
- 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;
+ return false;
}
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 $products
*/
private static function format_product_lines(array $products): string {
@@ -538,10 +628,11 @@ class PaymentRuntime {
if (!is_array($row)) {
continue;
}
- $price = $row['pay_price'] ?? $row['price'] ?? '';
- $value = $row['value'] ?? $row['balance'] ?? $price;
- $title = $row['title'] ?? $row['name'] ?? '';
- $lines[] = $price . '|' . $value . '|' . $title;
+ $price = max(0, (float) ($row['price'] ?? 0));
+ $pay_price = max(0, (float) ($row['pay_price'] ?? 0));
+ $pay = $pay_price > 0 ? $pay_price : $price;
+ $title = trim((string) ($row['tag'] ?? ''));
+ $lines[] = $pay . '|' . $price . '|' . $title;
}
return implode("\n", $lines);
}
diff --git a/tests/widget-system/asset-ledger-contract.test.cjs b/tests/widget-system/asset-ledger-contract.test.cjs
index 3418e9c7..9f0b3959 100644
--- a/tests/widget-system/asset-ledger-contract.test.cjs
+++ b/tests/widget-system/asset-ledger-contract.test.cjs
@@ -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 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 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 chargeCard = fs.readFileSync(path.join(root, 'src', 'Payment', 'ChargeCard.php'), 'utf8')
const creditsJs = fs.readFileSync(path.join(root, 'assets', 'js', 'credits.js'), 'utf8')
diff --git a/tests/widget-system/financial-flow-contract.test.cjs b/tests/widget-system/financial-flow-contract.test.cjs
index 916f4d60..d21b1ecf 100644
--- a/tests/widget-system/financial-flow-contract.test.cjs
+++ b/tests/widget-system/financial-flow-contract.test.cjs
@@ -15,7 +15,7 @@ test('financial flow and withdrawal numbers use the new-only schema', () => {
})
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')
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'/)