附近小店
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

db_store_amount.go 1.5 KiB

hace 2 meses
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "xorm.io/xorm"
  6. )
  7. func GetStoreAmount(sess *xorm.Session, storeId int, agentUid int) *model.CommunityTeamStoreAmount {
  8. var data model.CommunityTeamStoreAmount
  9. get, err := sess.Where("uid=? and parent_uid=?", storeId, agentUid).Get(&data)
  10. if get == false || err != nil {
  11. return nil
  12. }
  13. return &data
  14. }
  15. func GetStoreAmountEg(eg *xorm.Engine, storeId int, agentUid int) *model.CommunityTeamStoreAmount {
  16. var data model.CommunityTeamStoreAmount
  17. get, err := eg.Where("uid=? and parent_uid=?", storeId, agentUid).Get(&data)
  18. if get == false || err != nil {
  19. return nil
  20. }
  21. return &data
  22. }
  23. func GetStoreAmountFlowList(eg *xorm.Engine, arg map[string]string) (*[]model.CommunityTeamStoreAmountFlow, int64) {
  24. var data []model.CommunityTeamStoreAmountFlow
  25. sess := eg.Where("1=1")
  26. if arg["store_uid"] != "" {
  27. sess.And("uid=?", arg["store_uid"])
  28. }
  29. if arg["parent_uid"] != "" {
  30. sess.And("parent_uid=?", arg["parent_uid"])
  31. }
  32. if arg["title"] != "" {
  33. sess.And("title like ?", "%"+arg["title"]+"%")
  34. }
  35. if arg["oid"] != "" {
  36. sess.And("oid like ?", "%"+arg["oid"]+"%")
  37. }
  38. if arg["start_time"] != "" {
  39. sess.And("create_at>=?", arg["start_time"])
  40. }
  41. if arg["end_time"] != "" {
  42. sess.And("create_at<=?", arg["end_time"])
  43. }
  44. limit := utils.StrToInt(arg["size"])
  45. start := (utils.StrToInt(arg["p"]) - 1) * limit
  46. count, err := sess.Desc("id").Limit(limit, start).FindAndCount(&data)
  47. if err != nil {
  48. return nil, count
  49. }
  50. return &data, count
  51. }