use base context to handle the cases where the user IP address is unavailable

This commit is contained in:
MaysWind
2026-04-09 23:44:53 +08:00
parent fcedb3147d
commit d44798bf0f
6 changed files with 18 additions and 2 deletions
+5
View File
@@ -14,6 +14,11 @@ type CronContext struct {
cronJobInterval time.Duration
}
// ClientIP returns the client IP address, for cron job context, it always returns the loopback address
func (c *CronContext) ClientIP() string {
return "127.0.0.1"
}
// GetContextId returns the current context id
func (c *CronContext) GetContextId() string {
return c.contextId