Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.9 kB
1
Indexable
Never
//cart.php

$addLog = [
            'platform'  => 'web',
            'url'       => $_SERVER['REQUEST_URI']??'',
            'server'    => $_SERVER,
            'session'   => $this->session->data,
            'customer'  => $this->customer->getCustomerUid(),
        ];

        $currentRedisData = $this->abstract_session->get('carts.user_'.$this->customer->getCustomerUid());

        $addLog['redis'] = $currentRedisData;

        $addLog['setStatus'] = 0;

        if (isset($currentRedisData['session']['cart']) && !isMobileService()) {
            $addLog['setStatus'] = 1;
            $this->session->data['cart'] = unserialize($currentRedisData['session']['cart']);
            $this->session->data['cart_info'] = unserialize($currentRedisData['session']['cart_info']);
        }

        logMongo('app_warranty_test', $addLog);

//mobile_cart.php

private function initCart(): void
    {
        if (!isset($this->session->data['cart']) || !is_array($this->session->data['cart'])) {
            $this->session->data['cart'] = [];
            $this->session->data['cart_info'] = [];
        }

        $addLog = [
            'platform'  => 'app',
            'url'       => $_SERVER['REQUEST_URI']??'',
            'server'    => $_SERVER,
            'session'   => $this->session->data,
            'customer'  => $this->customer->getCustomerUid(),
        ];

        $currentRedisData = $this->abstract_session->get('carts.user_'.$this->customer->getCustomerUid());

        $addLog['redis'] = $currentRedisData;

        $addLog['setStatus'] = 0;

        if (isset($currentRedisData['session']['cart']) && isMobileService()) {
            $addLog['setStatus'] = 1;
            $this->session->data['cart'] = unserialize($currentRedisData['session']['cart']);
            $this->session->data['cart_info'] = unserialize($currentRedisData['session']['cart_info']);
        }

        logMongo('app_warranty_test', $addLog);
    }