feat: 添加商城权限自动回收机制
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -54,8 +54,9 @@ type ReqShopReq struct {
|
||||
|
||||
func (c *BaseSysUserController) ReqShop(ctx context.Context, req *ReqShopReq) (res *cool.BaseRes, err error) {
|
||||
t := cool.GetAdmin(ctx)
|
||||
baseSysUserService := service.NewBaseSysUserService()
|
||||
|
||||
user := service.NewBaseSysUserService().GetPerson(uint32(t.UserId))
|
||||
user := baseSysUserService.GetPerson(uint32(t.UserId))
|
||||
if user == nil || user.QQ == 0 {
|
||||
return cool.Fail("请先绑定QQ"), nil
|
||||
}
|
||||
@@ -63,7 +64,7 @@ func (c *BaseSysUserController) ReqShop(ctx context.Context, req *ReqShopReq) (r
|
||||
if err := playerservice.NewTaskService(uint32(t.UserId)).ShopRequirementError(); err != nil {
|
||||
return cool.Fail(err.Error()), nil
|
||||
}
|
||||
cool.DBM(&model.BaseSysUserRole{}).Data("roleId", "27", "userId", t.UserId).Save()
|
||||
cool.DBM(&model.BaseSysUserRole{}).Data("roleId", service.ShopRoleID, "userId", t.UserId).Save()
|
||||
res = cool.Ok(nil)
|
||||
return
|
||||
}
|
||||
@@ -83,19 +84,24 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
|
||||
|
||||
res = &SessionRes{}
|
||||
|
||||
t1 := service.NewBaseSysUserService().GetPerson(uint32(t.UserId))
|
||||
baseSysUserService := service.NewBaseSysUserService()
|
||||
t1 := baseSysUserService.GetPerson(uint32(t.UserId))
|
||||
|
||||
res.UserID = int(t1.ID)
|
||||
playerinfo := blazing.NewUserService(uint32(t1.ID)).Info.Person(uint32(t1.ID))
|
||||
if playerinfo != nil {
|
||||
res.IsReg = 1
|
||||
if t1.DepartmentID == 35 { ///抢先服玩家,3天没登录衰退
|
||||
|
||||
if playerinfo.UpdateTime.AddDate(0, 0, 3).Before(gtime.Now()) {
|
||||
if playerinfo.UpdateTime.AddDate(0, 0, 3).Before(gtime.Now()) {
|
||||
if t1.DepartmentID == 35 { ///抢先服玩家,3天没登录衰退
|
||||
t1.DepartmentID = 1
|
||||
service.NewBaseSysUserService().SetdepartmentId(uint32(t1.ID), 1)
|
||||
baseSysUserService.SetdepartmentId(uint32(t1.ID), 1)
|
||||
}
|
||||
}
|
||||
if playerinfo.UpdateTime.AddDate(0, 0, 7).Before(gtime.Now()) {
|
||||
err = baseSysUserService.CancelShopPermission(ctx, t1.ID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
res.PetID = dict.NewDictInfoService().GetShiny()
|
||||
|
||||
Reference in New Issue
Block a user