mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-20 19:07:56 +08:00
Merge branch 'master' into dev
# Conflicts: # main.go
This commit is contained in:
@@ -21,10 +21,11 @@ before_deploy:
|
|||||||
- GOARCH=amd64 GOOS=linux go build -o godoc_linux_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
|
- GOARCH=amd64 GOOS=linux go build -o godoc_linux_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
|
||||||
- GOARCH=amd64 GOOS=darwin go build -o godoc_darwin_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
|
- GOARCH=amd64 GOOS=darwin go build -o godoc_darwin_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
|
||||||
- GOARCH=amd64 GOOS=windows go build -o godoc_windows_amd64.exe -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
|
- GOARCH=amd64 GOOS=windows go build -o godoc_windows_amd64.exe -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
|
||||||
- rm -rf commands controllers models modules routers tasks vendor docs search data utils graphics .git Godeps uploads/* .gitignore .travis.yml Dockerfile gide.yaml LICENSE main.go README.md conf/enumerate.go conf/mail.go install.lock *.md
|
- rm -rf commands controllers models modules data routers tasks vendor docs search utils graphics .git Godeps uploads/* .gitignore .travis.yml Dockerfile gide.yaml LICENSE main.go README.md conf/enumerate.go conf/mail.go install.lock *.md
|
||||||
- zip -r godoc_linux_amd64.zip conf logs static uploads views godoc_linux_amd64
|
- cp conf/app.conf.example conf/app.conf
|
||||||
- zip -r godoc_darwin_amd64.zip conf logs static uploads views godoc_darwin_amd64
|
- zip -r godoc_linux_amd64.zip conf logs static uploads views lib godoc_linux_amd64
|
||||||
- zip -r godoc_windows_amd64.zip conf logs static uploads views godoc_windows_amd64.exe
|
- zip -r godoc_darwin_amd64.zip conf logs static uploads views lib godoc_darwin_amd64
|
||||||
|
- zip -r godoc_windows_amd64.zip conf logs static uploads views lib godoc_windows_amd64.exe
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
@@ -12,6 +12,8 @@ MinDoc 的前身是 SmartWiki 文档系统。SmartWiki 是基于 PHP 框架 lara
|
|||||||
|
|
||||||
# 安装与使用
|
# 安装与使用
|
||||||
|
|
||||||
|
**如果你的服务器上没有安装golang程序请手动设置一个环境变量如下:键名为 ZONEINFO,值为MinDoc程序所在路径。**
|
||||||
|
|
||||||
**Windows 教程:** [https://github.com/lifei6671/godoc/blob/master/README_WIN.md](https://github.com/lifei6671/godoc/blob/master/README_WIN.md)
|
**Windows 教程:** [https://github.com/lifei6671/godoc/blob/master/README_WIN.md](https://github.com/lifei6671/godoc/blob/master/README_WIN.md)
|
||||||
|
|
||||||
**Linux 教程:** [https://github.com/lifei6671/godoc/blob/master/README_LINUX.md](https://github.com/lifei6671/godoc/blob/master/README_LINUX.md)
|
**Linux 教程:** [https://github.com/lifei6671/godoc/blob/master/README_LINUX.md](https://github.com/lifei6671/godoc/blob/master/README_LINUX.md)
|
||||||
|
@@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/astaxie/beego/orm"
|
"github.com/astaxie/beego/orm"
|
||||||
"github.com/astaxie/beego/logs"
|
"github.com/astaxie/beego/logs"
|
||||||
"github.com/lifei6671/godoc/conf"
|
"github.com/lifei6671/godoc/conf"
|
||||||
|
|
||||||
"github.com/lifei6671/gocaptcha"
|
"github.com/lifei6671/gocaptcha"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RegisterDataBase 注册数据库
|
// RegisterDataBase 注册数据库
|
||||||
@@ -31,7 +31,12 @@ func RegisterDataBase() {
|
|||||||
|
|
||||||
orm.RegisterDataBase("default", "mysql", dataSource)
|
orm.RegisterDataBase("default", "mysql", dataSource)
|
||||||
|
|
||||||
orm.DefaultTimeLoc, _ = time.LoadLocation(timezone)
|
location , err := time.LoadLocation(timezone);
|
||||||
|
if err == nil {
|
||||||
|
orm.DefaultTimeLoc = location
|
||||||
|
}else{
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
589032
data/dictionary.txt
589032
data/dictionary.txt
File diff suppressed because it is too large
Load Diff
1161
data/stop_tokens.txt
1161
data/stop_tokens.txt
File diff suppressed because it is too large
Load Diff
10
lib/time/README
Normal file
10
lib/time/README
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
The zoneinfo.zip archive contains time zone files compiled using
|
||||||
|
the code and data maintained as part of the IANA Time Zone Database.
|
||||||
|
The IANA asserts that the database is in the public domain.
|
||||||
|
|
||||||
|
For more information, see
|
||||||
|
http://www.iana.org/time-zones
|
||||||
|
ftp://ftp.iana.org/tz/code/tz-link.htm
|
||||||
|
http://tools.ietf.org/html/rfc6557
|
||||||
|
|
||||||
|
To rebuild the archive, read and run update.bash.
|
51
lib/time/update.bash
Normal file
51
lib/time/update.bash
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2012 The Go Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style
|
||||||
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
# This script rebuilds the time zone files using files
|
||||||
|
# downloaded from the ICANN/IANA distribution.
|
||||||
|
# Consult http://www.iana.org/time-zones for the latest versions.
|
||||||
|
|
||||||
|
# Versions to use.
|
||||||
|
CODE=2016j
|
||||||
|
DATA=2016j
|
||||||
|
|
||||||
|
set -e
|
||||||
|
rm -rf work
|
||||||
|
mkdir work
|
||||||
|
cd work
|
||||||
|
mkdir zoneinfo
|
||||||
|
curl -O http://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
|
||||||
|
curl -O http://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
|
||||||
|
tar xzf tzcode$CODE.tar.gz
|
||||||
|
tar xzf tzdata$DATA.tar.gz
|
||||||
|
|
||||||
|
# Turn off 64-bit output in time zone files.
|
||||||
|
# We don't need those until 2037.
|
||||||
|
perl -p -i -e 's/pass <= 2/pass <= 1/' zic.c
|
||||||
|
|
||||||
|
make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo posix_only
|
||||||
|
|
||||||
|
# America/Los_Angeles should not be bigger than 1100 bytes.
|
||||||
|
# If it is, we probably failed to disable the 64-bit output, which
|
||||||
|
# triples the size of the files.
|
||||||
|
size=$(ls -l zoneinfo/America/Los_Angeles | awk '{print $5}')
|
||||||
|
if [ $size -gt 1200 ]; then
|
||||||
|
echo 'zone file too large; 64-bit edit failed?' >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd zoneinfo
|
||||||
|
rm -f ../../zoneinfo.zip
|
||||||
|
zip -0 -r ../../zoneinfo.zip *
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
echo
|
||||||
|
if [ "$1" == "-work" ]; then
|
||||||
|
echo Left workspace behind in work/.
|
||||||
|
else
|
||||||
|
rm -rf work
|
||||||
|
fi
|
||||||
|
echo New time zone files in zoneinfo.zip.
|
||||||
|
|
BIN
lib/time/zoneinfo.zip
Normal file
BIN
lib/time/zoneinfo.zip
Normal file
Binary file not shown.
10
main.go
10
main.go
@@ -3,17 +3,14 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/lifei6671/godoc/routers"
|
_ "github.com/lifei6671/godoc/routers"
|
||||||
_ "github.com/astaxie/beego/session/redis"
|
_ "github.com/astaxie/beego/session/redis"
|
||||||
_ "github.com/astaxie/beego/session/memcache"
|
_ "github.com/astaxie/beego/session/memcache"
|
||||||
_ "github.com/astaxie/beego/session/mysql"
|
_ "github.com/astaxie/beego/session/mysql"
|
||||||
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
"github.com/lifei6671/godoc/commands"
|
"github.com/lifei6671/godoc/commands"
|
||||||
"github.com/lifei6671/godoc/controllers"
|
"github.com/lifei6671/godoc/controllers"
|
||||||
"github.com/lifei6671/godoc/conf"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -22,12 +19,11 @@ var (
|
|||||||
GO_VERSION string
|
GO_VERSION string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", VERSION, BUILD_TIME, os.Args[0],GO_VERSION)
|
fmt.Printf("MinDoc version => %s\nbuild time => %s\nstart directory => %s\n%s\n", VERSION, BUILD_TIME, os.Args[0],GO_VERSION)
|
||||||
|
|
||||||
conf.VERSION = VERSION
|
|
||||||
|
|
||||||
commands.RegisterDataBase()
|
commands.RegisterDataBase()
|
||||||
commands.RegisterModel()
|
commands.RegisterModel()
|
||||||
commands.RegisterLogger()
|
commands.RegisterLogger()
|
||||||
@@ -36,8 +32,10 @@ func main() {
|
|||||||
|
|
||||||
beego.SetStaticPath("uploads","uploads")
|
beego.SetStaticPath("uploads","uploads")
|
||||||
|
|
||||||
beego.ErrorController(&controllers.ErrorController{})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
beego.ErrorController(&controllers.ErrorController{})
|
||||||
beego.Run()
|
beego.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -214,17 +214,17 @@ func (m *Book) ThoroughDeleteBook(id int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
o.Begin()
|
o.Begin()
|
||||||
sql1 := "DELETE FROM " + NewComment().TableNameWithPrefix() + " WHERE book_id = ?"
|
//sql1 := "DELETE FROM " + NewComment().TableNameWithPrefix() + " WHERE book_id = ?"
|
||||||
|
//
|
||||||
_,err := o.Raw(sql1,m.BookId).Exec()
|
//_,err := o.Raw(sql1,m.BookId).Exec()
|
||||||
|
//
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
o.Rollback()
|
// o.Rollback()
|
||||||
return err
|
// return err
|
||||||
}
|
//}
|
||||||
sql2 := "DELETE FROM " + NewDocument().TableNameWithPrefix() + " WHERE book_id = ?"
|
sql2 := "DELETE FROM " + NewDocument().TableNameWithPrefix() + " WHERE book_id = ?"
|
||||||
|
|
||||||
_,err = o.Raw(sql2,m.BookId).Exec()
|
_,err := o.Raw(sql2,m.BookId).Exec()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
o.Rollback()
|
o.Rollback()
|
||||||
|
Reference in New Issue
Block a user