This commit is contained in:
2020-02-17 22:34:34 +08:00
parent 58d999ed73
commit 259d232d89
109 changed files with 10344 additions and 89 deletions

49
app/model/MemberLog.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\model;
use think\Model;
use xin\helper\Server;
/**
* @title: 用户日志模型
*/
class MemberLog extends Model {
protected $type = [
'param' => 'json',
'visite_time' => 'timestamp',
];
public static function record($request) {
$data = [
'uid' => $request->user['uid'],
'url' => $request->baseUrl(),
'param' => $request->param(),
'method' => $request->method(),
'visite_time' => $request->time(),
'client_ip' => Server::getRemoteIp(),
'create_time' => time(),
];
self::create($data);
}
public function getMemberLogList($request) {
$param = $request->param();
$map = [];
$order = "id desc";
return self::with(['user'])->where($map)->order($order)->paginate($request->pageConfig);
}
public function user() {
return $this->hasOne('Member', 'uid', 'uid')->field('uid,nickname,username');
}
}