108 lines
3.3 KiB
PHP
108 lines
3.3 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Vlog extends HD_Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('biz/biz_visit_log_model');
|
|
$this->load->model('biz/biz_model');
|
|
$this->load->model("sys/sys_admin_model");
|
|
$this->load->model('app/licheb/app_licheb_users_model', 'app_user_model');
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$typeAry = $this->biz_model->type_ary();
|
|
$this->data['typeAry'] = $typeAry;
|
|
return $this->lists();
|
|
}
|
|
|
|
public function lists()
|
|
{
|
|
$params = $this->input->get();
|
|
$page = $this->input->get('page');
|
|
|
|
!$page && $page = 1;
|
|
$pageSize = 20;
|
|
$where = [];
|
|
if ($params['user_name']) {
|
|
$uids = 0;
|
|
$userList = $this->app_user_model->select(["uname like '%{$params['user_name']}%'" => null], '', '', '', 'id,uname');
|
|
if ($userList) {
|
|
$uids = implode(',', array_column($userList, 'id'));
|
|
}
|
|
$where["uid in ($uids)"] = null;
|
|
}
|
|
if ($params['biz_name']) {
|
|
$bizs = 0;
|
|
$bizList = $this->biz_model->select(["biz_name like '%{$params['biz_name']}%'" => null], '', '', '', 'id,biz_name');
|
|
if ($bizList) {
|
|
$bizs = implode(',', array_column($bizList, 'id'));
|
|
}
|
|
$where["biz_id in ($bizs)"] = null;
|
|
}
|
|
if ($params['type']) {
|
|
$type = intval($params['type']);
|
|
$where["biz_id in (select id from lc_biz where type={$type})"] = null;
|
|
}
|
|
if ($params['c_time']) {
|
|
$c_time = explode(' ~ ', $params['c_time']);
|
|
$c_time[0] && $where["createTime >="] = $c_time[0] . ' 00:00:00';
|
|
$c_time[1] && $where["createTime <="] = $c_time[1] . ' 23:59:59';
|
|
}
|
|
$rows = $this->biz_visit_log_model->select($where, 'id desc', $page, $pageSize);
|
|
$count = $this->biz_visit_log_model->count($where);
|
|
$list = [];
|
|
if ($rows) {
|
|
$bizIds = implode(',', array_unique(array_column($rows, 'biz_id')));
|
|
!$bizIds && $bizIds = 0;
|
|
$bizs = $this->biz_model->map('id', 'biz_name', ["id in ({$bizIds})" => null]);
|
|
|
|
$userIds = implode(',', array_unique(array_column($rows, 'uid')));
|
|
!$userIds && $userIds = 0;
|
|
$users = $this->app_user_model->map('id', 'uname', ["id in ({$userIds})" => null]);
|
|
foreach ($rows as $v) {
|
|
$v['url'] = explode('?', $v['url'])[0];
|
|
$v['biz_name'] = $bizs[$v['biz_id']] ?: '';
|
|
$v['username'] = $users[$v['uid']] ?: '';
|
|
$list[] = $v;
|
|
}
|
|
}
|
|
$this->data['params'] = $params;
|
|
$this->data['lists'] = $list;
|
|
$this->data['_title'] = '小程序访问日志';
|
|
$this->data['pager'] = array('count' => ceil($count / $pageSize), 'curr' => $page, 'totle' => $count);
|
|
$this->show_view('sys/vlog/lists', true);
|
|
}
|
|
|
|
public function add()
|
|
{
|
|
}
|
|
|
|
public function get()
|
|
{
|
|
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
}
|
|
|
|
public function batch()
|
|
{
|
|
|
|
}
|
|
|
|
public function export()
|
|
{
|
|
|
|
}
|
|
|
|
public function del()
|
|
{
|
|
|
|
}
|
|
}
|