86 lines
3.1 KiB
Go
86 lines
3.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bindbox-game/configs"
|
|
"bindbox-game/internal/repository/mysql"
|
|
"bindbox-game/internal/repository/mysql/model"
|
|
"flag"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
// Initialize config
|
|
configs.Init()
|
|
|
|
// Initialize MySQL
|
|
dbRepo, err := mysql.New()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
db := dbRepo.GetDbR()
|
|
|
|
startTime, _ := time.ParseInLocation("2006-01-02", "2026-01-19", time.Local)
|
|
endTime := startTime.Add(24 * time.Hour)
|
|
|
|
fmt.Printf("Checking for refunds between %v and %v\n", startTime, endTime)
|
|
|
|
var orders []model.Orders
|
|
// Check by UpdateAt (refund implies an update)
|
|
// Or just check Status=4 and CreatedAt (if refunded same day) or check Status=4 generally if it impacts that day's stats.
|
|
// Usually "Daily Stats" for 19th means events that happened on the 19th.
|
|
// Since the user image shows "Refund: 0", it means no refunds *attributed* to that day.
|
|
// Attribution could be by Order Creation Date or Refund Date.
|
|
// Let's check ANY order with status 4.
|
|
|
|
db.Where("status = ?", 4).
|
|
Where("updated_at >= ? AND updated_at < ?", startTime, endTime).
|
|
Find(&orders)
|
|
|
|
fmt.Printf("Found %d orders marked as Refunded (status=4) updated on 2026-01-19:\n", len(orders))
|
|
for _, o := range orders {
|
|
fmt.Printf("ID: %d, OrderNo: %s, Amount: %d, CreatedAt: %v, UpdatedAt: %v\n", o.ID, o.OrderNo, o.ActualAmount, o.CreatedAt, o.UpdatedAt)
|
|
}
|
|
|
|
// Also check created_at on that day for any order that is NOW status 4
|
|
var createdOrders []model.Orders
|
|
db.Where("status = ?", 4).
|
|
Where("created_at >= ? AND created_at < ?", startTime, endTime).
|
|
Find(&createdOrders)
|
|
|
|
fmt.Printf("Found %d orders created on 2026-01-19 that are currently Refunded (status=4):\n", len(createdOrders))
|
|
for _, o := range createdOrders {
|
|
fmt.Printf("ID: %d, OrderNo: %s, Amount: %d, SourceType: %d, Remark: %s, CreatedAt: %v\n", o.ID, o.OrderNo, o.ActualAmount, o.SourceType, o.Remark, o.CreatedAt)
|
|
}
|
|
|
|
// Check Douyin Orders
|
|
var douyinOrders []model.DouyinOrders
|
|
// OrderStatus 4 might be refund in DouyinOrders context if the code is correct.
|
|
// Let's check for any Status=4 in DouyinOrders on the 19th.
|
|
// Since DouyinOrders struct in gen.go has Clean fields, we can use it.
|
|
// Note: created_at might be in UTC or local, check logic.
|
|
// But let's just query by range.
|
|
db.Where("order_status = ?", 4).
|
|
Where("updated_at >= ? AND updated_at < ?", startTime, endTime).
|
|
Find(&douyinOrders)
|
|
|
|
fmt.Printf("Found %d refunded Douyin orders (status=4) updated on 2026-01-19:\n", len(douyinOrders))
|
|
for _, o := range douyinOrders {
|
|
fmt.Printf("ID: %v, ShopOrderID: %s, PayAmount: %d, UpdatedAt: %v\n", o.ID, o.ShopOrderID, o.ActualPayAmount, o.UpdatedAt)
|
|
}
|
|
|
|
// Also check created_at for Douyin Orders
|
|
var createdDouyinOrders []model.DouyinOrders
|
|
db.Where("order_status = ?", 4).
|
|
Where("created_at >= ? AND created_at < ?", startTime, endTime).
|
|
Find(&createdDouyinOrders)
|
|
|
|
fmt.Printf("Found %d refunded Douyin orders (status=4) created on 2026-01-19:\n", len(createdDouyinOrders))
|
|
for _, o := range createdDouyinOrders {
|
|
fmt.Printf("ID: %v, ShopOrderID: %s, PayAmount: %d, CreatedAt: %v, UpdatedAt: %v\n", o.ID, o.ShopOrderID, o.ActualPayAmount, o.CreatedAt, o.UpdatedAt)
|
|
}
|
|
}
|