()
| 558 | } |
| 559 | |
| 560 | func (this *ManagerController) Setting() { |
| 561 | tab := this.GetString("tab", "basic") |
| 562 | options, err := models.NewOption().All() |
| 563 | if err != nil { |
| 564 | this.Abort("404") |
| 565 | } |
| 566 | |
| 567 | if this.Ctx.Input.IsPost() { |
| 568 | for _, item := range options { |
| 569 | if _, ok := this.Ctx.Request.PostForm[item.OptionName]; ok { |
| 570 | item.OptionValue = this.GetString(item.OptionName) |
| 571 | item.InsertOrUpdate() |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | if err := models.NewElasticSearchClient().Init(); err != nil { |
| 576 | this.JsonResult(1, err.Error()) |
| 577 | } |
| 578 | |
| 579 | models.NewSign().UpdateSignRule() |
| 580 | models.NewReadRecord().UpdateReadingRule() |
| 581 | this.JsonResult(0, "ok") |
| 582 | } |
| 583 | |
| 584 | for _, item := range options { |
| 585 | if item.OptionName == "APP_PAGE" { |
| 586 | this.Data["APP_PAGE"] = item.OptionValue |
| 587 | this.Data["M_APP_PAGE"] = item |
| 588 | } else { |
| 589 | this.Data[item.OptionName] = item |
| 590 | } |
| 591 | } |
| 592 | this.Data["SITE_TITLE"] = this.Option["SITE_NAME"] |
| 593 | this.Data["Tab"] = tab |
| 594 | this.Data["IsSetting"] = true |
| 595 | this.Data["SeoTitle"] = "配置管理" |
| 596 | this.TplName = "manager/setting.html" |
| 597 | } |
| 598 | |
| 599 | // Transfer 转让书籍. |
| 600 | func (this *ManagerController) Transfer() { |
nothing calls this directly
no test coverage detected