Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xpkg
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xpkg
Commits
290e6fd6
提交
290e6fd6
authored
9月 19, 2025
作者:
mooncake9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
new dao
上级
f1fff87e
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
16 行增加
和
85 行删除
+16
-85
init.go
database/init.go
+6
-0
odao.go
xcommon/odao/odao.go
+7
-0
cron_job.go
xcron/controller/cron_job.go
+3
-2
swagger.go
xcron/types/swagger.go
+0
-83
没有找到文件。
database/init.go
浏览文件 @
290e6fd6
...
...
@@ -55,6 +55,12 @@ type XDB struct {
Schema
string
}
func
NewDB
(
schema
string
)
*
XDB
{
return
&
XDB
{
Schema
:
schema
,
}
}
func
(
x
XDB
)
DB
()
*
sgorm
.
DB
{
return
DB
(
x
.
Schema
)
}
...
...
xcommon/odao/odao.go
浏览文件 @
290e6fd6
...
...
@@ -37,6 +37,13 @@ type ODao[T ocache.IID] struct {
Sf
*
singleflight
.
Group
}
func
NewDao
[
T
ocache
.
IID
](
schema
string
)
*
ODao
[
T
]
{
return
&
ODao
[
T
]{
XDB
:
database
.
NewDB
(
schema
),
Sf
:
new
(
singleflight
.
Group
),
}
}
func
(
x
*
ODao
[
T
])
deleteCache
(
ctx
context
.
Context
,
id
xsf
.
ID
)
error
{
if
id
<=
0
{
return
nil
...
...
xcron/controller/cron_job.go
浏览文件 @
290e6fd6
...
...
@@ -8,6 +8,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/go-redsync/redsync/v4"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/request"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/gocron"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/logger"
...
...
@@ -125,7 +126,7 @@ func (x *cronJobController) Create(c *gin.Context) {
}
func
(
x
*
cronJobController
)
DeleteByID
(
c
*
gin
.
Context
)
{
in
:=
&
types
.
BaseIDReq
{}
in
:=
&
request
.
BaseIDReq
{}
if
err
:=
x
.
Bind
(
c
,
in
);
err
!=
nil
{
response
.
Error
(
c
,
err
)
return
...
...
@@ -151,7 +152,7 @@ func (x *cronJobController) UpdateByID(c *gin.Context) {
}
func
(
x
*
cronJobController
)
GetByID
(
c
*
gin
.
Context
)
{
in
:=
&
types
.
BaseIDReq
{}
in
:=
&
request
.
BaseIDReq
{}
if
err
:=
x
.
Bind
(
c
,
in
);
err
!=
nil
{
response
.
Error
(
c
,
err
)
return
...
...
xcron/types/swagger.go
deleted
100644 → 0
浏览文件 @
f1fff87e
// Package types define the structure of request parameters and return results in this package
package
types
import
(
"math"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/xsf"
)
var
(
InvalidParams
=
errcode
.
InvalidParams
)
const
(
LastIDLimit
=
1000
)
var
(
LastIDMax
=
xsf
.
ParseInt64
(
math
.
MaxInt64
)
)
type
Result
struct
{
Code
int
`json:"code" form:"code" example:"1" validate:"required"`
// 返回码 return code
Msg
string
`json:"message" form:"message" example:"OK" validate:"required"`
// 提示信息 information description
Data
interface
{}
`json:"data" form:"data"`
// 数据 data
}
type
Params
struct
{
PageIndex
int
`json:"page" form:"page" validate:"required" example:"1"`
//
PageSize
int
`json:"pageSize" form:"pageSize" validate:"required" example:"10"`
//
Sort
string
`json:"sort,omitempty" form:"sort,omitempty" validate:"required" example:"id"`
//
Columns
[]
Column
`json:"columns,omitempty" form:"columns,omitempty"`
//
}
type
Column
struct
{
Name
string
`json:"name" form:"name" validate:"required" example:"id"`
Exp
string
`json:"exp" form:"exp" validate:"required" example:"="`
// 表达式, 默认 = , 有 =, !=, >, >=, <, <=, like
Value
interface
{}
`json:"value" form:"value" validate:"required" example:"102"`
//
Logic
string
`json:"logic" form:"logic" example:"and"`
// 逻辑, 默认 "and", 支持 &, and, ||, or
}
type
Conditions
struct
{
Columns
[]
Column
`json:"columns" form:"columns"`
// columns info
}
type
BaseReply
struct
{
response
.
Result
}
type
BaseIDReq
struct
{
ID
xsf
.
ID
`json:"id" form:"id" swaggertype:"string" validate:"required" example:"1"`
// id
}
func
(
x
*
BaseIDReq
)
Valid
()
error
{
if
x
.
ID
<=
0
{
return
xerror
.
NewC
(
InvalidParams
.
Code
(),
"参数[id]不合法"
)
}
return
nil
}
// BaseIDsReq request params
type
BaseIDsReq
struct
{
IDs
[]
xsf
.
ID
`json:"ids" swaggertype:"array,string" form:"ids" validate:"required" example:"1" binding:"min=1"`
// id list
}
func
(
x
BaseIDsReq
)
Valid
()
error
{
if
len
(
x
.
IDs
)
==
0
{
return
xerror
.
NewC
(
InvalidParams
.
Code
(),
"参数[ids]不能为空"
)
}
return
nil
}
type
BasePageReply
struct
{
List
[]
any
`json:"list" form:"list"`
//
Total
int64
`json:"total" form:"total" example:"2000"`
//
}
type
BaseListReply
struct
{
List
[]
any
`json:"list" form:"list"`
//
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论