Refactor GetDefaultApplication().

This commit is contained in:
Yang Luo
2021-05-16 23:07:45 +08:00
parent 6508d96162
commit b103683fea
2 changed files with 18 additions and 6 deletions

View File

@ -50,9 +50,18 @@ func (c *ApiController) GetApplication() {
// @Success 200 {object} object.Application The Response object
// @router /get-default-application [get]
func (c *ApiController) GetDefaultApplication() {
owner := c.Input().Get("owner")
//owner := c.Input().Get("owner")
c.Data["json"] = object.GetDefaultApplication(owner)
if c.GetSessionUser() == "" {
c.Data["json"] = nil
c.ServeJSON()
return
}
username := c.GetSessionUser()
user := object.GetUser(username)
c.Data["json"] = object.GetApplicationByUser(user)
c.ServeJSON()
}