update api

This commit is contained in:
medcl 2022-01-23 16:21:52 +08:00
parent 1c0ac91ae8
commit 88d15e3c3e
2 changed files with 5 additions and 7 deletions

View File

@ -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 LabsUED\", \"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 LabsUED\", \"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)
}

View File

@ -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)