From 68c6633742acd22fc3496c04587e5cfd3dbef479 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Wed, 9 Sep 2020 18:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=91=E5=90=8D=E5=8D=95=E8=A1=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/go-fly.sql | 14 +++++++++++--- models/ipblacks.go | 10 ++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 models/ipblacks.go diff --git a/config/go-fly.sql b/config/go-fly.sql index 3aa43ee..c850e8d 100644 --- a/config/go-fly.sql +++ b/config/go-fly.sql @@ -60,7 +60,7 @@ CREATE TABLE `user_role` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `user_role` (`id`, `user_id`, `role_id`) VALUES (1, 1, 1), -(2, 2, 2) +(2, 2, 2); DROP TABLE IF EXISTS `role`; CREATE TABLE `role` ( @@ -74,7 +74,6 @@ INSERT INTO `role` (`id`, `name`, `method`, `path`) VALUES (1, '普通客服', 'GET', '/kefuinfo,/kefulist,/roles'), (2, '管理员', '*', '*'); - DROP TABLE IF EXISTS `welcome`; CREATE TABLE `welcome` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -86,4 +85,13 @@ CREATE TABLE `welcome` ( KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `welcome` (`id`, `user_id`, `content`, `is_default`, `ctime`) VALUES -(1, 'kefu2', '本客服代码开源,欢迎star,开源地址:https://github.com/taoshihan1991/go-fly', 1, '2020-08-24 02:57:49'); \ No newline at end of file +(1, 'kefu2', '本客服代码开源,欢迎star,开源地址:https://github.com/taoshihan1991/go-fly', 1, '2020-08-24 02:57:49'); + +DROP TABLE IF EXISTS `ipblack`; +CREATE TABLE `ipblack` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ip` varchar(100) NOT NULL DEFAULT '', + `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `kefu_id` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/models/ipblacks.go b/models/ipblacks.go new file mode 100644 index 0000000..1ae5a2f --- /dev/null +++ b/models/ipblacks.go @@ -0,0 +1,10 @@ +package models + +import "time" + +type Ipblack struct{ + ID uint `gorm:"primary_key" json:"id"` + IP string `json:"ip"` + KefuId string `json:"kefu_id"` + CreateAt time.Time `json:"create_at"` +}