﻿package main

import (
	"log"

	"verification-platform-backend/internal/database"
	"verification-platform-backend/internal/model"
)

func main() {
	database.Init()

	var codes []model.DynamicCode
	if err := database.DB.Limit(2).Find(&codes).Error; err != nil {
		log.Fatal("查询失败:", err)
	}

	for _, code := range codes {
		log.Printf("=== %s (key: %s) ===", code.Name, code.Key)
		log.Printf("代码长度: %d", len(code.Code))
		log.Printf("代码前200字符:\n%s", code.Code[:min(200, len(code.Code))])
		log.Println()
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
