shop_product_image.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package fetdata
  2. import (
  3. "golang-fave/engine/wrapper"
  4. "golang-fave/utils"
  5. )
  6. type ShopProductImage struct {
  7. wrap *wrapper.Wrapper
  8. object *utils.MySql_shop_product_image
  9. }
  10. func (this *ShopProductImage) ProductId() int {
  11. if this == nil {
  12. return 0
  13. }
  14. return this.object.A_product_id
  15. }
  16. func (this *ShopProductImage) FileName() string {
  17. if this == nil {
  18. return ""
  19. }
  20. return this.object.A_filename
  21. }
  22. func (this *ShopProductImage) FullImage() string {
  23. if this == nil {
  24. return ""
  25. }
  26. return "/products/images/" + utils.IntToStr(this.object.A_product_id) + "/" + this.object.A_filename
  27. }
  28. func (this *ShopProductImage) Thumbnail0() string {
  29. if this == nil {
  30. return ""
  31. }
  32. return "/api/product-image/thumb-0/" + utils.IntToStr(this.object.A_product_id) + "/" + this.object.A_filename
  33. }
  34. func (this *ShopProductImage) Thumbnail1() string {
  35. if this == nil {
  36. return ""
  37. }
  38. return "/api/product-image/thumb-1/" + utils.IntToStr(this.object.A_product_id) + "/" + this.object.A_filename
  39. }
  40. func (this *ShopProductImage) Thumbnail2() string {
  41. if this == nil {
  42. return ""
  43. }
  44. return "/api/product-image/thumb-2/" + utils.IntToStr(this.object.A_product_id) + "/" + this.object.A_filename
  45. }
  46. func (this *ShopProductImage) Thumbnail3() string {
  47. if this == nil {
  48. return ""
  49. }
  50. return "/api/product-image/thumb-3/" + utils.IntToStr(this.object.A_product_id) + "/" + this.object.A_filename
  51. }
  52. func (this *ShopProductImage) ThumbnailSize0() [2]int {
  53. return (*this.wrap.Config).Shop.Thumbnails.Thumbnail0
  54. }
  55. func (this *ShopProductImage) ThumbnailSize1() [2]int {
  56. return (*this.wrap.Config).Shop.Thumbnails.Thumbnail1
  57. }
  58. func (this *ShopProductImage) ThumbnailSize2() [2]int {
  59. return (*this.wrap.Config).Shop.Thumbnails.Thumbnail2
  60. }
  61. func (this *ShopProductImage) ThumbnailSize3() [2]int {
  62. return (*this.wrap.Config).Shop.Thumbnails.Thumbnail3
  63. }