<?php

namespace app\controller\admin\xm;

use app\BaseController;
use app\service\CurdService;
use think\response\Json;

class ChannelController extends BaseController
{

    public function page(): Json
    {
        try{
            $model = \app\entity\XmChannel::withSearch([], [
                'name'            => $this->request->get('name/s', ''),
                'code'        => $this->request->get('code/s', ''),
                'platform_id ' => $this->request->get('platform_id/d', 0),
            ])->append(['platform']);

            $paginate = CurdService::getPaginate($this->request, $model);
        }catch (\Exception $e){
            return  $this->writeError($e->getMessage());
        }


        return $this->writeSuccess('success', $paginate);
    }
}