feat(common): 升级 gf 框架版本至 v2.8.0 并优化模型时间字段
- 将 `github.com/gogf/gf/contrib/drivers/pgsql/v2` 和 redis 依赖从 v2.6.3 升级到 v2.8.0
- 使用 `*gtime.Time` 替代标准库 `time.Time` 以支持更灵活的时间处理
- 移除 Model 结构体中 CreateTime、UpdateTime 等字段的默认初始化逻辑
- 注释掉已弃用的 GDBM 函数,推荐使用 DBM
- 在 DBM 中添加 OnConflict("id") 配置以增强写入安全性
- 调整部分代码结构与调用方式以适配新版框架行为
```
41 lines
734 B
Go
41 lines
734 B
Go
package service
|
|
|
|
import (
|
|
"blazing/cool"
|
|
"blazing/modules/blazing/model"
|
|
)
|
|
|
|
type DoneService struct {
|
|
BaseService
|
|
}
|
|
|
|
func (s *DoneService) Exec(data model.EnumMilestone, id []uint32, fn func(*model.MilestoneEX) bool) {
|
|
|
|
m := s.GModel(s.Model).Where("done_type", data).Where("args", id)
|
|
var tt model.MilestoneEX
|
|
m.Scan(&tt)
|
|
ook := fn(&tt)
|
|
if !ook { //不需要保存
|
|
return
|
|
}
|
|
tt.PlayerID = uint64(s.userid)
|
|
|
|
_, 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": "角色名称不能重复",
|
|
}},
|
|
},
|
|
}
|
|
|
|
}
|