<?php
namespace app\model;

class User extends MySqlite
{
    protected $tablename = 'sys_user';

    protected $pk = 'id';

    protected $schema = [
        "id"          => "INTEGER",
        "username"    => "TEXT",
        "password"    => "TEXT",
        "create_time" => "INTEGER",
    ];

    public function __construct()
    {
        parent::__construct();
    }

    public function getInfoByUsername($username)
    {
        $sql = "select * from " . $this->tablename . " where username='" . $username . "' limit 1";

        $data = $this->getOne($sql);

        return $data;
    }

    public function getInfoById($userid)
    {
        $sql = "select * from " . $this->tablename . " where id='" . $userid . "' limit 1";

        $data = $this->getOne($sql);

        return $data;
    }
}

