This commit is contained in:
@@ -317,10 +317,7 @@ func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpaca
|
||||
}
|
||||
|
||||
}
|
||||
if skill.XML.DmgBindHpDv != 0 {
|
||||
skill.XML.Power = int(ourPet.Info.Hp/2 + ourPet.Info.Dv)
|
||||
|
||||
}
|
||||
// 5. 基础伤害公式:等级因子 * 威力因子 * 攻击 / 防御 / 50 + 2
|
||||
baseDamage := levelFactor.
|
||||
Div(alpacadecimal.NewFromInt(50)).
|
||||
@@ -340,7 +337,11 @@ func (our *Input) CalculatePower(deftype *Input, skill *info.SkillEntity) alpaca
|
||||
Mul(typeRate). // 克制系数
|
||||
|
||||
Mul(skill.Criticalrandom()) //随机波动
|
||||
//println(baseDamage.IntPart(), damage.IntPart(), attackDec.IntPart(), defenseDec.IntPart(), "技能伤害")
|
||||
//println(baseDamage.IntPart(), damage.IntPart(), attackDec.IntPart(), defenseDec.IntPart(), "技能伤害")
|
||||
if skill.XML.DmgBindHpDv != 0 {
|
||||
damage = alpacadecimal.NewFromInt(int64(ourPet.Info.Hp/2 + ourPet.Info.Dv))
|
||||
|
||||
}
|
||||
return damage
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"blazing/cool"
|
||||
|
||||
"blazing/modules/base/config"
|
||||
baseservice "blazing/modules/base/service"
|
||||
|
||||
"github.com/gogf/gf/v2/container/garray"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
@@ -73,7 +74,7 @@ func BaseAuthorityMiddleware(r *ghttp.Request) {
|
||||
cachetoken, _ := cool.CacheManager.Get(ctx, "admin:token:"+gconv.String(admin.UserId))
|
||||
rtoken := cachetoken.String()
|
||||
// 超管拥有所有权限
|
||||
if admin.UserId == 10001 && !admin.IsRefresh {
|
||||
if admin.UserId == baseservice.SuperAdminUserID && !admin.IsRefresh {
|
||||
if tokenString != rtoken && config.Config.Jwt.Sso {
|
||||
|
||||
statusCode = 401
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"blazing/common/rpc"
|
||||
"blazing/cool"
|
||||
"blazing/modules/base/config"
|
||||
baseservice "blazing/modules/base/service"
|
||||
"blazing/modules/config/service"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
@@ -181,7 +182,7 @@ func init() {
|
||||
return false
|
||||
}
|
||||
admin := token.Claims.(*cool.Claims)
|
||||
if admin.UserId != 10001 {
|
||||
if admin.UserId != baseservice.SuperAdminUserID {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ func (s *BaseSysLogService) Record(ctx g.Ctx) {
|
||||
// )
|
||||
baseSysLog.Params = r.GetBodyString()
|
||||
m := cool.DBM(s.Model)
|
||||
if baseSysLog.UserID == 10001 {
|
||||
if baseSysLog.UserID == SuperAdminUserID {
|
||||
return
|
||||
}
|
||||
m.Insert(g.Map{
|
||||
@@ -117,7 +117,7 @@ func (s *BaseSysLogService) RecordLog(userid uint32, desc string) {
|
||||
|
||||
baseSysLog.Params = desc
|
||||
m := cool.DBM(s.Model)
|
||||
if baseSysLog.UserID == 10001 {
|
||||
if baseSysLog.UserID == SuperAdminUserID {
|
||||
return
|
||||
}
|
||||
m.Insert(g.Map{
|
||||
@@ -136,7 +136,7 @@ func (s *BaseSysLogService) RecordKick(userid uint32, desc string) {
|
||||
|
||||
baseSysLog.Params = desc
|
||||
m := cool.DBM(s.Model)
|
||||
if baseSysLog.UserID == 10001 {
|
||||
if baseSysLog.UserID == SuperAdminUserID {
|
||||
return
|
||||
}
|
||||
m.Insert(g.Map{
|
||||
|
||||
@@ -29,7 +29,7 @@ func (c *BaseSysPermsService) Permmenu(ctx context.Context, roleIds []string) (r
|
||||
|
||||
res = &permmenu{
|
||||
Perms: baseSysMenuService.GetPerms(roleIds),
|
||||
Menus: baseSysMenuService.GetMenus(admin.RoleIds, admin.UserId == 10001),
|
||||
Menus: baseSysMenuService.GetMenus(admin.RoleIds, admin.UserId == SuperAdminUserID),
|
||||
}
|
||||
|
||||
return
|
||||
@@ -47,7 +47,7 @@ func (c *BaseSysPermsService) RefreshPerms(ctx context.Context, userId uint) (er
|
||||
)
|
||||
cool.CacheManager.Set(ctx, "admin:perms:"+gconv.String(userId), perms, 0)
|
||||
// 更新部门权限
|
||||
departments := baseSysDepartmentService.GetByRoleIds(roleIds, userId == 10001)
|
||||
departments := baseSysDepartmentService.GetByRoleIds(roleIds, userId == SuperAdminUserID)
|
||||
cool.CacheManager.Set(ctx, "admin:department:"+gconv.String(userId), departments, 0)
|
||||
|
||||
return
|
||||
|
||||
@@ -159,7 +159,7 @@ func (s *BaseSysUserService) ModifyBefore(ctx context.Context, method string, pa
|
||||
// 禁止删除超级管理员
|
||||
userIds := garray.NewIntArrayFrom(gconv.Ints(param["ids"]))
|
||||
currentId, found := userIds.Get(0)
|
||||
superAdminId := 10001
|
||||
superAdminId := int(SuperAdminUserID)
|
||||
|
||||
if userIds.Len() == 1 && found && currentId == superAdminId {
|
||||
err = gerror.New("超级管理员不能删除")
|
||||
@@ -167,7 +167,7 @@ func (s *BaseSysUserService) ModifyBefore(ctx context.Context, method string, pa
|
||||
}
|
||||
|
||||
// 删除超级管理员
|
||||
userIds.RemoveValue(10001)
|
||||
userIds.RemoveValue(superAdminId)
|
||||
g.RequestFromCtx(ctx).SetParam("ids", userIds.Slice())
|
||||
}
|
||||
return
|
||||
@@ -419,7 +419,7 @@ func (s *BaseSysUserService) ServiceUpdate(ctx context.Context, req *cool.Update
|
||||
}
|
||||
|
||||
// 禁止禁用超级管理员
|
||||
if userId == 10001 && (!r.Get("status").IsNil() && r.Get("status").Int() == 0) {
|
||||
if userId == SuperAdminUserID && (!r.Get("status").IsNil() && r.Get("status").Int() == 0) {
|
||||
err = gerror.New("禁止禁用超级管理员")
|
||||
return
|
||||
}
|
||||
@@ -545,7 +545,7 @@ func NewBaseSysUserService() *BaseSysUserService {
|
||||
Where: func(ctx context.Context) []g.Array {
|
||||
r := g.RequestFromCtx(ctx).GetMap()
|
||||
return []g.Array{
|
||||
{"id != ?", g.Slice{"10001"}, true}, //排除管理员
|
||||
{"id != ?", g.Slice{gconv.String(SuperAdminUserID)}, true}, //排除管理员
|
||||
{`("departmentId" IN (?))`, gconv.SliceStr(r["departmentIds"])},
|
||||
}
|
||||
},
|
||||
|
||||
3
modules/base/service/super_admin.go
Normal file
3
modules/base/service/super_admin.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package service
|
||||
|
||||
const SuperAdminUserID uint = 1000100
|
||||
@@ -40,11 +40,11 @@ func (s *GoldListService) validateOrderRecord(order *model.GoldBeanOrder) error
|
||||
|
||||
func (s *GoldListService) getPrevDayAvgRate() float64 {
|
||||
var (
|
||||
now = gtime.Now()
|
||||
yesterday = now.AddDate(0, 0, -1)
|
||||
dayStart = gtime.NewFromStr(yesterday.Format("Y-m-d") + " 00:00:00")
|
||||
nextDay = dayStart.AddDate(0, 0, 1)
|
||||
result struct {
|
||||
now = gtime.Now()
|
||||
yesterday = now.AddDate(0, 0, -1)
|
||||
dayStart = gtime.NewFromStr(yesterday.Format("Y-m-d") + " 00:00:00")
|
||||
nextDay = dayStart.AddDate(0, 0, 1)
|
||||
result struct {
|
||||
AvgRate float64 `json:"avg_rate"`
|
||||
}
|
||||
)
|
||||
@@ -86,9 +86,9 @@ func (s *GoldListService) ModifyBefore(ctx context.Context, method string, param
|
||||
}
|
||||
|
||||
var (
|
||||
prevAvg = s.getPrevDayAvgRate()
|
||||
minRate = math.Round(prevAvg*0.9*10000) / 10000
|
||||
maxRate = math.Round(prevAvg*1.1*10000) / 10000
|
||||
prevAvg = s.getPrevDayAvgRate()
|
||||
minRate = math.Round(prevAvg*0.9*10000) / 10000
|
||||
maxRate = math.Round(prevAvg*1.1*10000) / 10000
|
||||
)
|
||||
|
||||
if rate < minRate || rate > maxRate {
|
||||
@@ -103,7 +103,7 @@ func (s *GoldListService) ModifyBefore(ctx context.Context, method string, param
|
||||
if _, err = s.dbm_fix(s.Model).
|
||||
Where("rate", v.Rate).
|
||||
Where("exchange_num", v.ExchangeNum).
|
||||
Where("player_id", 10001).
|
||||
Where("player_id", service.SuperAdminUserID).
|
||||
Delete(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user