From 1a53b90590d70be1b389f33ae81c47f0d5238d48 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期三, 12 八月 2020 10:18:06 +0800
Subject: [PATCH] add userClient

---
 controllers/user.go |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/controllers/user.go b/controllers/user.go
index 3b437a1..927a38f 100644
--- a/controllers/user.go
+++ b/controllers/user.go
@@ -63,15 +63,16 @@
 func (u *UserController) Login() {
 	phoneNum := u.GetString("phoneNum")
 	cod := u.GetString("code")
+	cid := u.GetString("cid")  //unipush clientid
 	resp := code.Code{}
-	fmt.Println("phoneNum:", phoneNum, "code:", cod)
-	if phoneNum == "" || cod == "" {
+	fmt.Println("phoneNum:", phoneNum, "code:", cod, "clientId:", cid)
+	if phoneNum == "" || cod == ""{
 		resp.Success= false
 		resp.Status= http.StatusBadRequest
 		resp.Data= "鍙傛暟鏈夎"
 	} else {
 		var sv service.UserService
-		b, info, e := sv.Login(phoneNum, cod)
+		b, info, e := sv.Login(phoneNum, cod, cid)
 
 		if b {
 			resp.Success= true
@@ -132,11 +133,8 @@
 func (u *UserController) MyPlateNos() {
 	userId := u.GetString("userId")
 	fmt.Println("MyPlateNos userId", userId)
-	//var uc models.UserCar
-	//all, err := uc.GetByUserId(userId)
 	sv :=  service.NewCarService()
 	vehicleList := sv.GetVehicleListByPerson(userId)
-	fmt.Println("vehicleList:", vehicleList)
 	var nos = make([]string, 0)
 	if vehicleList != nil {
 		for _,p := range vehicleList {
@@ -188,4 +186,17 @@
 }
 
 
+// @router /sync [get]
+func (u *UserController) Sync() {
+	resp := code.Code{}
+	syncCount := service.SyncHikPerson()
 
+	resp.Success = true
+	resp.Status = http.StatusOK
+	resp.Data = map[string]interface{}{
+		"syncCount": syncCount,
+	}
+
+	u.Data["json"] = resp
+	u.ServeJSON()
+}

--
Gitblit v1.8.0