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

This commit is contained in:
昔念
2026-04-22 00:39:41 +08:00
parent b59beed45f
commit a6386daad8
11 changed files with 90 additions and 67 deletions

View File

@@ -76,11 +76,39 @@ func (s *PetService) PetCount(flag int) int {
return ret
}
// GetShowPets 获取基地展示的精灵列表is_show=1
func (s *PetService) GetShowPets() []model.Pet {
var tt []model.Pet
if err := s.dbm_fix(s.Model).Where("is_show", 1).Scan(&tt); err != nil {
return nil
}
for i := range tt {
tt[i].Data.CatchTime = tt[i].CatchTime
}
return tt
}
// UpdateIsShow 更新精灵基地展示状态
func (s *PetService) UpdateIsShow(catchTime uint32, isShow int) bool {
res, err := s.dbm(s.Model).
Where("catch_time", catchTime).
Data("is_show", isShow).
Update()
if err != nil {
return false
}
r, _ := res.RowsAffected()
return r > 0
}
func (s *PetService) UpdateFree(catchTime, fromFree, toFree uint32) bool {
res, err := s.dbm(s.Model).
Where("catch_time", catchTime).
Where("free", fromFree).
Data("free", toFree).
Data(g.Map{
"free": toFree,
"is_show": 0, // 放回背包/放生时取消基地展示
}).
Update()
if err != nil {
return false
@@ -109,6 +137,7 @@ func (s *PetService) UpdatePrice(catchTime, price, free uint32) error {
res, _ := s.dbm(s.Model).Where("catch_time", catchTime).Data(g.Map{
"sale_price": price,
"free": free,
"is_show": 0, // 上架/下架时取消基地展示
}).Update()
affected, _ := res.RowsAffected()
if affected > 0 && free != 2 && feeRate != 0 {

View File

@@ -41,19 +41,6 @@ func (s *RoomService) Set(id []model.FitmentShowInfo) {
ttt.PlayerID = uint64(s.userid)
m.Save(ttt)
}
func (s *RoomService) Show(cactime []uint32) {
//todo待测试
var ttt model.BaseHouseEx
m := s.dbm(s.Model)
m.Scan(&ttt)
ttt.ShowPokemon = cactime
ttt.PlayerID = uint64(s.userid)
m.Save(ttt)
}
// /添加进来的物品一定是保证存在的