2026-05-02 17:48:58 +08:00
|
|
|
package main
|
2026-04-30 20:54:02 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"log"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"verification-platform-backend/internal/database"
|
|
|
|
|
"verification-platform-backend/internal/model"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
database.Init()
|
|
|
|
|
|
|
|
|
|
var code model.DynamicCode
|
|
|
|
|
if err := database.DB.Where("key = ?", "test_push").First(&code).Error; err != nil {
|
|
|
|
|
log.Fatal("查询失败:", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fmt.Printf("ID: %d\n", code.ID)
|
|
|
|
|
fmt.Printf("Name: %s\n", code.Name)
|
|
|
|
|
fmt.Printf("Code length: %d\n", len(code.Code))
|
|
|
|
|
fmt.Printf("Contains newline: %v\n", strings.Contains(code.Code, "\n"))
|
|
|
|
|
fmt.Printf("Contains \\n literal: %v\n", strings.Contains(code.Code, "\\n"))
|
|
|
|
|
fmt.Printf("\n=== Raw Code ===\n")
|
|
|
|
|
fmt.Printf("%s\n", code.Code)
|
|
|
|
|
fmt.Printf("\n=== Code bytes (first 100) ===\n")
|
|
|
|
|
for i, b := range []byte(code.Code) {
|
|
|
|
|
if i >= 100 {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
if b == '\n' {
|
|
|
|
|
fmt.Printf("[\\n]")
|
|
|
|
|
} else if b == '\r' {
|
|
|
|
|
fmt.Printf("[\\r]")
|
|
|
|
|
} else if b >= 32 && b < 127 {
|
|
|
|
|
fmt.Printf("%c", b)
|
|
|
|
|
} else {
|
|
|
|
|
fmt.Printf("[%d]", b)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fmt.Println()
|
|
|
|
|
}
|