product.go 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package entity
  2. import "gopkg.in/guregu/null.v3"
  3. type Product struct {
  4. Id int `db:"id" json:"id"`
  5. No string `db:"no" json:"no"`
  6. Name string `db:"name" json: "name"`
  7. MarketPrice int `db:"market_price" json:"market_price"`
  8. Price int `db:"price" json:"price"`
  9. IsPutAway int `db:"is_putaway"`
  10. IsRecommend int `db:"is_recommend"`
  11. Tips string `db:"tips"`
  12. Tags string `db:"tags"`
  13. Picture string `db:"picture"`
  14. CreatedAt string `db:"created_at"`
  15. UpdatedAt string `db:"updated_at"`
  16. Tube string `db:"tube"`
  17. SaleMode int `db:"sale_mode"`
  18. Collection string `db:"collection"`
  19. Notice string `db:"notice"`
  20. Report string `db:"report"`
  21. IsDrawBlood int `db:"is_draw_blood"`
  22. Sampling string `db:"sampling"`
  23. TipReportDays int `db:"tip_report_days"`
  24. DpidStr string `db:"dpid_str"`
  25. }
  26. type ProductDB struct {
  27. Id int `db:"id" json:"id"`
  28. No null.String `db:"no" json:"no"`
  29. Name string `db:"name" json:"name"`
  30. Price int `db:"price" json:"price"`
  31. MarketPrice int `db:"market_price" json:"market_price"`
  32. IsPutAway int `db:"is_putaway" json:"isPutaway"`
  33. IsRecomment int `db:"is_recommend" json:"isRecommend"`
  34. Tips null.String `db:"tips" json:"tips"`
  35. Tags null.String `db:"tags" json:"tags"`
  36. Picture string `db:"picture"`
  37. CreatedAt string `db:"created_at" json:"createdAt"`
  38. UpdatedAt string `db:"updated_at" json:"updatedAt"`
  39. Items []DetectProduct `db:"-" json:"items"`
  40. Pictures []ProductPicture `db:"-" json:"pictures"`
  41. Attributes interface{} `db:"-" json:"attributes"`
  42. CityIds null.String `db:"cityIds" json:"CityIds"`
  43. CountyIds null.String `db:"countyIds" json:"CountyIds"`
  44. Citys []City `db:"-" json:"citys"`
  45. Tube null.String `db:"tube"`
  46. SaleMode int `db:"sale_mode"`
  47. Collection string `db:"collection" json:"collection"`
  48. Notice string `db:"notice" json:"notice"`
  49. Report string `db:"report" json:"report"`
  50. InstructionsTitle string `db:"instructionstitle" json:"instructionstitle"`
  51. Instructions string `db:"instructions" json:"instructions"`
  52. IsNoBooktime int `db:"is_no_booktime" json:"is_no_booktime"`
  53. IsDrawBlood int `db:"is_draw_blood" json:"is_draw_blood"`
  54. IsWorkFee int `db:"is_work_fee" json:"is_work_fee"`
  55. IsTip null.Int `db:"is_tip" json:"is_tip"`
  56. TipContent null.String `db:"tip_content" json:"tip_content"`
  57. Quantity int `db:"quantity" json:"quantity"`
  58. Sampling null.String `db:"sampling" json:"sampling"`
  59. IsJiyin null.Int `db:"is_jiyin" json:"is_jiyin"`
  60. Stock int `db:"stock" json:"stock"`
  61. StockSwitch string `db:"stock_switch" json:"stock_switch"`
  62. Pstock int `db:"pstock" json:"pstock"`
  63. PstockSwitch string `db:"pstock_switch" json:"pstock_switch"`
  64. BoughtNum null.Int `db:"bought_num" json:"-"`
  65. Searchs string `db:"searchs" json:"searchs"`
  66. TopNum int `db:"num" json:"top_num"`
  67. IsEmptyStomach int `db:"is_empty_stomach" json:"is_empty_stomach"`
  68. ZFBStock int `db:"zfb_stock" json:"-"`
  69. ZFBPStock int `db:"zfb_pstock" json:"-"`
  70. ZFBPrice int `db:"zfb_price" json:"-"`
  71. IsZFB int `db:"is_zfb" json:"-"`
  72. }
  73. func ZFBWash(l []*ProductDB) {
  74. for k := range l {
  75. l[k].Stock = l[k].ZFBStock
  76. l[k].Pstock = l[k].ZFBPStock
  77. l[k].Price = l[k].ZFBPrice
  78. }
  79. }
  80. /*type PicturePath struct {
  81. sql.NullString
  82. }
  83. func (s PicturePath) MarshalJSON() ([]byte, error) {
  84. if !s.Valid {
  85. return []byte("null"), nil
  86. }
  87. return json.Marshal(util.EncryptPath([]byte(s.String), []byte(util.PATH_SECRET)))
  88. }*/