1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-07 20:16:44 +08:00
parent 1a0a2badd4
commit 9cf6ad8b88
3 changed files with 13 additions and 36 deletions

View File

@@ -29,11 +29,7 @@ type Pet struct {
// FreedTime uint32 `struc:"skip"` //放生时间
//是否可交易这里应该定义在精灵ID里
//是否上架
Data string `gorm:"type:jsonb;not null;comment:'精灵全部数据'" json:"data"`
}
type PetEX struct {
Pet
Data PetInfo `orm:"data" json:"data"`
Data PetInfo `gorm:"type:jsonb;not null;comment:'精灵全部数据'" json:"data"`
}
type Attr uint32

View File

@@ -11,11 +11,11 @@ import (
)
// 获取精灵信息 0是仓库,1是放生
func (s *PetService) PetInfo(flag int) []model.PetEX {
var tt []model.PetEX
func (s *PetService) PetInfo(flag int) []model.Pet {
var tt []model.Pet
err := s.TestModel(s.Model).Where("free", flag).Scan(&tt)
if err != nil {
return []model.PetEX{}
return []model.Pet{}
}
for i := 0; i < len(tt); i++ {
@@ -49,7 +49,7 @@ func (s *PetService) UPdateFree(ctime uint32, free uint32) {
func (s *PetService) UPdate(t model.PetInfo) {
m := s.TestModel(s.Model).Where("player_id", s.userid).Where("catch_time", t.CatchTime)
var tt *model.PetEX
var tt *model.Pet
m.Scan(&tt)
if tt == nil {
return
@@ -60,10 +60,10 @@ func (s *PetService) UPdate(t model.PetInfo) {
panic(err)
}
}
func (s *PetService) PetInfo_One(cachetime uint32) *model.PetEX {
func (s *PetService) PetInfo_One(cachetime uint32) *model.Pet {
m := s.TestModel(s.Model).Where("player_id", s.userid).Where("catch_time", cachetime)
var tt *model.PetEX
var tt *model.Pet
m.Scan(&tt)
if tt == nil {
@@ -73,19 +73,19 @@ func (s *PetService) PetInfo_One(cachetime uint32) *model.PetEX {
tt.Data.CatchTime = tt.CatchTime
return tt
}
func (s *PetService) PetInfo_One_ohter(userid, cachetime uint32) model.PetEX {
func (s *PetService) PetInfo_One_ohter(userid, cachetime uint32) model.Pet {
m := s.TestModel(s.Model).Where("player_id", userid).Where("catch_time", cachetime)
var tt model.PetEX
var tt model.Pet
m.Scan(&tt)
tt.Data.CatchTime = tt.CatchTime
return tt
}
func (s *PetService) PetInfo_One_Unscoped(cachetime uint32) *model.PetEX {
func (s *PetService) PetInfo_One_Unscoped(cachetime uint32) *model.Pet {
m := s.TestModel(s.Model).Where("player_id", s.userid).Where("catch_time", cachetime).Unscoped()
var tt *model.PetEX
var tt *model.Pet
m.Scan(&tt)
if tt == nil {
@@ -121,7 +121,7 @@ RETURNING max_ts;
//fmt.Println(ret, err)
y.CatchTime = ret.Array()[0].Uint32()
m1 := cool.DBM(s.Model).Where("player_id", s.userid)
var player model.PetEX
var player model.Pet
player.PlayerID = s.userid
player.Data = *y
player.CatchTime = y.CatchTime

View File

@@ -18,26 +18,7 @@ func (s *RoomService) Get(userid uint32) model.BaseHouseEx {
}
// func (s *RoomService) Add(id, count uint32) {
// //todo待测试
// var ttt model.BaseHouseEx
// m := s.TestModel(s.Model)
// m.Scan(&ttt)
// if ttt.OwnedItems == nil {
// ttt.OwnedItems = make(map[uint32]uint32)
// }
// t, ok := ttt.OwnedItems[id]
// if ok {
// ttt.OwnedItems[id] = t + count
// } else {
// ttt.OwnedItems[id] = count
// }
// ttt.PlayerID = uint64(s.userid)
// m.Save(ttt)
// }
func (s *RoomService) Set(id []model.FitmentShowInfo) {
//todo待测试
if cool.Config.ServerInfo.IsVip != 0 {