https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/laciasmara.com/public_html/shop/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/laciasmara.com/public_html/shop/application/models/Promotional_campaign_log_m.php
<?php
defined('BASEPATH') or exit('No direct script access allowed');

/**
 * Promotional Campaign Log Model
 * For tracking user interactions with campaigns
 * 
 * Location: application/models/Promotional_campaign_log_model.php
 */
class Promotional_campaign_log_m extends CI_Model
{
    protected $table = 'promotional_campaign_logs';

    /**
     * Insert log entry
     * 
     * @param array $data
     * @return bool
     */
    public function insert($data)
    {
        return $this->db->insert($this->table, $data);
    }

    /**
     * Get logs for specific campaign
     * 
     * @param int $campaign_id
     * @param array $filters [action_type, date_from, date_to, limit]
     * @return array
     */
    public function get_campaign_logs($campaign_id, $filters = [])
    {
        $this->db->where('campaign_id', $campaign_id);

        if (isset($filters['action_type'])) {
            $this->db->where('action_type', $filters['action_type']);
        }

        if (isset($filters['date_from'])) {
            $this->db->where('accessed_at >=', $filters['date_from']);
        }

        if (isset($filters['date_to'])) {
            $this->db->where('accessed_at <=', $filters['date_to']);
        }

        $this->db->order_by('accessed_at', 'DESC');

        if (isset($filters['limit'])) {
            $this->db->limit($filters['limit']);
        }

        return $this->db->get($this->table)->result();
    }

    /**
     * Get unique visitors count
     * 
     * @param int $campaign_id
     * @return int
     */
    public function get_unique_visitors($campaign_id)
    {
        return $this->db
            ->distinct()
            ->select('session_id')
            ->where('campaign_id', $campaign_id)
            ->where('action_type', 'view')
            ->get($this->table)
            ->num_rows();
    }

    /**
     * Get top viewed products in campaign
     * 
     * @param int $campaign_id
     * @param int $limit
     * @return array
     */
    public function get_top_products($campaign_id, $limit = 10)
    {
        return $this->db
            ->select('p.id, p.name, p.image, COUNT(*) as view_count')
            ->from($this->table . ' cl')
            ->join('products p', 'p.id = cl.product_id')
            ->where('cl.campaign_id', $campaign_id)
            ->where('cl.action_type', 'click_product')
            ->where('cl.product_id IS NOT NULL')
            ->group_by('cl.product_id')
            ->order_by('view_count', 'DESC')
            ->limit($limit)
            ->get()
            ->result();
    }

    /**
     * Get hourly traffic for campaign
     * 
     * @param int $campaign_id
     * @param int $days
     * @return array
     */
    public function get_hourly_traffic($campaign_id, $days = 7)
    {
        $date_from = date('Y-m-d H:i:s', strtotime("-{$days} days"));

        return $this->db
            ->select('DATE_FORMAT(accessed_at, "%Y-%m-%d %H:00:00") as hour, COUNT(*) as count')
            ->where('campaign_id', $campaign_id)
            ->where('action_type', 'view')
            ->where('accessed_at >=', $date_from)
            ->group_by('hour')
            ->order_by('hour', 'ASC')
            ->get($this->table)
            ->result();
    }
}

https://t.me/RX1948 - 2025