fetdata.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package fetdata
  2. import (
  3. "html/template"
  4. "golang-fave/engine/wrapper"
  5. "golang-fave/utils"
  6. )
  7. type FERData struct {
  8. Wrap *wrapper.Wrapper
  9. DataRow interface{}
  10. }
  11. func New(wrap *wrapper.Wrapper, drow interface{}) *FERData {
  12. fer := &FERData{
  13. Wrap: wrap,
  14. DataRow: drow,
  15. }
  16. return fer.init()
  17. }
  18. func (this *FERData) init() *FERData {
  19. if this.Wrap.CurrModule == "index" {
  20. if this.DataRow.(*utils.MySql_page).A_meta_title == "" {
  21. this.DataRow.(*utils.MySql_page).A_meta_title = this.DataRow.(*utils.MySql_page).A_name
  22. }
  23. }
  24. return this
  25. }
  26. func (this *FERData) MetaTitle() string {
  27. if this.Wrap.CurrModule == "index" {
  28. return this.DataRow.(*utils.MySql_page).A_meta_title
  29. }
  30. return ""
  31. }
  32. func (this *FERData) MetaKeywords() string {
  33. if this.Wrap.CurrModule == "index" {
  34. return this.DataRow.(*utils.MySql_page).A_meta_keywords
  35. }
  36. return ""
  37. }
  38. func (this *FERData) MetaDescription() string {
  39. if this.Wrap.CurrModule == "index" {
  40. return this.DataRow.(*utils.MySql_page).A_meta_description
  41. }
  42. return ""
  43. }
  44. func (this *FERData) Name() string {
  45. if this.Wrap.CurrModule == "index" {
  46. return this.DataRow.(*utils.MySql_page).A_name
  47. }
  48. return ""
  49. }
  50. func (this *FERData) Alias() string {
  51. if this.Wrap.CurrModule == "index" {
  52. return this.DataRow.(*utils.MySql_page).A_alias
  53. }
  54. return ""
  55. }
  56. func (this *FERData) Content() template.HTML {
  57. if this.Wrap.CurrModule == "index" {
  58. return template.HTML(this.DataRow.(*utils.MySql_page).A_content)
  59. }
  60. return template.HTML("")
  61. }