goods.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package order
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. //"time"
  5. )
  6. type CygxGoods struct {
  7. GoodsId int `description:"商品ID"`
  8. GoodsName string `description:"商品名称"`
  9. Price float64 `description:"商品原价格"`
  10. CurrentPrice float64 `description:"商品现价(当时出售的价格)"`
  11. }
  12. type CygxGoodsResp struct {
  13. GoodsId int `description:"商品ID"`
  14. GoodsName string `description:"商品名称"`
  15. Price string `description:"商品原价格"`
  16. CurrentPrice string `description:"商品现价(当时出售的价格)"`
  17. PopupPriceMsg string `description:"价格弹窗信息"`
  18. }
  19. func GetCygxGoodsList(condition string, pars []interface{}) (item []*CygxGoodsResp, err error) {
  20. o := orm.NewOrm()
  21. sql := `SELECT *
  22. FROM
  23. cygx_goods
  24. WHERE 1 = 1 ` + condition
  25. _, err = o.Raw(sql, pars).QueryRows(&item)
  26. return
  27. }
  28. func GetCygxGoodsDetailByGoodsId(goodsId int) (item *CygxGoods, err error) {
  29. o := orm.NewOrm()
  30. sql := `SELECT * FROM cygx_goods WHERE goods_id = ? `
  31. err = o.Raw(sql, goodsId).QueryRow(&item)
  32. return
  33. }