| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- /**
- * AdminLoginLogModel.php UTF-8
- * 管理员登陆日志
- *
- * @date : 2018/3/2 15:21
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : linjiebin <ljb@huosdk.com>
- * @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;
- }
- }
|