项目目录优化,任务模块后端代码

This commit is contained in:
PandaGoAdmin
2021-12-23 17:23:27 +08:00
parent 0caf81660c
commit 21ff92a93c
67 changed files with 802 additions and 206 deletions

151
apps/job/api/job.go Normal file
View File

@@ -0,0 +1,151 @@
package api
import (
"pandax/apps/job/entity"
"pandax/apps/job/jobs"
"pandax/apps/job/services"
"pandax/base/biz"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/utils"
)
type JobApi struct {
JobApp services.JobModel
}
// @Summary 添加任务
// @Description 获取JSON
// @Tags 任务
// @Accept application/json
// @Product application/json
// @Param data body entity.SysJob true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /job/job [post]
// @Security X-TOKEN
func (j *JobApi) CreateJob(rc *ctx.ReqCtx) {
var job entity.SysJob
ginx.BindJsonAndValid(rc.GinCtx, &job)
job.CreateBy = rc.LoginAccount.UserName
j.JobApp.Insert(job)
}
// @Summary job列表
// @Description 获取JSON
// @Tags 任务
// @Param status query string false "status"
// @Param jobName query string false "jobName"
// @Param jobGroup query string false "jobGroup"
// @Param pageSize query int false "页条数"
// @Param pageNum query int false "页码"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /job/list [get]
// @Security
func (j *JobApi) GetJobList(rc *ctx.ReqCtx) {
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
jobName := rc.GinCtx.Query("jobName")
jobGroup := rc.GinCtx.Query("jobGroup")
status := rc.GinCtx.Query("status")
list, total := j.JobApp.FindListPage(pageNum, pageSize, entity.SysJob{JobName: jobName, JobGroup: jobGroup, Status: status})
rc.ResData = map[string]interface{}{
"data": list,
"total": total,
"pageNum": pageNum,
"pageSize": pageSize,
}
}
// @Summary 获取一个job
// @Description 获取JSON
// @Tags 任务
// @Param jobId path int true "jobId"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /job/{jobId} [get]
// @Security
func (j *JobApi) GetJob(rc *ctx.ReqCtx) {
jobId := ginx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("jobId"))
rc.ResData = j.JobApp.FindOne(int64(jobId))
}
// @Summary 修改JOB
// @Description 获取JSON
// @Tags 任务
// @Accept application/json
// @Product application/json
// @Param data body entity.SysJob true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /job [put]
// @Security X-TOKEN
func (l *JobApi) UpdateJob(rc *ctx.ReqCtx) {
var job entity.SysJob
ginx.BindJsonAndValid(rc.GinCtx, &job)
l.JobApp.Update(job)
}
// @Summary 批量删除JOB
// @Description 删除数据
// @Tags 任务
// @Param infoId path string true "以逗号(,分割的infoId"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /job/{jobId} [delete]
func (l *JobApi) DeleteJob(rc *ctx.ReqCtx) {
jobIds := rc.GinCtx.Param("jobId")
group := utils.IdsStrToIdsIntGroup(jobIds)
l.JobApp.Delete(group)
}
// @Summary 停止JOB
// @Description 停止Job
// @Tags 任务
// @Param jobId path int true "jobId"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /job/stop/{jobId} [get]
func (l *JobApi) StopJobForService(rc *ctx.ReqCtx) {
jobId := ginx.PathParamInt(rc.GinCtx, "jobId")
job := l.JobApp.FindOne(int64(jobId))
jobs.Remove(jobs.Crontab, job.EntryId)
}
// @Summary 开始JOB
// @Description 开始Job
// @Tags 任务
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /job/stop/{jobId} [get]
func (l *JobApi) StartJobForService(rc *ctx.ReqCtx) {
jobId := ginx.PathParamInt(rc.GinCtx, "jobId")
job := l.JobApp.FindOne(int64(jobId))
biz.IsTrue(job.Status == "0", "以关闭的任务不能开启")
biz.IsTrue(job.EntryId == 0, "任务不能重复启动")
var err error
if job.JobType == "1" {
var j = &jobs.HttpJob{}
j.InvokeTarget = job.InvokeTarget
j.CronExpression = job.CronExpression
j.JobId = job.JobId
j.Name = job.JobName
j.MisfirePolicy = job.MisfirePolicy
job.EntryId, err = jobs.AddJob(jobs.Crontab, j)
biz.ErrIsNil(err, "添加JOB失败")
} else {
var j = &jobs.ExecJob{}
j.InvokeTarget = job.InvokeTarget
j.CronExpression = job.CronExpression
j.JobId = job.JobId
j.Name = job.JobName
j.Args = job.Args
j.MisfirePolicy = job.MisfirePolicy
job.EntryId, err = jobs.AddJob(jobs.Crontab, j)
biz.ErrIsNil(err, "添加JOB失败")
}
l.JobApp.Update(*job)
}

20
apps/job/entity/job.go Normal file
View File

@@ -0,0 +1,20 @@
package entity
import "pandax/base/model"
type SysJob struct {
JobId int64 `json:"jobId" gorm:"primaryKey;autoIncrement"` // 编码
JobName string `json:"jobName" gorm:"type:varchar(255);"` // 名称
JobGroup string `json:"jobGroup" gorm:"type:varchar(255);"` // 任务分组
JobType string `json:"jobType" gorm:"type:varchar(1);"` // 任务类型
CronExpression string `json:"cronExpression" gorm:"type:varchar(255);"` // cron表达式
InvokeTarget string `json:"invokeTarget" gorm:"type:varchar(255);"` // 调用目标
Args string `json:"args" gorm:"type:varchar(255);"` // 目标参数
MisfirePolicy string `json:"misfirePolicy" gorm:"type:varchar(1);"` // 执行策略
Concurrent string `json:"concurrent" gorm:"type:varchar(1);"` // 是否并发
Status string `json:"status" gorm:"type:varchar(1);"` // 状态
EntryId int `json:"entry_id" gorm:"type:int(11);"` // job启动时返回的id
CreateBy string `json:"createBy" gorm:"type:varchar(128);comment:创建人"`
UpdateBy string `json:"updateBy" gorm:"type:varchar(128);comment:更新者"`
model.BaseModel
}

38
apps/job/jobs/examples.go Normal file
View File

@@ -0,0 +1,38 @@
package jobs
import (
"fmt"
"time"
)
// 需要将定义的struct 添加到字典中;
// 字典 key 可以配置到 自动任务 调用目标 中;
func InitJob() {
jobList = map[string]JobsExec{
"ExamplesOne": ExamplesOne{},
// ...
}
}
// 新添加的job 必须按照以下格式定义并实现Exec函数
type ExamplesOne struct {
}
func (t ExamplesOne) Exec(arg interface{}) error {
str := time.Now().Format(timeFormat) + " [INFO] JobCore ExamplesOne exec success"
// TODO: 这里需要注意 Examples 传入参数是 string 所以 arg.(string);请根据对应的类型进行转化;
switch arg.(type) {
case string:
if arg.(string) != "" {
fmt.Println("string", arg.(string))
fmt.Println(str, arg.(string))
} else {
fmt.Println("arg is nil")
fmt.Println(str, "arg is nil")
}
break
}
return nil
}

195
apps/job/jobs/jobbase.go Normal file
View File

@@ -0,0 +1,195 @@
package jobs
import (
"fmt"
"pandax/apps/job/entity"
"pandax/apps/job/services"
"pandax/base/global"
"pandax/base/httpclient"
"sync"
"time"
"github.com/robfig/cron/v3"
)
var timeFormat = "2006-01-02 15:04:05"
var retryCount = 3
var jobList map[string]JobsExec
var lock sync.Mutex
var Crontab = new(cron.Cron)
type JobCore struct {
InvokeTarget string
Name string
JobId int64
EntryId int
CronExpression string // 任务表达式
MisfirePolicy string // 错误执行策略
Args string
}
// 任务类型 http
type HttpJob struct {
cron *cron.Cron
JobCore
}
type ExecJob struct {
cron *cron.Cron
JobCore
}
func (e *ExecJob) Run() {
startTime := time.Now()
var obj = jobList[e.InvokeTarget]
if obj == nil {
global.Log.Warn("[Job] ExecJob Run job nil")
if e.MisfirePolicy == "2" {
Remove(e.cron, e.EntryId)
}
return
}
err := CallExec(obj.(JobsExec), e.Args)
if err != nil {
// 如果失败暂停一段时间重试
fmt.Println(time.Now().Format(timeFormat), " [ERROR] mission failed! ", err)
if e.MisfirePolicy == "2" {
Remove(e.cron, e.EntryId)
return
}
}
// 结束时间
endTime := time.Now()
// 执行时间
latencyTime := endTime.Sub(startTime)
//TODO: 待完善部分
//str := time.Now().Format(timeFormat) + " [INFO] JobCore " + string(e.EntryId) + "exec success , spend :" + latencyTime.String()
//ws.SendAll(str)
global.Log.Info("[Job] JobCore %s exec success , spend :%v", e.Name, latencyTime)
// 执行一次
if e.MisfirePolicy == "1" {
Remove(e.cron, e.EntryId)
}
return
}
//http 任务接口
func (h *HttpJob) Run() {
startTime := time.Now()
var count = 0
LOOP:
if count < retryCount {
_, err := httpclient.NewRequest(h.InvokeTarget).Get().BodyToString()
if err != nil {
time.Sleep(time.Duration(count+1) * 5 * time.Second)
count = count + 1
goto LOOP
}
}
// 结束时间
endTime := time.Now()
// 执行时间
latencyTime := endTime.Sub(startTime)
global.Log.Infof("[Job] JobCore %s exec success , spend :%v", h.Name, latencyTime)
if h.MisfirePolicy == "1" {
Remove(h.cron, h.EntryId)
}
return
}
func Setup() {
Crontab = NewWithSeconds()
// 获取系统job 0是默认1是系统
jl := services.JobModelDao.FindList(entity.SysJob{JobGroup: "1"})
jobList := *jl
if len(jobList) == 0 {
global.Log.Info(time.Now().Format(timeFormat), " [INFO] JobCore total:0")
return
}
err := services.JobModelDao.RemoveAllEntryID()
if err != nil {
global.Log.Info(time.Now().Format(timeFormat), " [ERROR] JobCore remove entry_id error", err)
}
sysJob := entity.SysJob{}
for i := 0; i < len(jobList); i++ {
if jobList[i].Status != "0" && jobList[i].EntryId > 0 {
continue
}
if jobList[i].JobType == "1" {
j := &HttpJob{}
j.InvokeTarget = jobList[i].InvokeTarget
j.CronExpression = jobList[i].CronExpression
j.JobId = jobList[i].JobId
j.Name = jobList[i].JobName
j.MisfirePolicy = jobList[i].MisfirePolicy
sysJob.EntryId, err = AddJob(Crontab, j)
} else if jobList[i].JobType == "2" {
j := &ExecJob{}
j.InvokeTarget = jobList[i].InvokeTarget
j.CronExpression = jobList[i].CronExpression
j.JobId = jobList[i].JobId
j.Name = jobList[i].JobName
j.Args = jobList[i].Args
j.MisfirePolicy = jobList[i].MisfirePolicy
sysJob.EntryId, err = AddJob(Crontab, j)
}
sysJob.JobId = jobList[i].JobId
services.JobModelDao.Update(sysJob)
}
// 其中任务
Crontab.Start()
global.Log.Info(time.Now().Format(timeFormat), " [INFO] JobCore start success.")
// 关闭任务
defer Crontab.Stop()
select {}
}
// 添加任务 AddJob(invokeTarget string, jobId int, jobName string, cronExpression string)
func AddJob(c *cron.Cron, job Job) (int, error) {
if job == nil {
return 0, nil
}
return job.addJob(c)
}
func (h *HttpJob) addJob(c *cron.Cron) (int, error) {
id, err := c.AddJob(h.CronExpression, h)
if err != nil {
return 0, err
}
h.cron = c
EntryId := int(id)
h.EntryId = EntryId
return EntryId, nil
}
func (h *ExecJob) addJob(c *cron.Cron) (int, error) {
id, err := c.AddJob(h.CronExpression, h)
if err != nil {
return 0, err
}
h.cron = c
EntryId := int(id)
h.EntryId = EntryId
return EntryId, nil
}
// 移除任务(停止任务)
func Remove(c *cron.Cron, entryID int) {
c.Remove(cron.EntryID(entryID))
var job entity.SysJob
job.EntryId = entryID
services.JobModelDao.RemoveEntryID(entryID)
}
func NewWithSeconds() *cron.Cron {
secondParser := cron.NewParser(cron.Second | cron.Minute |
cron.Hour | cron.Dom | cron.Month | cron.DowOptional | cron.Descriptor)
return cron.New(cron.WithParser(secondParser), cron.WithChain())
}

16
apps/job/jobs/type.go Normal file
View File

@@ -0,0 +1,16 @@
package jobs
import "github.com/robfig/cron/v3"
type Job interface {
Run()
addJob(*cron.Cron) (int, error)
}
type JobsExec interface {
Exec(arg interface{}) error
}
func CallExec(e JobsExec, arg interface{}) error {
return e.Exec(arg)
}

51
apps/job/router/job.go Normal file
View File

@@ -0,0 +1,51 @@
package router
import (
"github.com/gin-gonic/gin"
"pandax/apps/job/api"
"pandax/apps/job/services"
"pandax/base/ctx"
)
func InitJobRouter(router *gin.RouterGroup) {
// 登录日志
jobApi := &api.JobApi{
JobApp: services.JobModelDao,
}
job := router.Group("")
jobListLog := ctx.NewLogInfo("获取Job列表")
job.GET("list", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(jobListLog).Handle(jobApi.GetJobList)
})
getJobLog := ctx.NewLogInfo("获取Job信息")
job.GET(":jobId", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(getJobLog).Handle(jobApi.GetJob)
})
insertJobLog := ctx.NewLogInfo("添加Job信息")
job.POST("", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(insertJobLog).Handle(jobApi.CreateJob)
})
updateJobLog := ctx.NewLogInfo("修改Job信息")
job.PUT("", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(updateJobLog).Handle(jobApi.UpdateJob)
})
deleteJobLog := ctx.NewLogInfo("删除Job信息")
job.DELETE(":jobId", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(deleteJobLog).Handle(jobApi.DeleteJob)
})
stopJobLog := ctx.NewLogInfo("停止一个job")
job.DELETE(":jobId", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(stopJobLog).Handle(jobApi.StopJobForService)
})
starteJobLog := ctx.NewLogInfo("开启一个job")
job.DELETE(":jobId", func(c *gin.Context) {
ctx.NewReqCtxWithGin(c).WithLog(starteJobLog).Handle(jobApi.StartJobForService)
})
}

115
apps/job/services/job.go Normal file
View File

@@ -0,0 +1,115 @@
package services
import (
"pandax/apps/job/entity"
"pandax/base/biz"
"pandax/base/global"
)
type (
JobModel interface {
Insert(data entity.SysJob) *entity.SysJob
FindOne(jobId int64) *entity.SysJob
FindListPage(page, pageSize int, data entity.SysJob) (*[]entity.SysJob, int64)
FindList(data entity.SysJob) *[]entity.SysJob
Update(data entity.SysJob) *entity.SysJob
Delete(jobId []int64)
FindByEntryId(entryId int64) *entity.SysJob
RemoveAllEntryID() error
RemoveEntryID(EntryID int) error
}
jobModelImpl struct {
table string
}
)
var JobModelDao JobModel = &jobModelImpl{
table: `sys_jobs`,
}
func (m *jobModelImpl) Insert(data entity.SysJob) *entity.SysJob {
global.Db.Table(m.table).Create(&data)
return &data
}
func (m *jobModelImpl) FindOne(jobId int64) *entity.SysJob {
resData := new(entity.SysJob)
err := global.Db.Table(m.table).Where("`job_id` = ?", jobId).First(resData).Error
biz.ErrIsNil(err, "查询任务信息失败")
return resData
}
func (m *jobModelImpl) FindListPage(page, pageSize int, data entity.SysJob) (*[]entity.SysJob, int64) {
list := make([]entity.SysJob, 0)
var total int64 = 0
offset := pageSize * (page - 1)
db := global.Db.Table(m.table)
// 此处填写 where参数判断
if data.JobName != "" {
db = db.Where("job_name = ?", data.JobName)
}
if data.Status != "" {
db = db.Where("status = ?", data.Status)
}
if data.JobGroup != "" {
db = db.Where("job_group = ?", data.JobGroup)
}
err := db.Where("`delete_time` IS NULL").Count(&total).Error
err = db.Order("create_time desc").Limit(pageSize).Offset(offset).Find(&list).Error
biz.ErrIsNil(err, "查询任务分页信息失败")
return &list, total
}
func (m *jobModelImpl) FindList(data entity.SysJob) *[]entity.SysJob {
list := make([]entity.SysJob, 0)
db := global.Db.Table(m.table)
// 此处填写 where参数判断
if data.JobName != "" {
db = db.Where("job_name = ?", data.JobName)
}
if data.Status != "" {
db = db.Where("status = ?", data.Status)
}
if data.JobGroup != "" {
db = db.Where("job_group = ?", data.JobGroup)
}
err := db.Order("create_time desc").Find(&list).Error
if err != nil {
global.Log.Error("查询任务分页信息失败:" + err.Error())
}
return &list
}
func (m *jobModelImpl) Update(data entity.SysJob) *entity.SysJob {
biz.ErrIsNil(global.Db.Table(m.table).Updates(&data).Error, "修改任务失败")
return &data
}
func (m *jobModelImpl) Delete(jobIds []int64) {
err := global.Db.Table(m.table).Delete(&entity.SysJob{}, "`job_id` in (?)", jobIds).Error
biz.ErrIsNil(err, "删除操作日志信息失败")
return
}
func (m *jobModelImpl) FindByEntryId(entryId int64) *entity.SysJob {
resData := new(entity.SysJob)
err := global.Db.Table(m.table).Where("`entry_id` = ?", entryId).First(resData).Error
biz.ErrIsNil(err, "查询失败")
return resData
}
func (m *jobModelImpl) RemoveAllEntryID() error {
if err := global.Db.Table(m.table).Where("entry_id > ?", 0).Update("entry_id", 0).Error; err != nil {
return err
}
return nil
}
func (m *jobModelImpl) RemoveEntryID(EntryID int) error {
if err := global.Db.Table(m.table).Where("entry_id = ?", EntryID).Update("entry_id", 0).Error; err != nil {
return err
}
return nil
}

View File

@@ -1,11 +1,11 @@
package api
import (
"pandax/apps/log/entity"
"pandax/apps/log/services"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type LogLoginApi struct {
@@ -20,9 +20,9 @@ type LogLoginApi struct {
// @Param pageSize query int false "页条数"
// @Param pageNum query int false "页码"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/log/logLoginList [get]
// @Router /system/log/list [get]
// @Security
func (l LogLoginApi) GetLoginLogList(rc *ctx.ReqCtx) {
func (l *LogLoginApi) GetLoginLogList(rc *ctx.ReqCtx) {
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
loginLocation := rc.GinCtx.Query("loginLocation")
@@ -44,7 +44,7 @@ func (l LogLoginApi) GetLoginLogList(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/log/logLogin/{infoId} [get]
// @Security
func (l LogLoginApi) GetLoginLog(rc *ctx.ReqCtx) {
func (l *LogLoginApi) GetLoginLog(rc *ctx.ReqCtx) {
infoId := ginx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("infoId"))
rc.ResData = l.LogLoginApp.FindOne(int64(infoId))
}
@@ -59,7 +59,7 @@ func (l LogLoginApi) GetLoginLog(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /system/log/logLogin [put]
// @Security X-TOKEN
func (l LogLoginApi) UpdateLoginLog(rc *ctx.ReqCtx) {
func (l *LogLoginApi) UpdateLoginLog(rc *ctx.ReqCtx) {
var log entity.LogLogin
ginx.BindJsonAndValid(rc.GinCtx, &log)
l.LogLoginApp.Update(log)
@@ -72,7 +72,7 @@ func (l LogLoginApi) UpdateLoginLog(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /system/log/logLogin/{infoId} [delete]
func (l LogLoginApi) DeleteLoginLog(rc *ctx.ReqCtx) {
func (l *LogLoginApi) DeleteLoginLog(rc *ctx.ReqCtx) {
infoIds := rc.GinCtx.Param("infoId")
group := utils.IdsStrToIdsIntGroup(infoIds)
l.LogLoginApp.Delete(group)
@@ -84,6 +84,6 @@ func (l LogLoginApi) DeleteLoginLog(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /system/log/logLogin/all [delete]
func (l LogLoginApi) DeleteAll(rc *ctx.ReqCtx) {
func (l *LogLoginApi) DeleteAll(rc *ctx.ReqCtx) {
l.LogLoginApp.DeleteAll()
}

View File

@@ -2,11 +2,11 @@ package api
import (
"log"
"pandax/apps/log/entity"
"pandax/apps/log/services"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type LogOperApi struct {
@@ -21,9 +21,9 @@ type LogOperApi struct {
// @Param pageSize query int false "页条数"
// @Param pageNum query int false "页码"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/log/logOperList [get]
// @Router /system/log/list [get]
// @Security
func (l LogOperApi) GetOperLogList(rc *ctx.ReqCtx) {
func (l *LogOperApi) GetOperLogList(rc *ctx.ReqCtx) {
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
@@ -46,7 +46,7 @@ func (l LogOperApi) GetOperLogList(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Router /system/log/logOper/{operId} [get]
// @Security
func (l LogOperApi) GetOperLog(rc *ctx.ReqCtx) {
func (l *LogOperApi) GetOperLog(rc *ctx.ReqCtx) {
operId := ginx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("operId"))
rc.ResData = l.LogOperApp.FindOne(int64(operId))
}
@@ -58,7 +58,7 @@ func (l LogOperApi) GetOperLog(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /system/log/logOper/{operId} [delete]
func (l LogOperApi) DeleteOperLog(rc *ctx.ReqCtx) {
func (l *LogOperApi) DeleteOperLog(rc *ctx.ReqCtx) {
operIds := rc.GinCtx.Param("operId")
group := utils.IdsStrToIdsIntGroup(operIds)
log.Println("group", group)
@@ -71,6 +71,6 @@ func (l LogOperApi) DeleteOperLog(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /system/log/logOper/all [delete]
func (l LogOperApi) DeleteAll(rc *ctx.ReqCtx) {
func (l *LogOperApi) DeleteAll(rc *ctx.ReqCtx) {
l.LogOperApp.DeleteAll()
}

View File

@@ -2,9 +2,9 @@ package router
import (
"github.com/gin-gonic/gin"
"pandax/apps/log/api"
"pandax/apps/log/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitLogRouter(router *gin.RouterGroup) {

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/log/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/log/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -2,16 +2,16 @@ package api
import (
"log"
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/casbin"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type SystemApiApi struct {
ApiApp services.SysApiModel
ApiApp services2.SysApiModel
}
// @Tags SysApi
@@ -23,7 +23,7 @@ type SystemApiApi struct {
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /system/api [post]
func (s *SystemApiApi) CreateApi(rc *ctx.ReqCtx) {
var api entity.SysApi
var api entity2.SysApi
ginx.BindJsonAndValid(rc.GinCtx, &api)
log.Println(api)
s.ApiApp.Insert(api)
@@ -61,7 +61,7 @@ func (s *SystemApiApi) GetApiList(rc *ctx.ReqCtx) {
description := rc.GinCtx.Query("description")
method := rc.GinCtx.Query("method")
apiGroup := rc.GinCtx.Query("apiGroup")
api := entity.SysApi{Path: path, Description: description, Method: method, ApiGroup: apiGroup}
api := entity2.SysApi{Path: path, Description: description, Method: method, ApiGroup: apiGroup}
list, total := s.ApiApp.FindListPage(pageNum, pageSize, api)
rc.ResData = map[string]interface{}{
"data": list,
@@ -94,7 +94,7 @@ func (s *SystemApiApi) GetApiById(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
// @Router /api/api [put]
func (s *SystemApiApi) UpdateApi(rc *ctx.ReqCtx) {
var api entity.SysApi
var api entity2.SysApi
ginx.BindJsonAndValid(rc.GinCtx, &api)
s.ApiApp.Update(api)
}
@@ -107,7 +107,7 @@ func (s *SystemApiApi) UpdateApi(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /system/api/all [get]
func (s *SystemApiApi) GetAllApis(rc *ctx.ReqCtx) {
rc.ResData = s.ApiApp.FindList(entity.SysApi{})
rc.ResData = s.ApiApp.FindList(entity2.SysApi{})
}
// @Tags SysApi

View File

@@ -1,16 +1,16 @@
package api
import (
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/biz"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type ConfigApi struct {
ConfigApp services.SysConfigModel
ConfigApp services2.SysConfigModel
}
// @Summary 配置列表数据
@@ -30,7 +30,7 @@ func (p *ConfigApi) GetConfigList(rc *ctx.ReqCtx) {
configName := rc.GinCtx.Query("configName")
configKey := rc.GinCtx.Query("configKey")
configType := rc.GinCtx.Query("configType")
config := entity.SysConfig{ConfigName: configName, ConfigKey: configKey, ConfigType: configType}
config := entity2.SysConfig{ConfigName: configName, ConfigKey: configKey, ConfigType: configType}
list, total := p.ConfigApp.FindListPage(pageNum, pageSize, config)
rc.ResData = map[string]interface{}{
@@ -51,7 +51,7 @@ func (p *ConfigApi) GetConfigList(rc *ctx.ReqCtx) {
func (p *ConfigApi) GetConfigListByKey(rc *ctx.ReqCtx) {
configKey := rc.GinCtx.Query("configKey")
biz.IsTrue(configKey != "", "请传入配置Key")
rc.ResData = p.ConfigApp.FindList(entity.SysConfig{ConfigKey: configKey})
rc.ResData = p.ConfigApp.FindList(entity2.SysConfig{ConfigKey: configKey})
}
// @Summary 获取配置
@@ -77,7 +77,7 @@ func (p *ConfigApi) GetConfig(rc *ctx.ReqCtx) {
// @Router /system/config [post]
// @Security X-TOKEN
func (p *ConfigApi) InsertConfig(rc *ctx.ReqCtx) {
var config entity.SysConfig
var config entity2.SysConfig
ginx.BindJsonAndValid(rc.GinCtx, &config)
p.ConfigApp.Insert(config)
@@ -94,7 +94,7 @@ func (p *ConfigApi) InsertConfig(rc *ctx.ReqCtx) {
// @Router /system/config [put]
// @Security X-TOKEN
func (p *ConfigApi) UpdateConfig(rc *ctx.ReqCtx) {
var post entity.SysConfig
var post entity2.SysConfig
ginx.BindJsonAndValid(rc.GinCtx, &post)
p.ConfigApp.Update(post)
}

View File

@@ -3,19 +3,19 @@ package api
import (
"errors"
"fmt"
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/biz"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/global"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type DeptApi struct {
DeptApp services.SysDeptModel
UserApp services.SysUserModel
RoleApp services.SysRoleModel
DeptApp services2.SysDeptModel
UserApp services2.SysUserModel
RoleApp services2.SysRoleModel
}
// @Summary 获取角色的部门树
@@ -29,11 +29,11 @@ type DeptApi struct {
func (m *DeptApi) GetDeptTreeRoleSelect(rc *ctx.ReqCtx) {
roleId := ginx.PathParamInt(rc.GinCtx, "roleId")
result := m.DeptApp.SelectDeptLable(entity.SysDept{})
result := m.DeptApp.SelectDeptLable(entity2.SysDept{})
deptIds := make([]int64, 0)
if roleId != 0 {
deptIds = m.RoleApp.GetRoleDeptId(entity.SysRole{RoleId: int64(roleId)})
deptIds = m.RoleApp.GetRoleDeptId(entity2.SysRole{RoleId: int64(roleId)})
}
rc.ResData = map[string]interface{}{
"depts": result,
@@ -56,7 +56,7 @@ func (a *DeptApi) GetDeptList(rc *ctx.ReqCtx) {
deptName := rc.GinCtx.Query("deptName")
status := rc.GinCtx.Query("status")
deptId := ginx.QueryInt(rc.GinCtx, "deptId", 0)
dept := entity.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
dept := entity2.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
if dept.DeptName == "" {
rc.ResData = a.DeptApp.SelectDept(dept)
@@ -72,7 +72,7 @@ func (a *DeptApi) GetDeptList(rc *ctx.ReqCtx) {
// @Router /system/dept/ordinaryDeptLis [get]
// @Security
func (a *DeptApi) GetOrdinaryDeptList(rc *ctx.ReqCtx) {
rc.ResData = a.DeptApp.FindList(entity.SysDept{})
rc.ResData = a.DeptApp.FindList(entity2.SysDept{})
}
// @Summary 所有部门树数据
@@ -88,7 +88,7 @@ func (a *DeptApi) GetDeptTree(rc *ctx.ReqCtx) {
deptName := rc.GinCtx.Query("deptName")
status := rc.GinCtx.Query("status")
deptId := ginx.QueryInt(rc.GinCtx, "deptId", 0)
dept := entity.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
dept := entity2.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
rc.ResData = a.DeptApp.SelectDept(dept)
}
@@ -116,7 +116,7 @@ func (a *DeptApi) GetDept(rc *ctx.ReqCtx) {
// @Router /system/dept [post]
// @Security Bearer
func (a *DeptApi) InsertDept(rc *ctx.ReqCtx) {
var dept entity.SysDept
var dept entity2.SysDept
g := rc.GinCtx
ginx.BindJsonAndValid(g, &dept)
@@ -135,7 +135,7 @@ func (a *DeptApi) InsertDept(rc *ctx.ReqCtx) {
// @Router /system/dept [put]
// @Security Bearer
func (a *DeptApi) UpdateDept(rc *ctx.ReqCtx) {
var dept entity.SysDept
var dept entity2.SysDept
g := rc.GinCtx
ginx.BindJsonAndValid(g, &dept)
@@ -156,7 +156,7 @@ func (a *DeptApi) DeleteDept(rc *ctx.ReqCtx) {
deList := make([]int64, 0)
for _, id := range deptIds {
user := entity.SysUser{}
user := entity2.SysUser{}
user.DeptId = id
list := a.UserApp.FindList(user)
if len(*list) == 0 {

View File

@@ -4,19 +4,19 @@ import (
"fmt"
"github.com/kakuilan/kgo"
"os"
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/biz"
"pandax/base/config"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/global"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type DictApi struct {
DictType services.SysDictTypeModel
DictData services.SysDictDataModel
DictType services2.SysDictTypeModel
DictData services2.SysDictDataModel
}
// @Summary 字典类型列表数据
@@ -37,7 +37,7 @@ func (p *DictApi) GetDictTypeList(rc *ctx.ReqCtx) {
dictName := rc.GinCtx.Query("dictName")
dictType := rc.GinCtx.Query("dictType")
list, total := p.DictType.FindListPage(pageNum, pageSize, entity.SysDictType{Status: status, DictName: dictName, DictType: dictType})
list, total := p.DictType.FindListPage(pageNum, pageSize, entity2.SysDictType{Status: status, DictName: dictName, DictType: dictType})
rc.ResData = map[string]interface{}{
"data": list,
"total": total,
@@ -69,7 +69,7 @@ func (p *DictApi) GetDictType(rc *ctx.ReqCtx) {
// @Router /system/dict/type [post]
// @Security X-TOKEN
func (p *DictApi) InsertDictType(rc *ctx.ReqCtx) {
var dict entity.SysDictType
var dict entity2.SysDictType
ginx.BindJsonAndValid(rc.GinCtx, &dict)
dict.CreateBy = rc.LoginAccount.UserName
@@ -87,7 +87,7 @@ func (p *DictApi) InsertDictType(rc *ctx.ReqCtx) {
// @Router /system/dict/type [put]
// @Security X-TOKEN
func (p *DictApi) UpdateDictType(rc *ctx.ReqCtx) {
var dict entity.SysDictType
var dict entity2.SysDictType
ginx.BindJsonAndValid(rc.GinCtx, &dict)
dict.CreateBy = rc.LoginAccount.UserName
@@ -108,7 +108,7 @@ func (p *DictApi) DeleteDictType(rc *ctx.ReqCtx) {
deList := make([]int64, 0)
for _, id := range dictIds {
one := p.DictType.FindOne(id)
list := p.DictData.FindList(entity.SysDictData{DictType: one.DictType})
list := p.DictData.FindList(entity2.SysDictData{DictType: one.DictType})
if len(*list) == 0 {
deList = append(deList, id)
} else {
@@ -132,7 +132,7 @@ func (p *DictApi) ExportDictType(rc *ctx.ReqCtx) {
dictName := rc.GinCtx.Query("dictName")
dictType := rc.GinCtx.Query("dictType")
list := p.DictType.FindList(entity.SysDictType{Status: status, DictName: dictName, DictType: dictType})
list := p.DictType.FindList(entity2.SysDictType{Status: status, DictName: dictName, DictType: dictType})
fileName := utils.GetFileName(config.Conf.Server.ExcelDir, "字典")
utils.InterfaceToExcel(*list, fileName)
@@ -157,7 +157,7 @@ func (p *DictApi) GetDictDataList(rc *ctx.ReqCtx) {
dictLabel := rc.GinCtx.Query("dictLabel")
dictType := rc.GinCtx.Query("dictType")
status := rc.GinCtx.Query("status")
rc.ResData = p.DictData.FindList(entity.SysDictData{Status: status, DictType: dictType, DictLabel: dictLabel})
rc.ResData = p.DictData.FindList(entity2.SysDictData{Status: status, DictType: dictType, DictLabel: dictLabel})
}
// @Summary 字典数据获取
@@ -170,7 +170,7 @@ func (p *DictApi) GetDictDataList(rc *ctx.ReqCtx) {
func (p *DictApi) GetDictDataListByDictType(rc *ctx.ReqCtx) {
dictType := rc.GinCtx.Query("dictType")
biz.IsTrue(dictType != "", "请传入字典类型")
rc.ResData = p.DictData.FindList(entity.SysDictData{DictType: dictType})
rc.ResData = p.DictData.FindList(entity2.SysDictData{DictType: dictType})
}
// @Summary 获取字典数据
@@ -196,7 +196,7 @@ func (p *DictApi) GetDictData(rc *ctx.ReqCtx) {
// @Router /system/dict/data [post]
// @Security X-TOKEN
func (p *DictApi) InsertDictData(rc *ctx.ReqCtx) {
var data entity.SysDictData
var data entity2.SysDictData
ginx.BindJsonAndValid(rc.GinCtx, &data)
data.CreateBy = rc.LoginAccount.UserName
@@ -214,7 +214,7 @@ func (p *DictApi) InsertDictData(rc *ctx.ReqCtx) {
// @Router /system/dict/data [put]
// @Security X-TOKEN
func (p *DictApi) UpdateDictData(rc *ctx.ReqCtx) {
var data entity.SysDictData
var data entity2.SysDictData
ginx.BindJsonAndValid(rc.GinCtx, &data)
data.CreateBy = rc.LoginAccount.UserName

View File

@@ -2,19 +2,19 @@ package api
import (
"log"
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/biz"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/system/entity"
"pandax/system/services"
)
type MenuApi struct {
MenuApp services.SysMenuModel
DeptApp services.SysDeptModel
MenuApp services2.SysMenuModel
DeptApp services2.SysDeptModel
RoleMenuApp services.SysRoleMenuModel
RoleApp services.SysRoleModel
RoleMenuApp services2.SysRoleMenuModel
RoleApp services2.SysRoleModel
}
// @Summary 获取菜单树
@@ -25,7 +25,7 @@ type MenuApi struct {
// @Router /system/menu/menuTreSelect [get]
// @Security X-TOKEN
func (m *MenuApi) GetMenuTreeSelect(rc *ctx.ReqCtx) {
lable := m.MenuApp.SelectMenuLable(entity.SysMenu{})
lable := m.MenuApp.SelectMenuLable(entity2.SysMenu{})
rc.ResData = lable
}
@@ -51,10 +51,10 @@ func (m *MenuApi) GetMenuRole(rc *ctx.ReqCtx) {
func (m *MenuApi) GetMenuTreeRoleSelect(rc *ctx.ReqCtx) {
roleId := ginx.PathParamInt(rc.GinCtx, "roleId")
result := m.MenuApp.SelectMenuLable(entity.SysMenu{})
result := m.MenuApp.SelectMenuLable(entity2.SysMenu{})
menuIds := make([]int64, 0)
if roleId != 0 {
menuIds = m.RoleApp.GetRoleMeunId(entity.SysRole{RoleId: int64(roleId)})
menuIds = m.RoleApp.GetRoleMeunId(entity2.SysRole{RoleId: int64(roleId)})
}
rc.ResData = map[string]interface{}{
"menus": result,
@@ -73,7 +73,7 @@ func (m *MenuApi) GetMenuTreeRoleSelect(rc *ctx.ReqCtx) {
func (m *MenuApi) GetMenuPaths(rc *ctx.ReqCtx) {
roleKey := rc.GinCtx.Query("roleKey")
biz.IsTrue(roleKey != "", "请传入角色Key")
rc.ResData = m.RoleMenuApp.GetMenuPaths(entity.SysRoleMenu{RoleName: roleKey})
rc.ResData = m.RoleMenuApp.GetMenuPaths(entity2.SysRoleMenu{RoleName: roleKey})
}
// @Summary Menu列表数据
@@ -90,7 +90,7 @@ func (m *MenuApi) GetMenuList(rc *ctx.ReqCtx) {
menuName := rc.GinCtx.Query("menuName")
status := rc.GinCtx.Query("status")
menu := entity.SysMenu{MenuName: menuName, Status: status}
menu := entity2.SysMenu{MenuName: menuName, Status: status}
log.Println(menuName)
if menu.MenuName == "" {
rc.ResData = m.MenuApp.SelectMenu(menu)
@@ -122,7 +122,7 @@ func (m *MenuApi) GetMenu(rc *ctx.ReqCtx) {
// @Router /system/menu [post]
// @Security X-TOKEN
func (m *MenuApi) InsertMenu(rc *ctx.ReqCtx) {
var menu entity.SysMenu
var menu entity2.SysMenu
ginx.BindJsonAndValid(rc.GinCtx, &menu)
menu.CreateBy = rc.LoginAccount.UserName
m.MenuApp.Insert(menu)
@@ -143,7 +143,7 @@ func (m *MenuApi) InsertMenu(rc *ctx.ReqCtx) {
// @Router /system/menu [put]
// @Security X-TOKEN
func (m *MenuApi) UpdateMenu(rc *ctx.ReqCtx) {
var menu entity.SysMenu
var menu entity2.SysMenu
ginx.BindJsonAndValid(rc.GinCtx, &menu)
menu.UpdateBy = rc.LoginAccount.UserName
m.MenuApp.Update(menu)

View File

@@ -3,19 +3,19 @@ package api
import (
"errors"
"fmt"
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/biz"
"pandax/base/ctx"
"pandax/base/ginx"
"pandax/base/global"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type PostApi struct {
PostApp services.SysPostModel
UserApp services.SysUserModel
RoleApp services.SysRoleModel
PostApp services2.SysPostModel
UserApp services2.SysUserModel
RoleApp services2.SysRoleModel
}
// @Summary 职位列表数据
@@ -36,7 +36,7 @@ func (p *PostApi) GetPostList(rc *ctx.ReqCtx) {
status := rc.GinCtx.Query("status")
postName := rc.GinCtx.Query("postName")
postCode := rc.GinCtx.Query("postCode")
post := entity.SysPost{Status: status, PostName: postName, PostCode: postCode}
post := entity2.SysPost{Status: status, PostName: postName, PostCode: postCode}
list, total := p.PostApp.FindListPage(pageNum, pageSize, post)
rc.ResData = map[string]interface{}{
@@ -70,7 +70,7 @@ func (p *PostApi) GetPost(rc *ctx.ReqCtx) {
// @Router /system/post [post]
// @Security X-TOKEN
func (p *PostApi) InsertPost(rc *ctx.ReqCtx) {
var post entity.SysPost
var post entity2.SysPost
ginx.BindJsonAndValid(rc.GinCtx, &post)
post.CreateBy = rc.LoginAccount.UserName
@@ -88,7 +88,7 @@ func (p *PostApi) InsertPost(rc *ctx.ReqCtx) {
// @Router /system/post [put]
// @Security X-TOKEN
func (p *PostApi) UpdatePost(rc *ctx.ReqCtx) {
var post entity.SysPost
var post entity2.SysPost
ginx.BindJsonAndValid(rc.GinCtx, &post)
post.CreateBy = rc.LoginAccount.UserName
@@ -109,7 +109,7 @@ func (p *PostApi) DeletePost(rc *ctx.ReqCtx) {
deList := make([]int64, 0)
for _, id := range postIds {
user := entity.SysUser{}
user := entity2.SysUser{}
user.PostId = id
list := p.UserApp.FindList(user)
if len(*list) == 0 {

View File

@@ -5,6 +5,8 @@ import (
"fmt"
"github.com/kakuilan/kgo"
"os"
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/biz"
"pandax/base/casbin"
"pandax/base/config"
@@ -12,15 +14,13 @@ import (
"pandax/base/ginx"
"pandax/base/global"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
type RoleApi struct {
RoleApp services.SysRoleModel
UserApp services.SysUserModel
RoleMenuApp services.SysRoleMenuModel
RoleDeptApp services.SysRoleDeptModel
RoleApp services2.SysRoleModel
UserApp services2.SysUserModel
RoleMenuApp services2.SysRoleMenuModel
RoleDeptApp services2.SysRoleDeptModel
}
// @Summary 角色列表数据
@@ -41,7 +41,7 @@ func (r *RoleApi) GetRoleList(rc *ctx.ReqCtx) {
roleName := rc.GinCtx.Query("roleName")
roleKey := rc.GinCtx.Query("roleKey")
role := entity.SysRole{Status: status, RoleName: roleName, RoleKey: roleKey}
role := entity2.SysRole{Status: status, RoleName: roleName, RoleKey: roleKey}
list, total := r.RoleApp.FindListPage(pageNum, pageSize, role)
rc.ResData = map[string]interface{}{
@@ -63,7 +63,7 @@ func (r *RoleApi) GetRoleList(rc *ctx.ReqCtx) {
func (r *RoleApi) GetRole(rc *ctx.ReqCtx) {
roleId := ginx.PathParamInt(rc.GinCtx, "roleId")
role := r.RoleApp.FindOne(int64(roleId))
role.MenuIds = r.RoleApp.GetRoleMeunId(entity.SysRole{RoleId: int64(roleId)})
role.MenuIds = r.RoleApp.GetRoleMeunId(entity2.SysRole{RoleId: int64(roleId)})
rc.ResData = role
}
@@ -78,7 +78,7 @@ func (r *RoleApi) GetRole(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /system/role [post]
func (r *RoleApi) InsertRole(rc *ctx.ReqCtx) {
var role entity.SysRole
var role entity2.SysRole
ginx.BindJsonAndValid(rc.GinCtx, &role)
role.CreateBy = rc.LoginAccount.UserName
insert := r.RoleApp.Insert(role)
@@ -98,7 +98,7 @@ func (r *RoleApi) InsertRole(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
// @Router /system/role [put]
func (r *RoleApi) UpdateRole(rc *ctx.ReqCtx) {
var role entity.SysRole
var role entity2.SysRole
ginx.BindJsonAndValid(rc.GinCtx, &role)
role.UpdateBy = rc.LoginAccount.UserName
// 修改角色
@@ -121,7 +121,7 @@ func (r *RoleApi) UpdateRole(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
// @Router /system/role/changeStatus [put]
func (r *RoleApi) UpdateRoleStatus(rc *ctx.ReqCtx) {
var role entity.SysRole
var role entity2.SysRole
ginx.BindJsonAndValid(rc.GinCtx, &role)
role.UpdateBy = rc.LoginAccount.UserName
// 修改角色
@@ -138,14 +138,14 @@ func (r *RoleApi) UpdateRoleStatus(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "修改失败"}"
// @Router /system/role/dataScope [put]
func (r *RoleApi) UpdateRoleDataScope(rc *ctx.ReqCtx) {
var role entity.SysRole
var role entity2.SysRole
ginx.BindJsonAndValid(rc.GinCtx, &role)
role.UpdateBy = rc.LoginAccount.UserName
// 修改角色
update := r.RoleApp.Update(role)
if role.DataScope == "2" {
// 删除角色的部门绑定
r.RoleDeptApp.Delete(entity.SysRoleDept{RoleId: update.RoleId})
r.RoleDeptApp.Delete(entity2.SysRoleDept{RoleId: update.RoleId})
// 添加角色部门绑定
r.RoleDeptApp.Insert(role.RoleId, role.DeptIds)
}
@@ -162,7 +162,7 @@ func (r *RoleApi) DeleteRole(rc *ctx.ReqCtx) {
roleId := rc.GinCtx.Param("roleId")
roleIds := utils.IdsStrToIdsIntGroup(roleId)
user := entity.SysUser{}
user := entity2.SysUser{}
delList := make([]int64, 0)
// 判断角色下面是否绑定用户
for _, rid := range roleIds {
@@ -198,7 +198,7 @@ func (p *RoleApi) ExportRole(rc *ctx.ReqCtx) {
roleName := rc.GinCtx.Query("roleName")
roleKey := rc.GinCtx.Query("roleKey")
list := p.RoleApp.FindList(entity.SysRole{Status: status, RoleName: roleName, RoleKey: roleKey})
list := p.RoleApp.FindList(entity2.SysRole{Status: status, RoleName: roleName, RoleKey: roleKey})
fileName := utils.GetFileName(config.Conf.Server.ExcelDir, "角色")
utils.InterfaceToExcel(*list, fileName)

View File

@@ -7,6 +7,10 @@ import (
"github.com/mssola/user_agent"
"net/http"
"os"
form2 "pandax/apps/system/api/form"
vo2 "pandax/apps/system/api/vo"
entity2 "pandax/apps/system/entity"
services2 "pandax/apps/system/services"
"pandax/base/biz"
"pandax/base/captcha"
"pandax/base/config"
@@ -14,22 +18,18 @@ import (
"pandax/base/ginx"
"pandax/base/global"
"pandax/base/utils"
"pandax/system/api/form"
"pandax/system/api/vo"
"pandax/system/entity"
"pandax/system/services"
"strings"
"time"
)
type UserApi struct {
UserApp services.SysUserModel
MenuApp services.SysMenuModel
PostApp services.SysPostModel
RoleApp services.SysRoleModel
RoleMenuApp services.SysRoleMenuModel
DeptApp services.SysDeptModel
LogLogin services.LogLoginModel
UserApp services2.SysUserModel
MenuApp services2.SysMenuModel
PostApp services2.SysPostModel
RoleApp services2.SysRoleModel
RoleMenuApp services2.SysRoleMenuModel
DeptApp services2.SysDeptModel
LogLogin services2.LogLoginModel
}
// @Tags Base
@@ -61,11 +61,11 @@ func (u *UserApi) RefreshToken(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
// @Router /system/user/login [post]
func (u *UserApi) Login(rc *ctx.ReqCtx) {
var l form.Login
var l form2.Login
ginx.BindJsonAndValid(rc.GinCtx, &l)
biz.IsTrue(captcha.Verify(l.CaptchaId, l.Captcha), "验证码认证失败")
login := u.UserApp.Login(entity.Login{Username: l.Username, Password: l.Password})
login := u.UserApp.Login(entity2.Login{Username: l.Username, Password: l.Password})
role := u.RoleApp.FindOne(login.RoleId)
token, err := ctx.CreateToken(
@@ -96,7 +96,7 @@ func (u *UserApi) Login(rc *ctx.ReqCtx) {
"expire": time.Now().Unix() + config.Conf.Jwt.ExpireTime,
}
var loginLog entity.LogLogin
var loginLog entity2.LogLogin
ua := user_agent.New(rc.GinCtx.Request.UserAgent())
loginLog.Ipaddr = rc.GinCtx.ClientIP()
loginLog.LoginLocation = utils.GetRealAddressByIP(rc.GinCtx.ClientIP())
@@ -119,7 +119,7 @@ func (u *UserApi) Login(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
// @Router /system/user/logout [post]
func (u *UserApi) LogOut(rc *ctx.ReqCtx) {
var loginLog entity.LogLogin
var loginLog entity2.LogLogin
ua := user_agent.New(rc.GinCtx.Request.UserAgent())
loginLog.Ipaddr = rc.GinCtx.ClientIP()
loginLog.LoginTime = time.Now()
@@ -153,7 +153,7 @@ func (u *UserApi) GetSysUserList(rc *ctx.ReqCtx) {
userName := rc.GinCtx.Query("username")
phone := rc.GinCtx.Query("phone")
deptId := ginx.QueryInt(rc.GinCtx, "deptId", 0)
var user entity.SysUser
var user entity2.SysUser
user.Status = status
user.Username = userName
user.Phone = phone
@@ -176,16 +176,16 @@ func (u *UserApi) GetSysUserList(rc *ctx.ReqCtx) {
// @Security
func (u *UserApi) GetSysUserProfile(rc *ctx.ReqCtx) {
sysUser := entity.SysUser{}
sysUser := entity2.SysUser{}
sysUser.UserId = rc.LoginAccount.UserId
user := u.UserApp.FindOne(sysUser)
//获取角色列表
roleList := u.RoleApp.FindList(entity.SysRole{RoleId: rc.LoginAccount.RoleId})
roleList := u.RoleApp.FindList(entity2.SysRole{RoleId: rc.LoginAccount.RoleId})
//岗位列表
postList := u.PostApp.FindList(entity.SysPost{PostId: rc.LoginAccount.PostId})
postList := u.PostApp.FindList(entity2.SysPost{PostId: rc.LoginAccount.PostId})
//获取部门列表
deptList := u.DeptApp.FindList(entity.SysDept{DeptId: rc.LoginAccount.DeptId})
deptList := u.DeptApp.FindList(entity2.SysDept{DeptId: rc.LoginAccount.DeptId})
postIds := make([]int64, 0)
postIds = append(postIds, rc.LoginAccount.PostId)
@@ -222,7 +222,7 @@ func (u *UserApi) InsetSysUserAvatar(rc *ctx.ReqCtx) {
// 上传文件至指定目录
biz.ErrIsNil(rc.GinCtx.SaveUploadedFile(file, filPath), "保存头像失败")
}
sysuser := entity.SysUser{}
sysuser := entity2.SysUser{}
sysuser.UserId = rc.LoginAccount.UserId
sysuser.Avatar = "/" + filPath
sysuser.UpdateBy = rc.LoginAccount.UserName
@@ -238,10 +238,10 @@ func (u *UserApi) InsetSysUserAvatar(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /system/user/updatePwd [post]
func (u *UserApi) SysUserUpdatePwd(rc *ctx.ReqCtx) {
var pws entity.SysUserPwd
var pws entity2.SysUserPwd
ginx.BindJsonAndValid(rc.GinCtx, &pws)
user := entity.SysUser{}
user := entity2.SysUser{}
user.UserId = rc.LoginAccount.UserId
u.UserApp.SetPwd(user, pws)
}
@@ -256,13 +256,13 @@ func (u *UserApi) SysUserUpdatePwd(rc *ctx.ReqCtx) {
func (u *UserApi) GetSysUser(rc *ctx.ReqCtx) {
userId := ginx.PathParamInt(rc.GinCtx, "userId")
user := entity.SysUser{}
user := entity2.SysUser{}
user.UserId = int64(userId)
result := u.UserApp.FindOne(user)
roles := u.RoleApp.FindList(entity.SysRole{})
roles := u.RoleApp.FindList(entity2.SysRole{})
posts := u.PostApp.FindList(entity.SysPost{})
posts := u.PostApp.FindList(entity2.SysPost{})
rc.ResData = map[string]interface{}{
"data": result,
@@ -280,9 +280,9 @@ func (u *UserApi) GetSysUser(rc *ctx.ReqCtx) {
// @Router /system/user/getInit [get]
// @Security
func (u *UserApi) GetSysUserInit(rc *ctx.ReqCtx) {
roles := u.RoleApp.FindList(entity.SysRole{})
roles := u.RoleApp.FindList(entity2.SysRole{})
posts := u.PostApp.FindList(entity.SysPost{})
posts := u.PostApp.FindList(entity2.SysPost{})
mp := make(map[string]interface{}, 2)
mp["roles"] = roles
mp["posts"] = posts
@@ -296,13 +296,13 @@ func (u *UserApi) GetSysUserInit(rc *ctx.ReqCtx) {
// @Router /system/user/getInit [get]
// @Security
func (u *UserApi) GetUserRolePost(rc *ctx.ReqCtx) {
var user entity.SysUser
var user entity2.SysUser
user.UserId = rc.LoginAccount.UserId
resData := u.UserApp.FindOne(user)
roles := make([]entity.SysRole, 0)
posts := make([]entity.SysPost, 0)
roles := make([]entity2.SysRole, 0)
posts := make([]entity2.SysPost, 0)
for _, roleId := range strings.Split(resData.RoleIds, ",") {
ro := u.RoleApp.FindOne(kgo.KConv.Str2Int64(roleId))
roles = append(roles, *ro)
@@ -327,7 +327,7 @@ func (u *UserApi) GetUserRolePost(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /system/user/sysUser [post]
func (u *UserApi) InsertSysUser(rc *ctx.ReqCtx) {
var sysUser entity.SysUser
var sysUser entity2.SysUser
ginx.BindJsonAndValid(rc.GinCtx, &sysUser)
sysUser.CreateBy = rc.LoginAccount.UserName
u.UserApp.Insert(sysUser)
@@ -343,7 +343,7 @@ func (u *UserApi) InsertSysUser(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /system/user/sysUser [put]
func (u *UserApi) UpdateSysUser(rc *ctx.ReqCtx) {
var sysUser entity.SysUser
var sysUser entity2.SysUser
ginx.BindJsonAndValid(rc.GinCtx, &sysUser)
sysUser.CreateBy = rc.LoginAccount.UserName
u.UserApp.Update(sysUser)
@@ -359,7 +359,7 @@ func (u *UserApi) UpdateSysUser(rc *ctx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
// @Router /system/user/sysUser [put]
func (u *UserApi) UpdateSysUserStu(rc *ctx.ReqCtx) {
var sysUser entity.SysUser
var sysUser entity2.SysUser
ginx.BindJsonAndValid(rc.GinCtx, &sysUser)
sysUser.CreateBy = rc.LoginAccount.UserName
u.UserApp.Update(sysUser)
@@ -392,7 +392,7 @@ func (u *UserApi) ExportUser(rc *ctx.ReqCtx) {
userName := rc.GinCtx.Query("username")
phone := rc.GinCtx.Query("phone")
var user entity.SysUser
var user entity2.SysUser
user.Status = status
user.Username = userName
user.Phone = phone
@@ -409,7 +409,7 @@ func (u *UserApi) ExportUser(rc *ctx.ReqCtx) {
}
// 构建前端路由
func Build(menus []entity.SysMenu) []vo.RouterVo {
func Build(menus []entity2.SysMenu) []vo2.RouterVo {
equals := func(a string, b string) bool {
if a == b {
return true
@@ -419,9 +419,9 @@ func Build(menus []entity.SysMenu) []vo.RouterVo {
if len(menus) == 0 {
}
rvs := make([]vo.RouterVo, 0)
rvs := make([]vo2.RouterVo, 0)
for _, ms := range menus {
var rv vo.RouterVo
var rv vo2.RouterVo
rv.Name = ms.Path
rv.Path = ms.Path
rv.Component = ms.Component
@@ -429,7 +429,7 @@ func Build(menus []entity.SysMenu) []vo.RouterVo {
if ms.Permission != "" {
auth = strings.Split(ms.Permission, ",")
}
rv.Meta = vo.MetaVo{
rv.Meta = vo2.MetaVo{
Title: ms.MenuName,
IsLink: ms.IsLink,
IsHide: equals("1", ms.IsHide),

View File

@@ -2,14 +2,14 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitApiRouter(router *gin.RouterGroup) {
s := &api.SystemApiApi{
ApiApp: services.SysSysApiModelDao,
s := &api2.SystemApiApi{
ApiApp: services2.SysSysApiModelDao,
}
api := router.Group("api")

View File

@@ -2,14 +2,14 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitConfigRouter(router *gin.RouterGroup) {
s := &api.ConfigApi{
ConfigApp: services.SysSysConfigModelDao,
s := &api2.ConfigApi{
ConfigApp: services2.SysSysConfigModelDao,
}
config := router.Group("config")

View File

@@ -2,16 +2,16 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitDeptRouter(router *gin.RouterGroup) {
r := &api.DeptApi{
DeptApp: services.SysDeptModelDao,
RoleApp: services.SysRoleModelDao,
UserApp: services.SysUserModelDao,
r := &api2.DeptApi{
DeptApp: services2.SysDeptModelDao,
RoleApp: services2.SysRoleModelDao,
UserApp: services2.SysUserModelDao,
}
dept := router.Group("dept")

View File

@@ -2,15 +2,15 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitDictRouter(router *gin.RouterGroup) {
s := &api.DictApi{
DictType: services.SysDictTypeModelDao,
DictData: services.SysDictDataModelDao,
s := &api2.DictApi{
DictType: services2.SysDictTypeModelDao,
DictData: services2.SysDictDataModelDao,
}
dict := router.Group("dict")

View File

@@ -2,17 +2,17 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitMenuRouter(router *gin.RouterGroup) {
s := &api.MenuApi{
MenuApp: services.SysMenuModelDao,
RoleApp: services.SysRoleModelDao,
RoleMenuApp: services.SysRoleMenuModelDao,
DeptApp: services.SysDeptModelDao,
s := &api2.MenuApi{
MenuApp: services2.SysMenuModelDao,
RoleApp: services2.SysRoleModelDao,
RoleMenuApp: services2.SysRoleMenuModelDao,
DeptApp: services2.SysDeptModelDao,
}
menu := router.Group("menu")

View File

@@ -2,16 +2,16 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitPostRouter(router *gin.RouterGroup) {
s := &api.PostApi{
PostApp: services.SysPostModelDao,
UserApp: services.SysUserModelDao,
RoleApp: services.SysRoleModelDao,
s := &api2.PostApi{
PostApp: services2.SysPostModelDao,
UserApp: services2.SysUserModelDao,
RoleApp: services2.SysRoleModelDao,
}
post := router.Group("post")

View File

@@ -2,17 +2,17 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitRoleRouter(router *gin.RouterGroup) {
s := &api.RoleApi{
RoleApp: services.SysRoleModelDao,
RoleMenuApp: services.SysRoleMenuModelDao,
RoleDeptApp: services.SysRoleDeptModelDao,
UserApp: services.SysUserModelDao,
s := &api2.RoleApi{
RoleApp: services2.SysRoleModelDao,
RoleMenuApp: services2.SysRoleMenuModelDao,
RoleDeptApp: services2.SysRoleDeptModelDao,
UserApp: services2.SysUserModelDao,
}
role := router.Group("role")

View File

@@ -2,11 +2,11 @@ package router
import (
"github.com/gin-gonic/gin"
"pandax/system/api"
api2 "pandax/apps/system/api"
)
func InitSystemRouter(router *gin.RouterGroup) {
s := &api.System{}
s := &api2.System{}
sys := router.Group("")
{

View File

@@ -2,20 +2,20 @@ package router
import (
"github.com/gin-gonic/gin"
api2 "pandax/apps/system/api"
services2 "pandax/apps/system/services"
"pandax/base/ctx"
"pandax/system/api"
"pandax/system/services"
)
func InitUserRouter(router *gin.RouterGroup) {
s := &api.UserApi{
RoleApp: services.SysRoleModelDao,
MenuApp: services.SysMenuModelDao,
RoleMenuApp: services.SysRoleMenuModelDao,
UserApp: services.SysUserModelDao,
LogLogin: services.LogLoginModelDao,
DeptApp: services.SysDeptModelDao,
PostApp: services.SysPostModelDao,
s := &api2.UserApi{
RoleApp: services2.SysRoleModelDao,
MenuApp: services2.SysMenuModelDao,
RoleMenuApp: services2.SysRoleMenuModelDao,
UserApp: services2.SysUserModelDao,
LogLogin: services2.LogLoginModelDao,
DeptApp: services2.SysDeptModelDao,
PostApp: services2.SysPostModelDao,
}
user := router.Group("user")
// 获取验证码

View File

@@ -3,10 +3,10 @@ package services
import (
"errors"
"gorm.io/gorm"
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/casbin"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -1,9 +1,9 @@
package services
import (
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -2,9 +2,9 @@ package services
import (
"errors"
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -2,9 +2,9 @@ package services
import (
"fmt"
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -2,9 +2,9 @@ package services
import (
"fmt"
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -3,9 +3,9 @@ package services
import (
"github.com/kakuilan/kgo"
"golang.org/x/crypto/bcrypt"
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/global"
"pandax/system/entity"
)
type (

View File

@@ -24,7 +24,7 @@ func GetRealAddressByIP(ip string) string {
if err != nil {
return UNKNOWN
}
//fmt.Sprintf("%s %s",toMap["pro"].(string),toMap["city"].(string))
//log.Println(fmt.Sprintf("%s %s",toMap["pro"].(string),toMap["city"].(string)))
return toMap["addr"].(string)
}

View File

@@ -6,3 +6,8 @@ func TestIdsStrToIdsIntGroup(t *testing.T) {
group := IdsStrToIdsIntGroup("aaa")
t.Log(len(group))
}
func TestGetRealAddressByIP(t *testing.T) {
ip := GetRealAddressByIP("10.42.0.1")
t.Log(ip)
}

View File

@@ -71,7 +71,7 @@ spec:
app.kubernetes.io/version: 1.0.0
spec:
containers:
- image: xmadmin/pandax:v1.0
- image: xmadmin/pandax:v1.1
imagePullPolicy: Always
name: pandax
ports:

1
go.mod
View File

@@ -25,6 +25,7 @@ require (
github.com/mojocn/base64Captcha v1.3.5
github.com/mssola/user_agent v0.5.3
github.com/onsi/ginkgo v1.16.4 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/swaggo/gin-swagger v1.3.3 // indirect
github.com/swaggo/swag v1.7.6

2
go.sum
View File

@@ -236,6 +236,8 @@ github.com/richardlehane/mscfb v1.0.3 h1:rD8TBkYWkObWO0oLDFCbwMeZ4KoalxQy+QgniCj
github.com/richardlehane/mscfb v1.0.3/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1 h1:RfrALnSNXzmXLbGct/P2b4xkFz4e8Gmj/0Vj9M9xC1o=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=

View File

@@ -4,9 +4,11 @@ import (
"fmt"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
logRouter "pandax/apps/log/router"
sysRouter "pandax/apps/system/router"
"pandax/base/config"
"pandax/middleware"
sysRouter "pandax/system/router"
_ "pandax/docs"
@@ -67,7 +69,7 @@ func InitRouter() *gin.Engine {
//日志系统
log := router.Group("log")
{
sysRouter.InitLogRouter(log)
logRouter.InitLogRouter(log)
}
return router
}

View File

@@ -1,11 +1,11 @@
package initialize
import (
"pandax/apps/system/entity"
"pandax/base/biz"
"pandax/base/casbin"
"pandax/base/config"
"pandax/base/global"
"pandax/system/entity"
)
// 初始化时如果没有表创建表

View File

@@ -2,10 +2,10 @@ package middleware
import (
"net/http"
"pandax/apps/system/entity"
"pandax/apps/system/services"
"pandax/base/ctx"
"pandax/base/utils"
"pandax/system/entity"
"pandax/system/services"
)
func OperationHandler(rc *ctx.ReqCtx) error {

BIN
pandax

Binary file not shown.

View File

@@ -14,9 +14,9 @@
/>
<link rel="icon" href="./favicon.ico" />
<title>PandaUi</title>
<script type="module" crossorigin src="./assets/index.da9d3a49.js"></script>
<script type="module" crossorigin src="./assets/index.ccb80848.js"></script>
<link rel="modulepreload" href="./assets/vendor.14d7a511.js">
<link rel="stylesheet" href="./assets/index.d93ef0fd.css">
<link rel="stylesheet" href="./assets/index.e1169f65.css">
</head>
<body>
<div id="app"></div>