智盟项目
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

db_guide_order.go 3.0 KiB

pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 2 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 4 mēnešiem
pirms 1 gada
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "applet/app/utils"
  5. "fmt"
  6. )
  7. func GetGuideOrderByOne(oid, mid, types string) *model.GuideOrder {
  8. var data model.GuideOrder
  9. get, err := ZhimengDb.Where("uid=? and pvd_oid=? and pvd=?", mid, oid, types).Get(&data)
  10. if get == false || err != nil {
  11. fmt.Println(err)
  12. return nil
  13. }
  14. return &data
  15. }
  16. func GetGuideOrderList(args map[string]string) []model.GuideOrder {
  17. /***
  18. p 页数
  19. size 个数
  20. start_time 开始时间
  21. end_time 结束时间
  22. ord_type 订单类型
  23. video_type 视频类型
  24. status 订单状态
  25. settle_status 结算状态
  26. oid 订单号
  27. sort 排序
  28. is_to_settle 智盟结算
  29. to_settle_time 结算上月时间
  30. */
  31. var data = make([]model.GuideOrder, 0)
  32. size := utils.StrToInt(args["size"])
  33. offet := (utils.StrToInt(args["p"]) - 1) * size
  34. sess := ZhimengDb.Where("1=1")
  35. if args["start_time"] != "" {
  36. sess = sess.And("update_time>=?", args["start_time"])
  37. }
  38. if args["end_time"] != "" {
  39. sess = sess.And("update_time<=?", args["end_time"])
  40. }
  41. if args["type"] != "" {
  42. sess = sess.And("pvd=?", args["type"])
  43. }
  44. if args["uid"] != "" {
  45. sess = sess.And("uid=?", args["uid"])
  46. }
  47. if args["status"] != "" {
  48. sess = sess.And("status=?", args["status"])
  49. }
  50. if args["to_settle_time"] != "" {
  51. sess = sess.And("platform_settle_time<?", args["to_settle_time"])
  52. }
  53. if args["is_not_in"] != "" {
  54. sess = sess.And("three_type!=?", args["is_not_in"])
  55. }
  56. if args["is_in"] != "" {
  57. sess = sess.And("three_type=?", args["is_in"])
  58. }
  59. sort := "update_time desc,id desc"
  60. if args["sort"] != "" {
  61. sort = args["sort"]
  62. }
  63. if args["is_to_settle"] == "1" {
  64. sess = sess.And("settle_time=?", 0)
  65. }
  66. if args["is_commission"] == "1" {
  67. sess = sess.And("real_commission>?", 0)
  68. }
  69. err := sess.Limit(size, offet).OrderBy(sort).Find(&data)
  70. fmt.Println(err)
  71. fmt.Println(sess.LastSQL())
  72. return data
  73. }
  74. func GetGuideOrderListTotal(args map[string]string) ([]model.GuideOrder, int64) {
  75. var data = make([]model.GuideOrder, 0)
  76. size := utils.StrToInt(args["size"])
  77. offet := (utils.StrToInt(args["p"]) - 1) * size
  78. sess := ZhimengDb.Where("1=1")
  79. if args["start_time"] != "" {
  80. sess = sess.And("create_time>=?", utils.TimeStdParseUnix(args["start_time"]))
  81. }
  82. if args["end_time"] != "" {
  83. sess = sess.And("create_time<=?", utils.TimeStdParseUnix(args["end_time"]))
  84. }
  85. if args["type"] != "" {
  86. sess = sess.And("pvd=?", args["type"])
  87. }
  88. if args["settle_type"] == "0" {
  89. sess = sess.And("settle_time=?", 0)
  90. }
  91. if args["settle_type"] == "1" {
  92. sess = sess.And("settle_time>?", 0)
  93. }
  94. if args["uid"] != "" {
  95. sess = sess.And("uid=?", args["uid"])
  96. }
  97. if args["zuid"] != "" {
  98. sess = sess.And("station_uid=?", args["zuid"])
  99. }
  100. if args["oid"] != "" {
  101. sess = sess.And("pvd_oid like ?", "%"+args["oid"]+"%")
  102. }
  103. if args["status"] != "" {
  104. sess = sess.And("status=?", args["status"])
  105. }
  106. sort := "create_time desc,id desc"
  107. if args["sort"] != "" {
  108. sort = args["sort"]
  109. }
  110. total, err := sess.Limit(size, offet).OrderBy(sort).FindAndCount(&data)
  111. fmt.Println(err)
  112. fmt.Println(sess.LastSQL())
  113. return data, total
  114. }