代码拉取完成,页面将自动刷新
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())
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。