| | |
| | | return $this->getlogininfo($tempinfo['id']); |
| | | } |
| | | |
| | | //////获取用户登录信息/////////// |
| | | /** |
| | | * 获取用户登录信息 |
| | | * @param $id |
| | | * @return array |
| | | * @throws DataNotFoundException |
| | | * @throws DbException |
| | | * @throws ModelNotFoundException |
| | | */ |
| | | public function getlogininfo($id = ''): array { |
| | | $subwhere['id'] = $id; |
| | | $info = Db::name('administrators')->field($this->commfield)->where($subwhere)->find(); |
| | |
| | | return $msg; |
| | | } |
| | | |
| | | /////账号登录信息/////////////// |
| | | /** |
| | | * 更新用户信息 |
| | | * @return bool |
| | | */ |
| | | private function updateInfo(): bool { |
| | | $temp['login_time'] = time(); |
| | | $temp['login_ip'] = getIP(); |
| | |
| | | return FALSE; |
| | | } |
| | | |
| | | /** |
| | | * 写入登陆日志 |
| | | * @return void |
| | | */ |
| | | private function writelogs(): void { |
| | | //////登陆记录////////// |
| | | $d['login_ip'] = getIP(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * +---------------------------------------------------------- |
| | | * 保存session |
| | | * +---------------------------------------------------------- |
| | | * +---------------------------------------------------------- |
| | | * @return void |
| | | */ |
| | | public function saveSession(): void { |
| | | session($this->kinfo, $this->info); |
| | |
| | | } |
| | | |
| | | /** |
| | | * +---------------------------------------------------------- |
| | | * 判断用户是否登陆 |
| | | * @return bool |
| | | * +---------------------------------------------------------- |
| | | * +---------------------------------------------------------- |
| | | */ |
| | | public function islogin(): bool { |
| | | if (isset($this->info['id']) && $this->info['id'] != '') |
| | |
| | | } |
| | | |
| | | /** |
| | | * +---------------------------------------------------------- |
| | | * 用户退出 |
| | | * @return bool |
| | | * +---------------------------------------------------------- |
| | | * +---------------------------------------------------------- |
| | | */ |
| | | public function loginout(): bool { |
| | | $this->info = ""; |
| | |
| | | return TRUE; |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单 |
| | | * @return array |
| | | */ |
| | | public function menu(): array { |
| | | $condition['show_menu'] = 1; |
| | | $order = 'order_id asc,id asc'; |
| | | $list = Db::name('admin_menu') |
| | | ->field("id,title,menu_index,menu_icon,show_menu,menu_url,father_id") |
| | | ->cacheAlways(TRUE, 0, 'admin_menu') |
| | | ->cache(60) |
| | | ->where($condition) |
| | | ->order($order) |
| | | ->withAttr('menu_index', function ($value) { |
| | |
| | | } |
| | | return $result_arr; |
| | | } else { |
| | | return array(); |
| | | return []; |
| | | } |
| | | } |
| | | |