liuxiaolong
2020-09-01 ca10e9d776509f54cb0251b7eae44cee74d94b2c
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()
}