This commit is contained in:
Gitea
2022-01-09 22:24:10 +08:00
4 changed files with 784 additions and 785 deletions
+2 -3
View File
@@ -38,10 +38,9 @@ composer install
## 交流讨论 ## 交流讨论
> * 点击链接加入2群【sentcms网站管理系统2群】https://jq.qq.com/?_wv=1027&k=5ewmZ0w > * 点击链接加入圈子http://bbs.sentcms.com
> * 点击链接加入1群【SentCMS交流群】:http://jq.qq.com/?_wv=1027&k=2DXSKpe(已满) 勿加
[![](qrcode.png)](http://bbs.sentcms.com)
## SentCMS特性包括: ## SentCMS特性包括:
* 全新的路由体系,完美的路由解决方案 * 全新的路由体系,完美的路由解决方案
+78 -78
View File
@@ -1,79 +1,79 @@
<?php <?php
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ] // | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved. // | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn> // | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
namespace app\model; namespace app\model;
use think\Model; use think\Model;
use xin\helper\Server; use xin\helper\Server;
/** /**
* @title: 用户日志模型 * @title: 用户日志模型
*/ */
class MemberLog extends Model { class MemberLog extends Model {
protected $type = [ protected $type = [
'param' => 'json', 'param' => 'json',
'visite_time' => 'timestamp', 'visite_time' => 'timestamp',
]; ];
public static function record($request) { public static function record($request) {
$data = [ $data = [
'uid' => $request->user['uid'] ? $request->user['uid'] : 0, 'uid' => isset($request->user['uid']) ? $request->user['uid'] : 0,
'title' => self::getCurrentTitle($request), 'title' => self::getCurrentTitle($request),
'url' => $request->baseUrl(), 'url' => $request->baseUrl(),
'param' => $request->param(), 'param' => $request->param(),
'method' => $request->method(), 'method' => $request->method(),
'visite_time' => $request->time(), 'visite_time' => $request->time(),
'client_ip' => Server::getRemoteIp(), 'client_ip' => Server::getRemoteIp(),
'create_time' => time(), 'create_time' => time(),
]; ];
self::create($data); self::create($data);
} }
public function getMemberLogList($request) { public function getMemberLogList($request) {
$param = $request->param(); $param = $request->param();
$map = []; $map = [];
$order = "id desc"; $order = "id desc";
return self::with(['user'])->where($map)->order($order)->paginate($request->pageConfig); return self::with(['user'])->where($map)->order($order)->paginate($request->pageConfig);
} }
public function user() { public function user() {
return $this->hasOne('Member', 'uid', 'uid')->field('uid,nickname,username'); return $this->hasOne('Member', 'uid', 'uid')->field('uid,nickname,username');
} }
protected static function getCurrentTitle($request) { protected static function getCurrentTitle($request) {
$mate = ''; $mate = '';
$controller = strtr(strtolower($request->controller()), '.', '\\'); $controller = strtr(strtolower($request->controller()), '.', '\\');
$action = $request->action(); $action = $request->action();
$class = "\\app\\controller\\" . $controller; $class = "\\app\\controller\\" . $controller;
if (class_exists($class)) { if (class_exists($class)) {
$reflection = new \ReflectionClass($class); $reflection = new \ReflectionClass($class);
$group_doc = self::Parser($reflection->getDocComment()); $group_doc = self::Parser($reflection->getDocComment());
if (isset($group_doc['title'])) { if (isset($group_doc['title'])) {
$mate = $group_doc['title']; $mate = $group_doc['title'];
} }
$method = $reflection->getMethods(\ReflectionMethod::IS_FINAL | \ReflectionMethod::IS_PUBLIC); $method = $reflection->getMethods(\ReflectionMethod::IS_FINAL | \ReflectionMethod::IS_PUBLIC);
foreach ($method as $key => $v) { foreach ($method as $key => $v) {
if ($action == $v->name) { if ($action == $v->name) {
$title_doc = self::Parser($v->getDocComment()); $title_doc = self::Parser($v->getDocComment());
if (isset($title_doc['title'])) { if (isset($title_doc['title'])) {
$mate = $title_doc['title']; $mate = $title_doc['title'];
} }
} }
} }
} }
return $mate; return $mate;
} }
protected static function Parser($text) { protected static function Parser($text) {
$doc = new \doc\Doc(); $doc = new \doc\Doc();
return $doc->parse($text); return $doc->parse($text);
} }
} }
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

+704 -704
View File
File diff suppressed because one or more lines are too long