<?php
/**
 * Created by PhpStorm.
 * User : zw
 * Date : 2017/12/21
 * Time : 13:58
 * Intro:
 */

namespace app\model;

use think\Db;
use think\Model;


class AdminModel extends Model
{
    // 设置当前模型对应的完整数据表名称
    protected $table = 'u_admin';
    protected $db;

    public function __construct()
    {
        $this->db = Db::table($this->table);
    }

    public function verifyUser($params)
    {
        return $this->db->field("id,name,last_login_time")
            ->where($params)
            ->select();
    }

    public function updateLoginTime($id)
    {
        $where_["id"] = array( "eq", $id );
        $param["last_login_time"] = date("Y-m-d H:i:s", time());
        return $this->save($param, $where_);
    }

}