feat: remove forum feature (Phase 1)

This commit is contained in:
kate522 committed 2026-08-02 20:02:44 +08:00
1 parent f3e4cdd9cf
commit 2bbd7c01a3
173 files changed
+51 -27360

No files matched your search

+3 -61
View File
@@ -89,56 +89,11 @@ class CreatorRevenue {
$buyer_id = (int) ($order['user_id'] ?? 0);
$items = [];
if (class_exists('\AKSRT\Shop\Shop')) {
$shop = \AKSRT\Shop\Shop::get_instance();
if (method_exists($shop, 'get_order_items')) {
$items = (array) $shop->get_order_items($order_number);
}
}
if (!empty($items)) {
$this->settle_shop_items($order_number, $buyer_id, $items);
return;
}
$this->settle_non_shop_cash_order($order_number, $order, $buyer_id);
}
/**
* @param list<array<string,mixed>> $items
*/
private function settle_shop_items(string $order_number, int $buyer_id, array $items): void {
$revenue = Revenue::get_instance();
foreach ($items as $item) {
$product_id = (int) ($item['product_id'] ?? 0);
$pay_price = (float) ($item['pay_price'] ?? $item['total_price'] ?? 0);
if ($product_id <= 0 || $pay_price <= 0) {
continue;
}
$author_id = (int) get_post_field('post_author', $product_id);
if ($author_id <= 0 || $author_id === $buyer_id) {
continue;
}
$ratio = $this->resolve_share_ratio($author_id);
if ($ratio <= 0) {
continue;
}
$amount = round($pay_price * $ratio / 100, 2);
if ($amount <= 0) {
continue;
}
$revenue->add($author_id, $amount, $order_number, 'order');
}
}
/**
* Content / topic / plate_follow cash orders (no shop line items).
* Content / topic cash orders (no shop line items).
*/
private function settle_non_shop_cash_order(string $order_number, array $order, int $buyer_id): void {
$meta = $this->decode_note($order);
@@ -168,24 +123,11 @@ class CreatorRevenue {
return;
}
$is_plate = !empty($meta['plate_follow_pay'])
|| $product_type === \AKSRT\Core\DomainModel::ORDER_PRODUCT_PLATE_FOLLOW;
$is_topic = !empty($meta['topic_pay'])
|| ($product_type === \AKSRT\Core\DomainModel::ORDER_PRODUCT_RESOURCE
&& $post->post_type === 'aksrt_forum_topic');
$is_content = !empty($meta['content_pay'])
&& $post->post_type === 'post';
// Resource without content_pay/topic_pay and not a known cash kind: skip.
if (!$is_plate && !$is_topic && !$is_content) {
return;
}
// Guard: plate must be plate CPT; topic must be topic CPT.
if ($is_plate && $post->post_type !== 'aksrt_forum_plate') {
return;
}
if ($is_topic && $post->post_type !== 'aksrt_forum_topic') {
// Resource without content_pay and not a known cash kind: skip.
if (!$is_content) {
return;
}