@@ -216,7 +216,7 @@ func (this *BaseController) SetMember(member models.Member) {
216216
217217// JsonResult 响应 json 结果
218218func (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+ // 显示错误信息页面.
280280func (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字段
290290func (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+ // 站点地图
308308func (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链接作为目录
348348func (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+ // 排序
468468type Sort struct {
469469 Id int
470470 Pid int
471471 SortOrder int
472472 Identify string
473473}
474474
475- //替换链接
476- //如果是summary,则根据这个进行排序调整
475+ // 替换链接
476+ // 如果是summary,则根据这个进行排序调整
477477func (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+ // 内容采集
534534func (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+ // 关注或取消关注
556556func (this * BaseController ) SetFollow () {
557557 var cancel bool
558558 if this .Member == nil || this .Member .MemberId == 0 {
0 commit comments