feat:完善信息
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,4 +6,5 @@ SciencesServer
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
upload/*
|
||||
upload/*
|
||||
log/*
|
@ -1,8 +1,8 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
account2 "SciencesServer/app/api/enterprise/controller/account"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/enterprise/controller/account"
|
||||
"SciencesServer/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -33,7 +33,7 @@ func (a *Account) Login(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account.NewLogin()(api.GetLocal()(c).(string)).Launch(account.LoginMode(form.Mode), &account.LoginParams{
|
||||
data, err := account2.NewLogin()(api.GetLocal()(c).(string)).Launch(account2.LoginMode(form.Mode), &account2.LoginParams{
|
||||
Captcha: struct {
|
||||
Mobile string
|
||||
Captcha string
|
||||
@ -53,7 +53,7 @@ func (a *Account) Register(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account.NewRegister()(api.GetLocal()(c).(string)).Launch(&account.RegisterParams{
|
||||
data, err := account2.NewRegister()(api.GetLocal()(c).(string)).Launch(&account2.RegisterParams{
|
||||
Name: form.Name, Mobile: form.Mobile, Captcha: form.Captcha,
|
||||
Password: form.Password, RepeatPass: form.RepeatPass, Identity: form.Identity,
|
||||
})
|
||||
@ -72,6 +72,6 @@ func (a *Account) Logout(c *gin.Context) {
|
||||
if handle != nil {
|
||||
session = handle.(*service.SessionEnterprise)
|
||||
}
|
||||
err := account.NewLogout()(session, api.GetLocal()(c).(uint64)).Launch()
|
||||
err := account2.NewLogout()(session, api.GetLocal()(c).(uint64)).Launch()
|
||||
api.APIResponse(err)(c)
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/controller/config"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/enterprise/controller/config"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -1,9 +1,9 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
technology2 "SciencesServer/app/api/enterprise/controller/technology"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/enterprise/controller/technology"
|
||||
"SciencesServer/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -66,7 +66,7 @@ func (a *Technology) Paper(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
data, err := technology2.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -78,8 +78,8 @@ func (a *Technology) PaperAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.PaperParams{
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.PaperParams{
|
||||
Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
|
||||
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
|
||||
})
|
||||
@ -95,8 +95,8 @@ func (a *Technology) PaperEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.PaperParams{
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.PaperParams{
|
||||
ID: form.Convert(), Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
|
||||
Keyword: form.Keyword, Tags: form.Tags, Remark: form.Remark,
|
||||
})
|
||||
@ -110,7 +110,7 @@ func (a *Technology) PaperDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -124,7 +124,7 @@ func (a *Technology) Patent(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
data, err := technology2.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -136,7 +136,7 @@ func (a *Technology) PatentDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
data, err := technology2.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -148,8 +148,8 @@ func (a *Technology) PatentAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.PatentParams{
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.PatentParams{
|
||||
Title: form.Title, IPCCode: form.IPCCode, CPCCode: form.CPCCode, ApplyCode: form.ApplyCode,
|
||||
ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyZipCode: form.ApplyZipCode,
|
||||
Inventor: form.Inventor, PriorityCode: form.PriorityCode, OpenCode: form.OpenCode, ApplyAt: form.ApplyAt,
|
||||
@ -167,8 +167,8 @@ func (a *Technology) PatentEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.PatentParams{
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.PatentParams{
|
||||
ID: form.Convert(), Title: form.Title, IPCCode: form.IPCCode, CPCCode: form.CPCCode,
|
||||
ApplyCode: form.ApplyCode, ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress,
|
||||
ApplyZipCode: form.ApplyZipCode, Inventor: form.Inventor, PriorityCode: form.PriorityCode, OpenCode: form.OpenCode,
|
||||
@ -184,7 +184,7 @@ func (a *Technology) PatentDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -198,7 +198,7 @@ func (a *Technology) Demand(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
data, err := technology2.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -210,7 +210,7 @@ func (a *Technology) DemandDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
data, err := technology2.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -222,8 +222,8 @@ func (a *Technology) DemandAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.DemandParams{
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.DemandParams{
|
||||
Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Area: form.Area, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expect: form.Expect, Demand: struct {
|
||||
@ -244,8 +244,8 @@ func (a *Technology) DemandEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology.DemandParams{
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.DemandParams{
|
||||
ID: form.Convert(), Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Area: form.Area, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
Expect: form.Expect, Demand: struct {
|
||||
@ -264,7 +264,7 @@ func (a *Technology) DemandDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
user2 "SciencesServer/app/api/enterprise/controller/user"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/enterprise/controller/user"
|
||||
"SciencesServer/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@ -33,12 +33,12 @@ type (
|
||||
)
|
||||
|
||||
func (a *User) Info(c *gin.Context) {
|
||||
data := user.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).Info()
|
||||
data := user2.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).Info()
|
||||
api.APISuccess(data)
|
||||
}
|
||||
|
||||
func (a *User) Detail(c *gin.Context) {
|
||||
data, err := user.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).Detail()
|
||||
data, err := user2.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).Detail()
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ func (a *Tenant) SettledCompany(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Company(&user.SettledParams{
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Company(&user2.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)
|
||||
@ -66,7 +66,7 @@ func (a *Tenant) SettledExpert(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Expert(&user.SettledParams{
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Expert(&user2.SettledParams{
|
||||
ID: form.Convert(), Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords,
|
||||
}, &form.IdentityForExpert)
|
||||
api.APIResponse(err)(c)
|
||||
@ -81,7 +81,7 @@ func (a *Tenant) SettledResearch(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Research(&user.SettledParams{
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Research(&user2.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)
|
||||
@ -97,7 +97,7 @@ func (a *Tenant) SettledLaboratory(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Laboratory(&user.SettledParams{
|
||||
err := user2.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Laboratory(&user2.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)
|
||||
@ -112,12 +112,12 @@ func (a *User) SwitchIdentity(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).SwitchIdentity(form.Identity)
|
||||
err := user2.NewInstance()(api.GetSession()(c).(*service.SessionEnterprise)).SwitchIdentity(form.Identity)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *User) Back(c *gin.Context) {
|
||||
data, err := user.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).List()
|
||||
data, err := user2.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).List()
|
||||
api.APIResponse(err, data)
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ func (a *User) BackBind(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).Bind(&user.BackParams{
|
||||
err := user2.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).Bind(&user2.BackParams{
|
||||
Name: form.Name,
|
||||
IDCard: form.IDCard,
|
||||
BackCard: form.BackCard,
|
||||
@ -144,6 +144,6 @@ func (a *User) BackUnbind(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).Unbind(form.Convert())
|
||||
err := user2.NewBack()(api.GetSession()(c).(*service.SessionEnterprise)).Unbind(form.Convert())
|
||||
api.APIResponse(err)
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
model3 "SciencesServer/app/api/enterprise/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/handle"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
@ -57,13 +57,13 @@ func loginForSmsCaptcha(params *LoginParams, local string) (*InstanceLoginParams
|
||||
}
|
||||
var isExist bool
|
||||
// 查询账号信息
|
||||
mUserInstance := model.NewUserInstance()
|
||||
mUserInstance := model3.NewUserInstance()
|
||||
|
||||
if isExist, err = model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "name", "mobile", "status"},
|
||||
model2.NewWhere("mobile", params.Captcha.Mobile), model2.NewWhere("local", local)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mUserManage := model.NewUserManage()
|
||||
mUserManage := model3.NewUserManage()
|
||||
|
||||
if isExist {
|
||||
// 查询该区域下最后一次选中的信息
|
||||
@ -91,7 +91,7 @@ func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams,
|
||||
if !utils.ValidateMobile(params.Password.Mobile) {
|
||||
return nil, errors.New("手机号码格式异常")
|
||||
}
|
||||
mUserInstance := model.NewUserInstance()
|
||||
mUserInstance := model3.NewUserInstance()
|
||||
|
||||
isExist, err := model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "mobile", "password", "salt", "status"},
|
||||
model2.NewWhere("mobile", params.Password.Mobile), model2.NewWhere("local", local))
|
||||
@ -105,7 +105,7 @@ func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams,
|
||||
return nil, errors.New("账户或密码错误")
|
||||
}
|
||||
// 最后一次选中的身份信息
|
||||
mUserManage := model.NewUserManage()
|
||||
mUserManage := model3.NewUserManage()
|
||||
|
||||
if err = mUserManage.LastChooseInfo(mUserInstance.UUID); err != nil {
|
||||
return nil, err
|
@ -1,8 +1,8 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
model3 "SciencesServer/app/api/enterprise/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/handle"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
@ -54,7 +54,7 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
return nil, errors.New("验证码错误或已过期")
|
||||
}
|
||||
// 验证账号信息
|
||||
mUserInstance := model.NewUserInstance()
|
||||
mUserInstance := model3.NewUserInstance()
|
||||
|
||||
if pass, err = params.checkUserExist(mUserInstance.UserInstance, c.local); err != nil {
|
||||
return nil, err
|
||||
@ -67,7 +67,7 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
mUserInstance.Password = params.Password
|
||||
mUserInstance.Identity = params.Identity
|
||||
|
||||
mUserManage := model.NewUserManage()
|
||||
mUserManage := model3.NewUserManage()
|
||||
|
||||
if err = orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
if err = model2.Create(mUserInstance.UserInstance, tx); err != nil {
|
@ -1,7 +1,7 @@
|
||||
package identity
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
)
|
||||
|
@ -1,10 +1,10 @@
|
||||
package technology
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
@ -1,9 +1,9 @@
|
||||
package technology
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
"errors"
|
||||
"time"
|
@ -1,9 +1,9 @@
|
||||
package technology
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
@ -1,9 +1,9 @@
|
||||
package technology
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
@ -1,8 +1,8 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/handle"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/utils"
|
@ -1,9 +1,9 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/service"
|
||||
config2 "SciencesServer/config"
|
||||
"SciencesServer/serve/orm"
|
@ -1,9 +1,9 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
model3 "SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
@ -55,7 +55,7 @@ func (c *SettledParams) pass(uid, mUID uint64, mStatus model2.ExamineStatusKind)
|
||||
|
||||
// Company 公司企业
|
||||
func (c *Settled) Company(params *SettledParams, other *config.IdentityForCompany) error {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
mManageCompany := model3.NewManageCompany()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageCompany.ManageCompany)
|
||||
|
||||
@ -85,7 +85,7 @@ func (c *Settled) Company(params *SettledParams, other *config.IdentityForCompan
|
||||
|
||||
// Expert 专家
|
||||
func (c *Settled) Expert(params *SettledParams, other *config.IdentityForExpert) error {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
mManageExpert := model3.NewManageExpert()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageExpert.ManageExpert)
|
||||
|
||||
@ -120,7 +120,7 @@ func (c *Settled) Expert(params *SettledParams, other *config.IdentityForExpert)
|
||||
|
||||
// Research 研究机构
|
||||
func (c *Settled) Research(params *SettledParams, other *config.IdentityForResearch) error {
|
||||
mManageResearch := model.NewManageResearch()
|
||||
mManageResearch := model3.NewManageResearch()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageResearch.ManageResearch)
|
||||
|
||||
@ -149,7 +149,7 @@ func (c *Settled) Research(params *SettledParams, other *config.IdentityForResea
|
||||
|
||||
// Laboratory 实验室
|
||||
func (c *Settled) Laboratory(params *SettledParams, other *config.IdentityForLaboratory) error {
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
mManageLaboratory := model3.NewManageLaboratory()
|
||||
|
||||
err := params.effect(c.ManageUID, mManageLaboratory.ManageLaboratory)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller/auth"
|
||||
"SciencesServer/app/api/manage/controller/auth"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
@ -1,8 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller"
|
||||
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller/menu"
|
||||
"SciencesServer/app/api/manage/controller/menu"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller/role"
|
||||
role2 "SciencesServer/app/api/manage/controller/role"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -19,12 +19,12 @@ func (a *Role) List(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := role.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Status, form.Page, form.PageSize)
|
||||
data, err := role2.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Status, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (a *Role) Select(c *gin.Context) {
|
||||
data, err := role.NewInstance()(getSession()(c).(*service.Session)).Select()
|
||||
data, err := role2.NewInstance()(getSession()(c).(*service.Session)).Select()
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ func (a *Role) Add(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewInstance()(getSession()(c).(*service.Session)).Data(0, form.Name, form.Remark, form.Sort)
|
||||
err := role2.NewInstance()(getSession()(c).(*service.Session)).Data(0, form.Name, form.Remark, form.Sort)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ func (a *Role) Edit(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewInstance()(getSession()(c).(*service.Session)).Data(form.ID, form.Name, form.Remark, form.Sort)
|
||||
err := role2.NewInstance()(getSession()(c).(*service.Session)).Data(form.ID, form.Name, form.Remark, form.Sort)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ func (a *Role) Status(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewInstance()(getSession()(c).(*service.Session)).Status(form.ID, form.Status)
|
||||
err := role2.NewInstance()(getSession()(c).(*service.Session)).Status(form.ID, form.Status)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ func (a *Role) Delete(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewInstance()(getSession()(c).(*service.Session)).Delete(form.ID)
|
||||
err := role2.NewInstance()(getSession()(c).(*service.Session)).Delete(form.ID)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ func (a *Role) Menu(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := role.NewMenu()(getSession()(c).(*service.Session)).List(form.RoleID)
|
||||
data, err := role2.NewMenu()(getSession()(c).(*service.Session)).List(form.RoleID)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ func (a *Role) MenuBind(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewMenu()(getSession()(c).(*service.Session)).Bind(form.RoleID, form.MenuIDs)
|
||||
err := role2.NewMenu()(getSession()(c).(*service.Session)).Bind(form.RoleID, form.MenuIDs)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ func (a *Role) Auth(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := role.NewAuth()(getSession()(c).(*service.Session)).List(form.RoleID)
|
||||
data, err := role2.NewAuth()(getSession()(c).(*service.Session)).List(form.RoleID)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -259,6 +259,6 @@ func (a *Role) AuthBind(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := role.NewAuth()(getSession()(c).(*service.Session)).Bind(form.RoleID, form.AuthIDs)
|
||||
err := role2.NewAuth()(getSession()(c).(*service.Session)).Bind(form.RoleID, form.AuthIDs)
|
||||
APIResponse(err)(c)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller/tenant"
|
||||
tenant2 "SciencesServer/app/api/manage/controller/tenant"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -93,7 +93,7 @@ func (a *Tenant) List(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := tenant.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Status, form.Page, form.PageSize)
|
||||
data, err := tenant2.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Status, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ func (a *Tenant) Add(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewInstance()(getSession()(c).(*service.Session)).Add(&tenant.InstanceParams{Name: form.Name,
|
||||
err := tenant2.NewInstance()(getSession()(c).(*service.Session)).Add(&tenant2.InstanceParams{Name: form.Name,
|
||||
Image: form.FilterImageURL(), Account: form.Account, Password: form.Password, RepeatPwd: form.RepeatPwd,
|
||||
Deadline: form.Deadline, Remark: form.Remark,
|
||||
})
|
||||
@ -178,7 +178,7 @@ func (a *Tenant) Edit(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewInstance()(getSession()(c).(*service.Session)).Edit(&tenant.InstanceParams{ID: form.ID, Name: form.Name,
|
||||
err := tenant2.NewInstance()(getSession()(c).(*service.Session)).Edit(&tenant2.InstanceParams{ID: form.ID, Name: form.Name,
|
||||
Image: form.FilterImageURL(), Remark: form.Remark,
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
@ -218,7 +218,7 @@ func (a *Tenant) EditPassword(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewInstance()(getSession()(c).(*service.Session)).Edit(&tenant.InstanceParams{ID: form.ID, Password: form.Password,
|
||||
err := tenant2.NewInstance()(getSession()(c).(*service.Session)).Edit(&tenant2.InstanceParams{ID: form.ID, Password: form.Password,
|
||||
RepeatPwd: form.RepeatPwd,
|
||||
})
|
||||
APIResponse(err)(c)
|
||||
@ -253,17 +253,17 @@ func (a *Tenant) EditPassword(c *gin.Context) {
|
||||
func (a *Tenant) Detail(c *gin.Context) {
|
||||
form := &struct {
|
||||
idForm
|
||||
Type tenant.InstanceDetailType `json:"type" form:"type" binding:"required"`
|
||||
Page int `json:"current" form:"current"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
Name string `json:"name" form:"name"`
|
||||
Status int `json:"status" form:"status"`
|
||||
Type tenant2.InstanceDetailType `json:"type" form:"type" binding:"required"`
|
||||
Page int `json:"current" form:"current"`
|
||||
PageSize int `json:"pageSize" form:"pageSize"`
|
||||
Name string `json:"name" form:"name"`
|
||||
Status int `json:"status" form:"status"`
|
||||
}{}
|
||||
if err := bind(form)(c); err != nil {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := tenant.NewInstance()(getSession()(c).(*service.Session)).Detail(form.ID, form.Type, form.Page,
|
||||
data, err := tenant2.NewInstance()(getSession()(c).(*service.Session)).Detail(form.ID, form.Type, form.Page,
|
||||
form.PageSize, form.Name, form.Status)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
@ -299,7 +299,7 @@ func (a *Tenant) Renewal(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewInstance()(getSession()(c).(*service.Session)).Renewal(form.ID, form.Deadline)
|
||||
err := tenant2.NewInstance()(getSession()(c).(*service.Session)).Renewal(form.ID, form.Deadline)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ func (a *Tenant) StartUp(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewInstance()(getSession()(c).(*service.Session)).StartUp(form.ID)
|
||||
err := tenant2.NewInstance()(getSession()(c).(*service.Session)).StartUp(form.ID)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ func (a *Tenant) Disable(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewInstance()(getSession()(c).(*service.Session)).Disable(form.ID)
|
||||
err := tenant2.NewInstance()(getSession()(c).(*service.Session)).Disable(form.ID)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -398,7 +398,7 @@ func (a *Tenant) MemberBind(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewInstance()(getSession()(c).(*service.Session)).MemberBind(form.Convert(), form.Status)
|
||||
err := tenant2.NewInstance()(getSession()(c).(*service.Session)).MemberBind(form.Convert(), form.Status)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ func (a *Tenant) Menu(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := tenant.NewMenu()(getSession()(c).(*service.Session)).List(form.TenantID)
|
||||
data, err := tenant2.NewMenu()(getSession()(c).(*service.Session)).List(form.TenantID)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -490,7 +490,7 @@ func (a *Tenant) MenuBind(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewMenu()(getSession()(c).(*service.Session)).Bind(form.TenantID, form.MenuIDs)
|
||||
err := tenant2.NewMenu()(getSession()(c).(*service.Session)).Bind(form.TenantID, form.MenuIDs)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -525,6 +525,6 @@ func (a *Tenant) AuthBind(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := tenant.NewAuth()(getSession()(c).(*service.Session)).Bind(form.TenantID, form.AuthIDs)
|
||||
err := tenant2.NewAuth()(getSession()(c).(*service.Session)).Bind(form.TenantID, form.AuthIDs)
|
||||
APIResponse(err)(c)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/manage/controller/user"
|
||||
user2 "SciencesServer/app/api/manage/controller/user"
|
||||
"SciencesServer/app/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@ -24,7 +24,7 @@ type userForm struct {
|
||||
*/
|
||||
|
||||
func (a *User) Info(c *gin.Context) {
|
||||
data, err := user.NewInstance()(getSession()(c).(*service.Session)).Info()
|
||||
data, err := user2.NewInstance()(getSession()(c).(*service.Session)).Info()
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ func (a *User) List(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := user.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Mobile, form.Status, form.Page, form.PageSize)
|
||||
data, err := user2.NewInstance()(getSession()(c).(*service.Session)).List(form.Name, form.Mobile, form.Status, form.Page, form.PageSize)
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ func (a *User) List(c *gin.Context) {
|
||||
* }
|
||||
*/
|
||||
func (a *User) Menu(c *gin.Context) {
|
||||
data, err := user.NewMenu()(getSession()(c).(*service.Session)).List()
|
||||
data, err := user2.NewMenu()(getSession()(c).(*service.Session)).List()
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ func (a *User) Add(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewInstance()(getSession()(c).(*service.Session)).Add(&user.InstanceForm{
|
||||
err := user2.NewInstance()(getSession()(c).(*service.Session)).Add(&user2.InstanceForm{
|
||||
Account: form.Account, Name: form.Name, Mobile: form.Mobile, Password: form.Password,
|
||||
Remark: form.Remark, Gender: form.Gender, Departments: form.Departments, Roles: form.Roles,
|
||||
})
|
||||
@ -118,7 +118,7 @@ func (a *User) Edit(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewInstance()(getSession()(c).(*service.Session)).Edit(&user.InstanceForm{
|
||||
err := user2.NewInstance()(getSession()(c).(*service.Session)).Edit(&user2.InstanceForm{
|
||||
ID: form.ID, Account: form.Account, Name: form.Name, Mobile: form.Mobile,
|
||||
Remark: form.Remark, Gender: form.Gender, Departments: form.Departments, Roles: form.Roles,
|
||||
})
|
||||
@ -158,7 +158,7 @@ func (a *User) QuickPassword(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewInstance()(getSession()(c).(*service.Session)).Password(form.ID, form.Password, form.RepeatPwd)
|
||||
err := user2.NewInstance()(getSession()(c).(*service.Session)).Password(form.ID, form.Password, form.RepeatPwd)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ func (a *User) EditPassword(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewPerson()(getSession()(c).(*service.Session)).EditPassword(form.OldPwd, form.Password, form.RepeatPwd)
|
||||
err := user2.NewPerson()(getSession()(c).(*service.Session)).EditPassword(form.OldPwd, form.Password, form.RepeatPwd)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ func (a *User) Delete(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewInstance()(getSession()(c).(*service.Session)).Delete(form.ID)
|
||||
err := user2.NewInstance()(getSession()(c).(*service.Session)).Delete(form.ID)
|
||||
APIResponse(err)(c)
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ func (a *User) Role(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := user.NewRole()(getSession()(c).(*service.Session)).List(form.Convert())
|
||||
data, err := user2.NewRole()(getSession()(c).(*service.Session)).List(form.Convert())
|
||||
APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -253,6 +253,6 @@ func (a *User) RoleBind(c *gin.Context) {
|
||||
APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewRole()(getSession()(c).(*service.Session)).Bind(form.Convert(), form.RoleIDs)
|
||||
err := user2.NewRole()(getSession()(c).(*service.Session)).Bind(form.Convert(), form.RoleIDs)
|
||||
APIResponse(err)(c)
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/handle"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/utils"
|
||||
@ -27,7 +27,7 @@ func (c *Account) Login(account, password, captchaKey, captchaValue, equipment,
|
||||
if pass, _ := handle.NewCaptcha().Validate(&handle.CaptchaImage{Key: captchaKey, Captcha: captchaValue}); !pass {
|
||||
return nil, errors.New("验证码错误")
|
||||
}
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
|
||||
isExist, err := mSysUser.GetByAccountOrMobile(account)
|
||||
|
||||
@ -47,7 +47,7 @@ func (c *Account) Login(account, password, captchaKey, captchaValue, equipment,
|
||||
// 非超级管理员
|
||||
if !session.IsAdmin {
|
||||
// 查询相应关系
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
|
||||
if isExist, err = model2.FirstField(mSysUserTenant.SysUserTenant, []string{"id", "tenant_id", "identity", "status"},
|
||||
model2.NewWhere("uid", mSysUser.UUID)); err != nil {
|
||||
@ -58,7 +58,7 @@ func (c *Account) Login(account, password, captchaKey, captchaValue, equipment,
|
||||
if mSysUserTenant.TenantID <= 0 {
|
||||
goto Complete
|
||||
}
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
mSysTenant.ID = mSysUserTenant.TenantID
|
||||
|
||||
level := 0
|
@ -1,8 +1,8 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/model"
|
||||
)
|
||||
|
||||
type (
|
@ -1,9 +1,9 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
)
|
||||
|
@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"time"
|
||||
)
|
@ -1,8 +1,8 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/tools/ip"
|
||||
)
|
@ -1,8 +1,8 @@
|
||||
package menu
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/model"
|
||||
)
|
||||
|
||||
type (
|
@ -1,9 +1,9 @@
|
||||
package menu
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"errors"
|
||||
"time"
|
@ -1,10 +1,10 @@
|
||||
package role
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
auth2 "SciencesServer/app/api/manage/controller/auth"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
auth2 "SciencesServer/app/manage/controller/auth"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/logger"
|
||||
"SciencesServer/serve/orm"
|
||||
@ -19,7 +19,7 @@ type AuthHandle func(session *service.Session) *Auth
|
||||
|
||||
// List 角色权限列表
|
||||
func (c *Auth) List(roleID uint64) ([]*auth2.TreeChecked, error) {
|
||||
mSysAuth := model.NewSysAuth()
|
||||
mSysAuth := model3.NewSysAuth()
|
||||
|
||||
out, err := mSysAuth.RoleAuth(c.TenantID, roleID)
|
||||
|
||||
@ -32,7 +32,7 @@ func (c *Auth) List(roleID uint64) ([]*auth2.TreeChecked, error) {
|
||||
// Bind 角色权限绑定
|
||||
func (c *Auth) Bind(roleID uint64, authIDs []uint64) error {
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
mSysRoleAuth := model.NewSysRoleAuth()
|
||||
mSysRoleAuth := model3.NewSysRoleAuth()
|
||||
|
||||
err := model2.DeleteWhere(mSysRoleAuth.SysRoleAuth, []*model2.ModelWhere{model2.NewWhere("role_id", roleID)}, tx)
|
||||
|
||||
@ -40,7 +40,7 @@ func (c *Auth) Bind(roleID uint64, authIDs []uint64) error {
|
||||
return err
|
||||
}
|
||||
// 查询权限信息
|
||||
mSysAuth := model.NewSysAuth()
|
||||
mSysAuth := model3.NewSysAuth()
|
||||
|
||||
auths := make([]*model2.SysAuth, 0)
|
||||
|
@ -1,9 +1,9 @@
|
||||
package role
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/logger"
|
||||
"SciencesServer/utils"
|
@ -1,10 +1,10 @@
|
||||
package role
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
menu2 "SciencesServer/app/api/manage/controller/menu"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
menu2 "SciencesServer/app/manage/controller/menu"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
@ -18,7 +18,7 @@ type MenuHandle func(session *service.Session) *Menu
|
||||
|
||||
// List 菜单列表
|
||||
func (c *Menu) List(roleID uint64) ([]*menu2.TreeChecked, error) {
|
||||
mSysMenu := model.NewSysMenu()
|
||||
mSysMenu := model3.NewSysMenu()
|
||||
return menu2.MenuForRole(mSysMenu, c.TenantID, roleID)
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func (c *Menu) Bind(roleID uint64, menuIDs []uint64) error {
|
||||
if len(menuIDs) > 0 {
|
||||
var count int64
|
||||
|
||||
mSysMenu := model.NewSysMenu()
|
||||
mSysMenu := model3.NewSysMenu()
|
||||
|
||||
if err := model2.Count(mSysMenu.SysMenu, &count, model2.NewWhereIn("id", menuIDs),
|
||||
model2.NewWhere("auth", model2.SysMenuAuthForSystem)); err != nil {
|
||||
@ -36,7 +36,7 @@ func (c *Menu) Bind(roleID uint64, menuIDs []uint64) error {
|
||||
return errors.New("不可设置超管菜单")
|
||||
}
|
||||
}
|
||||
mSysRoleMenu := model.NewSysRoleMenu()
|
||||
mSysRoleMenu := model3.NewSysRoleMenu()
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
err := model2.DeleteWhere(mSysRoleMenu.SysRoleMenu, []*model2.ModelWhere{model2.NewWhere("role_id", roleID)}, tx)
|
@ -1,11 +1,11 @@
|
||||
package role
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/serve/logger"
|
||||
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
@ -18,8 +18,8 @@ type User struct{ *controller.Platform }
|
||||
type UserHandle func(session *service.Session) *User
|
||||
|
||||
// List 列表信息
|
||||
func (c *User) List(uid uint64) ([]*model.SysRoleUserInfo, error) {
|
||||
mSysRole := model.NewSysRole()
|
||||
func (c *User) List(uid uint64) ([]*model3.SysRoleUserInfo, error) {
|
||||
mSysRole := model3.NewSysRole()
|
||||
|
||||
out, err := mSysRole.UserRole(uid)
|
||||
|
||||
@ -31,7 +31,7 @@ func (c *User) List(uid uint64) ([]*model.SysRoleUserInfo, error) {
|
||||
|
||||
// Bind 绑定角色
|
||||
func (c *User) Bind(uid uint64, roleIDs []uint64) error {
|
||||
mSysUserRole := model.NewSysUserRole()
|
||||
mSysUserRole := model3.NewSysUserRole()
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
err := model2.DeleteWhere(mSysUserRole.SysUserRole, []*model2.ModelWhere{model2.NewWhere("uid", uid)}, tx)
|
@ -1,9 +1,9 @@
|
||||
package tenant
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/logger"
|
||||
"SciencesServer/serve/orm"
|
||||
@ -19,7 +19,7 @@ type AuthHandle func(session *service.Session) *Auth
|
||||
|
||||
// delete 删除所有权限
|
||||
func (c *Auth) delete(tenantID uint64, tenantKey string, tx *gorm.DB) error {
|
||||
mSysRoleAuth := model.NewSysRoleAuth()
|
||||
mSysRoleAuth := model3.NewSysRoleAuth()
|
||||
|
||||
err := model2.DeleteWhere(mSysRoleAuth.SysRoleAuth, []*model2.ModelWhere{model2.NewWhere("tenant_id", tenantID)}, tx)
|
||||
|
||||
@ -41,7 +41,7 @@ func (c *Auth) delete(tenantID uint64, tenantKey string, tx *gorm.DB) error {
|
||||
// revoke 撤销某些权限
|
||||
func (c *Auth) revoke(tenantID uint64, tenantKey string, authIDs []uint64, tx *gorm.DB) error {
|
||||
// 查询该租户下不含有的权限信息
|
||||
mSysRuleAuth := model.NewSysRoleAuth()
|
||||
mSysRuleAuth := model3.NewSysRoleAuth()
|
||||
|
||||
out, err := mSysRuleAuth.Auths(model2.NewWhere("r.tenant_id", tenantID), model2.NewWhereNotIn("r_a.auth_id", authIDs))
|
||||
|
||||
@ -76,7 +76,7 @@ func (c *Auth) revoke(tenantID uint64, tenantKey string, authIDs []uint64, tx *g
|
||||
|
||||
// Bind 绑定权限
|
||||
func (c *Auth) Bind(tenantID uint64, authIDs []uint64) error {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
mSysTenant.ID = tenantID
|
||||
|
||||
isExist, err := model2.FirstField(mSysTenant.SysTenant, []string{"id", "key"})
|
||||
@ -87,7 +87,7 @@ func (c *Auth) Bind(tenantID uint64, authIDs []uint64) error {
|
||||
return errors.New("租户/公司信息不存在或已被删除")
|
||||
}
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
mSysTenantAuth := model.NewSysTenantAuth()
|
||||
mSysTenantAuth := model3.NewSysTenantAuth()
|
||||
|
||||
if err = model2.DeleteWhere(mSysTenantAuth.SysTenantAuth, []*model2.ModelWhere{model2.NewWhere("tenant_id", mSysTenant.ID)}, tx); err != nil {
|
||||
return err
|
@ -1,11 +1,11 @@
|
||||
package tenant
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
auth2 "SciencesServer/app/api/manage/controller/auth"
|
||||
menu2 "SciencesServer/app/api/manage/controller/menu"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
auth2 "SciencesServer/app/manage/controller/auth"
|
||||
menu2 "SciencesServer/app/manage/controller/menu"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/serve/orm"
|
||||
@ -23,7 +23,7 @@ type InstanceHandle func(session *service.Session) *Instance
|
||||
type (
|
||||
// InstanceInfo 租户信息
|
||||
InstanceInfo struct {
|
||||
*model.SysTenantInfo
|
||||
*model3.SysTenantInfo
|
||||
}
|
||||
// InstanceParams 租户参数信息
|
||||
InstanceParams struct {
|
||||
@ -59,7 +59,7 @@ var instanceDetailGetHandle = map[InstanceDetailType]func(id uint64) func(args .
|
||||
// basic 基本信息
|
||||
func basic(id uint64) func(args ...interface{}) (interface{}, error) {
|
||||
return func(args ...interface{}) (interface{}, error) {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
mSysTenant.ID = id
|
||||
isExist, err := model2.FirstWhere(mSysTenant.SysTenant)
|
||||
|
||||
@ -68,7 +68,7 @@ func basic(id uint64) func(args ...interface{}) (interface{}, error) {
|
||||
} else if !isExist {
|
||||
return nil, errors.New("信息不存在")
|
||||
}
|
||||
return &InstanceInfo{SysTenantInfo: &model.SysTenantInfo{
|
||||
return &InstanceInfo{SysTenantInfo: &model3.SysTenantInfo{
|
||||
SysTenant: mSysTenant.SysTenant,
|
||||
}}, nil
|
||||
}
|
||||
@ -77,7 +77,7 @@ func basic(id uint64) func(args ...interface{}) (interface{}, error) {
|
||||
// member 人员信息
|
||||
func member(id uint64) func(args ...interface{}) (interface{}, error) {
|
||||
return func(args ...interface{}) (interface{}, error) {
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
|
||||
page := args[0].(int)
|
||||
pageSize := args[1].(int)
|
||||
@ -104,16 +104,16 @@ func member(id uint64) func(args ...interface{}) (interface{}, error) {
|
||||
// auth 权限信息
|
||||
func auth(id uint64) func(args ...interface{}) (interface{}, error) {
|
||||
return func(args ...interface{}) (interface{}, error) {
|
||||
mSysMenu := model.NewSysMenu()
|
||||
mSysMenu := model3.NewSysMenu()
|
||||
|
||||
_menu, err := mSysMenu.TenantMenu(id)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mSysAuth := model.NewSysAuth()
|
||||
mSysAuth := model3.NewSysAuth()
|
||||
|
||||
_auth := make([]*model.SysAuthScene, 0)
|
||||
_auth := make([]*model3.SysAuthScene, 0)
|
||||
|
||||
if _auth, err = mSysAuth.TenantAuth(id); err != nil {
|
||||
return nil, err
|
||||
@ -129,7 +129,7 @@ func (c *Instance) validateForCustomerCount(tenantID uint64, sysValue, srcValue
|
||||
if srcValue > sysValue {
|
||||
return true, nil
|
||||
}
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
|
||||
var count int64
|
||||
|
||||
@ -141,7 +141,7 @@ func (c *Instance) validateForCustomerCount(tenantID uint64, sysValue, srcValue
|
||||
|
||||
// List 列表信息
|
||||
func (c *Instance) List(name string, status, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
|
||||
var count int64
|
||||
|
||||
@ -170,7 +170,7 @@ func (c *Instance) List(name string, status, page, pageSize int) (*controller.Re
|
||||
|
||||
// Add 数据处理
|
||||
func (c *Instance) Add(params *InstanceParams) error {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
|
||||
if params.Password != params.RepeatPwd {
|
||||
return errors.New("密码不一致")
|
||||
@ -182,7 +182,7 @@ func (c *Instance) Add(params *InstanceParams) error {
|
||||
} else if isExist {
|
||||
return errors.New("该租户/公司名称已存在")
|
||||
}
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
|
||||
if isExist, err = model2.FirstWhere(mSysUser.SysUser, model2.NewWhere("account", params.Account)); err != nil {
|
||||
return err
|
||||
@ -204,7 +204,7 @@ func (c *Instance) Add(params *InstanceParams) error {
|
||||
if err = model2.Create(mSysUser.SysUser, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
mSysUserTenant.TenantID = mSysTenant.ID
|
||||
mSysUserTenant.UID = mSysUser.UUID
|
||||
mSysUserTenant.Identity = model2.SysUserTenantIdentityForSystemAdmin
|
||||
@ -222,7 +222,7 @@ func (c *Instance) Add(params *InstanceParams) error {
|
||||
|
||||
// Edit 修改信息
|
||||
func (c *Instance) Edit(params *InstanceParams) error {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
mSysTenant.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstWhere(mSysTenant.SysTenant)
|
||||
@ -255,7 +255,7 @@ func (c *Instance) Edit(params *InstanceParams) error {
|
||||
|
||||
// EditPassword 修改信息
|
||||
func (c *Instance) EditPassword(params *InstanceParams) error {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
mSysTenant.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstWhere(mSysTenant.SysTenant)
|
||||
@ -275,7 +275,7 @@ func (c *Instance) EditPassword(params *InstanceParams) error {
|
||||
return errors.New("密码不一致")
|
||||
}
|
||||
// 查询该租户下管理员信息
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
|
||||
if isExist, err = model2.FirstField(mSysUserTenant.SysUserTenant, []string{"id", "uid", "identity"},
|
||||
model2.NewWhere("tenant_id", params.ID), model2.NewWhere("identity", model2.SysUserTenantIdentityForSystemAdmin)); err != nil {
|
||||
@ -283,7 +283,7 @@ func (c *Instance) EditPassword(params *InstanceParams) error {
|
||||
} else if !isExist {
|
||||
return errors.New("该租户/公司下管理员信息不存在或已被删除")
|
||||
}
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
mSysUser.Password = params.Password
|
||||
mSysUser.Pass()
|
||||
|
||||
@ -312,7 +312,7 @@ func (c *Instance) Detail(id uint64, tType InstanceDetailType, page, pageSize in
|
||||
|
||||
// Renewal 续期操作
|
||||
func (c *Instance) Renewal(id uint64, deadline string) error {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
mSysTenant.ID = id
|
||||
|
||||
isExist, err := model2.FirstWhere(mSysTenant.SysTenant)
|
||||
@ -341,7 +341,7 @@ func (c *Instance) Renewal(id uint64, deadline string) error {
|
||||
|
||||
// StartUp 启用处理
|
||||
func (c *Instance) StartUp(id uint64) error {
|
||||
mSysTenant := model.NewSysTenant()
|
||||
mSysTenant := model3.NewSysTenant()
|
||||
mSysTenant.ID = id
|
||||
|
||||
isExist, err := model2.FirstWhere(mSysTenant.SysTenant)
|
||||
@ -395,7 +395,7 @@ func (c *Instance) Disable(id uint64) error {
|
||||
|
||||
// MemberBind 人员绑定/解绑
|
||||
func (c *Instance) MemberBind(id uint64, status int) error {
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
mSysUserTenant.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mSysUserTenant.SysUserTenant, []string{"id", "tenant_id", "identity"})
|
@ -1,10 +1,10 @@
|
||||
package tenant
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
menu2 "SciencesServer/app/api/manage/controller/menu"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
menu2 "SciencesServer/app/manage/controller/menu"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
@ -18,7 +18,7 @@ type MenuHandle func(session *service.Session) *Menu
|
||||
|
||||
// List 菜单列表
|
||||
func (c *Menu) List(tenantID uint64) ([]*menu2.TreeChecked, error) {
|
||||
mSysMenu := model.NewSysMenu()
|
||||
mSysMenu := model3.NewSysMenu()
|
||||
return menu2.MenuForTenant(mSysMenu, tenantID)
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func (c *Menu) Bind(tenantID uint64, menuIDs []uint64) error {
|
||||
if len(menuIDs) > 0 {
|
||||
var count int64
|
||||
|
||||
mSysMenu := model.NewSysMenu()
|
||||
mSysMenu := model3.NewSysMenu()
|
||||
|
||||
if err := model2.Count(mSysMenu.SysMenu, &count, model2.NewWhereIn("id", menuIDs),
|
||||
model2.NewWhere("auth", model2.SysMenuAuthForSystem)); err != nil {
|
||||
@ -36,7 +36,7 @@ func (c *Menu) Bind(tenantID uint64, menuIDs []uint64) error {
|
||||
return errors.New("不可设置超管菜单")
|
||||
}
|
||||
}
|
||||
mSysTenantMenu := model.NewSysTenantMenu()
|
||||
mSysTenantMenu := model3.NewSysTenantMenu()
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// TODO:先全部删除,后期考虑局部删除
|
||||
@ -46,7 +46,7 @@ func (c *Menu) Bind(tenantID uint64, menuIDs []uint64) error {
|
||||
return err
|
||||
}
|
||||
// 租户角色的菜单
|
||||
mSysRoleMenu := model.NewSysRoleMenu()
|
||||
mSysRoleMenu := model3.NewSysRoleMenu()
|
||||
|
||||
if len(menuIDs) <= 0 {
|
||||
if err = model2.DeleteWhere(mSysRoleMenu.SysRoleMenu, []*model2.ModelWhere{model2.NewWhere("tenant_id", tenantID)}, tx); err != nil {
|
@ -1,9 +1,9 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
@ -29,7 +29,7 @@ type (
|
||||
}
|
||||
// InstanceUserInfo 用户信息
|
||||
InstanceUserInfo struct {
|
||||
*model.SysUserTenantUser
|
||||
*model3.SysUserTenantUser
|
||||
UID string `json:"uid"`
|
||||
}
|
||||
)
|
||||
@ -44,7 +44,7 @@ type InstanceForm struct {
|
||||
|
||||
// Info 用户信息
|
||||
func (c *Instance) Info() (*InstanceInfo, error) {
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
|
||||
_, err := model2.FirstWhere(mSysUser.SysUser, model2.NewWhere("uuid", c.UID))
|
||||
|
||||
@ -58,7 +58,7 @@ func (c *Instance) Info() (*InstanceInfo, error) {
|
||||
|
||||
// List 列表信息
|
||||
func (c *Instance) List(name, mobile string, status, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
|
||||
where := []*model2.ModelWhere{model2.NewWhere("u_t.tenant_id", c.TenantID)}
|
||||
|
||||
@ -91,7 +91,7 @@ func (c *Instance) Add(params *InstanceForm) error {
|
||||
if utils.ValidateMobile(params.Mobile) {
|
||||
return errors.New("手机号码格式错误")
|
||||
}
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
// 查询登录账户或手机号码是否注册
|
||||
var count int64
|
||||
|
||||
@ -114,7 +114,7 @@ func (c *Instance) Add(params *InstanceForm) error {
|
||||
if err = model2.Create(mSysUser.SysUser, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
mSysUserTenant.TenantID = c.TenantID
|
||||
mSysUserTenant.UID = mSysUser.UUID
|
||||
if len(params.Departments) > 0 {
|
||||
@ -137,7 +137,7 @@ func (c *Instance) Edit(params *InstanceForm) error {
|
||||
if utils.ValidateMobile(params.Mobile) {
|
||||
return errors.New("手机号码格式错误")
|
||||
}
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
mSysUserTenant.ID = params.ID
|
||||
|
||||
isExist, err := model2.FirstField(mSysUserTenant.SysUserTenant, []string{"id", "tenant_id", "identity"})
|
||||
@ -150,7 +150,7 @@ func (c *Instance) Edit(params *InstanceForm) error {
|
||||
return errors.New("不可修改他人用户信息")
|
||||
}
|
||||
// 查询用户信息
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
|
||||
if isExist, err = model2.FirstWhere(mSysUser.SysUser, model2.NewWhere("uuid", mSysUserTenant.UID)); err != nil {
|
||||
return err
|
||||
@ -188,7 +188,7 @@ func (c *Instance) Password(id uint64, password, repeatPwd string) error {
|
||||
if password != repeatPwd {
|
||||
return errors.New("两次密码不一致")
|
||||
}
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
mSysUserTenant.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mSysUserTenant.SysUserTenant, []string{"id", "tenant_id", "identity"})
|
||||
@ -200,7 +200,7 @@ func (c *Instance) Password(id uint64, password, repeatPwd string) error {
|
||||
} else if mSysUserTenant.TenantID != c.TenantID {
|
||||
return errors.New("不可修改他人用户密码")
|
||||
}
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
mSysUser.Password = password
|
||||
mSysUser.Pass()
|
||||
|
||||
@ -215,7 +215,7 @@ func (c *Instance) Password(id uint64, password, repeatPwd string) error {
|
||||
}
|
||||
|
||||
func (c *Instance) Delete(id uint64) error {
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
mSysUserTenant.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mSysUserTenant.SysUserTenant, []string{"id", "tenant_id", "identity"})
|
||||
@ -231,7 +231,7 @@ func (c *Instance) Delete(id uint64) error {
|
||||
if err = model2.Delete(mSysUserTenant.SysUserTenant, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mSysUser := model.NewSysUser()
|
||||
mSysUser := model3.NewSysUser()
|
||||
|
||||
if err = model2.DeleteWhere(mSysUser.SysUser, []*model2.ModelWhere{
|
||||
model2.NewWhere("uuid", mSysUserTenant.UID),
|
@ -1,10 +1,10 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
menu2 "SciencesServer/app/api/manage/controller/menu"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
menu2 "SciencesServer/app/manage/controller/menu"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
)
|
||||
|
||||
@ -14,12 +14,12 @@ type MenuHandle func(session *service.Session) *Menu
|
||||
|
||||
// List 菜单列表
|
||||
func (c *Menu) List() (interface{}, error) {
|
||||
mSysMenu := model.NewSysMenu()
|
||||
mSysMenu := model3.NewSysMenu()
|
||||
|
||||
if c.IsAdmin {
|
||||
return menu2.MenuForSystem(mSysMenu)
|
||||
}
|
||||
mSysUserTenant := model.NewSysUserTenant()
|
||||
mSysUserTenant := model3.NewSysUserTenant()
|
||||
|
||||
if isExist, err := model2.FirstField(mSysUserTenant.SysUserTenant, []string{"id", "identity"},
|
||||
model2.NewWhere("tenant_id", c.TenantID), model2.NewWhere("uid", c.UID)); err != nil {
|
@ -1,8 +1,8 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"errors"
|
||||
"time"
|
@ -1,11 +1,11 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/manage/controller"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/manage/controller"
|
||||
"SciencesServer/serve/logger"
|
||||
|
||||
"SciencesServer/app/manage/model"
|
||||
"SciencesServer/app/service"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
@ -18,8 +18,8 @@ type Role struct{ *controller.Platform }
|
||||
type RoleHandle func(session *service.Session) *Role
|
||||
|
||||
// List 列表信息
|
||||
func (c *Role) List(uid uint64) ([]*model.SysRoleUserInfo, error) {
|
||||
mSysRole := model.NewSysRole()
|
||||
func (c *Role) List(uid uint64) ([]*model3.SysRoleUserInfo, error) {
|
||||
mSysRole := model3.NewSysRole()
|
||||
|
||||
out, err := mSysRole.UserRole(uid)
|
||||
|
||||
@ -31,7 +31,7 @@ func (c *Role) List(uid uint64) ([]*model.SysRoleUserInfo, error) {
|
||||
|
||||
// Bind 绑定角色
|
||||
func (c *Role) Bind(uid uint64, roleIDs []uint64) error {
|
||||
mSysUserRole := model.NewSysUserRole()
|
||||
mSysUserRole := model3.NewSysUserRole()
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
err := model2.DeleteWhere(mSysUserRole.SysUserRole, []*model2.ModelWhere{model2.NewWhere("uid", uid)}, tx)
|
@ -1,9 +1,8 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
api3 "SciencesServer/app/enterprise/api"
|
||||
api2 "SciencesServer/app/manage/api"
|
||||
|
||||
api2 "SciencesServer/app/api/enterprise/api"
|
||||
"SciencesServer/app/api/manage/api"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@ -24,20 +23,20 @@ func registerAPI(app *gin.Engine) {
|
||||
// apiPrefix + "/account/logout",
|
||||
//}...)))
|
||||
// Captcha 验证码
|
||||
g.GET("/captcha", new(api2.Captcha).Captcha)
|
||||
g.GET("/captcha", new(api.Captcha).Captcha)
|
||||
// Upload 上传管理
|
||||
g.POST("/upload", new(api2.Upload).Upload)
|
||||
g.POST("/upload", new(api.Upload).Upload)
|
||||
// Account 账户管理
|
||||
account := g.Group("/account")
|
||||
{
|
||||
_api := new(api2.Account)
|
||||
_api := new(api.Account)
|
||||
account.POST("/login", _api.Login)
|
||||
account.POST("/logout", _api.Logout)
|
||||
}
|
||||
// User 用户管理
|
||||
user := g.Group("/user")
|
||||
{
|
||||
_api := new(api2.User)
|
||||
_api := new(api.User)
|
||||
user.GET("/info", _api.Info)
|
||||
user.GET("/menu", _api.Menu)
|
||||
user.POST("/list", _api.List)
|
||||
@ -52,7 +51,7 @@ func registerAPI(app *gin.Engine) {
|
||||
// Tenant 租户管理
|
||||
tenant := g.Group("/tenant")
|
||||
{
|
||||
_api := new(api2.Tenant)
|
||||
_api := new(api.Tenant)
|
||||
tenant.POST("/list", _api.List)
|
||||
tenant.POST("/add", _api.Add)
|
||||
tenant.POST("/edit", _api.Edit)
|
||||
@ -69,7 +68,7 @@ func registerAPI(app *gin.Engine) {
|
||||
// Menu 菜单管理
|
||||
menu := g.Group("/menu")
|
||||
{
|
||||
_api := new(api2.Menu)
|
||||
_api := new(api.Menu)
|
||||
menu.GET("/list", _api.List)
|
||||
menu.POST("/add", _api.Add)
|
||||
menu.POST("/edit", _api.Edit)
|
||||
@ -79,13 +78,13 @@ func registerAPI(app *gin.Engine) {
|
||||
// Auth 权限管理
|
||||
auth := g.Group("/auth")
|
||||
{
|
||||
_api := new(api2.Auth)
|
||||
_api := new(api.Auth)
|
||||
auth.POST("/list", _api.List)
|
||||
}
|
||||
// Department 部门管理
|
||||
department := g.Group("/department")
|
||||
{
|
||||
_api := new(api2.Department)
|
||||
_api := new(api.Department)
|
||||
department.GET("/list", _api.List)
|
||||
department.GET("/select", _api.Select)
|
||||
department.POST("/add", _api.Add)
|
||||
@ -95,7 +94,7 @@ func registerAPI(app *gin.Engine) {
|
||||
// Role 角色管理
|
||||
role := g.Group("/role")
|
||||
{
|
||||
_api := new(api2.Role)
|
||||
_api := new(api.Role)
|
||||
role.POST("/list", _api.List)
|
||||
role.POST("/select", _api.Select)
|
||||
role.POST("/add", _api.Add)
|
||||
@ -110,7 +109,7 @@ func registerAPI(app *gin.Engine) {
|
||||
// Logs 日志管理
|
||||
log := g.Group("/log")
|
||||
{
|
||||
_api := new(api2.Log)
|
||||
_api := new(api.Log)
|
||||
log.POST("/login", _api.Login)
|
||||
}
|
||||
}
|
||||
@ -122,13 +121,13 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
// Config 配置管理
|
||||
config := g.Group("/config")
|
||||
{
|
||||
_api := new(api3.Config)
|
||||
_api := new(api2.Config)
|
||||
config.GET("/area", _api.Area)
|
||||
}
|
||||
// Technology 技术管理
|
||||
technology := g.Group("/technology")
|
||||
{
|
||||
_api := new(api3.Technology)
|
||||
_api := new(api2.Technology)
|
||||
technology.POST("/paper", _api.Paper)
|
||||
technology.POST("/paper/add", _api.PaperAdd)
|
||||
technology.POST("/paper/edit", _api.PaperEdit)
|
||||
|
Reference in New Issue
Block a user