<?php


namespace App\Repositories;

use App\Services\TencentImMessage;
use Dcat\Admin\Grid;
use Dcat\Admin\Repositories\Repository;
use Illuminate\Pagination\LengthAwarePaginator;

class ImMessage extends Repository
{
    public $user_id;
    public $to_user_id;
    public function __construct($id,$id2)
    {
        $this->user_id = $id;
        $this->to_user_id = $id2;
    }

    /**
     * 查询表格数据
     *
     * @param Grid\Model $model
     * @return LengthAwarePaginator
     */
    public function get(Grid\Model $model)
    {
        $currentPage = $model->getCurrentPage();
        $perPage = $model->getPerPage();

        $data =new TencentImMessage();

        $res = $data->getroammsg($this->user_id,$this->to_user_id);

        return $model->makePaginator($res['MsgCnt'],$res['MsgList']);
    }
}
