You've already forked think-plugs-notice
feat(admin): 添加后台首页入口和通知模块
- 新增 Index 控制器,实现后台首页逻辑- 添加通知模块,展示未读通知数量 - 实现用户资料修改和密码更改功能 - 添加主题切换功能 - 优化登录和权限验证流程 - 新增首页模板和样式
This commit is contained in:
@@ -37,4 +37,8 @@ class Notice extends Controller
|
|||||||
'read_at' => null
|
'read_at' => null
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function _read_save_result() {
|
||||||
|
$this->success('成功!', 'javascript:location.reload()', 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,4 +10,21 @@ class NoticeNotice extends Model
|
|||||||
{
|
{
|
||||||
return static::mk()->group('type')->field('type,count(id) as count')->select();
|
return static::mk()->group('type')->field('type,count(id) as count')->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前用户未读通知数量
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function getUnreadCount()
|
||||||
|
{
|
||||||
|
$userId = session('user.id');
|
||||||
|
if (!$userId) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return static::mk()
|
||||||
|
->where('staff_id', $userId)
|
||||||
|
->whereNull('read_at')
|
||||||
|
->count();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user