修改数据驾驶舱数据
This commit is contained in:
parent
a29809b72c
commit
53be594d64
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller\school\classes;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 功能访问记录管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Visit extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Visit模型对象
|
||||
* @var \app\admin\model\school\classes\Visit
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $qSwitch = true;
|
||||
protected $qFields = ["classes_lib_id","user_id","shop_id","classes_activity_id"];
|
||||
public function _initialize()
|
||||
{
|
||||
$this->model = new \app\admin\model\school\classes\Visit;
|
||||
parent::_initialize();
|
||||
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
$this->searchFields = ["id","classes_lib_id","classes_activity_id","lib.title","user.nickname","user.realname","user.mobile","activity.title"];
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['lib','activity',"user"])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
$row->getRelation('lib')->visible(['title','headimage']);
|
||||
$row->getRelation('activity')->visible(['title','headimage']);
|
||||
$row->getRelation('user')->visible(['nickname', 'realname', 'mobile', 'avatar']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller\school\classes;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 微信获取用户小程序访问分布数据
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class VisitDistribution extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* VisitDistribution模型对象
|
||||
* @var \app\admin\model\school\classes\VisitDistribution
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\school\classes\VisitDistribution;
|
||||
$this->view->assign("indexList", $this->model->getIndexList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Classes_lib_id' => '课程id',
|
||||
'Classes_activity_id' => '活动id',
|
||||
'Status' => '访问类型',
|
||||
'Status 1' => '课程',
|
||||
'Set status to 1' => '设为课程',
|
||||
'Status 2' => '活动',
|
||||
'Set status to 2' => '设为活动',
|
||||
'Createtime' => '访问时间',
|
||||
'Lib.title' => '课程标题',
|
||||
'Lib.headimage' => '课程头图',
|
||||
'Activity.title' => '活动标题',
|
||||
'Activity.headimage' => '活动头图',
|
||||
'User.nickname' => '访问用户昵称(空为游客)',
|
||||
'User.realname' => '访问用户真实姓名',
|
||||
'User.avatar' => '访问用户头像',
|
||||
'User.mobile' => '访问用户手机号',
|
||||
];
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Index' => '分布类型',
|
||||
'Index access_source_session_cnt' => '访问来源分布',
|
||||
'Set index to access_source_session_cnt'=> '设为访问来源分布',
|
||||
'Index access_staytime_info' => '访问时长分布',
|
||||
'Set index to access_staytime_info'=> '设为访问时长分布',
|
||||
'Index access_depth_info' => '访问深度的分布',
|
||||
'Set index to access_depth_info' => '设为访问深度的分布',
|
||||
'Ref_date' => '日期格式为yyyymmdd',
|
||||
'Key' => '场景id',
|
||||
'Value' => '该场景id访问pv',
|
||||
'Begin_date' => '开始日期格式为yyyymmdd',
|
||||
'End_date' => '结束日期格式为yyyymmdd',
|
||||
'Statistics_time' => '统计时间',
|
||||
'Miniapp_id' => '微信小程序id',
|
||||
'Createtime' => '创建时间'
|
||||
];
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\model\school\classes;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Visit extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'school_visit';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function lib()
|
||||
{
|
||||
return $this->belongsTo('Lib', 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function activity()
|
||||
{
|
||||
return $this->belongsTo('Activity', 'classes_activity_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\model\school\classes;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class VisitDistribution extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'school_visit_distribution';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'index_text',
|
||||
'statistics_time_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getIndexList()
|
||||
{
|
||||
return ['access_source_session_cnt' => __('Index access_source_session_cnt'), 'access_staytime_info' => __('Index access_staytime_info'), 'access_depth_info' => __('Index access_depth_info')];
|
||||
}
|
||||
|
||||
|
||||
public function getIndexTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['index']) ? $data['index'] : '');
|
||||
$list = $this->getIndexList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatisticsTimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['statistics_time']) ? $data['statistics_time'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setStatisticsTimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\validate\school\classes;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Visit extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\validate\school\classes;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class VisitDistribution extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/lib/index" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_activity_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-classes_activity_id" data-rule="required" data-source="school/classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<div class="radio">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,33 @@
|
|||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/lib/index" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$row.classes_lib_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_activity_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-classes_activity_id" data-rule="required" data-source="school/classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="{$row.classes_activity_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<div class="radio">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,46 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
|
||||
<div class="panel-heading">
|
||||
{:build_heading(null,FALSE)}
|
||||
<ul class="nav nav-tabs" data-field="status">
|
||||
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
|
||||
{foreach name="statusList" item="vo"}
|
||||
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/classes/visit/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
|
||||
<!-- <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/classes/visit/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('school/classes/visit/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
<!-- <div class="dropdown btn-group {:$auth->check('school/classes/visit/multi')?'':'hide'}">-->
|
||||
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
|
||||
<!-- <ul class="dropdown-menu text-left" role="menu">-->
|
||||
<!-- {foreach name="statusList" item="vo"}-->
|
||||
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li>-->
|
||||
<!-- {/foreach}-->
|
||||
<!-- </ul>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="0"
|
||||
data-operate-del="{:$auth->check('school/classes/visit/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,63 @@
|
|||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Index')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<select id="c-index" class="form-control selectpicker" name="row[index]">
|
||||
{foreach name="indexList" item="vo"}
|
||||
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Ref_date')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-ref_date" class="form-control" name="row[ref_date]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Key')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-key" class="form-control" name="row[key]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Value')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-value" class="form-control" name="row[value]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Begin_date')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-begin_date" class="form-control" name="row[begin_date]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('End_date')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-end_date" class="form-control" name="row[end_date]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Statistics_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-statistics_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[statistics_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Miniapp_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-miniapp_id" data-rule="required" data-source="miniapp/index" class="form-control selectpage" name="row[miniapp_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,63 @@
|
|||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Index')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<select id="c-index" class="form-control selectpicker" name="row[index]">
|
||||
{foreach name="indexList" item="vo"}
|
||||
<option value="{$key}" {in name="key" value="$row.index"}selected{/in}>{$vo}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Ref_date')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-ref_date" class="form-control" name="row[ref_date]" type="text" value="{$row.ref_date|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Key')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-key" class="form-control" name="row[key]" type="text" value="{$row.key|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Value')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-value" class="form-control" name="row[value]" type="text" value="{$row.value|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Begin_date')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-begin_date" class="form-control" name="row[begin_date]" type="text" value="{$row.begin_date|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('End_date')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-end_date" class="form-control" name="row[end_date]" type="text" value="{$row.end_date|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Statistics_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-statistics_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[statistics_time]" type="text" value="{:$row.statistics_time?datetime($row.statistics_time):''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Miniapp_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-miniapp_id" data-rule="required" data-source="miniapp/index" class="form-control selectpage" name="row[miniapp_id]" type="text" value="{$row.miniapp_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,135 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
|
||||
<div class="panel-heading">
|
||||
{:build_heading(null,FALSE)}
|
||||
<ul class="nav nav-tabs" data-field="index">
|
||||
<li class="{:$Think.get.index === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
|
||||
{foreach name="indexList" item="vo"}
|
||||
<li class="{:$Think.get.index === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
|
||||
<div class="alert alert-success-light">
|
||||
<b ><span style="color: red">
|
||||
|
||||
访问来源 key 对应关系(index='access_source_session_cnt'),场景值说明参见场景值<br>
|
||||
key 访问来源 对应场景值<br>
|
||||
1 小程序历史列表 1001 1002 1004<br>
|
||||
2 搜索 1005 1006 1027 1042 1053 1106 1108 1132<br>
|
||||
3 会话 1007 1008 1044 1093 1094 1096<br>
|
||||
4 扫一扫二维码 1011 1025 1047 1105 1124 1150<br>
|
||||
5 公众号主页 1020<br>
|
||||
6 聊天顶部 1022<br>
|
||||
7 系统桌面 1023 1113 1114 1117<br>
|
||||
8 小程序主页 1024 1135<br>
|
||||
9 附近的小程序 1026 1033 1068<br>
|
||||
11 模板消息 1014 1043 1107 1162<br>
|
||||
12 客服消息 1021<br>
|
||||
13 公众号菜单 1035 1102 1130<br>
|
||||
14 APP分享 1036<br>
|
||||
15 支付完成页 1034 1060 1072 1097 1109 1137 1149<br>
|
||||
16 长按识别二维码 1012 1048 1050 1125<br>
|
||||
17 相册选取二维码 1013 1049 1126<br>
|
||||
18 公众号文章 1058 1091<br>
|
||||
19 钱包 1019 1057 1061 1066 1070 1071<br>
|
||||
20 卡包 1028 1128 1148<br>
|
||||
21 小程序内卡券 1029 1062<br>
|
||||
22 其他小程序 1037<br>
|
||||
23 其他小程序返回 1038<br>
|
||||
24 卡券适用门店列表 1052<br>
|
||||
25 搜索框快捷入口 1054<br>
|
||||
26 小程序客服消息 1073 1081<br>
|
||||
27 公众号下发 1074 1076 1082 1152<br>
|
||||
28 系统会话菜单 1080 1083 1088<br>
|
||||
29 任务栏-最近使用 1089<br>
|
||||
30 长按小程序菜单圆点 1085 1090 1147<br>
|
||||
31 连wifi成功页 1064 1078<br>
|
||||
32 城市服务 1092<br>
|
||||
33 微信广告 1045 1046 1067 1084 1095<br>
|
||||
34 其他移动应用 1065 1069 1111 1140<br>
|
||||
35 发现入口-我的小程序 1003 1103<br>
|
||||
36 任务栏-我的小程序 1104<br>
|
||||
37 微信圈子 1138 1163<br>
|
||||
38 手机充值 1098<br>
|
||||
39 H5 1018 1055<br>
|
||||
40 插件 1040 1041 1099<br>
|
||||
41 大家在用 1118 1145<br>
|
||||
42 发现页 1112 1141 1142 1143<br>
|
||||
43 浮窗 1131<br>
|
||||
44 附近的人 1075 1134<br>
|
||||
45 看一看 1115<br>
|
||||
46 朋友圈 1009 1110 1154 1155<br>
|
||||
47 企业微信 1119 1120 1121 1122 1123 1156<br>
|
||||
48 视频 1136 1144<br>
|
||||
49 收藏 1010<br>
|
||||
50 微信红包 1100<br>
|
||||
51 微信游戏中心 1079 1127<br>
|
||||
52 摇一摇 1039 1077<br>
|
||||
53 公众号导购消息 1157<br>
|
||||
54 识物 1153<br>
|
||||
55 小程序订单 1151<br>
|
||||
56 小程序直播 1161<br>
|
||||
57 群工具 1158 1159 1160<br>
|
||||
10 其他 除上述外其余场景值<br>
|
||||
访问来源 key 对应关系(index='access_staytime_info')<br>
|
||||
key 访问时长<br>
|
||||
1 0-2s<br>
|
||||
2 3-5s<br>
|
||||
3 6-10s<br>
|
||||
4 11-20s<br>
|
||||
5 20-30s<br>
|
||||
6 30-50s<br>
|
||||
7 50-100s<br>
|
||||
8 >100s<br>
|
||||
平均访问深度 key 对应关系(index='access_depth_info')<br>
|
||||
key 访问时长<br>
|
||||
1 1 页<br>
|
||||
2 2 页<br>
|
||||
3 3 页<br>
|
||||
4 4 页<br>
|
||||
5 5 页<br>
|
||||
6 6-10 页<br>
|
||||
7 >10 页<br>
|
||||
</span></b>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/classes/visit_distribution/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
|
||||
<!-- <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/classes/visit_distribution/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('school/classes/visit_distribution/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
|
||||
|
||||
<!-- <div class="dropdown btn-group {:$auth->check('school/classes/visit_distribution/multi')?'':'hide'}">-->
|
||||
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
|
||||
<!-- <ul class="dropdown-menu text-left" role="menu">-->
|
||||
<!-- {foreach name="indexList" item="vo"}-->
|
||||
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="index={$key}">{:__('Set index to ' . $key)}</a></li>-->
|
||||
<!-- {/foreach}-->
|
||||
<!-- </ul>-->
|
||||
<!-- </div>-->
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="0"
|
||||
data-operate-del="{:$auth->check('school/classes/visit_distribution/del')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -5,6 +5,7 @@ use addons\epay\library\Service;
|
|||
use app\common\controller\Api;
|
||||
use app\common\library\NightSchoolBigData;
|
||||
use app\common\model\school\classes\order\Order;
|
||||
use app\common\model\school\classes\VisitDistribution;
|
||||
use bw\UrlLock;
|
||||
use think\Cache;
|
||||
|
||||
|
@ -70,6 +71,8 @@ class Crontab extends Api
|
|||
$res = $weMiniTotal->getWeanalysisAppidVisitdistribution($last_days_start_date, $last_days_end_date);
|
||||
$cacheNmae = 'getWeanalysisAppidVisitdistribution' . $last_days_start_date . $last_days_end_date;
|
||||
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
|
||||
VisitDistribution::setlog($last_days_start_date,$last_days_end_date,$res);
|
||||
|
||||
//微信小程序月趋势
|
||||
$res = $weMiniTotal->getWeanalysisAppidMonthlyVisittrend($month_start_date, $month_end_date);
|
||||
$cacheNmae = 'getWeanalysisAppidMonthlyVisittrend' . $month_start_date . $month_end_date;
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace app\api\controller;
|
|||
|
||||
use addons\epay\library\Service;
|
||||
use app\common\controller\Api;
|
||||
use app\common\model\school\classes\VisitDistribution;
|
||||
use app\common\model\style\HomeImages;
|
||||
use think\Cache;
|
||||
|
||||
|
@ -410,6 +411,7 @@ class WechatUtil extends Api
|
|||
|
||||
// 缓存在3600秒之后过期
|
||||
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
|
||||
VisitDistribution::setlog($begin_date,$end_date,$res);
|
||||
|
||||
} catch (\Exception $e){
|
||||
// Log::log($e->getMessage());
|
||||
|
@ -576,4 +578,39 @@ class WechatUtil extends Api
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(查询微信报错rid信息)
|
||||
* @ApiSummary(本接口用于查询调用公众号/小程序/第三方平台等接口报错返回的rid详情信息,辅助开发者高效定位问题)
|
||||
* @ApiMethod(POST)
|
||||
* @ApiParams (name="rid", type="string", required=true, description="调用接口报错返回的rid")
|
||||
* @ApiReturn({
|
||||
"code" => 1,
|
||||
"msg" => "获取成功",
|
||||
"data" => {}
|
||||
*})
|
||||
*/
|
||||
public function getRidInfo() {
|
||||
$rid = $this->request->post('rid/s',0);
|
||||
$cacheNmae = 'getRidInfo' . $rid ;
|
||||
try {
|
||||
// 实例对应的接口对象
|
||||
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
|
||||
$res = $weMiniTotal->getRidInfo($rid);
|
||||
|
||||
// 缓存在3600秒之后过期
|
||||
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
|
||||
|
||||
} catch (\Exception $e){
|
||||
// Log::log($e->getMessage());
|
||||
$res = Cache::get($cacheNmae);
|
||||
if($res){
|
||||
$this->success('生成成功', $res);
|
||||
}else{
|
||||
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||
}
|
||||
}
|
||||
$this->success('生成成功', $res);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -345,4 +345,68 @@ class BigData extends Api
|
|||
$this->success('返回成功', $res);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(得到前30天日期)
|
||||
* @ApiSummary(得到前30天日期)
|
||||
* @ApiParams(name = "time", type = "string",required=false,description = "计算的当前时间戳")
|
||||
* @ApiMethod(GET)
|
||||
* @ApiReturn({
|
||||
"code" => 1,
|
||||
"msg" => "获取成功",
|
||||
"data" => {}
|
||||
*})
|
||||
*/
|
||||
public function getLastThirtyDaysDate()
|
||||
{
|
||||
|
||||
try{
|
||||
$lock = new UrlLock(1,"getLastThirtyDaysDate-data-lock-suffix",120,"您的请求过于频繁,请您稍后再试!请求最大锁定间隔5秒/一次!");
|
||||
$lock->lock();
|
||||
$N = $this->request->request("time/s",0);
|
||||
$res = NightSchoolBigData::getLastThirtyDaysDate($N);
|
||||
|
||||
}catch (\Throwable $e){
|
||||
$lock->free();
|
||||
// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$lock->free();
|
||||
|
||||
$this->success('返回成功', $res);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(访问来源统计)
|
||||
* @ApiSummary(访问来源统计)
|
||||
* @ApiParams(name = "start_time", type = "string",required=false,description = "开始时间")
|
||||
* @ApiParams(name = "end_time", type = "string",required=false,description = "结束时间")
|
||||
* @ApiMethod(GET)
|
||||
* @ApiReturn({
|
||||
"code" => 1,
|
||||
"msg" => "获取成功",
|
||||
"data" => {}
|
||||
*})
|
||||
*/
|
||||
public function visitDistribution()
|
||||
{
|
||||
|
||||
try{
|
||||
$lock = new UrlLock(1,"visitDistribution-data-lock-suffix",120,"您的请求过于频繁,请您稍后再试!请求最大锁定间隔5秒/一次!");
|
||||
$lock->lock();
|
||||
$start_time = $this->request->request("start_time/s",0);
|
||||
$end_time = $this->request->request("end_time/s",0);
|
||||
$res = NightSchoolBigData::visitDistribution($start_time,$end_time);
|
||||
|
||||
}catch (\Throwable $e){
|
||||
$lock->free();
|
||||
// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
$lock->free();
|
||||
|
||||
$this->success('返回成功', $res);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ use app\common\model\school\classes\ClassesLib;
|
|||
use app\common\model\school\classes\hourorder\Order;
|
||||
use app\common\model\school\classes\Teacher;
|
||||
use app\common\model\school\classes\Type;
|
||||
use app\common\model\school\classes\Visit;
|
||||
use app\common\model\school\classes\VisitDistribution;
|
||||
use app\common\model\User;
|
||||
|
||||
/**
|
||||
|
@ -219,6 +221,7 @@ class NightSchoolBigData extends BaseModel
|
|||
$type_data["activity_num_text"] = "活动热度";
|
||||
$type_data["activity_sign_num"][] = \app\common\model\school\classes\activity\order\Order::where( "createtime",'between',[$time["start"],$time["end"]])->where("status","not in",["-3","6"])->count();
|
||||
$type_data["activity_num"][] = Activity::where( "createtime",'between',[$time["start"],$time["end"]])->count();
|
||||
$type_data["activity_views"][] = Visit::where("status",'2')->where( "createtime",'between',[$time["start"],$time["end"]])->count();
|
||||
}
|
||||
|
||||
return compact("dates","type_data");
|
||||
|
@ -241,29 +244,47 @@ class NightSchoolBigData extends BaseModel
|
|||
$time = strtotime("-1 day",$time);
|
||||
}
|
||||
|
||||
//得到当前是几号
|
||||
$day = date("d",$time);
|
||||
//用7进行除余,得到余数和整数商
|
||||
$mod = $day%7;
|
||||
//进行除7,截取整数部分(不需要向下或向上取整!)
|
||||
$day = $day-$mod;
|
||||
$last_seven = bcdiv($day,7,0);
|
||||
//如果=0.取上个月的最后一个七天
|
||||
if ($last_seven<=0){
|
||||
//得到上月最后一天 date('Y-m-d H:i');
|
||||
$last_mouth_last_day = strtotime(date("Y-m-01 00:00:00",$time))-1;
|
||||
$start_date = date("Ymd",strtotime("-6 days",$last_mouth_last_day));
|
||||
$end_date = date("Ymd",$last_mouth_last_day);
|
||||
}
|
||||
// //得到当前是几号
|
||||
// $day = date("d",$time);
|
||||
// //用7进行除余,得到余数和整数商
|
||||
// $mod = $day%7;
|
||||
// //进行除7,截取整数部分(不需要向下或向上取整!)
|
||||
// $day = $day-$mod;
|
||||
// $last_seven = bcdiv($day,7,0);
|
||||
// //如果=0.取上个月的最后一个七天
|
||||
// if ($last_seven<=0){
|
||||
// //得到上月最后一天 date('Y-m-d H:i');
|
||||
// $last_mouth_last_day = strtotime(date("Y-m-01 00:00:00",$time))-1;
|
||||
// $start_date = date("Ymd",strtotime("-6 days",$last_mouth_last_day));
|
||||
// $end_date = date("Ymd",$last_mouth_last_day);
|
||||
// }
|
||||
//如果>0,则取本月第$last_seven 个七天
|
||||
if ($last_seven>0){
|
||||
$last_seven_days = $last_seven * 7;
|
||||
// if ($last_seven>0){
|
||||
// $last_seven_days = $last_seven * 7;
|
||||
$start_date = date("Ymd",strtotime("-6 days",$time));
|
||||
$end_date = date("Ymd",$time);
|
||||
|
||||
// $start_date = date("Ymd",strtotime("+".($last_seven_days-7)." days",strtotime(date("Y-m-01 00:00:00",$time))));
|
||||
// $end_date = date("Ymd",strtotime("+".($last_seven_days-1)." days",strtotime(date("Y-m-01 00:00:00",$time))));
|
||||
// }
|
||||
return compact("start_date","end_date");
|
||||
}
|
||||
|
||||
|
||||
public static function getLastThirtyDaysDate($time=null){
|
||||
//如果是非数字,转成时间戳
|
||||
if ($time &&!is_numeric($time)){
|
||||
$time = strtotime($time);
|
||||
}
|
||||
if(!$time)$time = time();
|
||||
//时间如果是当天,需要减去一天
|
||||
if (date("Ymd",$time)==date("Ymd",time())){
|
||||
$time = strtotime("-1 day",$time);
|
||||
}
|
||||
|
||||
$start_date = date("Ymd",strtotime("-29 days",$time));
|
||||
$end_date = date("Ymd",$time);
|
||||
|
||||
return compact("start_date","end_date");
|
||||
}
|
||||
|
||||
|
@ -355,4 +376,24 @@ class NightSchoolBigData extends BaseModel
|
|||
}
|
||||
|
||||
|
||||
public static function visitDistribution($start_time=null,$end_time=null){
|
||||
$wheretime= [[]];
|
||||
if($start_time && $end_time){
|
||||
if(!is_numeric($start_time)) $start_time = strtotime($start_time);
|
||||
if(!is_numeric($end_time)) $end_time = strtotime($end_time);
|
||||
$wheretime= [ "statistics_time",'between',[$start_time,$end_time]];
|
||||
}
|
||||
$res = [];
|
||||
$data = [];
|
||||
$data["46"] = VisitDistribution::where("index","access_source_session_cnt")->where("key","46")->sum("value");
|
||||
|
||||
$data["29"] = VisitDistribution::where("index","access_source_session_cnt")->where("key","29")->sum("value");
|
||||
$data["2"] = VisitDistribution::where("index","access_source_session_cnt")->where("key","2")->sum("value");
|
||||
$data["total"] = VisitDistribution::where("index","access_source_session_cnt")->sum("value");
|
||||
$data["sum"] = $data["46"] + $data["29"] + $data["2"];
|
||||
$res['access_source_session_cnt'] = $data;
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace app\common\listener\classes;
|
||||
use app\common\model\manystore\Shop;
|
||||
use app\common\model\school\classes\Visit;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
use app\common\model\User;
|
||||
|
@ -186,7 +187,14 @@ class ActivityHook
|
|||
public function activityViewAfter(&$params)
|
||||
{
|
||||
['activity' => $activity,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
//访问记录
|
||||
Visit::create([
|
||||
"classes_lib_id"=>0,
|
||||
"classes_activity_id"=>$activity["id"],
|
||||
"shop_id"=>$activity["shop_id"],
|
||||
"status"=>'2',
|
||||
"user_id"=>$user_id,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
namespace app\common\listener\classes;
|
||||
use app\common\model\dyqc\ManystoreShop;
|
||||
use app\common\model\school\classes\Teacher;
|
||||
use app\common\model\school\classes\Visit;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
|
||||
|
@ -174,7 +175,14 @@ class ClassesHook
|
|||
public function classesViewAfter(&$params)
|
||||
{
|
||||
['classes' => $classes,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
|
||||
//访问记录
|
||||
Visit::create([
|
||||
"classes_lib_id"=>$classes["id"],
|
||||
"shop_id"=>$classes["shop_id"],
|
||||
"classes_activity_id"=>0,
|
||||
"status"=>'1',
|
||||
"user_id"=>$user_id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function classesCollectSuccessAfter(&$params)
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace app\common\model\school\classes;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\school\classes\activity\Activity;
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Visit extends BaseModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'school_visit';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function lib()
|
||||
{
|
||||
return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function activity()
|
||||
{
|
||||
return $this->belongsTo(Activity::class, 'classes_activity_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
namespace app\common\model\school\classes;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
|
||||
class VisitDistribution extends BaseModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'school_visit_distribution';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'index_text',
|
||||
'statistics_time_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getIndexList()
|
||||
{
|
||||
return ['access_source_session_cnt' => __('Index access_source_session_cnt'), 'access_staytime_info' => __('Index access_staytime_info'), 'access_depth_info' => __('Index access_depth_info')];
|
||||
}
|
||||
|
||||
|
||||
public function getIndexTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['index']) ? $data['index'] : '');
|
||||
$list = $this->getIndexList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getStatisticsTimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['statistics_time']) ? $data['statistics_time'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setStatisticsTimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
public static function setlog($begin_date,$end_date,$res){
|
||||
if(!isset($res["ref_date"]) || !isset($res["list"]))return false;
|
||||
//statistics_time = 开始时间的时间戳
|
||||
//begin_date 和 end_date如果带字符串‘-’ 则去除
|
||||
$begin_date = str_replace("-","",$begin_date);
|
||||
$end_date = str_replace("-","",$end_date);
|
||||
$data = [
|
||||
"ref_date"=>$res["ref_date"],
|
||||
"begin_date" =>$begin_date,
|
||||
"end_date" =>$end_date,
|
||||
"miniapp_id"=>config("site.wx_miniapp_id"),
|
||||
"statistics_time" => strtotime($res["ref_date"]." 0:0:0"),
|
||||
];
|
||||
|
||||
$list = $res["list"];
|
||||
foreach ($list as $k=>$v){
|
||||
if(isset($v['index']) && isset($v['item_list'])){
|
||||
foreach ($v['item_list'] as $kk=>$vv){
|
||||
$data["index"] = $v['index'];
|
||||
$data["key"] = $vv['key'];
|
||||
$data["value"] = $vv['value'];
|
||||
// var_dump(!self::where($data)->find());
|
||||
if(!self::where($data)->find()){
|
||||
|
||||
self::create($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ return [
|
|||
* CDN地址
|
||||
*/
|
||||
'cdnurl' => 'https://testy1.hschool.com.cn',
|
||||
// 'cdnurl' => '',
|
||||
/**
|
||||
* 文件保存格式
|
||||
*/
|
||||
|
|
|
@ -148,6 +148,21 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
|||
// return row.status == '2'||row.status == '3';
|
||||
// }
|
||||
},
|
||||
{
|
||||
name: 'visit',
|
||||
text: __('查看用户访问记录'),
|
||||
title: __('查看用户访问记录'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-handshake-o',
|
||||
dropdown : '更多',
|
||||
url: visit_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.classes_evaluate_id;
|
||||
// }
|
||||
},
|
||||
|
||||
{
|
||||
name: 'manystore',
|
||||
|
@ -422,5 +437,9 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
|||
return 'school/classes/activity/order/order/index?classes_activity_id='+row.id;
|
||||
}
|
||||
|
||||
var visit_url = function (row,dom) {
|
||||
return 'school/classes/visit/index?classes_activity_id='+row.id;
|
||||
}
|
||||
|
||||
return Controller;
|
||||
});
|
||||
|
|
|
@ -272,6 +272,22 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
|||
// }
|
||||
},
|
||||
|
||||
{
|
||||
name: 'visit',
|
||||
text: __('查看用户访问记录'),
|
||||
title: __('查看用户访问记录'),
|
||||
classname: 'btn btn-dialog',
|
||||
icon: 'fa fa-handshake-o',
|
||||
dropdown : '更多',
|
||||
url: visit_url,
|
||||
callback: function (data) {
|
||||
|
||||
},
|
||||
// visible: function (row) {
|
||||
// return row.classes_evaluate_id;
|
||||
// }
|
||||
},
|
||||
|
||||
{
|
||||
name: 'manystore',
|
||||
text: __('查看机构'),
|
||||
|
@ -637,6 +653,10 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
|
|||
return 'manystore/index/index?shop_id='+row.shop_id;
|
||||
}
|
||||
|
||||
var visit_url = function (row,dom) {
|
||||
return 'school/classes/visit/index?classes_lib_id='+row.id;
|
||||
}
|
||||
|
||||
|
||||
return Controller;
|
||||
});
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'school/classes/visit/index' + location.search,
|
||||
add_url: 'school/classes/visit/add'+ location.search,
|
||||
edit_url: 'school/classes/visit/edit'+ location.search,
|
||||
del_url: 'school/classes/visit/del',
|
||||
multi_url: 'school/classes/visit/multi',
|
||||
import_url: 'school/classes/visit/import',
|
||||
table: 'school_visit',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
fixedRightNumber: 1,
|
||||
fixedColumns: true,
|
||||
asyndownload: true,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'user_id', title: __('用户id'),visible:false},
|
||||
{field: 'classes_lib_id', title: __('Classes_lib_id')},
|
||||
{field: 'classes_activity_id', title: __('Classes_activity_id')},
|
||||
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
|
||||
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
|
||||
{field: 'user.realname', title: __('User.realname'),visible:false, operate: 'LIKE'},
|
||||
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
|
||||
{field: 'user.avatar', title: __('User.avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'lib.title', title: __('Lib.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'lib.headimage', title: __('Lib.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'activity.title', title: __('Activity.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'activity.headimage', title: __('Activity.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
|
@ -0,0 +1,61 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'school/classes/visit_distribution/index' + location.search,
|
||||
add_url: 'school/classes/visit_distribution/add',
|
||||
edit_url: 'school/classes/visit_distribution/edit',
|
||||
del_url: 'school/classes/visit_distribution/del',
|
||||
multi_url: 'school/classes/visit_distribution/multi',
|
||||
import_url: 'school/classes/visit_distribution/import',
|
||||
table: 'school_visit_distribution',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
{field: 'index', title: __('Index'), searchList: {"access_source_session_cnt":__('Index access_source_session_cnt'),"access_staytime_info":__('Index access_staytime_info'),"access_depth_info":__('Index access_depth_info')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'ref_date', title: __('Ref_date'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'key', title: __('Key'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'value', title: __('Value'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'begin_date', title: __('Begin_date'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'end_date', title: __('End_date'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'statistics_time', title: __('Statistics_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'miniapp_id', title: __('Miniapp_id'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
Loading…
Reference in New Issue