fix(payment): close creator income contract gaps

This commit is contained in:
2026-08-07 13:30:37 +08:00
parent cfb0a1368c
commit 7cca472fe9
14 changed files with 70 additions and 52 deletions
+11 -5
View File
@@ -187,10 +187,13 @@ class PayIncome {
}
}
$ids = array_values(array_unique($ids));
$ok = !empty($ids)
&& class_exists('\\AKSRT\\Payment\\Revenue')
&& \AKSRT\Payment\Revenue::get_instance()->settle($ids, get_current_user_id());
wp_safe_redirect($this->page_url('aksrt_income', ['aksrt_pay_msg' => $ok ? 'income_batch_settled' : 'income_failed']));
$batch_result = !empty($ids) && class_exists('\\AKSRT\\Payment\\Revenue')
? \AKSRT\Payment\Revenue::get_instance()->settle_batch($ids, get_current_user_id())
: ['settled' => [], 'failed' => $ids];
$message = empty($batch_result['settled'])
? 'income_failed'
: (!empty($batch_result['failed']) ? 'income_batch_partial' : 'income_batch_settled');
wp_safe_redirect($this->page_url('aksrt_income', ['aksrt_pay_msg' => $message]));
exit;
}
@@ -218,12 +221,15 @@ class PayIncome {
$map = [
'income_settled' => __('分成已结算。', 'aksrt'),
'income_batch_settled' => __('选中分成已批量结算。', 'aksrt'),
'income_batch_partial' => __('部分分成已结算,失败记录可稍后重试。', 'aksrt'),
'income_failed' => __('分成结算失败。', 'aksrt'),
];
if (!isset($map[$code])) {
return;
}
$class = str_contains($code, 'failed') ? 'notice-error' : 'notice-success';
$class = $code === 'income_batch_partial'
? 'notice-warning'
: (str_contains($code, 'failed') ? 'notice-error' : 'notice-success');
echo '<div class="notice ' . esc_attr($class) . ' is-dismissible"><p>' . esc_html($map[$code]) . '</p></div>';
}
+2 -2
View File
@@ -163,11 +163,11 @@ class SchemaPayment {
],
'revenue' => [
'key' => 'revenue',
'title' => '创作分成',
'title' => '创作中心',
'version' => '2.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'basic', 'title' => '创作分成设置', 'fields' => [
['key' => 'basic', 'title' => '创作中心设置', 'fields' => [
['key' => 'pay_income_s', 'label' => '启用创作分成', 'type' => 'switch', 'default' => false],
['key' => 'payment_revenue_cycle_days', 'label' => '结算周期(天)', 'type' => 'number', 'default' => 30, 'min' => 1, 'max' => 365, 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
['key' => 'payment_revenue_note', 'label' => '结算备注文案', 'type' => 'textarea', 'sanitize_type' => 'html', 'default' => '<p>订单完成并经过结算周期后,作者分成会自动转入对应的钱包。</p>', 'dependsOn' => ['key' => 'pay_income_s', 'value' => true]],
+1 -1
View File
@@ -601,7 +601,7 @@ class SchemaUsers {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'center', 'title' => '用户中心', 'fields' => [
['key' => 'user_center_tabs', 'label' => '用户中心 Tab', 'type' => 'input', 'default' => 'profile,level,posts,comments,favorites,vip,credits,revenue,auth', 'help' => '逗号分隔。level=我的等级;revenue=收益中心;auth=官方认证;等级、VIP、订单、收益中心和认证会按功能开关自动注入'],
['key' => 'user_center_tabs', 'label' => '用户中心 Tab', 'type' => 'input', 'default' => 'profile,level,comments,favorites,vip,credits,revenue,auth', 'help' => '逗号分隔。level=我的等级;creator=创作中心;revenue=推广收益中心;auth=官方认证;等级、VIP、订单、创作中心、收益中心和认证会按功能开关自动注入'],
['key' => 'user_cover_upload', 'label' => '封面上传', 'type' => 'switch', 'default' => true],
['key' => 'user_social_links', 'label' => '社交链接', 'type' => 'switch', 'default' => true],
['key' => 'user_desc_std', 'label' => '默认签名', 'type' => 'input', 'default' => '这家伙很懒…', 'desc' => '用户未设置个人简介时显示的默认文案'],