This commit is contained in:
@@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/model"
|
||||
"fmt"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@@ -27,6 +28,12 @@ func NewPetFusionService() *PetFusionService {
|
||||
|
||||
//获取主副精灵融合的id,如果不存在,那就给一个保底的id
|
||||
|
||||
func init() {
|
||||
g.DB().SetDebug(true)
|
||||
r := NewPetFusionService().getData(577, 2083)
|
||||
fmt.Println(r)
|
||||
|
||||
}
|
||||
func (s *PetFusionService) Data(p1, p2, rand uint32) uint32 {
|
||||
|
||||
if !grand.Meet(int((rand)/2), 100) {
|
||||
@@ -61,18 +68,13 @@ func (s *PetFusionService) getData(p1, p2 uint32) []model.PetFusion {
|
||||
m := dbm(s.Model)
|
||||
|
||||
var pet []model.PetFusion //一个特性应该是唯一的,但是我们要获取默认随机特性
|
||||
condition := g.Map{
|
||||
"main_pet_id": p1,
|
||||
"sub_pet_id": p2,
|
||||
"is_enable": 1,
|
||||
// "hits between ? and ?" : g.Slice{1, 10},
|
||||
// "exp > 0" : nil,
|
||||
// "category" : g.Slice{100, 200},
|
||||
}
|
||||
m.Where(condition).Scan(&pet)
|
||||
m.Where("main_pet_id", p1).Wheref(`sub_pet_ids @> ARRAY[?]::integer[]`, p2).
|
||||
Where("is_enable", 1).Scan(&pet)
|
||||
|
||||
return pet
|
||||
|
||||
}
|
||||
|
||||
func (s *PetFusionService) def() []model.PetFusion {
|
||||
|
||||
var pets []model.PetFusion
|
||||
|
||||
Reference in New Issue
Block a user