Skip to content

Commit

Permalink
1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tavenli committed May 31, 2017
1 parent 702aff3 commit 769800d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 102 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Go语言开发的端口转发工具 for port data forward
```
开发语言:GO
控制台框架:beego
数据库:sqlite3
```

# 功能介绍
Expand All @@ -26,11 +27,9 @@ Go语言开发的端口转发工具 for port data forward
# 快速安装说明
1. 下载编译好的程序包,并解压程序包
2. 在执行程序包目录下找 data/PortForwardDb.sql 的数据库创建文件,创建好数据库 PortForwardDb
3. 修改 conf/data.conf 中的数据库连接串,主要是修改连接MySQL的用户名和密码
4. 执行 start.sh (Linux)或 start.bat (Win)命令
5. 打开浏览器,进入控制台,打开 http://127.0.0.1:8000/login
6. 输入用户 admin 密码 123456 进入控制台
2. 执行 start.sh (Linux)或 start.bat (Win)命令
3. 打开浏览器,进入控制台,打开 http://127.0.0.1:8000/login
4. 输入用户 admin 密码 123456 进入控制台


# 控制台UI
Expand Down
6 changes: 3 additions & 3 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ echo "Build For Linux..."
set GOOS=linux
set GOARCH=amd64
set GOPATH=%GoDevWork%;%GOPATH%
go build -o PortForward
go build -o port-forward

echo "--------- Build For Linux Success!"

echo "Build For Win..."
:: set GOOS=windows
:: set GOARCH=386
:: go build -o PortForward.exe
:: go build -o port-forward.exe

set GOOS=windows
set GOARCH=amd64
set GOPATH=%GoDevWork%;%GOPATH%
go build -o PortForward.exe
go build -o port-forward.exe

echo "--------- Build For Win Success!"

Expand Down
87 changes: 0 additions & 87 deletions data/PortForwardDb.sql

This file was deleted.

15 changes: 8 additions & 7 deletions services/InitServices.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package services

import (
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
_ "github.com/mattn/go-sqlite3"
)

var (
Expand All @@ -15,12 +14,14 @@ var (
func init() {
//数据库连接
//_ "github.com/mattn/go-sqlite3"
//orm.RegisterDriver("sqlite3", orm.DRSqlite)
//orm.RegisterDataBase("default", "sqlite3", "data/data.db?cache=shared&mode=rwc")
orm.RegisterDriver("sqlite3", orm.DRSqlite)
orm.RegisterDataBase("default", "sqlite3", "file:data/data.db?cache=shared&loc=auto")
//orm.RegisterDataBase("default", "sqlite3", "file::memory:?mode=memory&cache=shared&loc=auto")

dataSource := beego.AppConfig.String("mysql.url")
orm.RegisterDriver("mysql", orm.DRMySQL)
orm.RegisterDataBase("default", "mysql", dataSource)
//_ "github.com/go-sql-driver/mysql"
//dataSource := beego.AppConfig.String("mysql.url")
//orm.RegisterDriver("mysql", orm.DRMySQL)
//orm.RegisterDataBase("default", "mysql", dataSource)

//开启DEBUG模式,输出SQL信息
orm.Debug = true
Expand Down
1 change: 1 addition & 0 deletions services/SysDataService.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ func (_self *SysDataService) SavePortForward(entity *models.PortForward) error {
}

func (_self *SysDataService) DelPortForwards(ids []int) error {
//sqlite3在debug模式中,每次操作后会卡住,release环境中没有问题
//批量删除
del_num, err := OrmerS.QueryTable(new(models.PortForward)).Filter("Id__in", ids).Delete()
if err != nil {
Expand Down

0 comments on commit 769800d

Please sign in to comment.