57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/player/model"
|
|
)
|
|
|
|
type DoneService struct {
|
|
BaseService
|
|
}
|
|
|
|
// func (s *DoneService) Exec(data model.EnumMilestone, id []uint32, fn func(*model.MilestoneEX) bool) {
|
|
// if cool.Config.ServerInfo.IsVip != 0 {
|
|
// cool.Logger.Info(context.TODO(), "测试服不消耗物品玩家数据", s.userid)
|
|
// return
|
|
// }
|
|
// arss := strings.Join(gconv.Strings(id), "-")
|
|
// m := s.PModel(s.Model).Where("done_type", data).Where("args", arss)
|
|
// var tt *model.MilestoneEX
|
|
// m.Scan(&tt)
|
|
// if tt == nil {
|
|
// tt = &model.MilestoneEX{
|
|
// Milestone: model.Milestone{
|
|
// DoneType: data,
|
|
// Args: strings.Join(gconv.Strings(id), "-"),
|
|
// //Count: 1,
|
|
// },
|
|
// }
|
|
// }
|
|
|
|
// tt.Args = id
|
|
// ook := fn(tt)
|
|
// if !ook { //不需要保存
|
|
// return
|
|
// }
|
|
// tt.PlayerID = uint64(s.userid)
|
|
// tt.Milestone.Args = strings.Join(gconv.Strings(id), "-")
|
|
|
|
// _, err := m.Save(tt)
|
|
// if err != nil {
|
|
// panic(err)
|
|
// }
|
|
|
|
// }
|
|
func NewDoneService(id uint32) *DoneService {
|
|
return &DoneService{
|
|
|
|
BaseService: BaseService{userid: id,
|
|
|
|
Service: &cool.Service{Model: model.NewMilestone(), UniqueKey: map[string]string{
|
|
"player_id": "角色名称不能重复",
|
|
}},
|
|
},
|
|
}
|
|
|
|
}
|