|
|
<?php
|
|
|
// +----------------------------------------------------------------------
|
|
|
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
|
|
// +----------------------------------------------------------------------
|
|
|
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
|
|
// | 开源版本可自由商用,可去除界面版权logo
|
|
|
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
|
|
// | github下载:https://github.com/likeshop-github/likeadmin
|
|
|
// | 访问官网:https://www.likeadmin.cn
|
|
|
// | likeadmin团队 版权所有 拥有最终解释权
|
|
|
// +----------------------------------------------------------------------
|
|
|
// | author: likeadminTeam
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
namespace app\adminapi\lists\stat;
|
|
|
|
|
|
|
|
|
use app\adminapi\lists\BaseAdminDataLists;
|
|
|
use app\common\model\stat\LogRichStat;
|
|
|
use app\common\lists\ListsSearchInterface;
|
|
|
use app\common\lists\ListsExcelInterface;
|
|
|
use app\common\model\config\Resources;
|
|
|
|
|
|
|
|
|
/**
|
|
|
* LogRichStat列表
|
|
|
* Class LogRichStatLists
|
|
|
* @package app\adminapi\listsstat
|
|
|
*/
|
|
|
class LogRichStatLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
|
|
|
{
|
|
|
/**
|
|
|
* @notes 设置导出字段
|
|
|
* @return string[]
|
|
|
* @author 段誉
|
|
|
* @date 2021/12/29 10:08
|
|
|
*/
|
|
|
public function setExcelFields(): array
|
|
|
{
|
|
|
return [
|
|
|
'cid' => '区服ID',
|
|
|
'type' => '类型:1=充值,2=资源',
|
|
|
'key' => 'KEY',
|
|
|
'name' => '道具名称',
|
|
|
'free' => '免费获取',
|
|
|
'pay' => '充值金额或付费获取',
|
|
|
'consume' => '消耗',
|
|
|
'logdate' => '统计日期',
|
|
|
];
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @notes 设置导出文件名
|
|
|
* @return string
|
|
|
* @author 段誉
|
|
|
* @date 2021/12/29 10:08
|
|
|
*/
|
|
|
public function setFileName(): string
|
|
|
{
|
|
|
return '财富统计';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @notes 设置搜索条件
|
|
|
* @return \string[][]
|
|
|
* @author likeadmin
|
|
|
* @date 2024/04/12 11:05
|
|
|
*/
|
|
|
public function setSearch(): array
|
|
|
{
|
|
|
return [
|
|
|
'=' => ['cid', 'type', 'key'],
|
|
|
'between' => ['logdate'],
|
|
|
];
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @notes 获取列表
|
|
|
* @return array
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
* @throws \think\db\exception\DbException
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
* @author likeadmin
|
|
|
* @date 2024/04/12 11:05
|
|
|
*/
|
|
|
public function lists(): array
|
|
|
{
|
|
|
$reConfig = Resources::column('name', 'key');
|
|
|
$list = LogRichStat::where($this->searchWhere)
|
|
|
->field(['id', 'cid', 'type', 'key', 'free', 'pay', 'consume', 'logdate'])
|
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
|
->order(['id' => 'desc'])
|
|
|
->select()
|
|
|
->toArray();
|
|
|
if ($list) {
|
|
|
foreach ($list as $k => $l) {
|
|
|
$list[$k]['name'] = isset($reConfig[$l['key']]) ? $reConfig[$l['key']] : '';
|
|
|
}
|
|
|
}
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @notes 获取数量
|
|
|
* @return int
|
|
|
* @author likeadmin
|
|
|
* @date 2024/04/12 11:05
|
|
|
*/
|
|
|
public function count(): int
|
|
|
{
|
|
|
return LogRichStat::where($this->searchWhere)->count();
|
|
|
}
|
|
|
}
|