diff --git a/cmd/install.go b/cmd/install.go
index e85366a..89846c6 100644
--- a/cmd/install.go
+++ b/cmd/install.go
@@ -2,10 +2,8 @@ package cmd
import (
"github.com/spf13/cobra"
- "github.com/taoshihan1991/imaptool/common"
"github.com/taoshihan1991/imaptool/models"
"github.com/taoshihan1991/imaptool/tools"
- "io/ioutil"
"log"
"os"
"strings"
@@ -13,25 +11,33 @@ import (
var installCmd = &cobra.Command{
Use: "install",
- Short: "安装导入数据",
+ Short: "Initialize database and import data", // More precise description
Run: func(cmd *cobra.Command, args []string) {
install()
},
}
func install() {
+ // Check if already installed
if ok, _ := tools.IsFileNotExist("./install.lock"); !ok {
- log.Println("请先删除./install.lock")
+ log.Println("Please remove ./install.lock file to reinstall")
os.Exit(1)
}
+
+ // Verify required files exist
sqlFile := "import.sql"
- isExit, _ := tools.IsFileExist(common.MysqlConf)
- dataExit, _ := tools.IsFileExist(sqlFile)
- if !isExit || !dataExit {
- log.Println("config/mysql.json 数据库配置文件或者数据库文件go-fly.sql不存在")
+ dataExists, _ := tools.IsFileExist(sqlFile)
+ if !dataExists {
+ log.Println("Configuration file config/mysql.json or database import file import.sql not found")
+ os.Exit(1)
+ }
+
+ // Execute SQL statements
+ sqls, err := os.ReadFile(sqlFile)
+ if err != nil {
+ log.Printf("Failed to read SQL file %s: %v\n", sqlFile, err)
os.Exit(1)
}
- sqls, _ := ioutil.ReadFile(sqlFile)
sqlArr := strings.Split(string(sqls), ";")
for _, sql := range sqlArr {
sql = strings.TrimSpace(sql)
@@ -39,13 +45,27 @@ func install() {
continue
}
err := models.Execute(sql)
- if err == nil {
- log.Println(sql, "\t success!")
- } else {
- log.Println(sql, err, "\t failed!", "数据库导入失败")
+ if err != nil {
+ log.Printf("SQL execution failed: %s\nError: %v\n", sql, err)
+ log.Println("Database initialization failed - please check SQL statements")
os.Exit(1)
}
+ log.Printf("Executed successfully: %s\n", sql)
}
- installFile, _ := os.OpenFile("./install.lock", os.O_RDWR|os.O_CREATE, os.ModePerm)
- installFile.WriteString("gofly live chat")
+
+ // Create installation lock file
+ installFile, err := os.OpenFile("./install.lock", os.O_RDWR|os.O_CREATE, os.ModePerm)
+ if err != nil {
+ log.Printf("Failed to create lock file: %v\n", err)
+ os.Exit(1)
+ }
+ defer installFile.Close()
+
+ _, err = installFile.WriteString("gofly live chat installation complete")
+ if err != nil {
+ log.Printf("Failed to write lock file: %v\n", err)
+ os.Exit(1)
+ }
+
+ log.Println("Database initialization completed successfully")
}
diff --git a/cmd/server.go b/cmd/server.go
index 8fd86fd..ace384a 100644
--- a/cmd/server.go
+++ b/cmd/server.go
@@ -2,20 +2,14 @@ package cmd
import (
"fmt"
- "github.com/gin-contrib/pprof"
"github.com/gin-gonic/gin"
"github.com/spf13/cobra"
- "github.com/taoshihan1991/imaptool/common"
"github.com/taoshihan1991/imaptool/middleware"
"github.com/taoshihan1991/imaptool/router"
- "github.com/taoshihan1991/imaptool/static"
"github.com/taoshihan1991/imaptool/tools"
"github.com/taoshihan1991/imaptool/ws"
"github.com/zh-five/xdaemon"
- "html/template"
- "io/ioutil"
"log"
- "net/http"
"os"
)
@@ -26,7 +20,7 @@ var (
var serverCmd = &cobra.Command{
Use: "server",
Short: "启动http服务",
- Example: "go-fly server -c config/",
+ Example: "gofly server -p 8082",
Run: func(cmd *cobra.Command, args []string) {
run()
},
@@ -58,27 +52,20 @@ func run() {
tools.Logger().Println("start server...\r\ngo:http://" + baseServer)
engine := gin.Default()
- if common.IsCompireTemplate {
- templ := template.Must(template.New("").ParseFS(static.TemplatesEmbed, "templates/*.html"))
- engine.SetHTMLTemplate(templ)
- engine.StaticFS("/assets", http.FS(static.JsEmbed))
- } else {
- engine.LoadHTMLGlob("static/templates/*")
- engine.Static("/assets", "./static")
- }
-
+ engine.LoadHTMLGlob("static/templates/*")
+ engine.Static("/assets", "./static")
engine.Static("/static", "./static")
engine.Use(tools.Session("gofly"))
engine.Use(middleware.CrossSite)
//性能监控
- pprof.Register(engine)
+ //pprof.Register(engine)
//记录日志
engine.Use(middleware.NewMidLogger())
router.InitViewRouter(engine)
router.InitApiRouter(engine)
//记录pid
- ioutil.WriteFile("gofly.sock", []byte(fmt.Sprintf("%d,%d", os.Getppid(), os.Getpid())), 0666)
+ os.WriteFile("gofly.sock", []byte(fmt.Sprintf("%d,%d", os.Getppid(), os.Getpid())), 0666)
//限流类
tools.NewLimitQueue()
//清理
diff --git a/config/go-fly.sql b/config/go-fly.sql
deleted file mode 100644
index d82fe6c..0000000
--- a/config/go-fly.sql
+++ /dev/null
@@ -1,181 +0,0 @@
-DROP TABLE IF EXISTS `user`|
-CREATE TABLE `user` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(50) NOT NULL DEFAULT '',
- `password` varchar(50) NOT NULL DEFAULT '',
- `nickname` varchar(50) NOT NULL DEFAULT '',
- `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `updated_at` timestamp NULL DEFAULT NULL,
- `deleted_at` timestamp NULL DEFAULT NULL,
- `avator` varchar(100) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `idx_name` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-TRUNCATE TABLE `user`|
-INSERT INTO `user` (`id`, `name`, `password`, `nickname`, `created_at`, `updated_at`, `deleted_at`, `avator`) VALUE
-(1, 'kefu2', '202cb962ac59075b964b07152d234b70', '智能客服系统', '2020-06-27 19:32:41', '2020-07-04 09:32:20', NULL, '/static/images/4.jpg')|
-
-DROP TABLE IF EXISTS `visitor`|
-CREATE TABLE `visitor` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(50) NOT NULL DEFAULT '',
- `avator` varchar(500) NOT NULL DEFAULT '',
- `source_ip` varchar(50) NOT NULL DEFAULT '',
- `to_id` varchar(50) NOT NULL DEFAULT '',
- `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `updated_at` timestamp NULL DEFAULT NULL,
- `deleted_at` timestamp NULL DEFAULT NULL,
- `visitor_id` varchar(100) NOT NULL DEFAULT '',
- `status` tinyint(4) NOT NULL DEFAULT '0',
- `refer` varchar(500) NOT NULL DEFAULT '',
- `city` varchar(100) NOT NULL DEFAULT '',
- `client_ip` varchar(100) NOT NULL DEFAULT '',
- `extra` varchar(2048) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `visitor_id` (`visitor_id`),
- KEY `to_id` (`to_id`),
- KEY `idx_update` (`updated_at`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-
-DROP TABLE IF EXISTS `message`|
-CREATE TABLE `message` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `kefu_id` varchar(100) NOT NULL DEFAULT '',
- `visitor_id` varchar(100) NOT NULL DEFAULT '',
- `content` varchar(2048) NOT NULL DEFAULT '',
- `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `updated_at` timestamp NULL DEFAULT NULL,
- `deleted_at` timestamp NULL DEFAULT NULL,
- `mes_type` enum('kefu','visitor') NOT NULL DEFAULT 'visitor',
- `status` enum('read','unread') NOT NULL DEFAULT 'unread',
- PRIMARY KEY (`id`),
- KEY `kefu_id` (`kefu_id`),
- KEY `visitor_id` (`visitor_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4|
-
-DROP TABLE IF EXISTS `user_role`|
-CREATE TABLE `user_role` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) NOT NULL DEFAULT '0',
- `role_id` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-INSERT INTO `user_role` (`id`, `user_id`, `role_id`) VALUE
-(1, 1, 1)|
-
-DROP TABLE IF EXISTS `role`|
-CREATE TABLE `role` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(100) NOT NULL DEFAULT '',
- `method` varchar(100) NOT NULL DEFAULT '',
- `path` varchar(2048) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-INSERT INTO `role` (`id`, `name`, `method`, `path`) VALUES
-(1, '普通客服', '*', '*')|
-
-DROP TABLE IF EXISTS `welcome`|
-CREATE TABLE `welcome` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `user_id` varchar(100) NOT NULL DEFAULT '',
- `keyword` varchar(100) NOT NULL DEFAULT '',
- `content` varchar(500) NOT NULL DEFAULT '',
- `is_default` tinyint(3) unsigned NOT NULL DEFAULT '0',
- `ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`),
- KEY `user_id` (`user_id`),
- KEY `keyword` (`keyword`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-INSERT INTO `welcome` (`id`, `user_id`, `content`, `is_default`, `ctime`, `keyword`) VALUES
-(NULL, 'kefu2', '我暂时离线,留言已转发到我的邮箱,稍后回复~', 1, '2020-08-24 02:57:49','offline')|
-INSERT INTO `welcome` (`id`, `user_id`, `content`, `is_default`, `ctime`, `keyword`) VALUES
-(NULL, 'kefu2', '请问有什么可以帮您?', 0, '2020-08-24 02:57:49','welcome')|
-
-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`),
- UNIQUE KEY `ip` (`ip`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-
-DROP TABLE IF EXISTS `config`|
-CREATE TABLE `config` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `conf_name` varchar(255) NOT NULL DEFAULT '',
- `conf_key` varchar(255) NOT NULL DEFAULT '',
- `conf_value` varchar(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `conf_key` (`conf_key`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '发送通知邮件(SMTP地址)', 'NoticeEmailSmtp', '')|
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '发送通知邮件(邮箱)', 'NoticeEmailAddress', '')|
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '发送通知邮件(密码)', 'NoticeEmailPassword', '')|
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '发送通知邮件(密码)', 'NoticeEmailPassword', '')|
-DROP TABLE IF EXISTS `about`|
-CREATE TABLE `about` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `title_cn` varchar(255) NOT NULL DEFAULT '',
- `title_en` varchar(255) NOT NULL DEFAULT '',
- `keywords_cn` varchar(255) NOT NULL DEFAULT '',
- `keywords_en` varchar(255) NOT NULL DEFAULT '',
- `desc_cn` varchar(1024) NOT NULL DEFAULT '',
- `desc_en` varchar(1024) NOT NULL DEFAULT '',
- `css_js` text NOT NULL,
- `html_cn` text NOT NULL,
- `html_en` text NOT NULL,
- `page` varchar(50) NOT NULL DEFAULT '',
-PRIMARY KEY (`id`),
-UNIQUE KEY `page` (`page`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-DROP TABLE IF EXISTS `reply_group`|
-CREATE TABLE `reply_group` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `group_name` varchar(50) NOT NULL DEFAULT '',
- `user_id` varchar(50) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`),
- KEY `user_id` (`user_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-INSERT INTO `reply_group` (`id`, `group_name`, `user_id`) VALUES (NULL, '常见问题', 'kefu2')|
-DROP TABLE IF EXISTS `reply_item`|
-CREATE TABLE `reply_item` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `content` varchar(1024) NOT NULL DEFAULT '',
- `group_id` int(11) NOT NULL DEFAULT '0',
- `user_id` varchar(50) NOT NULL DEFAULT '',
- `item_name` varchar(50) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`),
- KEY `user_id` (`user_id`),
- KEY `group_id` (`group_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
-DROP TABLE IF EXISTS `land_page`|
-CREATE TABLE `land_page` (
- `id` int(11) NOT NULL,
- `title` varchar(125) NOT NULL DEFAULT '',
- `keyword` varchar(255) NOT NULL DEFAULT '',
- `content` text NOT NULL,
- `language` varchar(50) NOT NULL DEFAULT '',
- `page_id` varchar(50) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci|
-DROP TABLE IF EXISTS `language`|
-CREATE TABLE `language` (
- `id` int(11) NOT NULL,
- `country` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
- `short_key` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT ''
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci|
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES (1, '中文简体', 'zh-cn')|
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES (2, '正體中文', 'zh-tw')|
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES (3, 'English', 'en_us')|
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES (4, '日本語', 'ja_jp')|
-DROP TABLE IF EXISTS `user_client`|
-CREATE TABLE `user_client` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `kefu` varchar(100) NOT NULL DEFAULT '',
- `client_id` varchar(100) NOT NULL DEFAULT '',
- `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY `idx_user` (`kefu`,`client_id`),
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8|
\ No newline at end of file
diff --git a/go-fly.go b/gofly.go
similarity index 100%
rename from go-fly.go
rename to gofly.go
diff --git a/import.sql b/import.sql
index b4d713e..7ef9d6f 100644
--- a/import.sql
+++ b/import.sql
@@ -13,7 +13,7 @@ CREATE TABLE `user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
TRUNCATE TABLE `user`;
INSERT INTO `user` (`id`, `name`, `password`, `nickname`, `created_at`, `updated_at`, `deleted_at`, `avator`) VALUE
-(1, 'kefu2', '202cb962ac59075b964b07152d234b70', 'Open Source LiveChat Support', '2020-06-27 19:32:41', '2020-07-04 09:32:20', NULL, '/static/images/4.jpg');
+(1, 'agent', 'b33aed8f3134996703dc39f9a7c95783', 'Open Source LiveChat Support', '2020-06-27 19:32:41', '2020-07-04 09:32:20', NULL, '/static/images/4.jpg');
DROP TABLE IF EXISTS `visitor`;
CREATE TABLE `visitor` (
@@ -53,44 +53,6 @@ CREATE TABLE `message` (
KEY `visitor_id` (`visitor_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-DROP TABLE IF EXISTS `user_role`;
-CREATE TABLE `user_role` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(11) NOT NULL DEFAULT '0',
- `role_id` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO `user_role` (`id`, `user_id`, `role_id`) VALUE
-(1, 1, 1);
-
-DROP TABLE IF EXISTS `role`;
-CREATE TABLE `role` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `name` varchar(100) NOT NULL DEFAULT '',
- `method` varchar(100) NOT NULL DEFAULT '',
- `path` varchar(2048) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO `role` (`id`, `name`, `method`, `path`) VALUES
-(1, 'Customer Support', '*', '*');
-
-DROP TABLE IF EXISTS `welcome`;
-CREATE TABLE `welcome` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `user_id` varchar(100) NOT NULL DEFAULT '',
- `keyword` varchar(100) NOT NULL DEFAULT '',
- `content` varchar(500) NOT NULL DEFAULT '',
- `is_default` tinyint(3) unsigned NOT NULL DEFAULT '0',
- `ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`),
- KEY `user_id` (`user_id`),
- KEY `keyword` (`keyword`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO `welcome` (`id`, `user_id`, `content`, `is_default`, `ctime`, `keyword`) VALUES
-(NULL, 'kefu2', 'I am currently offline. Your message has been forwarded to my email and I will reply soon.', 1, '2020-08-24 02:57:49','offline');
-INSERT INTO `welcome` (`id`, `user_id`, `content`, `is_default`, `ctime`, `keyword`) VALUES
-(NULL, 'kefu2', 'How may I help you today?', 0, '2020-08-24 02:57:49','welcome');
-
DROP TABLE IF EXISTS `ipblack`;
CREATE TABLE `ipblack` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -107,34 +69,23 @@ CREATE TABLE `config` (
`conf_name` varchar(255) NOT NULL DEFAULT '',
`conf_key` varchar(255) NOT NULL DEFAULT '',
`conf_value` varchar(255) NOT NULL DEFAULT '',
+ `user_id` varchar(500) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `conf_key` (`conf_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES
-(NULL, 'Announcement', 'AllNotice', 'Open source customer support system at your service');
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES
-(NULL, 'Offline Message', 'OfflineMessage', 'I am currently offline and will reply to you later!');
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES
-(NULL, 'Welcome Message', 'WelcomeMessage', 'How may I help you?');
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES
-(NULL, 'Email Address (SMTP)', 'NoticeEmailSmtp', '');
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES
-(NULL, 'Email Account', 'NoticeEmailAddress', '');
-INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES
-(NULL, 'Email Password (SMTP)', 'NoticeEmailPassword', '');
+INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`, `user_id`) VALUES
+(NULL, 'Announcement', 'AllNotice', 'Open source customer support system at your service','agent');
+INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`, `user_id`) VALUES
+(NULL, 'Offline Message', 'OfflineMessage', 'I am currently offline and will reply to you later!','agent');
+INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`, `user_id`) VALUES
+(NULL, 'Welcome Message', 'WelcomeMessage', 'How may I help you?','agent');
+INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`, `user_id`) VALUES
+(NULL, 'Email Address (SMTP)', 'NoticeEmailSmtp', '','agent');
+INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`, `user_id`) VALUES
+(NULL, 'Email Account', 'NoticeEmailAddress', '','agent');
+INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`, `user_id`) VALUES
+(NULL, 'Email Password (SMTP)', 'NoticeEmailPassword', '','agent');
-DROP TABLE IF EXISTS `about`;
-CREATE TABLE `about` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `title_en` varchar(255) NOT NULL DEFAULT '',
- `keywords_en` varchar(255) NOT NULL DEFAULT '',
- `desc_en` varchar(1024) NOT NULL DEFAULT '',
- `css_js` text NOT NULL,
- `html_en` text NOT NULL,
- `page` varchar(50) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `page` (`page`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `reply_group`;
CREATE TABLE `reply_group` (
@@ -145,7 +96,7 @@ CREATE TABLE `reply_group` (
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `reply_group` (`id`, `group_name`, `user_id`) VALUES
-(NULL, 'Frequently Asked Questions', 'kefu2');
+(NULL, 'Frequently Asked Questions', 'agent');
DROP TABLE IF EXISTS `reply_item`;
CREATE TABLE `reply_item` (
@@ -157,40 +108,4 @@ CREATE TABLE `reply_item` (
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `group_id` (`group_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-DROP TABLE IF EXISTS `land_page`;
-CREATE TABLE `land_page` (
- `id` int(11) NOT NULL,
- `title` varchar(125) NOT NULL DEFAULT '',
- `keyword` varchar(255) NOT NULL DEFAULT '',
- `content` text NOT NULL,
- `language` varchar(50) NOT NULL DEFAULT '',
- `page_id` varchar(50) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-
-DROP TABLE IF EXISTS `language`;
-CREATE TABLE `language` (
- `id` int(11) NOT NULL,
- `country` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
- `short_key` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT ''
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES
-(1, 'Simplified Chinese', 'zh-cn');
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES
-(2, 'Traditional Chinese', 'zh-tw');
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES
-(3, 'English', 'en-us');
-INSERT INTO `language` (`id`, `country`, `short_key`) VALUES
-(4, 'Japanese', 'ja-jp');
-
-DROP TABLE IF EXISTS `user_client`;
-CREATE TABLE `user_client` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `kefu` varchar(100) NOT NULL DEFAULT '',
- `client_id` varchar(100) NOT NULL DEFAULT '',
- `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- UNIQUE KEY `idx_user` (`kefu`,`client_id`),
- PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/readme.md b/readme.md
index 5397867..57f4a04 100644
--- a/readme.md
+++ b/readme.md
@@ -45,7 +45,7 @@ go env -w GOPROXY=https://goproxy.cn,direct
Clone the repository in any directory:
```php
git clone https://github.com/taoshihan1991/go-fly.git
-cd go-fly
+cd gofly
```
* Initialize the Database
```php
@@ -76,7 +76,7 @@ For domain access, configure a reverse proxy to port 8081 to hide the port numbe
### Customer Service Integration
Chat Link
-http://127.0.0.1:8081/chatIndex?kefu_id=kefu2
+http://127.0.0.1:8081/chatIndex?kefu_id=agent
Popup Integration
@@ -89,7 +89,7 @@ Popup Integration
})(window, document,"http://127.0.0.1:8081",function(u){
KEFU.init({
KEFU_URL:u,
- KEFU_KEFU_ID: "kefu2",
+ KEFU_KEFU_ID: "agent",
})
});
diff --git a/readme_en.md b/readme_en.md
deleted file mode 100644
index a008cda..0000000
--- a/readme_en.md
+++ /dev/null
@@ -1,137 +0,0 @@
-# GOFLY [V1KF] GOFLY LIVE CHAT FOR CUSTOMER SUPPORT SERVICE
-中文 |
-English |
-The official website
-
-### Please note that this project is for personal learning and testing only, and is prohibited for all online commercial use and illegal use!
-
-### It appears that you are providing information about purchasing a paid version of the software and receiving an installation package and authorization.
-
-## The main technology stack
-gin + jwt-go + websocket + go.uuid + gorm + cobra + VueJS + ElementUI + MySQL
-
-### Preview
-
-
-
-
-
-
-
-
-
-### To install and use:
-
-
-#### 1. Install and run MySQL >=5.5, and create the gofly database.
-
- create database gofly charset utf8;
-
- edit config/mysql.json
-```php
-{
- "Server":"127.0.0.1",
- "Port":"3306",
- "Database":"gofly",
- "Username":"go-fly",
- "Password":"go-fly"
-}
-```
-
-#### 2. Run the source code:
-
-1. Go module:
-
- go env -w GO111MODULE=on
-
- go env -w GOPROXY=https://goproxy.cn,direct
-
- git clone https://github.com/taoshihan1991/go-fly.git
-
- go run go-fly.go install
-
- go run go-fly.go server
-
-3. Source code packaging: go build go-fly.go, which will generate the go-fly executable file.
-
-4. Import the database (will delete the table and clear the data): ./go-fly install
-
-5. Binary file execution:
-
- linux: ./go-fly server [optional -p 8082 -d]
-
- windows: go-fly.exe server [optional -p 8082 -d]
-
-6. Close the program:
- ./go-fly stop
-
- For Linux, use the ps and kill commands to kill the process:
-
- ps -ef|grep go-fly
-
- kill process parent process id; kill process child process id
-
- or killall go-fly
-
-#### Usage
-The server installation is complete and the service is running, and the client can be accessed through the browser.
-
-The default port is 8081. If you use the -p parameter to specify the port, you can access it through the browser http://127.0.0.1:port.
-
-The default user name and password are kefu2 and 123
-
-
-
-
-### Nginx
-
-```php
-server {
- listen 443 ssl http2;
- ssl on;
- ssl_certificate conf.d/cert/4263285_gofly.sopans.com.pem;
- ssl_certificate_key conf.d/cert/4263285_gofly.sopans.com.key;
- ssl_session_timeout 5m;
- ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
- ssl_prefer_server_ciphers on;
- #listen 80;
- server_name gofly.sopans.com;
- access_log /var/log/nginx/gofly.sopans.com.access.log main;
- location /static {
- root /var/www/html/go-fly;//自己的部署路径,静态文件直接nginx响应
- }
- location / {
- proxy_pass http://127.0.0.1:8081;
- proxy_http_version 1.1;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Origin "";
- }
-}
-server{
- listen 80;
- server_name gofly.sopans.com;
- access_log /var/log/nginx/gofly.sopans.com.access.log main;
- location /static {
- root /var/www/html/go-fly;//自己的部署路径,静态文件直接nginx响应
- }
- location / {
- proxy_pass http://127.0.0.1:8081;
- proxy_http_version 1.1;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Origin "";
- }
-}
-```
-
-#### If you encounter a pop-up window requiring authentication after logging into the backend, please go to the official website to register an account and bind your phone. Entering your bound phone number + your own password will allow you to pass the authentication. If you do not have a Chinese phone number, please contact me on the official website to obtain a test phone number and password.
-
-### Copyright
-
-This project is a complete code with full functionality, but it is still only for personal demonstration and testing and does not include online use.
-
-All commercial activities are prohibited. When using this software, please comply with local laws and regulations. Any illegal use is at your own risk.
\ No newline at end of file