feat:优化项目信息

This commit is contained in:
henry
2021-12-01 14:12:23 +08:00
parent c27e115517
commit 3abfe92add
32 changed files with 397 additions and 429 deletions

View File

@ -24,7 +24,6 @@ type (
Captcha string `json:"captcha" form:"captcha" binding:"required"`
Password string `json:"password" form:"password" binding:"required"`
RepeatPass string `json:"repeat_pass" form:"repeat_pass" binding:"required"`
Identity int `json:"identity" form:"identity" binding:"required"`
}
)
@ -57,7 +56,7 @@ func (a *Account) Register(c *gin.Context) {
}
data, err := account.NewRegister()(api.GetLocal()(c).(string)).Launch(&account.RegisterParams{
Name: form.Name, Mobile: form.Mobile, Captcha: form.Captcha,
Password: form.Password, RepeatPass: form.RepeatPass, Identity: form.Identity,
Password: form.Password, RepeatPass: form.RepeatPass,
})
api.APIResponse(err, data)(c)
}

View File

@ -37,11 +37,6 @@ func (*User) Info(c *gin.Context) {
api.APISuccess(data)
}
func (*User) Detail(c *gin.Context) {
data, err := user.NewInstance()(api.GetSession()(c).(*session.Enterprise)).Detail()
api.APIResponse(err, data)(c)
}
func (*User) BindMobile(c *gin.Context) {
form := &struct {
Mobile string `json:"mobile" form:"mobile" binding:"required"`
@ -118,7 +113,32 @@ func (*User) SettledLaboratory(c *gin.Context) {
api.APIResponse(err)(c)
}
func (*User) SwitchIdentity(c *gin.Context) {
func (*User) SettledAgent(c *gin.Context) {
form := &struct {
userSettledForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Agent(&user.SettledParams{
ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords,
})
api.APIResponse(err)(c)
}
func (*User) IdentityBasic(c *gin.Context) {
data, err := user.NewIdentity()(api.GetSession()(c).(*session.Enterprise)).Basic()
api.APIResponse(err, data)(c)
}
func (*User) IdentityDetail(c *gin.Context) {
data, err := user.NewIdentity()(api.GetSession()(c).(*session.Enterprise)).Detail()
api.APIResponse(err, data)(c)
}
func (*User) IdentitySwitch(c *gin.Context) {
form := &struct {
Identity int `json:"identity" form:"identity" binding:"required"`
}{}
@ -126,7 +146,7 @@ func (*User) SwitchIdentity(c *gin.Context) {
api.APIFailure(err.(error))(c)
return
}
err := user.NewInstance()(api.GetSession()(c).(*session.Enterprise)).SwitchIdentity(form.Identity)
err := user.NewIdentity()(api.GetSession()(c).(*session.Enterprise)).Switch(form.Identity)
api.APIResponse(err)(c)
}