1 Star 0 Fork 0

micro-tools/micro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
client.go 803 Bytes
一键复制 编辑 原始数据 按行查看 历史
545403892 提交于 2023-06-05 23:58 +08:00 . init
package main
import (
"gitee.com/micro-tools/micro/module"
"gitee.com/micro-tools/micro/module/base"
"gitee.com/micro-tools/wf/os/gtimer"
"time"
)
type Client struct {
base.Module
}
func New() module.Module {
this := new(Client)
return this
}
func (c *Client) GetType() string {
return "client"
}
func (c *Client) OnInit(app module.App) {
c.Module.OnInit(c, app)
gtimer.SetInterval(time.Second*5, func() {
c.Request1()
})
//gtimer.SetInterval(time.Second*5, func() {
// c.Request2()
//})
}
func (c *Client) Run(closeSig chan bool) {
c.App.Logger().Infof("%s模块运行中...", c.GetType())
<-closeSig
c.App.Logger().Infof("%s模块已停止...", c.GetType())
}
func (c *Client) OnDestroy() {
c.Module.OnDestroy()
c.App.Logger().Infof("%s模块已回收...", c.GetType())
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/micro-tools/micro.git
git@gitee.com:micro-tools/micro.git
micro-tools
micro
micro
v1.0.2

搜索帮助