feat(schedule): support KOL subscription targets and random time windows
Extend schedule tasks to dispatch KOL subscription prompts in addition to prompt rules, add daily/weekly scheduling with fixed or random time windows, and track dispatch outcomes (last run, status, consecutive failures). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,6 @@ package app
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
@@ -201,8 +200,8 @@ func (s *InstantTaskService) List(ctx context.Context, params InstantTaskListPar
|
||||
return nil, response.ErrInternal(50010, "scan_failed", err.Error())
|
||||
}
|
||||
|
||||
item.ExecutionTime = stringPtrFromDBValue(executionAt)
|
||||
item.CreatedAt = fmt.Sprintf("%v", createdAt)
|
||||
item.ExecutionTime = timeStringPtrFromDBValue(executionAt)
|
||||
item.CreatedAt = timeStringFromDBValue(createdAt)
|
||||
item.Articles = parseInstantTaskArticleLinks(articlesJSON)
|
||||
autoPublishPlatforms, err := loadScheduleAutoPublishPlatforms(ctx, s.pool, actor.TenantID, inputParamsJSON)
|
||||
if err != nil {
|
||||
@@ -228,14 +227,6 @@ func (s *InstantTaskService) List(ctx context.Context, params InstantTaskListPar
|
||||
}, nil
|
||||
}
|
||||
|
||||
func stringPtrFromDBValue(value interface{}) *string {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
text := fmt.Sprintf("%v", value)
|
||||
return &text
|
||||
}
|
||||
|
||||
func parseJSONMap(raw []byte) (map[string]interface{}, error) {
|
||||
if len(raw) == 0 {
|
||||
return map[string]interface{}{}, nil
|
||||
|
||||
Reference in New Issue
Block a user