You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.7 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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\log;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\log\ResourceLogDaodao;
use app\common\lists\ListsSearchInterface;
use app\common\lists\ListsExcelInterface;
use think\facade\Db;
use app\common\service\JsonService;
use app\common\model\config\Resources;
/**
* ResourceLogDaodao1列表
* Class ResourceLogDaodao1Lists
* @package app\adminapi\listslog
*/
class ResourceLogDaodaoLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExcelInterface
{
/**
* @notes 设置导出字段
* @return string[]
* @author 段誉
* @date 2021/12/29 10:08
*/
public function setExcelFields(): array
{
return [
'Uid' => '用户ID',
'Desc' => '来源',
'BeforeVal' => '操作前',
'AfterVal' => '操作后',
'Key' => '道具KEY',
'Val' => '变化值',
'Action' => '动作',
'LogTime' => '日志时间',
];
}
/**
* @notes 设置导出文件名
* @return string
* @author 段誉
* @date 2021/12/29 10:08
*/
public function setFileName(): string
{
return '道具日志';
}
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/03/25 10:39
*/
public function setSearch(): array
{
return [
'=' => ['Uid', 'Desc', 'Key', 'Action'],
'between' => ['LogTime'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2024/03/25 10:39
*/
public function lists(): array
{
if ($this->params['Cid'] <= 0) {
return JsonService::throw("请输入区服ID");
}
$cid = $this->params['Cid'];
$reConfig = Resources::column('name', 'key');
$list = Db::connect('game_sdk_log')->name('resource_log_daodao_' . $cid)
->where($this->searchWhere)
->field(['Id', 'Uid', 'Desc', 'BeforeVal', 'AfterVal', 'Key', 'Val', 'Action', 'LogTime'])
->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/03/25 10:39
*/
public function count(): int
{
$cid = $this->params['Cid'];
if (!$cid || $cid <= 0) {
return 0;
}
return Db::connect('game_sdk_log')->name('resource_log_daodao_' . $cid)
->where($this->searchWhere)->count();
}
}