智慧食堂
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.

svc_enterprise.go 4.1 KiB

pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 8 mēnešiem
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
pirms 1 gada
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package svc
  2. import (
  3. "applet/app/customer/md"
  4. "applet/app/db"
  5. "applet/app/db/model"
  6. "applet/app/enum"
  7. )
  8. func EnterpriseList(req md.EnterpriseListReq, platform string) (m []model.Enterprise, total int64, err error) {
  9. eg := db.Db.Where("1=1")
  10. if platform == "wx_applet" {
  11. eg.And("pvd != ? ", enum.EnterprisePvdForFaceScanPayment).Or("pvd = ? and mode !=?", enum.EnterprisePvdForFaceScanPayment, enum.EnterpriseModeForSchool)
  12. }
  13. if platform == "alipay_applet" {
  14. //TODO::暂只开放金茂小学支付宝购买权限
  15. eg.And("pvd != ? ", enum.EnterprisePvdForOnlinePayment).Or("pvd = ? and mode !=?", enum.EnterprisePvdForOnlinePayment, enum.EnterpriseModeForSchool).Or("id = 7")
  16. }
  17. if req.Name != "" {
  18. eg.And("name like ?", "%"+req.Name+"%")
  19. }
  20. total, err = eg.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
  21. if err != nil {
  22. return
  23. }
  24. return
  25. }
  26. func CentralKitchenForSchoolInfo(enterpriseId int) (err error, resp md.CentralKitchenForSchoolInfoResp) {
  27. //1、查询`enterprise`
  28. enterpriseDb := db.EnterpriseDb{}
  29. enterpriseDb.Set()
  30. enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
  31. if err != nil {
  32. return
  33. }
  34. resp.Name = enterprise.Name
  35. resp.Memo = enterprise.Memo
  36. resp.Kind = enterprise.Kind
  37. resp.State = enterprise.State
  38. //2、查询`central_kitchen_for_school_with_spec`
  39. centralKitchenForSchoolWithSpec := db.CentralKitchenForSchoolWithSpec{}
  40. centralKitchenForSchoolWithSpec.Set(enterpriseId)
  41. spec, err := centralKitchenForSchoolWithSpec.GetCentralKitchenForSchoolWithSpec()
  42. if err != nil {
  43. return
  44. }
  45. if spec != nil {
  46. resp.IsOpenBreakfast = spec.IsOpenBreakfast
  47. resp.IsOpenLunch = spec.IsOpenLunch
  48. resp.IsOpenDinner = spec.IsOpenDinner
  49. resp.BreakfastUnitPrice = spec.BreakfastUnitPrice
  50. resp.BreakfastUnitPriceForTeacher = spec.BreakfastUnitPriceForTeacher
  51. resp.LunchUnitPrice = spec.LunchUnitPrice
  52. resp.LunchUnitPriceForTeacher = spec.LunchUnitPriceForTeacher
  53. resp.DinnerUnitPrice = spec.DinnerUnitPrice
  54. resp.DinnerUnitPriceForTeacher = spec.DinnerUnitPriceForTeacher
  55. }
  56. //3、查询`central_kitchen_for_school_set`
  57. centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{}
  58. centralKitchenForSchoolSetDb.Set(enterpriseId)
  59. set, err := centralKitchenForSchoolSetDb.GetCentralKitchenForSchoolSet()
  60. if err != nil {
  61. return
  62. }
  63. if set != nil {
  64. resp.IsOpenTeacherReportMeal = set.IsOpenTeacherReportMeal
  65. resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
  66. resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
  67. resp.IsOpenReportMealForSemester = set.IsOpenReportMealForSemester
  68. resp.IsOpenTeacherReportMealForDay = set.IsOpenTeacherReportMealForDay
  69. resp.IsOpenTeacherReportMealForMonth = set.IsOpenTeacherReportMealForMonth
  70. resp.IsOpenTeacherReportMealForSemester = set.IsOpenTeacherReportMealForSemester
  71. }
  72. return
  73. }
  74. func NursingHomePackageInfo(enterpriseId int) (err error, resp md.NursingHomePackageInfoResp) {
  75. //1、查询`enterprise`
  76. enterpriseDb := db.EnterpriseDb{}
  77. enterpriseDb.Set()
  78. enterprise, err := enterpriseDb.GetEnterprise(enterpriseId)
  79. if err != nil {
  80. return
  81. }
  82. resp.Name = enterprise.Name
  83. resp.Memo = enterprise.Memo
  84. resp.Kind = enterprise.Kind
  85. resp.State = enterprise.State
  86. //2、查询`central_kitchen_for_school_with_spec`
  87. centralKitchenForSchoolWithSpec := db.NursingHomeWithSpec{}
  88. centralKitchenForSchoolWithSpec.Set(enterpriseId)
  89. spec, err := centralKitchenForSchoolWithSpec.GetNursingHomeWithSpec()
  90. if err != nil {
  91. return
  92. }
  93. if spec != nil {
  94. resp.IsOpenBreakfast = spec.IsOpenBreakfast
  95. resp.IsOpenLunch = spec.IsOpenLunch
  96. resp.IsOpenDinner = spec.IsOpenDinner
  97. resp.BreakfastUnitPrice = spec.BreakfastUnitPrice
  98. resp.LunchUnitPrice = spec.LunchUnitPrice
  99. resp.DinnerUnitPrice = spec.DinnerUnitPrice
  100. }
  101. //3、查询`central_kitchen_for_school_set`
  102. centralKitchenForSchoolSetDb := db.NursingHomeSetDb{}
  103. centralKitchenForSchoolSetDb.Set(enterpriseId)
  104. set, err := centralKitchenForSchoolSetDb.GetNursingHomeSet()
  105. if err != nil {
  106. return
  107. }
  108. if set != nil {
  109. resp.IsOpenReportMealForDay = set.IsOpenReportMealForDay
  110. resp.IsOpenReportMealForMonth = set.IsOpenReportMealForMonth
  111. resp.IsOpenReportMealForYear = set.IsOpenReportMealForYear
  112. }
  113. return
  114. }