|
|
@ -1,6 +1,7 @@ |
|
|
|
<?php |
|
|
|
namespace app\home\service; |
|
|
|
|
|
|
|
use app\model\PusherLogModel; |
|
|
|
use app\model\UserModel; |
|
|
|
|
|
|
|
class NoticeService extends BaseHomeService |
|
|
@ -27,4 +28,31 @@ class NoticeService extends BaseHomeService |
|
|
|
return $this->toData('500', lang('system_busy'), [$exception->getMessage(), $exception->getTrace()]); |
|
|
|
} |
|
|
|
} |
|
|
|
public function pusherLog($param, $userId): array |
|
|
|
{ |
|
|
|
try { |
|
|
|
if (empty($param['page']) || !is_numeric($param['page'])) { |
|
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
|
} |
|
|
|
if (empty($param['limit']) || !is_numeric($param['limit'])) { |
|
|
|
return $this->toData('400', lang('parameter_error')); |
|
|
|
} |
|
|
|
// 获取pusher推送记录 |
|
|
|
$list = PusherLogModel::where(['user_id'=>$userId])->order('id', 'desc')->paginate([ |
|
|
|
'list_rows' => $param['limit'], |
|
|
|
'page' => $param['page'], |
|
|
|
]); |
|
|
|
return $this->toData('0', 'successful', [ |
|
|
|
'list' => $list->items(), |
|
|
|
'total' => $list->total(), |
|
|
|
'page' => $list->currentPage(), |
|
|
|
'last_page' => $list->lastPage(), |
|
|
|
'user_id' => $userId, |
|
|
|
]); |
|
|
|
|
|
|
|
} catch (\Exception $exception) { |
|
|
|
return $this->toData('500', lang('system_busy'), [$exception->getMessage(), $exception->getTrace()]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |