liuxiaolong
2020-06-17 49f07b0ce7a6a9e0893a9a01199130f2fa0e619c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package controllers
 
import (
    "car-service/extend/code"
    "car-service/models"
    "car-service/service"
    "github.com/astaxie/beego"
    "net/http"
    "sort"
)
 
type CarController struct {
    beego.Controller
}
 
// @Title 统计剩余车位
// @Description 统计剩余车位
// @Success 200 {object} models.CarStatistic
// @Failure 403 {string} json ""
// @router /statistic [get]
func (c *CarController) Statistic() {
    //sv := service.NewCarService()
    //sta := sv.Statistic()
    sta := models.CarStatistic{
        Left: 80,
    }
    resp := code.Code{
        Success: true,
        Status: http.StatusOK,
        Data: sta,
    }
    c.Data["json"] = resp
    c.ServeJSON()
}
 
// @Title 根据车牌号查找车位信息
// @Description 根据车牌号查找车位信息
// @Success 200 {object} models.CarPos
// @Failure 403 {string} json ""
// @router /carPos [get]
func (c *CarController) findCar() {
 
}
 
// @Title 车位占用情况
// @Description 车位占用情况
// @Success 200 {object} models.PosResult
// @Failure 403 {string} json ""
// @router /spaceNo [get]
func (c *CarController) SpaceNo() {
    sv := service.NewCarService()
    spaceNos := sv.FindSpaceNo()
    sort.Sort(spaceNos)
    resp := code.Code{
        Success: true,
        Status: http.StatusOK,
        Data: spaceNos,
    }
    c.Data["json"] = resp
    c.ServeJSON()
}
 
func (c *CarController) BindCarSpace() {
    sv := service.NewCarService()
 
    if sv.BindCarSpace() {
 
    }
    c.ServeJSON()
}