123456789101112131415161718192021222324252627 |
- package v1
- import (
- "github.com/gin-gonic/gin"
- "lttc-go-adm-znaf/models"
- "lttc-go-adm-znaf/pkg/app"
- "lttc-go-adm-znaf/pkg/e"
- "net/http"
- )
- // @Summary GetAllVehicles
- // @Description 获取所有车辆信息
- // @Success 200 {string} json "{ "code": 200, "data": {}, "msg": "ok" }"
- // @Router /api/v1/getAllVehicles [get]
- func GetAllVehicles(c *gin.Context) {
- appG := app.Gin{C: c}
- vehicles, err := models.GetAllVehicles()
- if err != nil {
- appG.Response(http.StatusInternalServerError, e.ERROR, nil)
- }
- data := make(map[string]interface{})
- data["vehicles"] = vehicles
- appG.Response(http.StatusOK, e.SUCCESS, data)
- }
|