feat:完善信息
This commit is contained in:
@ -22,6 +22,10 @@ func (a *Config) Industry(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func (a *Config) Research(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
func (a *Config) Area(c *gin.Context) {
|
||||
form := &struct {
|
||||
Key string `json:"key" form:"key"`
|
||||
|
9
app/api/enterprise/api/menu.go
Normal file
9
app/api/enterprise/api/menu.go
Normal file
@ -0,0 +1,9 @@
|
||||
package api
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type Menu struct{}
|
||||
|
||||
func (*Menu) Menu(c *gin.Context) {
|
||||
|
||||
}
|
@ -19,7 +19,7 @@ type (
|
||||
Code string `json:"code" form:"code"`
|
||||
config.Area
|
||||
Introduce string `json:"introduce" form:"introduce"`
|
||||
Industry uint64 `json:"industry" form:"industry"`
|
||||
Industry string `json:"industry" form:"industry"` // 行业领域
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
}
|
||||
// userBankForm 银行平台信息参数
|
||||
|
@ -76,7 +76,7 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
mUserManage.UID = mUserInstance.UUID
|
||||
mUserManage.Name = params.Name
|
||||
mUserManage.Identity = params.Identity
|
||||
mUserManage.Selected = model2.UserManageSelectedForYes
|
||||
mUserManage.IsSelected = model2.UserManageSelectedForYes
|
||||
return model2.Create(mUserManage.UserManage, tx)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
|
@ -28,8 +28,8 @@ func (c *Config) Transaction() map[int]string {
|
||||
}
|
||||
|
||||
// Industry 行业信息
|
||||
func (c *Config) Industry() {
|
||||
|
||||
func (c *Config) Industry() map[string]*config.MemoryForIndustry {
|
||||
return config.MemoryForIndustryInfo
|
||||
}
|
||||
|
||||
// Research 研究领域信息
|
||||
|
@ -3,8 +3,10 @@ package identity
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Instance struct {
|
||||
@ -18,7 +20,8 @@ type (
|
||||
// InstanceForExpert 专家信息
|
||||
InstanceForExpert struct {
|
||||
*model.UserManageForExpert
|
||||
ID string `json:"id"`
|
||||
ID string `json:"id"`
|
||||
Industry string `json:"industry"`
|
||||
}
|
||||
)
|
||||
|
||||
@ -46,8 +49,15 @@ func (c *Instance) Expert(name, mobile string, page, pageSize int) (*controller.
|
||||
|
||||
for _, v := range out {
|
||||
mUserManage.ID = v.ID
|
||||
mUserManage.IdentityInfo = v.IdentityInfo
|
||||
obj := mUserManage.GetIdentityInfoAttribute().(*model2.UserIdentityForExpert)
|
||||
industry := make([]string, 0)
|
||||
|
||||
for _, v := range strings.Split(obj.Industry, ";") {
|
||||
industry = append(industry, config.GetIndustryInfo(v, "-"))
|
||||
}
|
||||
list = append(list, &InstanceForExpert{
|
||||
UserManageForExpert: v, ID: mUserManage.GetEncodeID(),
|
||||
UserManageForExpert: v, ID: mUserManage.GetEncodeID(), Industry: strings.Join(industry, ";"),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
|
19
app/api/enterprise/controller/menu/instance.go
Normal file
19
app/api/enterprise/controller/menu/instance.go
Normal file
@ -0,0 +1,19 @@
|
||||
package menu
|
||||
|
||||
import "SciencesServer/app/service"
|
||||
|
||||
type Instance struct {
|
||||
*service.SessionEnterprise
|
||||
}
|
||||
|
||||
type InstanceHandle func(enterprise *service.SessionEnterprise) *Instance
|
||||
|
||||
func (c *Instance) List() {
|
||||
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(enterprise *service.SessionEnterprise) *Instance {
|
||||
return &Instance{enterprise}
|
||||
}
|
||||
}
|
@ -81,12 +81,12 @@ func (c *Instance) SwitchIdentity(identity int) error {
|
||||
|
||||
if err = orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
if err = model2.UpdatesWhere(mUserManage.UserManage, map[string]interface{}{
|
||||
"selected": model2.UserManageSelectedForNo, "updated_at": now,
|
||||
"is_selected": model2.UserManageSelectedForNo, "updated_at": now,
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uid", c.ManageUID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
return model2.Updates(mUserManage.UserManage, map[string]interface{}{
|
||||
"selected": model2.UserManageSelectedForYes, "updated_at": now,
|
||||
"is_selected": model2.UserManageSelectedForYes, "updated_at": now,
|
||||
}, tx)
|
||||
}); err != nil {
|
||||
return err
|
||||
|
@ -21,7 +21,7 @@ type SettledParams struct {
|
||||
Code string // 唯一编码
|
||||
config.Area
|
||||
Introduce string
|
||||
Industry uint64 `json:"industry"`
|
||||
Industry string `json:"industry"`
|
||||
Keywords []string `json:"keywords"`
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ func (c *SettledParams) pass(uid, mUID uint64, mStatus model2.ExamineStatusKind)
|
||||
func (c *Settled) Company(params *SettledParams, other *config.IdentityForCompany) error {
|
||||
mManageCompany := model3.NewManageCompany()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageCompany.ManageCompany)
|
||||
err := params.effect(c.UID, mManageCompany.ManageCompany)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -73,10 +73,10 @@ func (c *Settled) Company(params *SettledParams, other *config.IdentityForCompan
|
||||
mManageCompany.Introduce = params.Introduce
|
||||
|
||||
if mManageCompany.ID <= 0 {
|
||||
mManageCompany.UID = c.ManageUID
|
||||
mManageCompany.UID = c.UID
|
||||
return model2.Create(mManageCompany.ManageCompany)
|
||||
}
|
||||
if !params.pass(c.ManageUID, mManageCompany.UID, mManageCompany.Status) {
|
||||
if !params.pass(c.UID, mManageCompany.UID, mManageCompany.Status) {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mManageCompany.Status = model2.ExamineStatusForOngoing
|
||||
@ -87,7 +87,7 @@ func (c *Settled) Company(params *SettledParams, other *config.IdentityForCompan
|
||||
func (c *Settled) Expert(params *SettledParams, other *config.IdentityForExpert) error {
|
||||
mManageExpert := model3.NewManageExpert()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageExpert.ManageExpert)
|
||||
err := params.effect(c.UID, mManageExpert.ManageExpert)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -108,10 +108,10 @@ func (c *Settled) Expert(params *SettledParams, other *config.IdentityForExpert)
|
||||
mManageExpert.Research = utils.AnyToJSON(other.Research)
|
||||
|
||||
if mManageExpert.ID <= 0 {
|
||||
mManageExpert.UID = c.ManageUID
|
||||
mManageExpert.UID = c.UID
|
||||
return model2.Create(mManageExpert.ManageExpert)
|
||||
}
|
||||
if !params.pass(c.ManageUID, mManageExpert.UID, mManageExpert.Status) {
|
||||
if !params.pass(c.UID, mManageExpert.UID, mManageExpert.Status) {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mManageExpert.Status = model2.ExamineStatusForOngoing
|
||||
@ -122,7 +122,7 @@ func (c *Settled) Expert(params *SettledParams, other *config.IdentityForExpert)
|
||||
func (c *Settled) Research(params *SettledParams, other *config.IdentityForResearch) error {
|
||||
mManageResearch := model3.NewManageResearch()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageResearch.ManageResearch)
|
||||
err := params.effect(c.UID, mManageResearch.ManageResearch)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -137,10 +137,10 @@ func (c *Settled) Research(params *SettledParams, other *config.IdentityForResea
|
||||
mManageResearch.Research = other.Research
|
||||
|
||||
if mManageResearch.ID <= 0 {
|
||||
mManageResearch.UID = c.ManageUID
|
||||
mManageResearch.UID = c.UID
|
||||
return model2.Create(mManageResearch.ManageResearch)
|
||||
}
|
||||
if !params.pass(c.ManageUID, mManageResearch.UID, mManageResearch.Status) {
|
||||
if !params.pass(c.UID, mManageResearch.UID, mManageResearch.Status) {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mManageResearch.Status = model2.ExamineStatusForOngoing
|
||||
@ -151,7 +151,7 @@ func (c *Settled) Research(params *SettledParams, other *config.IdentityForResea
|
||||
func (c *Settled) Laboratory(params *SettledParams, other *config.IdentityForLaboratory) error {
|
||||
mManageLaboratory := model3.NewManageLaboratory()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageLaboratory.ManageLaboratory)
|
||||
err := params.effect(c.UID, mManageLaboratory.ManageLaboratory)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -169,10 +169,10 @@ func (c *Settled) Laboratory(params *SettledParams, other *config.IdentityForLab
|
||||
mManageLaboratory.Research = utils.AnyToJSON(other.Research)
|
||||
|
||||
if mManageLaboratory.ID <= 0 {
|
||||
mManageLaboratory.UID = c.ManageUID
|
||||
mManageLaboratory.UID = c.UID
|
||||
return model2.Create(mManageLaboratory.ManageLaboratory)
|
||||
}
|
||||
if !params.pass(c.ManageUID, mManageLaboratory.UID, mManageLaboratory.Status) {
|
||||
if !params.pass(c.UID, mManageLaboratory.UID, mManageLaboratory.Status) {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mManageLaboratory.Status = model2.ExamineStatusForOngoing
|
||||
|
15
app/api/enterprise/model/sys_menu.go
Normal file
15
app/api/enterprise/model/sys_menu.go
Normal file
@ -0,0 +1,15 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type SysMenu struct {
|
||||
*model.SysMenu
|
||||
}
|
||||
|
||||
func (m *SysMenu) Menus() {
|
||||
|
||||
}
|
||||
|
||||
func NewSysMenu() *SysMenu {
|
||||
return &SysMenu{model.NewSysMenu()}
|
||||
}
|
@ -15,16 +15,17 @@ type UserManage struct {
|
||||
type (
|
||||
// UserManageForExpert 专家信息
|
||||
UserManageForExpert struct {
|
||||
ID uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Mobile string `json:"mobile"`
|
||||
ID uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Mobile string `json:"mobile"`
|
||||
IdentityInfo string `json:"-"`
|
||||
}
|
||||
)
|
||||
|
||||
// Expert 专家数据
|
||||
func (m *UserManage) Expert(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*UserManageForExpert, error) {
|
||||
query := orm.GetDB().Table(m.TableName()+" AS m").
|
||||
Select(strings.Join([]string{"m.id", "m.name", "u.mobile"}, ",")).
|
||||
Select(strings.Join([]string{"m.id", "m.name", "u.mobile", "m.identity_info"}, ",")).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u ON m.uid = u.uuid", model.NewUserInstance().TableName())).
|
||||
Where("m.is_deleted = ?", model.DeleteStatusForNot).
|
||||
Where("m.identity = ?", config.TenantUserIdentityForExpert)
|
||||
|
Reference in New Issue
Block a user