泊客-博客网站搭建之路

设计日志

4-28:完成登录注册的页面及功能
4-30:完成登录注册的ajax验证,登录注册响应
5-7:完成更改密码功能,实现拦截器功能
5-9:完成个人信息编辑功能

数据库设计

  • 用户表:
(
	userId bigint auto_increment comment '用户ID',
	userName varchar(32) not null comment '用户名',
	password varchar(32) not null comment '用户密码',
	userSex varchar(6) default '男' not null comment '用户性别',
	phone varchar(11) not null comment '用户电话',
	email varchar(32) null comment '用户邮箱',
	role varchar(16) default '普通用户' not null comment '用户角色',
	user_register_time datetime null comment '用户注册时间',
	constraint t_user_pk
		primary key (userId)
);
  • 博客类型表:
(
	type_id int auto_increment comment '类型ID',
	type_name varchar(32) not null comment '类型名',
	constraint t_user_pk
		primary key (userId)
);
  • 博客信息表:
(
	blog_id bigint auto_increment comment '博客id',
	blog_title varchar(100) not null comment '博客标题',
	blog_content longtext not null comment '博客内容',
	userId bigint null comment '创建人id',
	type_id int null comment '类型ID',
	blog_status int default 0 not null comment '博客状态 1为发布 0为草稿',
	create_time date not null comment '创建时间',
	update_time date not null comment '更新时间',
	view_num bigint default 0 not null comment '观看数量',
	praise_num bigint default 0 not null comment '点赞数量',
	constraint t_blog_pk
		primary key (blog_id),
	constraint t_blog___fk_type_id
		foreign key (type_id) references blog_type (type_id),
	constraint t_blog___fk_userId
		foreign key (userId) references t_user (userId)
);
  • 评论表:
(
	comment_id bigint auto_increment comment '评论id',
	comment_content varchar(500) not null comment '评论内容',
	blog_id bigint not null comment '博客id',
	create_time datetime not null comment '评论时间	',
	userId bigint not null comment '评论人ID',
	replyId bigint not null comment '评论回复人ID',
	constraint t_comment_pk
		primary key (comment_id),
	constraint t_comment___fk_blog_id
		foreign key (blog_id) references t_blog (blog_id),
	constraint t_comment___fk_userId
		foreign key (userId) references t_user (userId)
);

遇到的问题

问题一(5-8):实现个人信息编辑功能时,后台数据库数据已更改但前台数据却没有随之改变,奇怪的是当我退出账号重新登陆后再查看个人信息时却发现数据已更改。

解决:session未及时更新,数据库的数据更新之后,session也需要随之刷新

问题二(5-8):实现个人信息编辑功能时,想让某些输入框可以输入,某些不可。

解决:再鼠标放在输入框上时使其失去焦点即可,onfocus=this.blur();

posted @ 2022-05-09 11:55  zhoushikang  阅读(2)  评论(0编辑  收藏  举报