feat:完善信息

This commit is contained in:
henry
2021-10-13 11:23:55 +08:00
parent 17fb77e84a
commit 21dc62ba8e
11 changed files with 129 additions and 102 deletions

View File

@ -33,7 +33,7 @@ func (a *Account) Login(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
data, err := account.NewLogin()().Launch(account.LoginMode(form.Mode), &account.LoginParams{
data, err := account.NewLogin()(api.GetLocal()(c).(uint64)).Launch(account.LoginMode(form.Mode), &account.LoginParams{
Captcha: struct {
Mobile string
Captcha string
@ -53,7 +53,7 @@ func (a *Account) Register(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
data, err := account.NewRegister()().Launch(&account.RegisterParams{
data, err := account.NewRegister()(api.GetLocal()(c).(uint64)).Launch(&account.RegisterParams{
Name: form.Name, Mobile: form.Mobile, Captcha: form.Captcha,
Password: form.Password, RepeatPass: form.RepeatPass, Identity: form.Identity,
})
@ -72,6 +72,6 @@ func (a *Account) Logout(c *gin.Context) {
if handle != nil {
session = handle.(*service.SessionEnterprise)
}
err := account.NewLogout()(session).Launch()
err := account.NewLogout()(session, api.GetLocal()(c).(uint64)).Launch()
api.APIResponse(err)(c)
}

View File

@ -31,7 +31,8 @@ func (a *Technology) Paper(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
data, err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise)).List(form.Title, form.Page, form.PageSize)
data, err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
List(form.Title, form.Page, form.PageSize)
api.APIResponse(err, data)
}
@ -42,10 +43,11 @@ func (a *Technology) PaperAdd(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise)).Form(&technology.PaperParams{
Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
})
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
Form(&technology.PaperParams{
Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
})
api.APIResponse(err)
}
@ -58,10 +60,11 @@ func (a *Technology) PaperEdit(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise)).Form(&technology.PaperParams{
ID: form.Convert(), Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
})
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
Form(&technology.PaperParams{
ID: form.Convert(), Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
})
api.APIResponse(err)
}
@ -72,6 +75,7 @@ func (a *Technology) PaperDelete(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise)).Delete(form.Convert())
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(uint64)).
Delete(form.Convert())
api.APIResponse(err)
}