作者 赵彬吉

update

... ... @@ -20,32 +20,4 @@ class GroupLogic extends BaseLogic
$this->model = new Group();
}
public function save($param){
if(!empty($param['pid'])){
if(!empty($param['id']) && $param['pid'] == $param['id']){
$this->fail('上级菜单不能是本菜单');
}
$p_Group = $this->getCacheInfo($param['pid']);
if(!$p_Group){
$this->fail('上级菜单不存在');
}
}
return parent::save($param);
}
public function delete($ids, $map = []){
$ids= array_filter(Arr::splitFilterToArray($ids), 'intval');
foreach ($ids as $id){
$info = $this->getCacheInfo($id);
if(!$info){
continue;
}
//是否有子菜单
if(Group::where('pid', $id)->count()){
$this->fail("菜单{$info['title']}存在子菜单,不能删除");
}
}
return parent::delete($ids);
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Logic\Aside;
use App\Models\Manage;
use App\Models\ManageLoginLog;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Session;
... ... @@ -25,18 +26,21 @@ class LoginLogic extends BaseLogic
public function login()
{
$info = $this->model->where('mobile', $this->requestAll['mobile'])->first();
$manage = $this->model->where('mobile', $this->requestAll['mobile'])->first();
if (!$info){
if (!$manage){
$this->fail('登录用户名不存在');
}
if (Manage::STATUS_DISABLE == $info->status) {
if (Manage::STATUS_DISABLE == $manage->status) {
$this->fail('帐号已被禁用');
}
if (!Hash::check($this->requestAll['password'], $info->password)) {
if (!Hash::check($this->requestAll['password'], $manage->password)) {
$this->fail('登录密码不正确');
}
Session::put('manage', $info->toArray());
Session::put('manage', $manage->toArray());
ManageLoginLog::addLog($manage->id);
return $this->success();
}
... ...
... ... @@ -9,6 +9,6 @@ class Department extends Base
use SoftDeletes;
//设置关联表名
protected $table = 'gl_department';
protected $table = 'gl_project_department';
}
... ...
<?php
namespace App\Models;
use Illuminate\Support\Facades\Session;
class ManageLoginLog extends Base
{
//设置关联表名
protected $table = 'gl_manage_login_log';
const UPDATED_AT = null;
/**
* 登录日志
* @param $manage_id
* @author zbj
* @date 2023/4/20
*/
public function addLog($manage_id){
$log = new self();
$log->manage_id = $manage_id;
$log->session_id = Session::getId();
$log->ip = request()->ip();
$log->save();
}
}
... ...