Apply .gitignore rules

This commit is contained in:
皮蛋13361098506
2025-01-06 16:21:36 +08:00
parent 1b77f62820
commit ccd2c530cf
580 changed files with 69806 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package gameServerMgr
import (
"encoding/json"
. "Framework/managecenterModel"
)
var (
mChargeConfigMap = make(map[int32][]*ChargeConfig, 0)
)
//解析充值配置信息
func ParseChargeConfigInfo(partnerList []*Partner) {
tmpChargeConfigMap := make(map[int32][]*ChargeConfig, 0)
//循环解析所有合作商里面的充值配置信息
for _, partner := range partnerList {
var chargeConfigList []*ChargeConfig
if err := json.Unmarshal([]byte(partner.ChargeConfig), &chargeConfigList); err == nil {
tmpChargeConfigMap[partner.Id] = chargeConfigList
}
}
mChargeConfigMap = tmpChargeConfigMap
}
// 根据合作商Id获取合作商充值配置对象
func GetChargeConfigList(partnerId int32) (chargeConfigList []*ChargeConfig, exist bool) {
chargeConfigList, exist = mChargeConfigMap[partnerId]
return
}

View File

@@ -0,0 +1,47 @@
package debugUtil
import "github.com/fatih/color"
// Code 显示代码
type Code = color.Attribute
const (
Code_Reset Code = color.Reset
Code_Bold Code = color.Bold
Code_Faint Code = color.Faint
Code_Italic Code = color.Italic
Code_Underline Code = color.Underline
Code_BlinkSlow Code = color.BlinkSlow
Code_BlinkRapid Code = color.BlinkRapid
Code_ReverseVideo Code = color.ReverseVideo
Code_Concealed Code = color.Concealed
Code_CrossedOut Code = color.CrossedOut
)
// ForegroundColor 前景色
type ForegroundColor = color.Attribute
const (
Foreground_Black ForegroundColor = color.FgBlack
Foreground_Red ForegroundColor = color.FgRed
Foreground_Green ForegroundColor = color.FgGreen
Foreground_Yellow ForegroundColor = color.FgYellow
Foreground_Blue ForegroundColor = color.FgBlue
Foreground_Purple ForegroundColor = color.FgMagenta
Foreground_Cyan ForegroundColor = color.FgCyan
Foreground_White ForegroundColor = color.FgWhite
)
// BackgroundColor 背景色
type BackgroundColor = color.Attribute
const (
BackgroundColor_Black = color.BgBlack
BackgroundColor_Red = color.BgRed
BackgroundColor_Green = color.BgGreen
BackgroundColor_Yellow = color.BgYellow
BackgroundColor_Blue = color.BgBlue
BackgroundColor_Purple = color.BgMagenta
BackgroundColor_Cyan = color.BgCyan
BackgroundColor_White = color.BgWhite
)

View File

@@ -0,0 +1,98 @@
package hash32
/*
* ***注意***
*
* Sum 使用的是[]byte参数string中文是utf-8编码
* SumByRune 使用的是[]rune参数中文使用的是unicode编码
*
* 两种参数中文编码不同同一个string调用两个接口得到的hash是不同的 这是要特别注意的
*
* 对string进行for range操作会自动被[]rune化一定要注意
*
*/
const shiftBit = 11 // 每个字节移位数(测试经验值11)
const reverseBit = 32 - shiftBit
// 快速Hash计算(*** 注意只取了rune低16位进行hash计算计算结果与SumByRune不一致 ***)
func FastSumByRune2(in rune, hs uint32) (out uint32) {
out = ((hs << shiftBit) | (hs >> reverseBit)) + uint32(byte(in>>8))
out = ((out << shiftBit) | (out >> reverseBit)) + uint32(byte(in))
return
}
// 快速Hash计算(*** 此计算结果与SumByRune一致 ***)
func FastSumByRune4(in rune, hs uint32) (out uint32) {
out = ((hs << shiftBit) | (hs >> reverseBit)) + uint32(byte(in>>24))
out = ((out << shiftBit) | (out >> reverseBit)) + uint32(byte(in>>16))
out = ((out << shiftBit) | (out >> reverseBit)) + uint32(byte(in>>8))
out = ((out << shiftBit) | (out >> reverseBit)) + uint32(byte(in))
return
}
// 原Hash值参数重
func hsArg(hsOpt ...uint32) (out uint32) {
out = uint32(0)
if len(hsOpt) > 0 {
out = hsOpt[0]
}
return
}
// Hash计算
// in - 待hash串
// hsOpt - 原hash值(在此基础上继续hash)
func Sum(in []byte, hsOpt ...uint32) (out uint32) {
out = hsArg(hsOpt...)
for _, v := range in {
out = ((out << shiftBit) | (out >> reverseBit)) + uint32(v)
}
return
}
// Hash计算
func SumByRune(in rune, hsOpt ...uint32) (out uint32) {
// rune转[]byte
inVal := make([]byte, 4)
inVal[0] = byte(in >> 24)
inVal[1] = byte(in >> 16)
inVal[2] = byte(in >> 8)
inVal[3] = byte(in)
// *** 经实际测试:不加以下代码运行效率更高 ***
// 去除前面多余的\x00
// for {
// if len(inVal) <= 1 {
// // 以免全0异常至少要保留1位
// break
// }
// if inVal[0] == 0 {
// inVal = inVal[1:]
// } else {
// break
// }
// }
// 规避hash冲突"N-"与"中"unicode编码均为#4E2D即会产生hash冲突
// 若长度>1(即非常规ASCII)所有字节最高位置1
// if len(inVal) > 1 {
// for i := 0; i < len(inVal); i++ {
// inVal[i] |= 0x80
// }
// }
out = Sum(inVal, hsOpt...)
return
}
// Hash计算
func SumByRunes(in []rune, hsOpt ...uint32) (out uint32) {
out = hsArg(hsOpt...)
for _, v := range in {
out = SumByRune(v, out)
}
return
}