From dbc843d0b37f786fb816131bcc7ebca86dbe72e9 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期四, 06 八月 2020 09:58:46 +0800
Subject: [PATCH] add crossRecord

---
 controllers/user.go |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/controllers/user.go b/controllers/user.go
index 1947e7c..2025f12 100644
--- a/controllers/user.go
+++ b/controllers/user.go
@@ -131,11 +131,12 @@
 // @router /myPlateNos [get]
 func (u *UserController) MyPlateNos() {
 	userId := u.GetString("userId")
-	var uc models.UserCar
-	all, err := uc.GetByUserId(userId)
+	fmt.Println("MyPlateNos userId", userId)
+	sv :=  service.NewCarService()
+	vehicleList := sv.GetVehicleListByPerson(userId)
 	var nos = make([]string, 0)
-	if err == nil && all != nil {
-		for _,p := range all {
+	if vehicleList != nil {
+		for _,p := range vehicleList {
 			nos = append(nos, p.PlateNo)
 		}
 	}
@@ -148,3 +149,40 @@
 	u.ServeJSON()
 }
 
+// @router /delPlateNo [delete]
+func (u *UserController) DelPlateNo() {
+	userId := u.GetString("userId")
+	plateNo := u.GetString("plateNo")
+	resp := code.Code{}
+	var uc models.UserCar
+	i,e := uc.Delete(userId, plateNo)
+	fmt.Println("delPlateNo i:",i, "e:", e)
+	if e ==nil && i >0 {
+		resp.Success = true
+		resp.Status = http.StatusOK
+		resp.Data = "鍒犻櫎鎴愬姛"
+	} else {
+		resp.Success = false
+		resp.Status = http.StatusInternalServerError
+		resp.Data = "鍒犻櫎澶辫触"
+	}
+	u.Data["json"] = resp
+	u.ServeJSON()
+}
+
+// @router /all [get]
+func (u *UserController) GetUserAll() {
+	resp := code.Code{}
+	sv := service.NewCarService()
+	personAll := sv.GetHikPersonList()
+	if personAll != nil {
+		resp.Success = true
+		resp.Status = http.StatusOK
+		resp.Data = personAll
+	}
+	u.Data["json"] = resp
+	u.ServeJSON()
+}
+
+
+

--
Gitblit v1.8.0