2025-06-23 12:24:23 +08:00
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
|
2025-12-31 16:20:01 +08:00
|
|
|
|
"golang.org/x/crypto/bcrypt"
|
2025-07-06 01:49:19 +08:00
|
|
|
|
|
2025-11-29 19:26:56 +08:00
|
|
|
|
"blazing/common/data/xmlres"
|
2025-06-23 12:24:23 +08:00
|
|
|
|
_ "blazing/contrib/files/local"
|
2025-11-17 21:45:45 +00:00
|
|
|
|
"blazing/login/internal/cmd"
|
2025-06-23 12:24:23 +08:00
|
|
|
|
|
|
|
|
|
|
// Minio,按需启用
|
|
|
|
|
|
// _ "blazing/contrib/files/minio"
|
|
|
|
|
|
|
|
|
|
|
|
// 阿里云OSS,按需启用
|
|
|
|
|
|
// _ "blazing/contrib/files/oss"
|
|
|
|
|
|
|
|
|
|
|
|
// _ "blazing/contrib/drivers/sqlite"
|
|
|
|
|
|
|
2025-07-04 19:40:01 +08:00
|
|
|
|
//_ "blazing/contrib/drivers/mysql"
|
2025-06-23 12:24:23 +08:00
|
|
|
|
|
|
|
|
|
|
_ "blazing/modules"
|
|
|
|
|
|
|
2025-08-27 20:52:15 +00:00
|
|
|
|
"github.com/gogf/gf/v2/os/gctx"
|
2025-06-23 12:24:23 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
2025-11-29 19:26:56 +08:00
|
|
|
|
func init() {
|
|
|
|
|
|
xmlres.Initfile()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-23 12:24:23 +08:00
|
|
|
|
func main() {
|
2026-02-14 13:15:10 +08:00
|
|
|
|
|
2026-01-03 10:20:36 +00:00
|
|
|
|
// err := service.RemoteExecuteScript(ip, sshPort, user, password, scriptPort)
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
// log.Fatal(err)
|
|
|
|
|
|
// }
|
2025-12-31 16:20:01 +08:00
|
|
|
|
// 调用方法
|
|
|
|
|
|
// userInfo, err := service.GetUserInfo("694425176@qq.com", "qq694425176")
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
// log.Fatal(err)
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// // 输出结果
|
|
|
|
|
|
// fmt.Printf("用户名: %s\n", userInfo.Data.Attributes.Username)
|
|
|
|
|
|
// fmt.Printf("显示名: %s\n", userInfo.Data.Attributes.DisplayName)
|
|
|
|
|
|
// fmt.Printf("头像: %s\n", userInfo.Data.Attributes.AvatarUrl)
|
|
|
|
|
|
// fmt.Printf("加入时间: %s\n", userInfo.Data.Attributes.JoinTime)
|
|
|
|
|
|
// fmt.Printf("金钱: %.2f\n", userInfo.Data.Attributes.Money)
|
|
|
|
|
|
// fmt.Printf("用户组: %s\n", userInfo.Included[0].Attributes.NameSingular)
|
|
|
|
|
|
// password := "12345678"
|
|
|
|
|
|
|
|
|
|
|
|
// // 哈希密码
|
|
|
|
|
|
// hash, err := HashPassword(password)
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
// log.Fatal(err)
|
|
|
|
|
|
// }
|
|
|
|
|
|
// fmt.Println("哈希结果:", hash)
|
|
|
|
|
|
// hash = "$2y$10$027xtOgP6yG8HRPP5zpNdO1ay1MzaxIeBDdNt73VgE2WWQqTUYih2"
|
|
|
|
|
|
// // 验证密码
|
|
|
|
|
|
// match := CheckPasswordHash(password, hash)
|
|
|
|
|
|
// fmt.Println("密码匹配:", match)
|
2025-12-26 23:46:10 +08:00
|
|
|
|
// service.NewShinyService().Args(53)
|
2025-12-21 17:18:33 +00:00
|
|
|
|
//player.TestPureMatrixSplit()
|
2025-11-29 19:26:56 +08:00
|
|
|
|
// for _, i := range xmlres.ItemsMAP {
|
|
|
|
|
|
|
|
|
|
|
|
// cool.DBM(dict.NewDictInfoService().GetModel()).Insert(
|
|
|
|
|
|
// g.Map{"typeId": 6, "name": i.Name, "remark": i.ID, "ordernum": 1},
|
|
|
|
|
|
// )
|
|
|
|
|
|
// fmt.Println(i.ID, i.Name)
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2025-11-22 00:44:42 +08:00
|
|
|
|
//input.Test()
|
2025-11-14 02:04:19 +08:00
|
|
|
|
// element.TestAllScenarios()
|
2025-11-20 15:19:13 +08:00
|
|
|
|
|
|
|
|
|
|
// for i := 0; i < 1000000; i++ {
|
|
|
|
|
|
|
|
|
|
|
|
// go func() {
|
|
|
|
|
|
// ff := &info.LeaveMapOutboundInfo{
|
|
|
|
|
|
// 10001,
|
|
|
|
|
|
// }
|
|
|
|
|
|
// t := common.NewTomeeHeader(2002, 10001).Pack(ff)
|
|
|
|
|
|
// if len(t) != 21 {
|
|
|
|
|
|
// panic(t)
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// }()
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
2025-11-04 14:01:17 +00:00
|
|
|
|
//service.TestSendVerificationCode()
|
2025-11-17 21:45:45 +00:00
|
|
|
|
|
2025-12-14 05:34:39 +08:00
|
|
|
|
// for i := 0; i < 10; i++ {
|
|
|
|
|
|
// t := model.GenPetInfo(1, 31, 1, 1, 1, 1)
|
|
|
|
|
|
// t.ShinyInfo = make([]model.GlowFilter, 1)
|
|
|
|
|
|
// // 假设 t 是包含 ShinyInfo 字段的结构体,ShinyInfo 是 GlowFilter 类型的切片
|
|
|
|
|
|
// t.ShinyInfo[0] = model.GlowFilter{
|
|
|
|
|
|
// // 光晕颜色:白色(十六进制 0xFFFFFF),符合 uint32 类型
|
|
|
|
|
|
// Color: 0xFFFFFF,
|
|
|
|
|
|
// // 透明度:0.8(0.0~1.0 范围内的合理值,float64 类型)
|
|
|
|
|
|
// Alpha: 0.8,
|
|
|
|
|
|
// // 水平模糊量:10(0~255 范围内,uint8 类型,略高于默认值6)
|
|
|
|
|
|
// BlurX: 10,
|
|
|
|
|
|
// // 垂直模糊量:10(与 BlurX 对称,uint8 类型)
|
|
|
|
|
|
// BlurY: 10,
|
|
|
|
|
|
// // 发光强度:8(0~255 范围内,uint8 类型,略高于默认值2)
|
|
|
|
|
|
// Strength: 8,
|
|
|
|
|
|
// // 滤镜应用次数:2(1~3 范围内,int 类型,非默认值1)
|
|
|
|
|
|
// Quality: 2,
|
|
|
|
|
|
// // 内侧发光:true(bool 类型,模拟开启内侧发光)
|
|
|
|
|
|
// Inner: true,
|
|
|
|
|
|
// // 挖空:false(bool 类型,保持默认逻辑)
|
|
|
|
|
|
// Knockout: false,
|
|
|
|
|
|
// // 颜色矩阵:标准 RGBA 矩阵(20个uint8,符合 [20]uint8 数组类型)
|
|
|
|
|
|
// // 矩阵含义:R=100%、G=100%、B=100%、A=100%,无颜色偏移
|
|
|
|
|
|
// ColorMatrixFilter: [20]uint8{
|
|
|
|
|
|
// 1, 0, 0, 0, 0, // R 通道
|
|
|
|
|
|
// 0, 1, 0, 0, 0, // G 通道
|
|
|
|
|
|
// 0, 0, 1, 0, 0, // B 通道
|
|
|
|
|
|
// 0, 0, 0, 1, 0, // A 通道
|
|
|
|
|
|
// },
|
|
|
|
|
|
// }
|
|
|
|
|
|
// service.NewUserService(10001).Pet.PetAdd(t)
|
|
|
|
|
|
// }
|
2025-12-08 17:03:43 +08:00
|
|
|
|
// for i := 0; i < 1000; i++ {
|
|
|
|
|
|
// service.NewUserService(10001).Pet.PetAdd(t)
|
|
|
|
|
|
// }
|
2025-11-17 21:45:45 +00:00
|
|
|
|
// service.NewUserService(10001).Pet.PetInfo_One_exec(t.CatchTime, func(pe *model.PetEX) {
|
|
|
|
|
|
// fmt.Println(pe.CreateTime)
|
|
|
|
|
|
|
|
|
|
|
|
// pe.Data.ID = 100
|
|
|
|
|
|
// })
|
2025-07-06 19:31:30 +08:00
|
|
|
|
cmd.Main.Run(gctx.New())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func kick(id int) {
|
2025-07-17 05:20:30 +08:00
|
|
|
|
// // go Start(cool.Config.Port)
|
|
|
|
|
|
// //go rpc()
|
|
|
|
|
|
// go func() {
|
|
|
|
|
|
// t := rpc.StartClient(0, &struct{}{})
|
|
|
|
|
|
// err := t.Kick(1)
|
|
|
|
|
|
// fmt.Println(err)
|
|
|
|
|
|
// //err := t.Kick(1)
|
|
|
|
|
|
// err = t.Kick(10001)
|
|
|
|
|
|
// fmt.Println(err)
|
|
|
|
|
|
// }()
|
2025-06-23 12:24:23 +08:00
|
|
|
|
}
|
2025-12-31 16:20:01 +08:00
|
|
|
|
|
|
|
|
|
|
// HashPassword 对密码进行 Bcrypt 哈希
|
|
|
|
|
|
func HashPassword(password string) (string, error) {
|
|
|
|
|
|
// bcrypt.DefaultCost = 10,与 Laravel 默认一致
|
|
|
|
|
|
bytes, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
|
|
|
|
|
return string(bytes), err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CheckPasswordHash 验证密码与哈希是否匹配
|
|
|
|
|
|
func CheckPasswordHash(password, hash string) bool {
|
|
|
|
|
|
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
|
|
|
|
|
return err == nil
|
|
|
|
|
|
}
|