| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- // +----------------------------------------------------------------------
- // | saiadmin [ saiadmin快速开发框架 ]
- // +----------------------------------------------------------------------
- // | Author: your name
- // +----------------------------------------------------------------------
- namespace app\v1\logic\gameLog;
- use plugin\saiadmin\basic\BaseLogic;
- use plugin\saiadmin\exception\ApiException;
- use plugin\saiadmin\utils\Helper;
- use app\v1\model\gameLog\SdkLoginLog;
- /**
- * 登录日志逻辑层
- */
- class SdkLoginLogLogic extends BaseLogic
- {
- /**
- * 构造函数
- */
- public function __construct()
- {
- $this->model = new SdkLoginLog();
- }
- /**
- * 分页查询数据
- * @param $query
- * @return mixed
- */
- public function getList($query): mixed
- {
- $saiType = request()->input('saiType', 'list');
- $page = request()->input('page', 1);
- $limit = request()->input('limit', 10);
- $orderBy = request()->input('orderBy', '');
- $loginTime = request()->input('login_time', '');
- $orderType = request()->input('orderType', $this->orderType);
- if(empty($orderBy)) {
- $orderBy = $this->orderField !== '' ? $this->orderField : $this->model->getPk();
- }
- $query->order($orderBy, $orderType);
-
- $tableName = 'sdk_login_log_'.date('Ym',strtotime($loginTime));
-
-
- print_r('tableName:'.$tableName);
- // 切换表名
- $query->table($tableName);
- if ($saiType === 'all') {
- return $query->select()->toArray();
- }
-
- return $query->paginate($limit, false, ['page' => $page])->toArray();
- }
- }
|