feat: 实现每日签到功能并优化战斗和道具逻辑
This commit is contained in:
37
modules/config/service/sign.go
Normal file
37
modules/config/service/sign.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/config/model"
|
||||
)
|
||||
|
||||
type SignInService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
func (s *SignInService) GetActive(signInID uint32) *model.SignIn {
|
||||
m := cool.DBM(s.Model)
|
||||
if signInID != 0 {
|
||||
m.Where("sign_in_id", signInID)
|
||||
}
|
||||
m.Where("status", 1)
|
||||
m.Order("sign_in_id", "asc")
|
||||
|
||||
var out *model.SignIn
|
||||
m.Scan(&out)
|
||||
return out
|
||||
}
|
||||
|
||||
func NewSignInService() *SignInService {
|
||||
return &SignInService{
|
||||
&cool.Service{
|
||||
Model: model.NewSignIn(),
|
||||
ListQueryOp: &cool.QueryOp{
|
||||
FieldEQ: []string{"sign_in_id", "status"},
|
||||
},
|
||||
PageQueryOp: &cool.QueryOp{
|
||||
FieldEQ: []string{"sign_in_id", "status"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user