作者 赵彬吉

update

@@ -20,32 +20,4 @@ class GroupLogic extends BaseLogic @@ -20,32 +20,4 @@ class GroupLogic extends BaseLogic
20 20
21 $this->model = new Group(); 21 $this->model = new Group();
22 } 22 }
23 -  
24 - public function save($param){  
25 - if(!empty($param['pid'])){  
26 - if(!empty($param['id']) && $param['pid'] == $param['id']){  
27 - $this->fail('上级菜单不能是本菜单');  
28 - }  
29 - $p_Group = $this->getCacheInfo($param['pid']);  
30 - if(!$p_Group){  
31 - $this->fail('上级菜单不存在');  
32 - }  
33 - }  
34 - return parent::save($param);  
35 - }  
36 -  
37 - public function delete($ids, $map = []){  
38 - $ids= array_filter(Arr::splitFilterToArray($ids), 'intval');  
39 - foreach ($ids as $id){  
40 - $info = $this->getCacheInfo($id);  
41 - if(!$info){  
42 - continue;  
43 - }  
44 - //是否有子菜单  
45 - if(Group::where('pid', $id)->count()){  
46 - $this->fail("菜单{$info['title']}存在子菜单,不能删除");  
47 - }  
48 - }  
49 - return parent::delete($ids);  
50 - }  
51 } 23 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Logic\Aside; 3 namespace App\Http\Logic\Aside;
4 4
5 use App\Models\Manage; 5 use App\Models\Manage;
  6 +use App\Models\ManageLoginLog;
6 use Illuminate\Support\Facades\Hash; 7 use Illuminate\Support\Facades\Hash;
7 use Illuminate\Support\Facades\Session; 8 use Illuminate\Support\Facades\Session;
8 9
@@ -25,18 +26,21 @@ class LoginLogic extends BaseLogic @@ -25,18 +26,21 @@ class LoginLogic extends BaseLogic
25 26
26 public function login() 27 public function login()
27 { 28 {
28 - $info = $this->model->where('mobile', $this->requestAll['mobile'])->first(); 29 + $manage = $this->model->where('mobile', $this->requestAll['mobile'])->first();
29 30
30 - if (!$info){ 31 + if (!$manage){
31 $this->fail('登录用户名不存在'); 32 $this->fail('登录用户名不存在');
32 } 33 }
33 - if (Manage::STATUS_DISABLE == $info->status) { 34 + if (Manage::STATUS_DISABLE == $manage->status) {
34 $this->fail('帐号已被禁用'); 35 $this->fail('帐号已被禁用');
35 } 36 }
36 - if (!Hash::check($this->requestAll['password'], $info->password)) { 37 + if (!Hash::check($this->requestAll['password'], $manage->password)) {
37 $this->fail('登录密码不正确'); 38 $this->fail('登录密码不正确');
38 } 39 }
39 - Session::put('manage', $info->toArray()); 40 + Session::put('manage', $manage->toArray());
  41 +
  42 + ManageLoginLog::addLog($manage->id);
  43 +
40 return $this->success(); 44 return $this->success();
41 } 45 }
42 46
@@ -9,6 +9,6 @@ class Department extends Base @@ -9,6 +9,6 @@ class Department extends Base
9 use SoftDeletes; 9 use SoftDeletes;
10 10
11 //设置关联表名 11 //设置关联表名
12 - protected $table = 'gl_department'; 12 + protected $table = 'gl_project_department';
13 13
14 } 14 }
  1 +<?php
  2 +
  3 +namespace App\Models;
  4 +
  5 +use Illuminate\Support\Facades\Session;
  6 +
  7 +class ManageLoginLog extends Base
  8 +{
  9 + //设置关联表名
  10 + protected $table = 'gl_manage_login_log';
  11 +
  12 + const UPDATED_AT = null;
  13 +
  14 + /**
  15 + * 登录日志
  16 + * @param $manage_id
  17 + * @author zbj
  18 + * @date 2023/4/20
  19 + */
  20 + public function addLog($manage_id){
  21 + $log = new self();
  22 + $log->manage_id = $manage_id;
  23 + $log->session_id = Session::getId();
  24 + $log->ip = request()->ip();
  25 + $log->save();
  26 + }
  27 +}