From 0aca22f3cef923ebe6b2e3d3136e7057cecb2056 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 04 七月 2019 10:18:26 +0800 Subject: [PATCH] fix tip bug --- controllers/user.go | 2 +- extend/code/code.go | 4 ++++ controllers/area.go | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/controllers/area.go b/controllers/area.go index c4ba15d..ae7cdbc 100644 --- a/controllers/area.go +++ b/controllers/area.go @@ -72,9 +72,9 @@ } paramBody := util.Struct2Map(model) if api.AreaAdd(paramBody) { - util.ResponseFormat(c,code.Success,"淇濆瓨鎴愬姛") + util.ResponseFormat(c,code.AddSuccess,"娣诲姞鎴愬姛") } else { - util.ResponseFormat(c,code.ComError,"淇濆瓨澶辫触") + util.ResponseFormat(c,code.ComError,"娣诲姞澶辫触") } } @@ -109,7 +109,7 @@ paramBody := util.Struct2Map(model) var api dbapi.AreaApi if api.AreaUpdate(paramBody) { - util.ResponseFormat(c,code.Success,"鏇存柊鎴愬姛") + util.ResponseFormat(c,code.UpdateSuccess,"鏇存柊鎴愬姛") }else { util.ResponseFormat(c,code.ComError,"鏇存柊澶辫触") } @@ -133,7 +133,7 @@ } if api.AreaDelete(areaId) { - util.ResponseFormat(c, code.Success, "鍒犻櫎鎴愬姛") + util.ResponseFormat(c, code.DelSuccess, "鍒犻櫎鎴愬姛") } else { util.ResponseFormat(c, code.ComError,"鍒犻櫎澶辫触") } diff --git a/controllers/user.go b/controllers/user.go index 5cff7b9..e57b4e3 100644 --- a/controllers/user.go +++ b/controllers/user.go @@ -39,7 +39,7 @@ if flag { authDriver := auth.GenerateAuthDriver() tokenStr := (*authDriver).Login(c.Request, c.Writer, util.Struct2Map(userInfo)) - util.ResponseFormat(c,code.Success,map[string]interface{}{ + util.ResponseFormat(c,code.LoginSuccess,map[string]interface{}{ "userInfo":userInfo, "access_token":tokenStr, "refresh_token":tokenStr, diff --git a/extend/code/code.go b/extend/code/code.go index 4eca900..58628aa 100644 --- a/extend/code/code.go +++ b/extend/code/code.go @@ -12,6 +12,9 @@ var ( // Success 璇锋眰澶勭悊鎴愬姛 Success = &Code{http.StatusOK, true, "璇锋眰澶勭悊鎴愬姛"} + AddSuccess = &Code{http.StatusOK,true,"娣诲姞鎴愬姛"} + UpdateSuccess = &Code{http.StatusOK,true,"鏇存柊鎴愬姛"} + DelSuccess = &Code{http.StatusOK,true,"鍒犻櫎鎴愬姛"} // RequestParamError 璇锋眰鍙傛暟閿欒 RequestParamError = &Code{http.StatusBadRequest, false, "璇锋眰鍙傛暟鏈夎"} // AccountPassUnmatch 璇ヨ处鍙峰師瀵嗙爜涓嶅尮閰� @@ -24,6 +27,7 @@ UploadSuffixError = &Code{http.StatusBadRequest, false, "璇ヤ笂浼犳枃浠舵牸寮忕洰鍓嶆殏涓嶆敮鎸�"} // UploadSizeLimit 鐩墠涓婁紶浠呮敮鎸佸皬浜�5M鐨勬枃浠跺唴瀹� UploadSizeLimit = &Code{http.StatusBadRequest, false, "鐩墠涓婁紶浠呮敮鎸佸皬浜�5M鐨勬枃浠跺唴瀹�"} + LoginSuccess = &Code{http.StatusOK,true,"鐧诲綍鎴愬姛"} // SigninInfoError 璐︽埛鍚嶆垨瀵嗙爜鏈夎 SigninInfoError = &Code{http.StatusUnauthorized, false, "璐︽埛鍚嶆垨瀵嗙爜鏈夎"} // TokenNotFound 璇锋眰鏈惡甯oken, 鏃犳潈璁块棶 -- Gitblit v1.8.0