* @version : HUOSDK 8.0 */ namespace huo\model\user; use think\Model; class AdminLoginLogModel extends Model { protected $name = 'admin_login_log'; public function __construct($data = []) { parent::__construct($data); } /** * 用户表 * * @return \think\model\relation\HasOne */ public function user() { return $this->belongsTo('huo\model\user\UserModel', 'user_id', 'id', [], 'left')->field('id,user_login') ->setEagerlyType(0); } /** * 登录记录 * * @param array $map * @param int $offset * * @return bool|\think\Paginator * @throws \think\exception\DbException */ public function userLoginInfo($map = [], $offset = 10) { $_data = $this ->with('user') ->where($map) ->order('id desc') ->paginate($offset); return $_data; } /** * 插入记录 * * @param $data * * @return bool|int|string */ public function addLog($data) { $_res = $this->insert($data); if ($_res !== false) { return true; } return $_res; } }