xiaogang 4 years ago
parent
commit
777f8a3e83
2 changed files with 21 additions and 4 deletions
  1. 3 4
      app/Admin/Actions/Chat/ChatLog.php
  2. 18 0
      app/Repositories/ImMessage.php

+ 3 - 4
app/Admin/Actions/Chat/ChatLog.php

@@ -1,5 +1,6 @@
 <?php
 <?php
 namespace App\Admin\Actions\Chat;
 namespace App\Admin\Actions\Chat;
+use App\Repositories\ImMessage;
 use App\Services\TencentImMessage;
 use App\Services\TencentImMessage;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Grid;
 use Dcat\Admin\Grid\LazyRenderable;
 use Dcat\Admin\Grid\LazyRenderable;
@@ -9,10 +10,8 @@ class ChatLog extends LazyRenderable
 
 
     public function grid(): Grid
     public function grid(): Grid
     {
     {
-        $data =new TencentImMessage();
-        $res = $data->getroammsg(1,1064);
-        dd($res);
-        return Grid::make(new \App\Models\UserInfoModel(), function (Grid $grid) {
+
+        return Grid::make(new ImMessage(), function (Grid $grid) {
             $grid->column('user_id', 'ID')->sortable();
             $grid->column('user_id', 'ID')->sortable();
             $grid->column('nickname');
             $grid->column('nickname');
             $grid->column('created_at');
             $grid->column('created_at');

+ 18 - 0
app/Repositories/ImMessage.php

@@ -3,8 +3,26 @@
 
 
 namespace App\Repositories;
 namespace App\Repositories;
 
 
+use App\Services\TencentImMessage;
+use Dcat\Admin\Grid;
+use Illuminate\Pagination\LengthAwarePaginator;
 
 
 class ImMessage
 class ImMessage
 {
 {
+    /**
+     * 查询表格数据
+     *
+     * @param Grid\Model $model
+     * @return LengthAwarePaginator
+     */
+    public function get(Grid\Model $model)
+    {
+        $currentPage = $model->getCurrentPage();
+        $perPage = $model->getPerPage();
 
 
+        $data =new TencentImMessage();
+        $res = $data->getroammsg(1,1064);
+
+       return $model->makePaginator('',$res);
+    }
 }
 }