BaseSystemMission

package
v5.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReginSub

func ReginSub(mission *Mission, handle func())

ReginSub 快速订阅

func ReginWait

func ReginWait(mission *Mission, nextAt time.Time)

ReginWait 注册新的挂靠

func Run

func Run()

Run 调度程序保护器

Types

type ArgsGetMissionList

type ArgsGetMissionList struct {
	//分页
	Pages CoreSQL2.ArgsPages `json:"pages"`
	//组织ID
	OrgID int64 `db:"org_id" json:"orgID" check:"id" empty:"true"`
	//搜索
	Search string `json:"search" check:"search" empty:"true"`
}

ArgsGetMissionList 获取服务列表参数

type FieldsMission

type FieldsMission struct {
	//ID
	ID int64 `db:"id" json:"id" unique:"true"`
	//更新时间
	UpdateAt time.Time `db:"update_at" json:"updateAt" default:"now()"`
	//组织ID
	// 如果为0则为系统服务
	OrgID int64 `db:"org_id" json:"orgID" check:"id" empty:"true" index:"true"`
	//任务名称
	Name string `db:"name" json:"name" check:"des" min:"1" max:"300" empty:"true"`
	//标识码
	Mark string `db:"mark" json:"mark" check:"mark"`
	//开始时间
	StartAt time.Time `db:"start_at" json:"startAt" default:"0"`
	//当前执行提示
	NowTip string `db:"now_tip" json:"nowTip" check:"des" min:"1" max:"1000" empty:"true"`
	//停止时间
	StopAt time.Time `db:"stop_at" json:"stopAt" default:"0"`
	//暂停时间
	PauseAt time.Time `db:"pause_at" json:"pauseAt" default:"0"`
	//暂停位置
	Location string `db:"location" json:"location" check:"des" min:"1" max:"1000" empty:"true"`
	//总数量
	AllCount int64 `db:"all_count" json:"allCount"`
	//已经执行数量
	RunCount int64 `db:"run_count" json:"runCount"`
	//总消耗时间秒
	RunAllSec int64 `db:"run_all_sec" json:"runAllSec"`
	//计划执行时间
	NextTime string `db:"next_time" json:"nextTime"`
}

FieldsMission 任务记录

func GetMissionByMark

func GetMissionByMark(orgID int64, mark string) (data FieldsMission)

GetMissionByMark 获取指定服务

func GetMissionList

func GetMissionList(args *ArgsGetMissionList) (dataList []FieldsMission, dataCount int64, err error)

GetMissionList 获取服务列表

type Mission

type Mission struct {
	//组织ID
	// 如果为0则为系统服务
	OrgID int64 `db:"org_id" json:"orgID"`
	//任务名称
	Name string `db:"name" json:"name"`
	//标识码
	Mark string `db:"mark" json:"mark"`
	//计划执行时间
	NextTime string `db:"next_time" json:"nextTime"`

	//挂靠模式,本模块主动触发形式
	Bind MissionBind
	// contains filtered or unexported fields
}

Mission 初始化方法

func (*Mission) Do

func (t *Mission) Do()

Do 触发器

func (*Mission) Finish

func (t *Mission) Finish()

Finish 完成一轮执行

func (*Mission) IsStop

func (t *Mission) IsStop() bool

IsStop 是否停止

func (*Mission) Pause

func (t *Mission) Pause()

Pause 暂停任务

func (*Mission) Start

func (t *Mission) Start(nowTip string, location string, allCount int64)

Start 开始任务

func (*Mission) Stop

func (t *Mission) Stop()

Stop 停止任务

func (*Mission) Update

func (t *Mission) Update(nowTip string, location string, runCount int64)

Update 更新执行情况

func (*Mission) UpdateAddTotal

func (t *Mission) UpdateAddTotal(allCount int64)

UpdateAddTotal 更新总量情况

func (*Mission) UpdateBlockTime

func (t *Mission) UpdateBlockTime(sec int)

UpdateBlockTime 修改拦截器时间

func (*Mission) UpdateTotal

func (t *Mission) UpdateTotal(allCount int64)

UpdateTotal 更新总量情况

type MissionBind

type MissionBind struct {
	//消息标识码
	NatsCode string
	//触发消息地址
	NatsMsg string
	// contains filtered or unexported fields
}

func (*MissionBind) Finish

func (t *MissionBind) Finish()

func (*MissionBind) IsStart

func (t *MissionBind) IsStart() bool

IsStart 检查是否正在执行

func (*MissionBind) NeedStart

func (t *MissionBind) NeedStart() bool

NeedStart 是否需要开始执行

func (*MissionBind) Start

func (t *MissionBind) Start()

Start 开始执行

func (*MissionBind) UpdateNextAt

func (t *MissionBind) UpdateNextAt(nextAt time.Time)

UpdateNextAt 更新下一次执行时间

func (*MissionBind) UpdateNextAtFutureDay

func (t *MissionBind) UpdateNextAtFutureDay(day, hour, minute, sec int)

UpdateNextAtFutureDay 更新下一次执行时间到未来某一天

func (*MissionBind) UpdateNextAtFutureHour

func (t *MissionBind) UpdateNextAtFutureHour(hour, minute, sec int)

UpdateNextAtFutureHour 更新下一次执行时间到明天指定时间

func (*MissionBind) UpdateNextAtFutureMonth

func (t *MissionBind) UpdateNextAtFutureMonth(month, day, hour, minute, sec int)

UpdateNextAtFutureMonth 更新下一次执行时间到未来某月

func (*MissionBind) UpdateNextAtFutureSec

func (t *MissionBind) UpdateNextAtFutureSec(sec int)

UpdateNextAtFutureSec 更新下一次执行时间未来几秒

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL