Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
penghcheng committed Nov 12, 2019
1 parent da6333c commit 5976614
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/Service/CommonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function getSysLogList(int $pageSize = 10, int $currPage = 1): array

$where = " 1=1 ";

$sysOsss = Db::select("SELECT * FROM sys_oss a JOIN (select id from sys_oss order by id desc limit " . $startCount . ", " . $pageSize . ") b ON a.id = b.id where " . $where . " order by b.id desc;");
$sysOsss = Db::select("SELECT * FROM sys_oss a where " . $where . " order by a.id desc limit " . $startCount . "," . $pageSize);

if (!empty($sysOsss)) {
$sysOsss = SysOssFormatter::instance()->arrayFormat($sysOsss);
Expand Down
17 changes: 9 additions & 8 deletions app/Service/SysUserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function getSysUserList(int $user_id, string $username, int $pageSize = 1
$where .= " and a.username like '%" . $username . "%'";
}

$sysUsers = Db::select("SELECT * FROM sys_user a JOIN (select user_id from sys_user order by user_id desc limit " . $startCount . ", " . $pageSize . ") b ON a.user_id = b.user_id where " . $where . " order by b.user_id desc;");
$sysUsers = Db::select("SELECT * FROM sys_user a where " . $where . " order by a.user_id desc limit " . $startCount . "," . $pageSize);

if (!empty($sysUsers)) {
$sysUsers = SysUserFormatter::instance()->arrayFormat($sysUsers);
Expand Down Expand Up @@ -320,7 +320,7 @@ public function getSysRoleList(int $user_id, string $roleName, int $pageSize = 1
$where .= " and a.role_name like '%" . $roleName . "%'";
}

$sysRoles = Db::select("SELECT * FROM sys_role a JOIN (select role_id from sys_role order by role_id desc limit " . $startCount . ", " . $pageSize . ") b ON a.role_id = b.role_id where " . $where . " order by b.role_id desc;");
$sysRoles = Db::select("SELECT * FROM sys_role a where " . $where . " order by a.role_id desc limit " . $startCount . "," . $pageSize);

if (!empty($sysRoles)) {
$sysRoles = SysRoleFormatter::instance()->arrayFormat($sysRoles);
Expand Down Expand Up @@ -694,7 +694,8 @@ public function getSysLogList(string $key, int $pageSize = 10, int $currPage = 1
$where .= " and a.username like '%" . $key . "%' or a.operation like '%" . $key . "%'";
}

$sysLogs = Db::select("SELECT * FROM sys_log a JOIN (select id from sys_log order by id desc limit " . $startCount . ", " . $pageSize . ") b ON a.id = b.id where " . $where . " order by b.id desc;");
$sysLogs = Db::select("SELECT * FROM sys_log a where " . $where . " order by a.id desc limit " . $startCount . "," . $pageSize);


if (!empty($sysLogs)) {
$sysLogs = SysLogFormatter::instance()->arrayFormat($sysLogs);
Expand All @@ -715,7 +716,7 @@ public function getSysLogList(string $key, int $pageSize = 10, int $currPage = 1
* @param array $params
* @return bool
*/
public function sysLogSave(array $params)
public function sysLogSave(array $params)
{
return Db::table("sys_log")->insert($params);
}
Expand Down Expand Up @@ -749,18 +750,18 @@ public function getSysConfigList(string $paramKey, int $pageSize = 10, int $curr
$where .= " and a.param_key like '%" . $paramKey . "%' or a.remark like '%" . $paramKey . "%'";
}

$sysRoles = Db::select("SELECT * FROM sys_config a JOIN (select id from sys_config order by id desc limit " . $startCount . ", " . $pageSize . ") b ON a.id = b.id where " . $where . " order by b.id desc;");
$sysConfigs = Db::select("SELECT * FROM sys_config a where " . $where . " order by a.id desc limit " . $startCount . "," . $pageSize);

if (!empty($sysRoles)) {
$sysRoles = SysConfigFormatter::instance()->arrayFormat($sysRoles);
if (!empty($sysConfigs)) {
$sysConfigs = SysConfigFormatter::instance()->arrayFormat($sysConfigs);
}

$result = [
'totalCount' => $totalCount,
'pageSize' => $pageSize,
'totalPage' => $totalPage,
'currPage' => $currPage,
'list' => $sysRoles
'list' => $sysConfigs
];
return $result;
}
Expand Down

0 comments on commit 5976614

Please sign in to comment.