feat:完善信息

This commit is contained in:
henry
2021-10-11 16:30:53 +08:00
parent 0dd46c0c9d
commit 7830ab0c86
15 changed files with 408 additions and 101 deletions

View File

@ -54,7 +54,6 @@ func (a *Technology) PaperEdit(c *gin.Context) {
api.IDStringForm
paperForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return

View File

@ -2,6 +2,7 @@ package api
import (
"SciencesServer/app/basic/api"
"SciencesServer/app/basic/config"
"SciencesServer/app/enterprise/controller/tenant"
"SciencesServer/app/service"
"github.com/gin-gonic/gin"
@ -9,11 +10,75 @@ import (
type Tenant struct{}
type SettledBasic struct {
api.IDStringForm
api.ImageForm
Name string `json:"name" form:"name"`
Code string `json:"code" form:"code"`
config.Area
Introduce string `json:"introduce" form:"introduce"`
Industry uint64 `json:"industry" form:"industry"`
Keywords []string `json:"keywords" form:"keywords"`
}
func (a *Tenant) SettledCompany(c *gin.Context) {
err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Company(nil, nil)
form := &struct {
SettledBasic
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Company(&tenant.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,
}, nil)
api.APIResponse(err)(c)
}
func (a *Tenant) SettledExpert(c *gin.Context) {
form := &struct {
SettledBasic
config.IdentityForExpert
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Expert(&tenant.SettledParams{
ID: form.Convert(), Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords,
}, &form.IdentityForExpert)
api.APIResponse(err)(c)
}
func (a *Tenant) SettledResearch(c *gin.Context) {
form := &struct {
SettledBasic
config.IdentityForResearch
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Research(&tenant.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,
}, &form.IdentityForResearch)
api.APIResponse(err)(c)
}
func (a *Tenant) SettledLaboratory(c *gin.Context) {
form := &struct {
SettledBasic
config.IdentityForLaboratory
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Laboratory(&tenant.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,
}, &form.IdentityForLaboratory)
api.APIResponse(err)(c)
}

View File

@ -16,12 +16,10 @@ func (a *User) Info(c *gin.Context) {
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"` // 公司属性
Name string `json:"name" form:"name" binding:"required"` // 名称
Email string `json:"email" form:"email" binding:"required"` // 邮箱
Job string `json:"job" form:"job" binding:"required"` // 职务
FixedPhone string `json:"fixed_phone" form:"fixed_phone" ` // 固定电话
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
@ -29,9 +27,8 @@ func (a *User) Perfect(c *gin.Context) {
}
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,
Name: form.Name, Email: form.Email, Job: form.Job, FixedPhone: form.FixedPhone,
},
TenantParamsForCompany: &form.Company,
})
api.APIResponse(err)
}