Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9dc4ed8
Showing
620 changed files
with
716,747 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Go template | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 | ||
.glide/ | ||
### macOS template | ||
*.DS_Store | ||
.AppleDouble | ||
.DS_Store | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
wenku.it | ||
wenku.it.jpg | ||
cache | ||
tests | ||
|
||
cache/runtime/ | ||
logs/ | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
controllers/MobileControllers/ | ||
static/Admin/default/img/ | ||
uploads/ | ||
.idea | ||
/logs/*.log | ||
/cache/* | ||
DocHub | ||
*.sql | ||
*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#项目名称 | ||
appname = DocHub | ||
#程序版本 | ||
version=1.0 | ||
#运行端口 | ||
httpport = 8090 | ||
#运行模式:prod, dev 或者 test【正式部署站点的时候,设置为prod】 | ||
runmode = dev | ||
|
||
#页面底部单页显示个数限制 | ||
pageslimit=6 | ||
|
||
#必须启用session,否则无法登录后台 | ||
sessionon = true | ||
#开启文件存储session | ||
SessionProvider=file | ||
#Session存放位置 | ||
SessionProviderConfig=cache/session | ||
SessionName=dochub | ||
|
||
|
||
#爬虫采集下载的文档在本地的存放路径 | ||
|
||
|
||
cookieSecret=sfgowtrfgjqwetryfqef8sd | ||
|
||
#允许上传的文件大小(单位:字节),默认50MB=52428800 | ||
max_upload_size=52428800 | ||
|
||
#成功或失败页面的跳转等待时间,默认5秒 | ||
redirect_time=5 | ||
|
||
#会员注册的金币奖励 | ||
coinreg=10 | ||
|
||
#开启GZip[建议开启] | ||
EnableGzip=true | ||
|
||
#文档下载连接URL有效期,单位为秒,默认60秒 | ||
UrlExpire=60 | ||
|
||
#libreoffice的可执行文件路径(注意,windows下要用\\代替原路径的\) | ||
#如:“C:\Program Files (x86)\LibreOffice 4\program\soffice”要换成“C:\\Program Files (x86)\\LibreOffice 4\\program\\soffice” | ||
#soffice=C:\\Program Files (x86)\\LibreOffice 5\\program\\soffice | ||
soffice=/Applications/LibreOffice.app/Contents/MacOS/soffice | ||
#soffice=soffice | ||
|
||
#imagick命令行 | ||
imagick=convert | ||
|
||
#pdf2svg命令 | ||
pdf2svg=pdf2svg | ||
|
||
#是否开启svg压缩,开启压缩,需要配置svgo | ||
compressSvg=true | ||
|
||
#svg文件压缩【nodejs模块】 | ||
svgo=svgo | ||
|
||
#举报原因,参考格式:1:垃圾广告;2:淫秽色情;3:虚假中奖;4:敏感信息;5:人身攻击;6:骚扰他人 | ||
ReportReason=1:垃圾广告;2:淫秽色情;3:虚假中奖;4:敏感信息;5:人身攻击;6:骚扰他人 | ||
|
||
#本地浏览文件 | ||
|
||
#启动XSRF | ||
enablexsrf = true | ||
xsrfkey = gsrtewrt45324joidsffrtqwe | ||
xsrfexpire = 3600 | ||
|
||
|
||
#搜索API[这个应该设置为在后台可配置] | ||
SearchApi=http://api.wenku.it/index.php | ||
|
||
|
||
########以下不要改动###### | ||
|
||
#引入数据库配置文件 | ||
include "database.conf" | ||
|
||
#引入邮箱配置 | ||
include "email.conf" | ||
|
||
|
||
#引入OSS配置 | ||
include "oss.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[email] | ||
host=smtpdm.aliyun.com | ||
port=80 | ||
username=admin@wenkuzhijia.cn | ||
password=HCF1990wenkuzhijia | ||
replyto=truthhun@foxmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[oss] | ||
#当前环境是否内网,内网则启用内网endpoint,否则启用外网endpoint | ||
IsInternal=false | ||
|
||
#内网的endpoint | ||
EndpointInternal=oss-cn-hongkong-internal.aliyuncs.com | ||
|
||
#外网的endpoint | ||
EndpointOuter=oss-cn-qingdao.aliyuncs.com | ||
|
||
#key | ||
AccessKeyId= | ||
|
||
#secret | ||
AccessKeySecret= | ||
|
||
#供文档预览的bucket | ||
BucketPreview=wenku-preview | ||
|
||
#供文档存储的bucket | ||
BucketStore=itwenku-store | ||
|
||
#预览链接 | ||
#PreviewUrl=http://wenku-preview.oss-cn-qingdao.aliyuncs.com | ||
PreviewUrl=http://static.wenku.it | ||
DownloadUrl=http://dl.wenku.it | ||
|
||
#签名链接默认有效期时间,单位为秒 | ||
UrlExpire=600 | ||
|
||
#默认图片 | ||
DefaultAvatar=/default/avatar.png | ||
DefaultCover=/default/cover.jpg | ||
DefaultBanner=/default/banner.jpg | ||
DefaultPic=/default/default.jpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package AdminControllers | ||
|
||
type AdController struct { | ||
BaseController | ||
} | ||
|
||
func (this *AdController) Get() { | ||
this.Data["IsAd"] = true | ||
this.TplName = "index.html" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package AdminControllers | ||
|
||
import ( | ||
"fmt" | ||
|
||
"time" | ||
|
||
"os" | ||
|
||
"strings" | ||
|
||
"github.com/TruthHun/DocHub/helper" | ||
"github.com/TruthHun/DocHub/models" | ||
) | ||
|
||
//IT文库注册会员管理 | ||
|
||
type BannerController struct { | ||
BaseController | ||
} | ||
|
||
//横幅列表 | ||
func (this *BannerController) Get() { | ||
var err error | ||
if this.Data["Banners"], _, err = models.ModelBanner.List(1, 100); err != nil { | ||
helper.Logger.Error(err.Error()) | ||
} | ||
this.Data["IsBanner"] = true | ||
this.TplName = "index.html" | ||
} | ||
|
||
//新增横幅 | ||
func (this *BannerController) Add() { | ||
f, h, err := this.GetFile("Picture") | ||
if err == nil { | ||
defer f.Close() | ||
dir := "uploads/" + time.Now().Format("2006-01-02") | ||
os.MkdirAll(dir, 0777) | ||
ext := helper.GetSuffix(h.Filename, ".") | ||
filepath := dir + "/" + helper.MyMD5(fmt.Sprintf("%v-%v", h.Filename, time.Now().Unix())) + "." + ext | ||
err = this.SaveToFile("Picture", filepath) // 保存位置 | ||
if err == nil { | ||
if md5str, err := helper.FileMd5(filepath); err == nil { | ||
save := md5str + "." + ext | ||
err = models.ModelOss.MoveToOss(filepath, save, true, true) | ||
if err == nil { | ||
var banner models.Banner | ||
this.ParseForm(&banner) | ||
banner.Picture = save | ||
banner.TimeCreate = int(time.Now().Unix()) | ||
banner.Status = true | ||
_, err = models.O.Insert(&banner) | ||
} | ||
} | ||
} | ||
} | ||
if err != nil { | ||
helper.Logger.Error(err.Error()) | ||
this.ResponseJson(0, err.Error()) | ||
} | ||
this.ResponseJson(1, "横幅添加成功") | ||
} | ||
|
||
//删除横幅 | ||
func (this *BannerController) Del() { | ||
var err error | ||
id := this.GetString("id") | ||
ids := strings.Split(id, ",") | ||
if len(ids) > 0 { | ||
//之所以这么做,是因为如果没有第一个参数,则参数编程了[]string,而不是[]interface{},有疑问可以自己验证试下 | ||
if _, err = models.ModelBanner.Del(ids[0], ids[1:]); err != nil { | ||
helper.Logger.Error(err.Error()) | ||
this.ResponseJson(0, err.Error()) | ||
} | ||
} | ||
this.ResponseJson(1, "删除成功") | ||
} |
Oops, something went wrong.