Skip to content

Commit

Permalink
Merge pull request #45 from stick-i/V0.2.0-beta
Browse files Browse the repository at this point in the history
V0.2.0-beta
  • Loading branch information
stick-i authored Aug 11, 2022
2 parents 2380ea2 + 17846f4 commit 15ce292
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 65 deletions.
2 changes: 1 addition & 1 deletion document/sql/blink.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TABLE `blink`
`modified_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 5
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = Compact;
Expand Down
27 changes: 9 additions & 18 deletions document/sql/blog.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/*
Navicat Premium Data Transfer
Source Server : blog.sticki.live
Source Server Type : MySQL
Source Server Version : 50650
Source Host : sql.blog.sticki.live:3306
Source Schema : blog
Target Server Type : MySQL
Expand Down Expand Up @@ -37,7 +35,7 @@ CREATE TABLE `blog`
INDEX `author_id` (`author_id`) USING BTREE,
INDEX `school_code` (`school_code`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 34
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = COMPACT;
Expand All @@ -52,8 +50,7 @@ CREATE TABLE `blog_content`
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '博客内容',
`modified_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`blog_id`) USING BTREE,
UNIQUE INDEX `blog_id` (`blog_id`) USING BTREE,
CONSTRAINT `fk_blog_content_blog_1` FOREIGN KEY (`blog_id`) REFERENCES `blog` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
UNIQUE INDEX `blog_id` (`blog_id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
Expand Down Expand Up @@ -88,8 +85,7 @@ CREATE TABLE `blog_general`
`collection_num` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '收藏量',
`score` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '评分',
PRIMARY KEY (`blog_id`) USING BTREE,
UNIQUE INDEX `blog_id` (`blog_id`) USING BTREE,
CONSTRAINT `fk_blog_general_blog_1` FOREIGN KEY (`blog_id`) REFERENCES `blog` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
UNIQUE INDEX `blog_id` (`blog_id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
Expand All @@ -105,10 +101,7 @@ CREATE TABLE `blog_set_tag`
`tag_id` int(10) UNSIGNED NOT NULL,
`blog_id` int(10) UNSIGNED NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_blog_set_tag_blog_1` (`blog_id`) USING BTREE,
INDEX `fk_blog_set_tag_tag_1` (`tag_id`) USING BTREE,
CONSTRAINT `fk_blog_set_tag_blog_1` FOREIGN KEY (`blog_id`) REFERENCES `blog` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `fk_blog_set_tag_tag_1` FOREIGN KEY (`tag_id`) REFERENCES `tag` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
INDEX `index_tag_blog` (`tag_id`, `blog_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8
Expand All @@ -127,10 +120,9 @@ CREATE TABLE `collect_blog`
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_blog_collection_user_1` (`user_id`) USING BTREE,
INDEX `fk_blog_collection_blog_1` (`blog_id`) USING BTREE,
CONSTRAINT `collect_blog_ibfk_1` FOREIGN KEY (`blog_id`) REFERENCES `blog` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT
INDEX `fk_blog_collection_blog_1` (`blog_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 8
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = COMPACT;
Expand Down Expand Up @@ -159,7 +151,7 @@ CREATE TABLE `config`
`result` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci NULL DEFAULT NULL COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 2
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = Compact;
Expand All @@ -176,10 +168,9 @@ CREATE TABLE `like_blog`
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `fk_blog_likes_user_1` (`user_id`) USING BTREE,
INDEX `fk_blog_likes_blog_1` (`blog_id`) USING BTREE,
CONSTRAINT `like_blog_ibfk_1` FOREIGN KEY (`blog_id`) REFERENCES `blog` (`id`) ON DELETE NO ACTION ON UPDATE RESTRICT
INDEX `fk_blog_likes_blog_1` (`blog_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 35
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = COMPACT;
Expand Down
2 changes: 1 addition & 1 deletion document/sql/comment.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CREATE TABLE `comment`
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 117
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = COMPACT;
Expand Down
16 changes: 6 additions & 10 deletions document/sql/resource.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/*
Navicat Premium Data Transfer
Source Server : blog.sticki.live
Source Server Type : MySQL
Source Server Version : 50650
Source Host : sql.blog.sticki.live:3306
Source Schema : resource
Target Server Type : MySQL
Expand All @@ -27,10 +25,9 @@ CREATE TABLE `city`
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci NOT NULL COMMENT '名称',
`province_id` int(10) UNSIGNED NOT NULL COMMENT '所属省份id',
PRIMARY KEY (`id`) USING BTREE,
INDEX `province_id` (`province_id`) USING BTREE,
CONSTRAINT `city_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE
INDEX `province_id` (`province_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 333
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = Compact;
Expand All @@ -49,7 +46,7 @@ CREATE TABLE `image`
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `img` (`url`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 39
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = Compact;
Expand All @@ -64,7 +61,7 @@ CREATE TABLE `province`
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci NOT NULL COMMENT '省份名称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 35
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = Compact;
Expand All @@ -86,10 +83,9 @@ CREATE TABLE `university`
UNIQUE INDEX `code` (`code`) USING BTREE,
UNIQUE INDEX `identifier` (`identifier`) USING BTREE,
INDEX `name` (`name`) USING BTREE,
INDEX `city_id` (`city_id`) USING BTREE,
CONSTRAINT `university_ibfk_1` FOREIGN KEY (`city_id`) REFERENCES `city` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE
INDEX `city_id` (`city_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 2629
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci
ROW_FORMAT = Compact;
Expand Down
49 changes: 21 additions & 28 deletions document/sql/user.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/*
Navicat Premium Data Transfer
Source Server : blog.sticki.live
Source Server Type : MySQL
Source Server Version : 50650
Source Host : sql.blog.sticki.live:3306
Source Schema : user
Target Server Type : MySQL
Expand All @@ -29,7 +27,7 @@ CREATE TABLE `config`
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `param` (`param`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 2
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = Compact;
Expand All @@ -49,7 +47,7 @@ CREATE TABLE `user`
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `username` (`username`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 46
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = COMPACT;
Expand All @@ -70,8 +68,7 @@ CREATE TABLE `user_basic`
`modified_time` datetime(6) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '信息修改时间',
`name_modify_time` datetime(6) NULL DEFAULT NULL COMMENT '用户名修改时间',
`start_work_time` datetime(6) NULL DEFAULT NULL COMMENT '开始工作的时间',
PRIMARY KEY (`username`) USING BTREE,
CONSTRAINT `user_basic_ibfk_1` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE RESTRICT
PRIMARY KEY (`username`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
Expand Down Expand Up @@ -115,11 +112,9 @@ CREATE TABLE `user_follow`
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id` (`fans_id`) USING BTREE,
INDEX `follow_id` (`follow_id`) USING BTREE,
CONSTRAINT `user_follow_ibfk_1` FOREIGN KEY (`fans_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `user_follow_ibfk_2` FOREIGN KEY (`follow_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
INDEX `follow_id` (`follow_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 63
AUTO_INCREMENT = 1
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = COMPACT;
Expand All @@ -138,14 +133,27 @@ CREATE TABLE `user_safety`
PRIMARY KEY (`user_id`) USING BTREE,
UNIQUE INDEX `email` (`mail`) USING BTREE,
UNIQUE INDEX `mobile` (`mobile`) USING BTREE,
INDEX `fk_user_safety_user_general_1` (`username`) USING BTREE,
CONSTRAINT `user_safety_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `user_safety_ibfk_2` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE
INDEX `fk_user_safety_user_general_1` (`username`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8
COLLATE = utf8_general_mysql500_ci
ROW_FORMAT = COMPACT;

-- ----------------------------
-- View structure for user_view
-- ----------------------------
DROP VIEW IF EXISTS `user_view`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `user_view` AS
select `user`.`id` AS `id`,
`user`.`username` AS `username`,
`user`.`nickname` AS `nickname`,
`user`.`school_code` AS `school_code`,
concat(`config`.`result`, `user`.`avatar_url`) AS `avatar_url`,
`user`.`register_time` AS `register_time`
from (`user`
join `config`)
where (`config`.`param` = 'avatar_url');

-- ----------------------------
-- View structure for fans_view
-- ----------------------------
Expand Down Expand Up @@ -184,19 +192,4 @@ select `user_follow`.`id` AS `id`,
from (`user_follow`
left join `user_view` on ((`user_view`.`id` = `user_follow`.`follow_id`)));

-- ----------------------------
-- View structure for user_view
-- ----------------------------
DROP VIEW IF EXISTS `user_view`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `user_view` AS
select `user`.`id` AS `id`,
`user`.`username` AS `username`,
`user`.`nickname` AS `nickname`,
`user`.`school_code` AS `school_code`,
concat(`config`.`result`, `user`.`avatar_url`) AS `avatar_url`,
`user`.`register_time` AS `register_time`
from (`user`
join `config`)
where (`config`.`param` = 'avatar_url');

SET FOREIGN_KEY_CHECKS = 1;
14 changes: 7 additions & 7 deletions vueblog/src/components/content/topbar/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@ export default {
},
//修改用户学校
ChangeSchool(){
let formdata=new FormData()
formdata.append('code',this.schoolCode)
this.$axios.put('/user/school',formdata,this.config).then(res=>{
// if()
})
this.visible=false
},
let formdata = new FormData()
formdata.append('code', this.schoolCode)
this.$axios.put('/user/school/code', formdata, this.config).then(res => {
// if()
})
this.visible = false
},
// 获取省份
getProvinces() {
this.$axios.get("/resource/province").then((res) => {
Expand Down

0 comments on commit 15ce292

Please sign in to comment.