package new_mobile_api_controllers import ( "XT_New/controllers" "XT_New/enums" "XT_New/service" "fmt" ) type CommonApiController struct { controllers.BaseAuthAPIController } func (this *CommonApiController) GetInspectionMajor() { major, err := service.GetInspectionMajor(0) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "inspection": major, }) } func (this *CommonApiController) GetInspectionMinor() { id, _ := this.GetInt64("id") fmt.Println("id", id) minor, err := service.GetInspectionMinor(id) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "inspection": minor, }) } func (this *CommonApiController) GetInspectionRange() { id, _ := this.GetInt64("id") fmt.Println("id", id) inspectionRange, err := service.GetInspectionRange(id) if err != nil { this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError) return } this.ServeSuccessJSON(map[string]interface{}{ "inspectionRange": inspectionRange, }) } func (this *CommonApiController) SaveInspection() { fmt.Println("触发-------------------0") //dataBody := make(map[string]interface{}, 0) //err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody) //fmt.Println("err",err) //inspectionmajor := int64(dataBody["inspectionMajor"].(float64)) //fmt.Println("大项",inspectionmajor) //inspectionMinor := int64(dataBody["inspectionMinor"].(float64)) //fmt.Println("小项",inspectionMinor) //minrange := dataBody["min_range"].(string) //fmt.Println("minragne",minrange) //largerange := dataBody["large_range"].(string) //fmt.Println("largerange",largerange) //sort := dataBody["sort"].(string) //fmt.Println("sort",sort) }