ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 日志管理 主要管理后台用户的行为操作,如登录、添加、删除等 > 有待完善 ### 具体代码模块 /application/extra/function.php ~~~ /** * 记录日志 * @param [type] $uid [用户id] * @param [type] $username [用户名] * @param [type] $description [描述] * @param [type] $status [状态] * @param [type] $tag [标签] * @param [type] $act [操作] * @return [type] [description] */ function writelog($item_id,$tag='',$act='',$uid,$uname,$description,$status=1) { $data['item_id'] = $item_id; $data['uid'] = $uid; $data['uname'] = $uname; $data['description'] = $description; $data['status'] = $status; $data['tag'] = $tag; $data['act'] = $act; $data['ip'] = request()->ip(); $data['create_time'] = time(); $log = Db::name('Log')->insert($data); } ~~~ ~~~ function writelog_admin($tag,$act,$description,$status=1){ $data['item_id'] = session('item_id'); $data['uid'] = session('uid'); $data['uname'] = session('username'); $data['description'] = $description; $data['status'] = $status; $data['tag'] = $tag; $data['act'] = $act; $data['ip'] = request()->ip(); $data['create_time'] = time(); $log = Db::name('Log')->insert($data); } ~~~ `writelog_admin('admin','login','后台登录成功');` `writelog_admin('admin','managefee','物业管理费缴费');`