feat:注释不用的代码
This commit is contained in:
@ -119,7 +119,7 @@ func (c *Demand) Form(params *DemandParams) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,数据不存在")
|
return errors.New("操作错误,数据不存在")
|
||||||
} else if mTechnologyDemand.UID != c.ManageUID {
|
} else if mTechnologyDemand.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
} else if mTechnologyDemand.Status != model2.TechnologyDemandStatusForRefuse &&
|
} else if mTechnologyDemand.Status != model2.TechnologyDemandStatusForRefuse &&
|
||||||
mTechnologyDemand.Status != model2.TechnologyDemandStatusForDraft {
|
mTechnologyDemand.Status != model2.TechnologyDemandStatusForDraft {
|
||||||
@ -156,7 +156,7 @@ func (c *Demand) Form(params *DemandParams) error {
|
|||||||
return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand)
|
return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand)
|
||||||
}
|
}
|
||||||
mTechnologyDemand.TenantID = c.TenantID
|
mTechnologyDemand.TenantID = c.TenantID
|
||||||
mTechnologyDemand.UID = c.ManageUID
|
mTechnologyDemand.MUid = c.ManageUID
|
||||||
mTechnologyDemand.Local.Local = c.local
|
mTechnologyDemand.Local.Local = c.local
|
||||||
return model2.Create(mTechnologyDemand.TechnologyDemand)
|
return model2.Create(mTechnologyDemand.TechnologyDemand)
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ func (c *Demand) Delete(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,数据不存在")
|
return errors.New("操作错误,数据不存在")
|
||||||
} else if mTechnologyDemand.UID != c.ManageUID {
|
} else if mTechnologyDemand.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
if err = model2.Delete(mTechnologyDemand.TechnologyDemand); err != nil {
|
if err = model2.Delete(mTechnologyDemand.TechnologyDemand); err != nil {
|
||||||
|
@ -73,7 +73,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("信息不存在")
|
return errors.New("信息不存在")
|
||||||
} else if c.ManageUID != mTechnologyInstance.UID {
|
} else if c.ManageUID != mTechnologyInstance.MUid {
|
||||||
return errors.New("操作错误,无权限操作")
|
return errors.New("操作错误,无权限操作")
|
||||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft &&
|
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForDraft &&
|
||||||
mTechnologyInstance.Status != model2.TechnologyInstanceStatusForRefuse {
|
mTechnologyInstance.Status != model2.TechnologyInstanceStatusForRefuse {
|
||||||
@ -105,7 +105,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
|||||||
mTechnologyInstance.UpdatedAt = time.Now()
|
mTechnologyInstance.UpdatedAt = time.Now()
|
||||||
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
||||||
}
|
}
|
||||||
mTechnologyInstance.UID = c.ManageUID
|
mTechnologyInstance.MUid = c.ManageUID
|
||||||
mTechnologyInstance.Local.Local = c.local
|
mTechnologyInstance.Local.Local = c.local
|
||||||
mTechnologyInstance.TenantID = c.TenantID
|
mTechnologyInstance.TenantID = c.TenantID
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ func (c *Instance) Shelf(id uint64, status int) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("信息不存在")
|
return errors.New("信息不存在")
|
||||||
} else if c.ManageUID != mTechnologyInstance.UID {
|
} else if c.ManageUID != mTechnologyInstance.MUid {
|
||||||
return errors.New("操作错误,无权限操作")
|
return errors.New("操作错误,无权限操作")
|
||||||
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
} else if mTechnologyInstance.Status != model2.TechnologyInstanceStatusForAgree {
|
||||||
return errors.New("操作错误,当前状态不允许处理上下架")
|
return errors.New("操作错误,当前状态不允许处理上下架")
|
||||||
@ -147,7 +147,7 @@ func (c *Instance) Delete(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("信息不存在")
|
return errors.New("信息不存在")
|
||||||
} else if c.ManageUID != mTechnologyInstance.UID {
|
} else if c.ManageUID != mTechnologyInstance.MUid {
|
||||||
return errors.New("操作错误,无权限操作")
|
return errors.New("操作错误,无权限操作")
|
||||||
}
|
}
|
||||||
if err = model2.Delete(mTechnologyInstance.TechnologyInstance); err != nil {
|
if err = model2.Delete(mTechnologyInstance.TechnologyInstance); err != nil {
|
||||||
|
@ -70,7 +70,7 @@ func (c *Paper) Form(params *PaperParams) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("当前论文信息不存在")
|
return errors.New("当前论文信息不存在")
|
||||||
} else if mTechnologyPaper.UID != c.ManageUID {
|
} else if mTechnologyPaper.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ func (c *Paper) Form(params *PaperParams) error {
|
|||||||
|
|
||||||
if params.ID <= 0 {
|
if params.ID <= 0 {
|
||||||
mTechnologyPaper.TenantID = c.TenantID
|
mTechnologyPaper.TenantID = c.TenantID
|
||||||
mTechnologyPaper.UID = c.ManageUID
|
mTechnologyPaper.MUid = c.ManageUID
|
||||||
mTechnologyPaper.Local.Local = c.local
|
mTechnologyPaper.Local.Local = c.local
|
||||||
return model2.Create(mTechnologyPaper.TechnologyPaper)
|
return model2.Create(mTechnologyPaper.TechnologyPaper)
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ func (c *Patent) Form(params *PatentParams) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,专利信息不存在")
|
return errors.New("操作错误,专利信息不存在")
|
||||||
} else if mTechnologyPatent.UID != c.ManageUID {
|
} else if mTechnologyPatent.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (c *Patent) Form(params *PatentParams) error {
|
|||||||
}
|
}
|
||||||
mTechnologyPatent.TenantID = c.TenantID
|
mTechnologyPatent.TenantID = c.TenantID
|
||||||
mTechnologyPatent.Local.Local = c.local
|
mTechnologyPatent.Local.Local = c.local
|
||||||
mTechnologyPatent.UID = c.ManageUID
|
mTechnologyPatent.MUid = c.ManageUID
|
||||||
return model2.Create(mTechnologyPatent.TechnologyPatent)
|
return model2.Create(mTechnologyPatent.TechnologyPatent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ func (c *Patent) Delete(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,专利信息不存在")
|
return errors.New("操作错误,专利信息不存在")
|
||||||
} else if mTechnologyPatent.UID != c.ManageUID {
|
} else if mTechnologyPatent.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
return model2.Delete(mTechnologyPatent.TechnologyPatent)
|
return model2.Delete(mTechnologyPatent.TechnologyPatent)
|
||||||
|
@ -100,7 +100,7 @@ func (c *Topic) Form(params *TopicParams) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,课题信息不存在")
|
return errors.New("操作错误,课题信息不存在")
|
||||||
} else if mTechnologyTopic.UID != c.ManageUID {
|
} else if mTechnologyTopic.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
} else if mTechnologyTopic.Status != model2.TechnologyTopicStatusForDraft &&
|
} else if mTechnologyTopic.Status != model2.TechnologyTopicStatusForDraft &&
|
||||||
mTechnologyTopic.Status != model2.TechnologyTopicStatusForRefuse {
|
mTechnologyTopic.Status != model2.TechnologyTopicStatusForRefuse {
|
||||||
@ -124,7 +124,7 @@ func (c *Topic) Form(params *TopicParams) error {
|
|||||||
}
|
}
|
||||||
mTechnologyTopic.TenantID = c.TenantID
|
mTechnologyTopic.TenantID = c.TenantID
|
||||||
mTechnologyTopic.Local.Local = c.local
|
mTechnologyTopic.Local.Local = c.local
|
||||||
mTechnologyTopic.UID = c.ManageUID
|
mTechnologyTopic.MUid = c.ManageUID
|
||||||
return model2.Create(mTechnologyTopic.TechnologyTopic)
|
return model2.Create(mTechnologyTopic.TechnologyTopic)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ func (c *Topic) Delete(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,课题信息不存在")
|
return errors.New("操作错误,课题信息不存在")
|
||||||
} else if mTechnologyTopic.UID != c.ManageUID {
|
} else if mTechnologyTopic.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
return model2.Delete(mTechnologyTopic.TechnologyTopic)
|
return model2.Delete(mTechnologyTopic.TechnologyTopic)
|
||||||
|
@ -84,7 +84,7 @@ func (c *Bank) Bind(params *BankParams, captcha string) error {
|
|||||||
} else if count > 0 {
|
} else if count > 0 {
|
||||||
return errors.New("当前银行卡已被注册")
|
return errors.New("当前银行卡已被注册")
|
||||||
}
|
}
|
||||||
mUserManageBank.UID = c.ManageUID
|
mUserManageBank.MUid = c.ManageUID
|
||||||
mUserManageBank.Name = params.Name
|
mUserManageBank.Name = params.Name
|
||||||
mUserManageBank.IDCard = params.IDCard
|
mUserManageBank.IDCard = params.IDCard
|
||||||
mUserManageBank.BankCard = params.BankCard
|
mUserManageBank.BankCard = params.BankCard
|
||||||
@ -109,7 +109,7 @@ func (c *Bank) Unbind(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
} else if !isExist {
|
} else if !isExist {
|
||||||
return errors.New("操作错误,绑定信息不存在")
|
return errors.New("操作错误,绑定信息不存在")
|
||||||
} else if mUserManageBank.UID != c.ManageUID {
|
} else if mUserManageBank.MUid != c.ManageUID {
|
||||||
return errors.New("无权限操作")
|
return errors.New("无权限操作")
|
||||||
}
|
}
|
||||||
return model2.Delete(mUserManageBank)
|
return model2.Delete(mUserManageBank)
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
model3 "SciencesServer/app/api/manage/model"
|
model3 "SciencesServer/app/api/manage/model"
|
||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/app/service"
|
"SciencesServer/app/service"
|
||||||
"SciencesServer/serve/logger"
|
|
||||||
"SciencesServer/serve/orm"
|
"SciencesServer/serve/orm"
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
|
|
||||||
@ -64,18 +63,18 @@ func (c *Auth) Bind(roleID uint64, authIDs []uint64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go utils.TryCatch(func() {
|
go utils.TryCatch(func() {
|
||||||
permission := service.NewPermission([]string{utils.UintToString(roleID)}, authRequests...)(c.TenantKey, "")
|
//permission := service.NewPermission([]string{utils.UintToString(roleID)}, authRequests...)(c.TenantKey, "")
|
||||||
// 删除角色权限
|
//// 删除角色权限
|
||||||
if _, err = permission.RemoveRolePolicy(); err != nil {
|
//if _, err = permission.RemoveRolePolicy(); err != nil {
|
||||||
logger.ErrorF("删除角色【%d】规则信息错误:%v", roleID, err)
|
// logger.ErrorF("删除角色【%d】规则信息错误:%v", roleID, err)
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
if len(authRequests) > 0 {
|
//if len(authRequests) > 0 {
|
||||||
if _, err = permission.AddPolicies(); err != nil {
|
// if _, err = permission.AddPolicies(); err != nil {
|
||||||
logger.ErrorF("创建角色【%d】规则信息错误:%v", roleID, err)
|
// logger.ErrorF("创建角色【%d】规则信息错误:%v", roleID, err)
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"SciencesServer/app/api/manage/model"
|
"SciencesServer/app/api/manage/model"
|
||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/app/service"
|
"SciencesServer/app/service"
|
||||||
"SciencesServer/serve/logger"
|
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
@ -157,12 +156,12 @@ func (c *Instance) Delete(id uint64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go utils.TryCatch(func() {
|
go utils.TryCatch(func() {
|
||||||
permission := service.NewPermission([]string{utils.UintToString(id)})(c.TenantKey, "")
|
//permission := service.NewPermission([]string{utils.UintToString(id)})(c.TenantKey, "")
|
||||||
// 删除角色权限
|
//// 删除角色权限
|
||||||
if _, err = permission.RemoveRolePolicy(); err != nil {
|
//if _, err = permission.RemoveRolePolicy(); err != nil {
|
||||||
logger.ErrorF("删除租户【%s】下角色【%d】权限信息错误:%v", c.TenantKey, id, err)
|
// logger.ErrorF("删除租户【%s】下角色【%d】权限信息错误:%v", c.TenantKey, id, err)
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"SciencesServer/app/api/manage/controller"
|
"SciencesServer/app/api/manage/controller"
|
||||||
model3 "SciencesServer/app/api/manage/model"
|
model3 "SciencesServer/app/api/manage/model"
|
||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/serve/logger"
|
|
||||||
|
|
||||||
"SciencesServer/app/service"
|
"SciencesServer/app/service"
|
||||||
"SciencesServer/serve/orm"
|
"SciencesServer/serve/orm"
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
@ -59,16 +57,16 @@ func (c *User) Bind(uid uint64, roleIDs []uint64) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go utils.TryCatch(func() {
|
go utils.TryCatch(func() {
|
||||||
permission := service.NewPermission(obj)(c.TenantKey, utils.UintToString(uid))
|
//permission := service.NewPermission(obj)(c.TenantKey, utils.UintToString(uid))
|
||||||
|
//
|
||||||
if _, err = permission.DeleteRolesForUser(false); err != nil {
|
//if _, err = permission.DeleteRolesForUser(false); err != nil {
|
||||||
logger.ErrorF("删除用户【%d】角色权限错误:%v", uid, err)
|
// logger.ErrorF("删除用户【%d】角色权限错误:%v", uid, err)
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
if _, err = permission.AddRoleForUser(); err != nil {
|
//if _, err = permission.AddRoleForUser(); err != nil {
|
||||||
logger.ErrorF("添加用户【%d】角色权限错误:%v", uid, err)
|
// logger.ErrorF("添加用户【%d】角色权限错误:%v", uid, err)
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -64,12 +64,12 @@ func (c *Auth) revoke(tenantID uint64, tenantKey string, authIDs []uint64, tx *g
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go utils.TryCatch(func() {
|
go utils.TryCatch(func() {
|
||||||
permission := service.NewPermission(roleIDs, auths...)(c.TenantKey, "")
|
//permission := service.NewPermission(roleIDs, auths...)(c.TenantKey, "")
|
||||||
// 删除角色权限
|
//// 删除角色权限
|
||||||
if _, err = permission.RemoveNamedGroupingPolicies(); err != nil {
|
//if _, err = permission.RemoveNamedGroupingPolicies(); err != nil {
|
||||||
logger.ErrorF("删除租户【%s】下角色权限错误:%v", tenantKey, err)
|
// logger.ErrorF("删除租户【%s】下角色权限错误:%v", tenantKey, err)
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ type TechnologyDemand struct {
|
|||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
Local
|
Local
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||||
Title string `gorm:"column:title;type:varchar(50);default:null;comment:需求名称" json:"title"`
|
Title string `gorm:"column:title;type:varchar(50);default:null;comment:需求名称" json:"title"`
|
||||||
Kind string `gorm:"column:kind;type:varchar(50);default:null;comment:需求类别" json:"-"`
|
Kind string `gorm:"column:kind;type:varchar(50);default:null;comment:需求类别" json:"-"`
|
||||||
Area
|
Area
|
||||||
|
@ -7,7 +7,7 @@ type TechnologyInstance struct {
|
|||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
Local
|
Local
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||||
PatentID uint64 `gorm:"column:patent_id;type:int;default:0;comment:代表专利" json:"patent_id"`
|
PatentID uint64 `gorm:"column:patent_id;type:int;default:0;comment:代表专利" json:"patent_id"`
|
||||||
Title string `gorm:"column:title;type:varchar(30);default:null;comment:名称" json:"title"`
|
Title string `gorm:"column:title;type:varchar(30);default:null;comment:名称" json:"title"`
|
||||||
Company string `gorm:"column:company;type:varchar(30);default:null;comment:单位" json:"company"`
|
Company string `gorm:"column:company;type:varchar(30);default:null;comment:单位" json:"company"`
|
||||||
|
@ -10,7 +10,7 @@ type TechnologyPaper struct {
|
|||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
Local
|
Local
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||||
Title string `gorm:"column:title;type:varchar(100);default:null;comment:题目" json:"title"`
|
Title string `gorm:"column:title;type:varchar(100);default:null;comment:题目" json:"title"`
|
||||||
Ext string `gorm:"column:ext;type:varchar(30);default:null;comment:引用格式" json:"ext"`
|
Ext string `gorm:"column:ext;type:varchar(30);default:null;comment:引用格式" json:"ext"`
|
||||||
Author string `gorm:"column:author;type:varchar(100);default:null;comment:作者" json:"author"`
|
Author string `gorm:"column:author;type:varchar(100);default:null;comment:作者" json:"author"`
|
||||||
|
@ -7,7 +7,7 @@ type TechnologyPatent struct {
|
|||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
Local
|
Local
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户管理uuid" json:"-"`
|
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||||
Title string `gorm:"column:title;type:varchar(50);default:null;comment:专利名称" json:"title"`
|
Title string `gorm:"column:title;type:varchar(50);default:null;comment:专利名称" json:"title"`
|
||||||
IPCCode string `gorm:"column:ipc_code;type:varchar(30);default:null;comment:IPC分类号" json:"ipc_code"`
|
IPCCode string `gorm:"column:ipc_code;type:varchar(30);default:null;comment:IPC分类号" json:"ipc_code"`
|
||||||
CPCCode string `gorm:"column:cpc_code;type:varchar(30);default:null;comment:CPC分类号" json:"cpc_code"`
|
CPCCode string `gorm:"column:cpc_code;type:varchar(30);default:null;comment:CPC分类号" json:"cpc_code"`
|
||||||
|
@ -10,7 +10,7 @@ type TechnologyTopic struct {
|
|||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
Local
|
Local
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||||
Title string `gorm:"column:title;type:varchar(100);default:null;comment:名称" json:"title"`
|
Title string `gorm:"column:title;type:varchar(100);default:null;comment:名称" json:"title"`
|
||||||
Code string `gorm:"column:code;type:varchar(30);default:null;comment:编号" json:"code"`
|
Code string `gorm:"column:code;type:varchar(30);default:null;comment:编号" json:"code"`
|
||||||
Emcee string `gorm:"column:emcee;type:varchar(30);default:null;comment:主持人" json:"emcee"`
|
Emcee string `gorm:"column:emcee;type:varchar(30);default:null;comment:主持人" json:"emcee"`
|
||||||
|
@ -4,7 +4,7 @@ package model
|
|||||||
type UserManageBank struct {
|
type UserManageBank struct {
|
||||||
Model
|
Model
|
||||||
ModelTenant
|
ModelTenant
|
||||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户管理uuid" json:"-"`
|
MUid uint64 `gorm:"column:m_uid;type:int;default:0;comment:用户manage_uuid" json:"-"`
|
||||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"`
|
Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"`
|
||||||
IDCard string `gorm:"column:id_card;type:varchar(18);default:null;comment:身份证号" json:"id_card"`
|
IDCard string `gorm:"column:id_card;type:varchar(18);default:null;comment:身份证号" json:"id_card"`
|
||||||
BankCard string `gorm:"column:bank_card;type:varchar(18);default:null;comment:银行卡号" json:"bank_card"`
|
BankCard string `gorm:"column:bank_card;type:varchar(18);default:null;comment:银行卡号" json:"bank_card"`
|
||||||
|
@ -4,16 +4,22 @@ import (
|
|||||||
api2 "SciencesServer/app/api/enterprise/api"
|
api2 "SciencesServer/app/api/enterprise/api"
|
||||||
"SciencesServer/app/api/manage/api"
|
"SciencesServer/app/api/manage/api"
|
||||||
api3 "SciencesServer/app/basic/api"
|
api3 "SciencesServer/app/basic/api"
|
||||||
|
"SciencesServer/app/session"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
// registerAPI 注册API
|
// registerAPI 注册API
|
||||||
func registerAPI(app *gin.Engine) {
|
func registerAPI(app *gin.Engine) {
|
||||||
apiPrefix := "/api"
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// registerManageAPI 注册API
|
||||||
|
func registerManageAPI(app *gin.Engine) {
|
||||||
|
apiPrefix := "/manage"
|
||||||
g := app.Group(apiPrefix)
|
g := app.Group(apiPrefix)
|
||||||
|
|
||||||
// 登录验证
|
// 登录验证
|
||||||
g.Use(NeedLogin(AddSkipperURL([]string{
|
g.Use(NeedLogin(session.NewManage(), AddSkipperURL([]string{
|
||||||
apiPrefix + "/captcha",
|
apiPrefix + "/captcha",
|
||||||
apiPrefix + "/account/login",
|
apiPrefix + "/account/login",
|
||||||
apiPrefix + "/account/logout",
|
apiPrefix + "/account/logout",
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"SciencesServer/app/logic"
|
||||||
"SciencesServer/app/service"
|
"SciencesServer/app/service"
|
||||||
"SciencesServer/config"
|
"SciencesServer/config"
|
||||||
"SciencesServer/serve/cache"
|
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -24,7 +24,7 @@ func AddSkipperURL(url ...string) SkipperURL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NeedLogin 需要登录
|
// NeedLogin 需要登录
|
||||||
func NeedLogin(skipperURL ...SkipperURL) gin.HandlerFunc {
|
func NeedLogin(session logic.ISession, skipperURL ...SkipperURL) gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
if len(skipperURL) > 0 && skipperURL[0](c) {
|
if len(skipperURL) > 0 && skipperURL[0](c) {
|
||||||
c.Next()
|
c.Next()
|
||||||
@ -37,7 +37,7 @@ func NeedLogin(skipperURL ...SkipperURL) gin.HandlerFunc {
|
|||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session, err := service.NewAuthToken(token).Auth()
|
err := service.NewAuthToken(token).Auth(session)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"message": err.Error()})
|
c.JSON(http.StatusUnauthorized, gin.H{"message": err.Error()})
|
||||||
@ -62,11 +62,11 @@ func NeedPermission(skipperURL ...SkipperURL) PermissionHandle {
|
|||||||
|
|
||||||
if !_session.IsAdmin {
|
if !_session.IsAdmin {
|
||||||
if _session.TenantID > 0 {
|
if _session.TenantID > 0 {
|
||||||
if isExist, _ := cache.Cache.SIsMember(config.RedisKeyForTenant, _session.TenantKey); !isExist {
|
//if isExist, _ := cache.Cache.SIsMember(config.RedisKeyForTenant, _session.TenantKey); !isExist {
|
||||||
c.JSON(http.StatusForbidden, gin.H{"message": "租户/公司信息协议已到期或已被禁用,无权限访问!"})
|
// c.JSON(http.StatusForbidden, gin.H{"message": "租户/公司信息协议已到期或已被禁用,无权限访问!"})
|
||||||
c.Abort()
|
// c.Abort()
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
//if pass, _ := service.NewPermission(nil, &service.AuthRequest{
|
//if pass, _ := service.NewPermission(nil, &service.AuthRequest{
|
||||||
// Url: key,
|
// Url: key,
|
||||||
|
@ -57,6 +57,7 @@ func (this *Router) Init() *gin.Engine {
|
|||||||
app.StaticFS("/upload", http.Dir("./upload"))
|
app.StaticFS("/upload", http.Dir("./upload"))
|
||||||
// 注册路由
|
// 注册路由
|
||||||
registerAPI(app)
|
registerAPI(app)
|
||||||
|
registerManageAPI(app)
|
||||||
registerEnterpriseAPI(app)
|
registerEnterpriseAPI(app)
|
||||||
|
|
||||||
app.MaxMultipartMemory = 4 << 20
|
app.MaxMultipartMemory = 4 << 20
|
||||||
|
Reference in New Issue
Block a user