From 88d15e3c3e181c2295405d2c38ff8c02b0f79e26 Mon Sep 17 00:00:00 2001 From: medcl Date: Sun, 23 Jan 2022 16:21:52 +0800 Subject: [PATCH] update api --- api/index_management/index.go | 6 +++--- api/init.go | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/api/index_management/index.go b/api/index_management/index.go index b82b9cf2..176f71a0 100644 --- a/api/index_management/index.go +++ b/api/index_management/index.go @@ -65,7 +65,7 @@ func (handler APIHandler) CreateDictItemAction(w http.ResponseWriter, req *http. return } - err = orm.Save(dict) + err = orm.Create(&dict) if err != nil { resp["status"] = false resp["error"] = err @@ -130,6 +130,6 @@ func (handler APIHandler) AccountLogin(w http.ResponseWriter, req *http.Request, } func (handler APIHandler) CurrentUser(w http.ResponseWriter, req *http.Request, ps httprouter.Params) { - data:=[]byte("{ \"name\": \"INFINI Labs\", \"avatar\": \"\", \"userid\": \"10001\", \"email\": \"hello@infini.ltd\", \"signature\": \"极限科技 - 专业的开源搜索与实时数据分析整体解决方案提供商。\", \"title\": \"首席设计师\", \"group\": \"INFINI Labs-UED\", \"tags\": [ { \"key\": \"0\", \"label\": \"很有想法的\" }, { \"key\": \"1\", \"label\": \"专注设计\" }, { \"key\": \"2\", \"label\": \"辣~\" }, { \"key\": \"3\", \"label\": \"大长腿\" }, { \"key\": \"4\", \"label\": \"川妹子\" }, { \"key\": \"5\", \"label\": \"海纳百川\" } ], \"notifyCount\": 12, \"country\": \"China\", \"geographic\": { \"province\": { \"label\": \"湖南省\", \"key\": \"330000\" }, \"city\": { \"label\": \"长沙市\", \"key\": \"330100\" } }, \"address\": \"岳麓区湘江金融中心\", \"phone\": \"4001399200\" }") - handler.Write(w,data) + data := []byte("{ \"name\": \"INFINI Labs\", \"avatar\": \"\", \"userid\": \"10001\", \"email\": \"hello@infini.ltd\", \"signature\": \"极限科技 - 专业的开源搜索与实时数据分析整体解决方案提供商。\", \"title\": \"首席设计师\", \"group\": \"INFINI Labs-UED\", \"tags\": [ { \"key\": \"0\", \"label\": \"很有想法的\" }, { \"key\": \"1\", \"label\": \"专注设计\" }, { \"key\": \"2\", \"label\": \"辣~\" }, { \"key\": \"3\", \"label\": \"大长腿\" }, { \"key\": \"4\", \"label\": \"川妹子\" }, { \"key\": \"5\", \"label\": \"海纳百川\" } ], \"notifyCount\": 12, \"country\": \"China\", \"geographic\": { \"province\": { \"label\": \"湖南省\", \"key\": \"330000\" }, \"city\": { \"label\": \"长沙市\", \"key\": \"330100\" } }, \"address\": \"岳麓区湘江金融中心\", \"phone\": \"4001399200\" }") + handler.Write(w, data) } diff --git a/api/init.go b/api/init.go index 713c4bd2..da246399 100644 --- a/api/init.go +++ b/api/init.go @@ -78,13 +78,11 @@ func Init(cfg *config.AppConfig) { - api.HandleAPIMethod(api.POST, "/api/login/account", handler.AccountLogin) - api.HandleAPIMethod(api.GET, "/api/currentUser", handler.CurrentUser) - - api.HandleAPIMethod(api.POST, "/account/login", handler.AccountLogin) api.HandleAPIMethod(api.GET, "/account/current_user", handler.CurrentUser) + api.HandleAPIMethod(api.GET, "/account/current_user", handler.CurrentUser) +