feat(forum): guest cash purchase for topic and plate follow
- Reuse pay_no_logged_in / pay_cookie_day; generalized guest cookie helpers - Topic + plate cash: guest preview/purchase (no balance), order.user_id=0, cookie unlock - View gates: can_view_topic pay + plate follow accept signed guest cookies - Templates: guest buy/follow CTAs; poll endpoint allows plate_follow guest orders
This commit is contained in:
1 parent
a9150862ef
commit
6b6314b033
9 files changed
+274
-70
No files matched your search
@@ -209,6 +209,13 @@ trait AKSRT_Forum_Board_Service_Part_2 {
|
||||
}
|
||||
|
||||
if ($user_id <= 0) {
|
||||
// Guest cash follow unlock via signed cookie (money follow pay only).
|
||||
if ($allow_view === 'follow'
|
||||
&& function_exists('aksrt_guest_has_plate_follow_access')
|
||||
&& aksrt_guest_has_plate_follow_access($plate_id)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -282,9 +289,13 @@ trait AKSRT_Forum_Board_Service_Part_2 {
|
||||
* Check if a user is following a plate (§7.2 关注).
|
||||
*/
|
||||
public function is_user_following_plate(int $user_id, int $plate_id): bool {
|
||||
if ($user_id <= 0) {
|
||||
if ($plate_id <= 0) {
|
||||
return false;
|
||||
}
|
||||
if ($user_id <= 0) {
|
||||
return function_exists('aksrt_guest_has_plate_follow_access')
|
||||
&& aksrt_guest_has_plate_follow_access($plate_id);
|
||||
}
|
||||
$follow_list = get_user_meta($user_id, 'aksrt_follow_plate', true);
|
||||
if (!is_array($follow_list)) {
|
||||
return false;
|
||||
|
||||
@@ -220,7 +220,8 @@ trait AKSRT_Forum_Topic_Service_Part_3 {
|
||||
|
||||
if ($visibility === AKSRT_Forum::VISIBILITY_PAY) {
|
||||
if ($viewer_user_id <= 0) {
|
||||
return false;
|
||||
return function_exists('aksrt_guest_has_paid_access')
|
||||
&& aksrt_guest_has_paid_access((int) $post->ID);
|
||||
}
|
||||
return $this->has_user_paid_topic($viewer_user_id, (int) $post->ID);
|
||||
}
|
||||
@@ -514,9 +515,12 @@ trait AKSRT_Forum_Topic_Service_Part_3 {
|
||||
* Paid access for VISIBILITY_PAY: unlock list OR paid resource order OR VIP free.
|
||||
*/
|
||||
public function has_user_paid_topic(int $user_id, int $topic_id): bool {
|
||||
if ($user_id <= 0 || $topic_id <= 0) {
|
||||
if ($topic_id <= 0) {
|
||||
return false;
|
||||
}
|
||||
if ($user_id <= 0) {
|
||||
return function_exists('aksrt_guest_has_paid_access') && aksrt_guest_has_paid_access($topic_id);
|
||||
}
|
||||
|
||||
if ($this->has_user_unlocked_topic($user_id, $topic_id)) {
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user