Some checks failed
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Failing after 35s
- 新增新房预售证表 house_presale 存储预售许可信息 - 为 house_community 表添加 avg_price 字段存储小区参考均价 - 增强服务器操作审计日志功能,新增管理员账号、IP归属地、错误信息、UA等字段 - 实现纯Go版IP归属地离线解析器,无外部依赖,支持二分查找 - 优化看房列表查询逻辑,修复Fields设置位置导致的SQL语法错误 - 集成招聘模块,添加独立数据库配置和Bark推送服务支持 - 重构日志查询接口,支持多维度筛选和综合分页列表展示 - 更新DAO实体结构同步数据库表结构调整
29 lines
914 B
Go
29 lines
914 B
Go
package recruitment
|
||
|
||
import (
|
||
"context"
|
||
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
"github.com/gogf/gf/v2/os/gcron"
|
||
)
|
||
|
||
// StartScheduler 注册定时任务:每日 03:00 增量抓取全部启用源,08:00 推送招聘早报。
|
||
// 调度器随 service 进程常驻,不额外引入系统 crontab。
|
||
func StartScheduler(ctx context.Context) {
|
||
if _, err := gcron.Add(ctx, "0 3 * * *", func(c context.Context) {
|
||
_, summary, e := Recruitment().Trigger(c, 0, false)
|
||
if e != nil {
|
||
g.Log().Errorf(c, "recruit daily crawl failed: %v", e)
|
||
} else {
|
||
g.Log().Infof(c, "recruit daily crawl done: %s", summary)
|
||
}
|
||
}, "recruit-crawl-daily"); err != nil {
|
||
g.Log().Errorf(ctx, "add recruit crawl cron failed: %v", err)
|
||
}
|
||
if _, err := gcron.Add(ctx, "0 8 * * *", func(c context.Context) {
|
||
sendDailyDigest(c)
|
||
}, "recruit-push-daily"); err != nil {
|
||
g.Log().Errorf(ctx, "add recruit push cron failed: %v", err)
|
||
}
|
||
}
|