42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/basic/api"
|
|
"SciencesServer/app/enterprise/controller/user"
|
|
"SciencesServer/app/service"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type User struct{}
|
|
|
|
func (a *User) Info(c *gin.Context) {
|
|
data := user.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).Info()
|
|
api.APISuccess(data)
|
|
}
|
|
|
|
func (a *User) Perfect(c *gin.Context) {
|
|
form := &struct {
|
|
Avatar string `json:"avatar" form:"avatar" binding:"required"` // 头像
|
|
Name string `json:"name" form:"name" binding:"required"` // 名称
|
|
Email string `json:"email" form:"email" binding:"required"` // 邮箱
|
|
Job string `json:"job" form:"job" binding:"required"` // 职务
|
|
Address string `json:"address" form:"address" ` // 地址
|
|
Company user.TenantParamsForCompany `json:"company" form:"company"` // 公司属性
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
err := user.NewTenant()(api.GetSession()(c).(*service.SessionEnterprise)).Perfect(&user.TenantPerfectParams{
|
|
TenantBasicParams: &user.TenantBasicParams{
|
|
Avatar: form.Avatar, Name: form.Name, Email: form.Email, Job: form.Job, Address: form.Address,
|
|
},
|
|
TenantParamsForCompany: &form.Company,
|
|
})
|
|
api.APIResponse(err)
|
|
}
|
|
|
|
func (a *User) SwitchIdentity(c *gin.Context) {
|
|
|
|
}
|