<?php

namespace app\admin\controller\data;

use app\common\controller\AdminController;
use EasyAdmin\annotation\ControllerAnnotation;
use EasyAdmin\annotation\NodeAnotation;
use think\App;
use think\facade\Db;

/**
 * @ControllerAnnotation(title="data_register_retain")
 */
class RegisterRetain extends AdminController
{

    use \app\admin\traits\Curd;

    public function __construct(App $app)
    {
        parent::__construct($app);

        $this->model = new \app\admin\model\DataRegisterRetain();
        
    }

    /**
     * @NodeAnotation(title="列表")
     */
    public function index(){
        if ($this->request->isAjax()) {
            if (input('selectFields')) {
                return $this->selectList();
            }
            list($page, $limit, $where) = $this->buildTableParames();
            $model = Db::table('data_register_retain')
                ->where($where);
            $data = [
                'code' => 0,
                'msg' => '',
                'count' => $model->count(),
                'data' => $model->page($page, $limit)->order($this->sort)->select(),
            ];
            return json($data);
        }
        return $this->fetch();
    }

    
}
