Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
ef73d1ac2b
|
@ -0,0 +1,44 @@
|
|||
|
||||
## 使用官方Go镜像作为构建环境
|
||||
#FROM golang:1.21.0 AS builder
|
||||
#
|
||||
## 设置工作目录
|
||||
#WORKDIR /app
|
||||
#
|
||||
## 复制项目源码
|
||||
#COPY . .
|
||||
#
|
||||
## 复制go模块依赖文件
|
||||
#COPY go.mod go.sum ./
|
||||
#
|
||||
## 安装go模块依赖
|
||||
#RUN go env -w GOPROXY=https://goproxy.cn,direct
|
||||
#RUN go mod tidy
|
||||
#
|
||||
## 编译Go应用程序,生成静态链接的二进制文件
|
||||
#RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o server .
|
||||
|
||||
# 创建最终镜像,用于运行编译后的Go程序
|
||||
FROM alpine
|
||||
|
||||
RUN echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/main' > /etc/apk/repositories \
|
||||
&& echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/community' >>/etc/apk/repositories \
|
||||
&& apk update && apk add tzdata \
|
||||
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone \
|
||||
|
||||
ENV server = "admin"
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 将编译好的二进制文件从构建阶段复制到运行阶段
|
||||
COPY /server .
|
||||
#COPY --from=builder /app/server .
|
||||
COPY .env .
|
||||
COPY ./front ./front
|
||||
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
# 设置容器启动时运行的命令
|
||||
ENTRYPOINT ["/app/server", "-a", "$server"]
|
|
@ -27,28 +27,29 @@ type ReportChannelList struct {
|
|||
UpdateTime []time.Time `json:"update_time" form:"update_time"`
|
||||
}
|
||||
|
||||
func (this *ReportChannelListRequest) Request2DB() (db ReportChannelList, err error) {
|
||||
db.ReportChannelId = this.ReportChannelId
|
||||
db.ClientKey = this.ClientKey
|
||||
db.ClientSecret = this.ClientSecret
|
||||
db.Status = this.Status
|
||||
db.CreateTime = []time.Time{}
|
||||
func (this *ReportChannelListRequest) Request2DB() (filter ReportChannelList, err error) {
|
||||
filter.PageRequest = this.PageRequest
|
||||
filter.ReportChannelId = this.ReportChannelId
|
||||
filter.ClientKey = this.ClientKey
|
||||
filter.ClientSecret = this.ClientSecret
|
||||
filter.Status = this.Status
|
||||
filter.CreateTime = []time.Time{}
|
||||
var t time.Time
|
||||
if len(this.CreateTime) == 2 {
|
||||
t, err = utils.StrToTimeShanghai(this.CreateTime[0])
|
||||
db.CreateTime = append(db.CreateTime, t)
|
||||
filter.CreateTime = append(filter.CreateTime, t)
|
||||
t, err = utils.StrToTimeShanghai(this.CreateTime[1])
|
||||
db.CreateTime = append(db.CreateTime, t)
|
||||
filter.CreateTime = append(filter.CreateTime, t)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
db.UpdateTime = []time.Time{}
|
||||
filter.UpdateTime = []time.Time{}
|
||||
if len(this.UpdateTime) == 2 {
|
||||
t, err = utils.StrToTimeShanghai(this.UpdateTime[0])
|
||||
db.UpdateTime = append(db.UpdateTime, t)
|
||||
filter.UpdateTime = append(filter.UpdateTime, t)
|
||||
t, err = utils.StrToTimeShanghai(this.UpdateTime[1])
|
||||
db.UpdateTime = append(db.UpdateTime, t)
|
||||
filter.UpdateTime = append(filter.UpdateTime, t)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package croncmdmodel
|
||||
|
||||
import (
|
||||
"github.com/qit-team/snow-core/db"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
once sync.Once
|
||||
m *CronCmdModel
|
||||
)
|
||||
|
||||
// 实体
|
||||
type CronCmd struct {
|
||||
CmdId string `xorm:"'cmd_id' UNSIGNED INT"`
|
||||
CmdName string `xorm:"'cmd_name' varchar(20)"`
|
||||
UserIds string `xorm:"'user_ids' varchar(50)"`
|
||||
EntryId int `xorm:"'entry_id' int(10)"`
|
||||
ReadDbId int `xorm:"'read_db_id' int(10)"`
|
||||
WriteDbId int `xorm:"'write_db_id' int(11)"`
|
||||
ExecuteType int `xorm:"'execute_type' TINYINT"`
|
||||
ExecuteRead string `xorm:"'execute_read' TEXT"`
|
||||
ExecuteWrite string `xorm:"'execute_write' TEXT"`
|
||||
Cron string `xorm:"'cron' varchar(64)"`
|
||||
MatchJson string `xorm:"'match_json' JSON"`
|
||||
SendTimeType int `xorm:"'send_time_type' TINYINT"`
|
||||
SendLimit int `xorm:"'send_limit' SMALLINT"`
|
||||
ReportChannelId int `xorm:"'report_channel_id' int(11)"`
|
||||
CreateTime time.Time `xorm:"'create_time' datetime"`
|
||||
UpdateTime time.Time `xorm:"'update_time' timestamp"`
|
||||
Status int `xorm:"'status' TINYINT"`
|
||||
FailReason string `xorm:"'fail_reason' varchar(200)"`
|
||||
DeletedTime time.Time `xorm:"'deleted_time' datetime"`
|
||||
}
|
||||
|
||||
// 表名
|
||||
func (m *CronCmd) TableName() string {
|
||||
return "cron_cmd"
|
||||
}
|
||||
|
||||
// 私有化,防止被外部new
|
||||
type CronCmdModel struct {
|
||||
db.Model //组合基础Model,集成基础Model的属性和方法
|
||||
}
|
||||
|
||||
// 单例模式
|
||||
func GetInstance() *CronCmdModel {
|
||||
once.Do(func() {
|
||||
m = new(CronCmdModel)
|
||||
//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
|
||||
})
|
||||
return m
|
||||
}
|
Loading…
Reference in New Issue