feat:完善项目信息
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
||||
"SciencesServer/app/api/admin/controller/manage"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -51,7 +50,7 @@ func (*Manage) Expert(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*service.Session), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(string)).
|
||||
Expert(form.Name, form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)
|
||||
}
|
||||
|
@ -5,19 +5,19 @@ import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/basic/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/app/session"
|
||||
"gorm.io/gorm"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Instance struct {
|
||||
*service.Session
|
||||
*session.Admin
|
||||
gorm.Model
|
||||
local string
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *service.Session, local string) *Instance
|
||||
type InstanceHandle func(session *session.Admin, local string) *Instance
|
||||
|
||||
type (
|
||||
// InstanceForExpert 专家信息
|
||||
@ -87,10 +87,10 @@ func (c *Instance) Expert(name string, status int, page, pageSize int) (*control
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *service.Session, local string) *Instance {
|
||||
return func(session *session.Admin, local string) *Instance {
|
||||
return &Instance{
|
||||
Session: session,
|
||||
local: local,
|
||||
Admin: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -266,6 +266,6 @@ func (c *Innovate) KindDelete(id uint64) error {
|
||||
|
||||
func NewInnovate() InnovateHandle {
|
||||
return func(admin *session.Admin) *Innovate {
|
||||
return &Innovate{}
|
||||
return &Innovate{admin}
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ type (
|
||||
InstanceInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.SysTenant
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// InstanceSelectInfo 租户筛选信息
|
||||
InstanceSelectInfo struct {
|
||||
@ -66,6 +67,7 @@ func (c *Instance) Index(name string, page, pageSize int) (*controller.ReturnPag
|
||||
list = append(list, &InstanceInfo{
|
||||
ID: v.GetEncodeID(),
|
||||
SysTenant: v,
|
||||
Area: v.FormatBasic(),
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
|
@ -38,11 +38,12 @@ type (
|
||||
}
|
||||
// InstanceUserInfo 用户信息
|
||||
InstanceUserInfo struct {
|
||||
UID string `json:"uid"`
|
||||
Avatar string `json:"avatar"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Mobile string `json:"mobile"`
|
||||
UID string `json:"uid"`
|
||||
Avatar string `json:"avatar"`
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
Mobile string `json:"mobile"`
|
||||
IsSuper bool `json:"is_super"` // 总后台
|
||||
}
|
||||
// InstanceDepartmentInfo 部门信息
|
||||
InstanceDepartmentInfo struct {
|
||||
@ -136,7 +137,7 @@ func (c *Instance) Info() (*InstanceUserInfo, error) {
|
||||
}
|
||||
return &InstanceUserInfo{
|
||||
UID: mSysUser.UUIDString(), Avatar: mSysUser.Avatar, Name: mSysUser.Name,
|
||||
Email: mSysUser.Email, Mobile: mSysUser.Mobile,
|
||||
Email: mSysUser.Email, Mobile: mSysUser.Mobile, IsSuper: c.TenantID <= 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,13 @@ type ServiceInnovateInfo struct {
|
||||
Title string `json:"title"`
|
||||
TenantName string `json:"tenant_name"`
|
||||
KindTitle string `json:"kind_title"`
|
||||
Sort int `json:"sort"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (m *ServiceInnovate) Innovate(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ServiceInnovateInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS i").
|
||||
Select("i.id", "i.title", "t.name AS tenant_name", "k.title AS kind_title", "i.created_at",
|
||||
Select("i.id", "i.title", "t.name AS tenant_name", "k.title AS kind_title", "i.sort", "i.created_at",
|
||||
"t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON i.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS k ON i.kind = k.id", model.NewServiceInnovateKind().TableName())).
|
||||
|
Reference in New Issue
Block a user