提交信息

This commit is contained in:
1
2025-08-27 20:52:15 +00:00
parent fc2f88f14a
commit b36ff6d0f1
10 changed files with 283 additions and 18 deletions

View File

@@ -0,0 +1,31 @@
package service
import (
"blazing/cool"
"blazing/modules/blazing/model"
"encoding/json"
"github.com/gogf/gf/v2/database/gdb"
)
type UserService struct {
userid uint32
*cool.Service
}
func (s *UserService) GetModel() *gdb.Model {
return cool.DBM(s.Model).Where("player_id", s.userid)
}
func (s *UserService) Exec(t func(map[uint32]model.TaskInfo) bool) {
var tt model.Task
s.GetModel().Scan(&tt)
var ttt map[uint32]model.TaskInfo
json.Unmarshal([]byte(tt.Data), &ttt)
t(ttt)
t1, _ := json.Marshal(&ttt)
tt.Data = string(t1)
s.GetModel().Save(&tt) //退出时保存
}