```
feat(pet): 添加宠物收集功能和称号系统 - 实现了宠物收集任务状态查询功能 - 新增Collect方法处理宠物收集逻辑,包括类型验证和ID合法性检查 - 创建validTypeIDMap映射表统一管理合法的类型ID集合 - 重构任务状态判断逻辑,基于model.Completion状态进行判断 refactor(map): 统一玩家信息结构体 - 将OutInfo重命名为SimpleInfo并添加Title字段 - 更新EnterMap方法的返回类型为SimpleInfo - 修改space包中的UserInfo映射类型为SimpleInfo feat(task): 集成称号奖励到任务系统 - 在PlayerInfo结构体中添加Title字段 - 扩展TaskConfig模型支持称号奖励配置 - 更新用户信息服务处理用户名大小写转换 refactor(space): 优化空间服务数据结构 - 更新GetInfo方法返回SimpleInfo切片 - 调整UserInfo CsMap泛型类型参数 - 修改ListMapPlayerOutboundInfo中Player数组类型 style(login): 规范化用户名输入处理 - 登录时将用户名转换为小写进行比较 - 使用strings.EqualFold进行大小
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
@@ -43,7 +44,7 @@ func (s *BaseSysLoginService) Login(ctx context.Context, req *v1.BaseOpenLoginRe
|
||||
username = req.Username
|
||||
baseSysUser = model.NewBaseSysUser()
|
||||
)
|
||||
|
||||
username = strings.ToLower(username)
|
||||
vcode, _ := cool.CacheManager.Get(ctx, "login:"+captchaId)
|
||||
if vcode.String() != verifyCode {
|
||||
err = gerror.New("验证码错误")
|
||||
@@ -66,7 +67,7 @@ func (s *BaseSysLoginService) Login(ctx context.Context, req *v1.BaseOpenLoginRe
|
||||
md5password, _ := gmd5.Encrypt(password)
|
||||
var user *model.BaseSysUser
|
||||
|
||||
if userInfo.Data.Attributes.Username != username { //说明没查找到用户
|
||||
if !strings.EqualFold(userInfo.Data.Attributes.Username, username) { //说明没查找到用户
|
||||
//后端添加的账户
|
||||
cool.DBM(baseSysUser).Where("username=?", username).Where("password=?", md5password).Where("status=?", 1).Scan(&user)
|
||||
if user == nil {
|
||||
|
||||
@@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"blazing/cool"
|
||||
|
||||
@@ -118,7 +119,7 @@ func (s *BaseSysUserService) Gen(user UserAttributes) (data interface{}, err err
|
||||
lastInsertId, err := m.Data(user).Data(
|
||||
|
||||
g.Map{
|
||||
"username": user.Username,
|
||||
"username": strings.ToLower(user.Username),
|
||||
"headImg": user.AvatarUrl,
|
||||
"departmentId": 1,
|
||||
},
|
||||
@@ -150,6 +151,9 @@ func (s *BaseSysUserService) ServiceAdd(ctx context.Context, req *cool.AddReq) (
|
||||
if !r.Get("password").IsNil() {
|
||||
reqmap["password"] = gmd5.MustEncryptString(r.Get("password").String())
|
||||
}
|
||||
if !r.Get("username").IsNil() {
|
||||
reqmap["username"] = strings.ToLower(r.Get("username").String())
|
||||
}
|
||||
if s.UniqueKey != nil {
|
||||
for k, v := range s.UniqueKey {
|
||||
if reqmap[k] != nil {
|
||||
@@ -225,7 +229,9 @@ func (s *BaseSysUserService) ServiceUpdate(ctx context.Context, req *cool.Update
|
||||
|
||||
r := g.RequestFromCtx(ctx)
|
||||
rMap := r.GetMap()
|
||||
|
||||
if !r.Get("username").IsNil() {
|
||||
rMap["username"] = strings.ToLower(r.Get("username").String())
|
||||
}
|
||||
// 如果不传入ID代表更新当前用户
|
||||
userId := r.Get("id", admin.UserId).Uint()
|
||||
userInfo, err := m.Where("id", userId).One()
|
||||
|
||||
@@ -118,6 +118,7 @@ type PlayerInfo struct {
|
||||
UserID uint32 `struc:"uint32" json:"user_id"` // 米米号 通过sid拿到
|
||||
RegisterTime uint32 `struc:"uint32" json:"register_time"` // 注册时间(秒时间戳)
|
||||
Nick string `struc:"[16]byte" default:"seer" json:"nick"` // 16字节昵称
|
||||
Title uint32 `struc:"uint32" json:"title"` // 称号
|
||||
Vip uint16 `struc:"uint16" json:"vip"` // 固定0
|
||||
Viped uint16 `struc:"uint16" default:"15" json:"viped"` // 固定15
|
||||
DSFlag uint32 `struc:"uint32" json:"ds_flag"` // 固定0
|
||||
|
||||
@@ -25,6 +25,8 @@ type TaskConfig struct {
|
||||
ItemRewardIds []uint32 `gorm:"not null;type:json;default:'[]';comment:'绑定奖励物品ID数组,关联item_gift表主键'" json:"item_reward_ids" description:"奖励物品数组"`
|
||||
ElfRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励精灵ID,关联elf_gift表主键'" json:"elf_reward_ids" description:"绑定奖励精灵ID"`
|
||||
|
||||
//绑定奖励
|
||||
TitleRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励称号'" json:"title_reward_ids" description:"绑定奖励称号"`
|
||||
// 任务状态和周期
|
||||
IsEnabled uint32 `gorm:"not null;default:1;comment:'是否启用该任务(0-禁用 1-启用)'" json:"is_enabled" description:"是否启用"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user