common_api_controller.go 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package new_mobile_api_controllers
  2. import (
  3. "XT_New/controllers"
  4. "XT_New/enums"
  5. "XT_New/service"
  6. "fmt"
  7. )
  8. type CommonApiController struct {
  9. controllers.BaseAuthAPIController
  10. }
  11. func (this *CommonApiController) GetInspectionMajor() {
  12. major, err := service.GetInspectionMajor(0)
  13. if err != nil {
  14. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  15. return
  16. }
  17. this.ServeSuccessJSON(map[string]interface{}{
  18. "inspection": major,
  19. })
  20. }
  21. func (this *CommonApiController) GetInspectionMinor() {
  22. id, _ := this.GetInt64("id")
  23. fmt.Println("id", id)
  24. minor, err := service.GetInspectionMinor(id)
  25. if err != nil {
  26. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  27. return
  28. }
  29. this.ServeSuccessJSON(map[string]interface{}{
  30. "inspection": minor,
  31. })
  32. }
  33. func (this *CommonApiController) GetInspectionRange() {
  34. id, _ := this.GetInt64("id")
  35. fmt.Println("id", id)
  36. inspectionRange, err := service.GetInspectionRange(id)
  37. if err != nil {
  38. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  39. return
  40. }
  41. this.ServeSuccessJSON(map[string]interface{}{
  42. "inspectionRange": inspectionRange,
  43. })
  44. }
  45. func (this *CommonApiController) SaveInspection() {
  46. fmt.Println("触发-------------------0")
  47. //dataBody := make(map[string]interface{}, 0)
  48. //err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  49. //fmt.Println("err",err)
  50. //inspectionmajor := int64(dataBody["inspectionMajor"].(float64))
  51. //fmt.Println("大项",inspectionmajor)
  52. //inspectionMinor := int64(dataBody["inspectionMinor"].(float64))
  53. //fmt.Println("小项",inspectionMinor)
  54. //minrange := dataBody["min_range"].(string)
  55. //fmt.Println("minragne",minrange)
  56. //largerange := dataBody["large_range"].(string)
  57. //fmt.Println("largerange",largerange)
  58. //sort := dataBody["sort"].(string)
  59. //fmt.Println("sort",sort)
  60. }