feat: 固定创建真实采购任务 (#112)

This commit is contained in:
chengma
2026-08-10 17:52:48 +08:00
parent 29b4491afe
commit e1b32ea024
20 changed files with 185 additions and 82 deletions
+12
View File
@@ -22,6 +22,18 @@ func ClientPurchaseMode(q Execer, clientID string) (string, error) {
return ParseClientPurchaseMode(raw.String), nil
}
// ClientSeenAfter 判断客户端是否在指定 UTC 时间之后上报过活动。
func ClientSeenAfter(q Execer, clientID, cutoff string) (bool, error) {
var online bool
if err := q.QueryRow(
`SELECT EXISTS(SELECT 1 FROM clients WHERE client_id = ? AND last_seen_at >= ?)`,
clientID, cutoff,
).Scan(&online); err != nil {
return false, fmt.Errorf("检查客户端 %s 在线状态失败: %w", clientID, err)
}
return online, nil
}
// ParseClientPurchaseMode 把登记能力转成安全的固定值,供列表和创建校验共用。
func ParseClientPurchaseMode(raw string) string {
var capabilities struct {