Skip to content

Commit bca5364

Browse files
committed
修复图书封面上传bug
2 parents 9d9d5ca + b5a18dd commit bca5364

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,7 @@ docker
4949
license.cert
5050
index
5151
index/
52+
/web
53+
/am
54+
/group
55+
/platform

controllers/BaseController.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (this *BaseController) SetMember(member models.Member) {
216216

217217
// JsonResult 响应 json 结果
218218
func (this *BaseController) JsonResult(errCode int, errMsg string, data ...interface{}) {
219-
if !this.Ctx.Input.IsAjax() {
219+
if !this.Ctx.Input.IsAjax() && this.Ctx.Request.Method == "GET" {
220220
this.Data["Message"] = errMsg
221221
this.Abort("404")
222222
}
@@ -276,17 +276,17 @@ func (this *BaseController) BaseUrl() string {
276276
return this.Ctx.Input.Scheme() + "://" + this.Ctx.Request.Host
277277
}
278278

279-
//显示错误信息页面.
279+
// 显示错误信息页面.
280280
func (this *BaseController) ShowErrorPage(errCode int, errMsg string) {
281281
this.TplName = "errors/error.html"
282282
this.Data["ErrorMessage"] = errMsg
283283
this.Data["ErrorCode"] = errCode
284284
this.StopRun()
285285
}
286286

287-
//根据页面获取seo
288-
//@param page 页面标识
289-
//@param defSeo 默认的seo的map,必须有title、keywords和description字段
287+
// 根据页面获取seo
288+
// @param page 页面标识
289+
// @param defSeo 默认的seo的map,必须有title、keywords和description字段
290290
func (this *BaseController) GetSeoByPage(page string, defSeo map[string]string) {
291291
var seo models.Seo
292292

@@ -304,7 +304,7 @@ func (this *BaseController) GetSeoByPage(page string, defSeo map[string]string)
304304
this.Data["SeoDescription"] = seo.Description
305305
}
306306

307-
//站点地图
307+
// 站点地图
308308
func (this *BaseController) Sitemap() {
309309
this.Data["SeoTitle"] = "站点地图 - " + this.Sitename
310310
page, _ := this.GetInt("page")
@@ -344,7 +344,7 @@ func (this *BaseController) loginByMemberId(memberId int) (err error) {
344344
return err
345345
}
346346

347-
//在markdown头部加上<bookstack></bookstack>或者<bookstack/>,即解析markdown中的ul>li>a链接作为目录
347+
// 在markdown头部加上<bookstack></bookstack>或者<bookstack/>,即解析markdown中的ul>li>a链接作为目录
348348
func (this *BaseController) sortBySummary(bookIdentify, htmlStr string, bookId int) string {
349349
debug := beego.AppConfig.String("runmod") != "prod"
350350
o := orm.NewOrm()
@@ -464,16 +464,16 @@ func (this *BaseController) sortBySummary(bookIdentify, htmlStr string, bookId i
464464
return htmlStr
465465
}
466466

467-
//排序
467+
// 排序
468468
type Sort struct {
469469
Id int
470470
Pid int
471471
SortOrder int
472472
Identify string
473473
}
474474

475-
//替换链接
476-
//如果是summary,则根据这个进行排序调整
475+
// 替换链接
476+
// 如果是summary,则根据这个进行排序调整
477477
func (this *BaseController) replaceLinks(bookIdentify string, docHtml string, isSummary ...bool) string {
478478
var (
479479
book models.Book
@@ -530,7 +530,7 @@ func (this *BaseController) replaceLinks(bookIdentify string, docHtml string, is
530530
return docHtml
531531
}
532532

533-
//内容采集
533+
// 内容采集
534534
func (this *BaseController) Crawl() {
535535
if this.Member.MemberId > 0 {
536536
if val, ok := this.GetSession("crawl").(string); ok && val == "1" {
@@ -552,7 +552,7 @@ func (this *BaseController) Crawl() {
552552
this.JsonResult(1, "请先登录再操作")
553553
}
554554

555-
//关注或取消关注
555+
// 关注或取消关注
556556
func (this *BaseController) SetFollow() {
557557
var cancel bool
558558
if this.Member == nil || this.Member.MemberId == 0 {

controllers/SettingController.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type SettingController struct {
2424
BaseController
2525
}
2626

27-
//基本信息
27+
// 基本信息
2828
func (this *SettingController) Index() {
2929
if this.Ctx.Input.IsPost() {
3030
email := strings.TrimSpace(this.GetString("email", ""))
@@ -62,7 +62,7 @@ func (this *SettingController) Index() {
6262
this.TplName = "setting/index.html"
6363
}
6464

65-
//修改密码
65+
// 修改密码
6666
func (this *SettingController) Password() {
6767

6868
if this.Ctx.Input.IsPost() {
@@ -114,7 +114,7 @@ func (this *SettingController) Password() {
114114
this.TplName = "setting/password.html"
115115
}
116116

117-
//收藏
117+
// 收藏
118118
func (this *SettingController) Star() {
119119
page, _ := this.GetInt("page")
120120
cid, _ := this.GetInt("cid")
@@ -150,7 +150,7 @@ func (this *SettingController) Star() {
150150
this.Data["Cates"] = cates
151151
}
152152

153-
//二维码
153+
// 二维码
154154
func (this *SettingController) Qrcode() {
155155

156156
if this.Ctx.Input.IsPost() {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ replace github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 => github.
77
require (
88
github.com/PuerkitoBio/goquery v1.6.0
99
github.com/TruthHun/converter v0.0.0-20210623150616-172c168cdcda
10-
github.com/TruthHun/gotil v0.0.0-20210817134928-d2d642c3c7b7
10+
github.com/TruthHun/gotil v0.0.0-20221201022546-19fe8ec6ef40
1111
github.com/TruthHun/html2article v0.0.0-20180202140721-67d6ff09647b
1212
github.com/TruthHun/html2json v0.0.0-20201228115506-dee0570dffa8
1313
github.com/alexcesaro/mail v0.0.0-20141015155039-29068ce49a17

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ github.com/PuerkitoBio/goquery v1.6.0/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBK
77
github.com/TruthHun/converter v0.0.0-20210623150616-172c168cdcda h1:5J7hfnVImIf2MsBp7NZ+YrmcSrKUy5rW5sonkMxHkfY=
88
github.com/TruthHun/converter v0.0.0-20210623150616-172c168cdcda/go.mod h1:n0OITYsMcCW3XbBVOBn3jMiXRuCmDwDXPsumL7D/JBY=
99
github.com/TruthHun/gotil v0.0.0-20210509080330-2470bb9be7cd/go.mod h1:0V5BlPJa24R0PzuXVURUfjaQ8Z7cmqsVSW7ftuhesN0=
10-
github.com/TruthHun/gotil v0.0.0-20210817134928-d2d642c3c7b7 h1:TL0LZ/cmjfX0sEsygVruVoJNGR9krd8UiTPlSg4nT+o=
11-
github.com/TruthHun/gotil v0.0.0-20210817134928-d2d642c3c7b7/go.mod h1:i5tqOvH+rsm0voXHnKkzayNkWnv8L/F7wVv+mBdrAL0=
10+
github.com/TruthHun/gotil v0.0.0-20221201022546-19fe8ec6ef40 h1:wLKVlwymHUF3EoYxIzqR/bpvE/wXAcuX0jZCDUlf6N8=
11+
github.com/TruthHun/gotil v0.0.0-20221201022546-19fe8ec6ef40/go.mod h1:i5tqOvH+rsm0voXHnKkzayNkWnv8L/F7wVv+mBdrAL0=
1212
github.com/TruthHun/html2article v0.0.0-20180202140721-67d6ff09647b h1:JXD7vWKiJGRqkRuitwA8BxJVGr1yp2hQULQII7RaAXo=
1313
github.com/TruthHun/html2article v0.0.0-20180202140721-67d6ff09647b/go.mod h1:fG1YIVgbJZLR41X/jfUjShbO0uxMnA5J4Mv01ys/Mbk=
1414
github.com/TruthHun/html2json v0.0.0-20201228115506-dee0570dffa8 h1:ALJMA2bVcsGE1bYwYnglACvQfpI3M0aGoRvrq9rv+yM=

0 commit comments

Comments
 (0)