package models
|
|
import "strconv"
|
|
var (
|
SpaceNo2Pos map[string]string //海康车位号-页面配置编号
|
Pos2SpaceNo map[string]string //页面配置编号-海康车位号
|
)
|
|
func init() {
|
SpaceNo2Pos = make(map[string]string)
|
Pos2SpaceNo = make(map[string]string)
|
for i:=1;i<100;i++ {
|
posNo := "A"+strconv.Itoa(i)
|
SpaceNo2Pos[strconv.Itoa(i)] = posNo
|
Pos2SpaceNo[posNo] = strconv.Itoa(i)
|
}
|
}
|
|
type CarStatistic struct {
|
Left int `json:"left"`
|
}
|
|
type PosInfo struct {
|
SpaceNo string `json:"spaceNo"`
|
PosNo string `json:"posNo"`
|
State int `json:"state"` //0:空闲,1:有车
|
PlateNo string `json:"plateNo"`
|
}
|
|
type PosResult []PosInfo
|
|
func (al PosResult) Len()int {
|
return len(al)
|
}
|
func (al PosResult) Swap(i,j int) {
|
al[i],al[j] = al[j],al[i]
|
}
|
func (al PosResult) Less(i,j int) bool {
|
s1, _ := strconv.Atoi(al[i].SpaceNo)
|
s2, _ := strconv.Atoi(al[j].SpaceNo)
|
return s1 < s2
|
}
|