From 27f1012d2fecda7bcc3d9f44c5dd4c10a7cf38a4 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期二, 18 八月 2020 12:13:54 +0800 Subject: [PATCH] add log --- controllers/user.go | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/controllers/user.go b/controllers/user.go index 29b3f0c..a906ae3 100644 --- a/controllers/user.go +++ b/controllers/user.go @@ -65,7 +65,7 @@ cod := u.GetString("code") cid := u.GetString("cid") //unipush clientid resp := code.Code{} - fmt.Println("phoneNum:", phoneNum, "code:", cod) + fmt.Println("phoneNum:", phoneNum, "code:", cod, "clientId:", cid) if phoneNum == "" || cod == ""{ resp.Success= false resp.Status= http.StatusBadRequest @@ -94,6 +94,17 @@ // @Success 200 {string} logout success // @router /logout [get] func (u *UserController) Logout() { + cid := u.GetString("cid") //unipush clientid + fmt.Println("clientId:", cid) + + if cid != "" { + go func() { + unbindB, unE := service.UnbindAlias(cid) + fmt.Println("unbind result:", unbindB, "err:", unE) + var uc models.UserClient + uc.DeleteByCid(cid) + }() + } resp := code.Code{} resp.Success = true resp.Status = http.StatusOK @@ -186,4 +197,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