diff --git a/app/controller/api/v1/User.php b/app/controller/api/v1/User.php index 2f1f89b..045eef6 100644 --- a/app/controller/api/v1/User.php +++ b/app/controller/api/v1/User.php @@ -377,15 +377,11 @@ class User extends Base } $where = []; - // $where[] = ['cl.created_at', '>', date($day.' 00:00:00')]; - // $where[] = ['cl.created_at', '<', date($day.' 23:59:59')]; $dayInt = str_replace('-', '', $day); $where[] = ['cl.day', '=', $dayInt]; $where[] = ['cl.account_id', '=', $accountId]; - if ($worksiteId) { - $where[] = ['cl.worksite_id', '=', $worksiteId]; - } + $where[] = ['cl.worksite_id', '=', $worksiteId ?: $account['worksite_id']]; $where[] = ['cl.role', '=', $account['role']]; $limit = $account['role'] == Account::ROLE_NORMAL ? 4 : 0;//普通用户只展示最新4条 其他不限制 @@ -505,7 +501,7 @@ class User extends Base $where[] = ['cl.day', 'like', $ym.'%']; $where[] = ['cl.account_id', '=', $accountId]; $where[] = ['cl.role', '=', $account['role']]; - $where[] = ['cl.worksite_id', '=', $worksiteId]; + $where[] = ['cl.worksite_id', '=', $worksiteId ?: $accountId['worksite_id']]; $list = \app\model\ClockLog::alias('cl') ->where($where) ->select();