'用户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(); } }