2026-02-18 23:23:34 +08:00

57 lines
1.2 KiB
Go

package main
import (
"fmt"
"os"
driver "gorm.io/driver/mysql"
"gorm.io/gorm"
)
type TaskTier struct {
ID int64
TaskID int64
ActivityID int64
Threshold int64
}
func main() {
dsn := os.Getenv("DSN")
if dsn == "" {
dsn = "root:bindbox2025kdy@tcp(150.158.78.154:3306)/dev_game?charset=utf8mb4&parseTime=True&loc=Local"
}
db, err := gorm.Open(driver.Open(dsn), &gorm.Config{})
if err != nil {
fmt.Printf("Error connecting to DB: %v\n", err)
return
}
taskID := 270
fmt.Printf("Inspecting Task %d...\n", taskID)
var tiers []TaskTier
db.Table("task_center_task_tiers").Where("task_id = ?", taskID).Find(&tiers)
if len(tiers) == 0 {
fmt.Println("No tiers found for this task.")
return
}
hasActivity := false
for _, t := range tiers {
fmt.Printf("- Tier ID: %d, Activity ID: %d, Threshold: %d\n", t.ID, t.ActivityID, t.Threshold)
if t.ActivityID > 0 {
hasActivity = true
}
}
if !hasActivity {
fmt.Println("\nResult: This is a GLOBAL Task (No specific Activity ID linked).")
fmt.Println("Expectation: `sub_progress` should be empty.")
} else {
fmt.Println("\nResult: This is an ACTIVITY Task.")
fmt.Println("Expectation: `sub_progress` should be populated if orders exist.")
}
}