面包店
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 

68 lignes
1.7 KiB

  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetOrderGoodsListByIpad(eg *xorm.Engine, param map[string]string) (*[]model.OrderGoods, int64) {
  8. var order []model.OrderGoods
  9. sess := eg.Where("state!=5 and num!=success_num")
  10. if param["oid"] != "" {
  11. sess.And("oid = ?", param["oid"])
  12. }
  13. if param["gid"] != "" {
  14. sess.And("goods_id = ?", param["gid"])
  15. }
  16. if param["sku_id"] != "" {
  17. sess.And("sku_id = ?", param["sku_id"])
  18. }
  19. if param["state"] != "" {
  20. sess.And("state =?", param["state"])
  21. }
  22. if param["keyword"] != "" {
  23. sess.And("goods_title like ?", "%"+param["keyword"]+"%")
  24. }
  25. size := utils.StrToInt(param["limit"])
  26. start := (utils.StrToInt(param["page"]) - 1) * size
  27. count, err := sess.Limit(size, start).OrderBy("id asc").FindAndCount(&order)
  28. if err != nil {
  29. return nil, count
  30. }
  31. return &order, count
  32. }
  33. func GetOrderGoodsById(eg *xorm.Engine, id string) *model.OrderGoods {
  34. var order model.OrderGoods
  35. get, err := eg.Where("id=?", id).Get(&order)
  36. if get == false || err != nil {
  37. return nil
  38. }
  39. return &order
  40. }
  41. func GetOrderGoodsByIds(sess *xorm.Session, id string) *[]model.OrderGoods {
  42. var order []model.OrderGoods
  43. err := sess.Where("oid=?", id).Find(&order)
  44. if err != nil {
  45. return nil
  46. }
  47. return &order
  48. }
  49. func GetOrderGoodsByIdSess(sess *xorm.Session, id string) *model.OrderGoods {
  50. var order model.OrderGoods
  51. get, err := sess.Where("id=?", id).Get(&order)
  52. if get == false || err != nil {
  53. return nil
  54. }
  55. return &order
  56. }
  57. func GetOrderGoods(sess *xorm.Session, oid, gid, skuId string) *model.OrderGoods {
  58. var data model.OrderGoods
  59. get, err := sess.Where("oid=? and goods_id=? and sku_id=?", oid, gid, skuId).Get(&data)
  60. if err != nil || get == false {
  61. return nil
  62. }
  63. return &data
  64. }