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

33 lines
685 B
Go

package main
import (
"bindbox-game/configs"
"bindbox-game/internal/repository/mysql"
"bindbox-game/internal/repository/mysql/dao"
"context"
"flag"
"fmt"
)
func main() {
flag.Parse()
// 初始化配置
configs.Init()
// 初始化数据库
db, err := mysql.New()
if err != nil {
panic(err)
}
// 查询ID为22的优惠券
coupon, err := dao.Use(db.GetDbR()).SystemCoupons.WithContext(context.Background()).Where(dao.Use(db.GetDbR()).SystemCoupons.ID.Eq(22)).First()
if err != nil {
fmt.Printf("Error querying coupon 22: %v\n", err)
return
}
fmt.Printf("Coupon 22: Name=%s, Status=%d, ShowInMiniapp=%d\n", coupon.Name, coupon.Status, coupon.ShowInMiniapp)
}