修改网关代码的结构,调整了逻辑,删除了许多无用的代码

This commit is contained in:
kongyuebin
2021-09-16 14:57:23 +08:00
parent 706a95317d
commit 2a98cbd9ac
58 changed files with 6137 additions and 744 deletions

47
gateway/utils/bank.go Normal file

File diff suppressed because one or more lines are too long

View File

@@ -38,3 +38,7 @@ func GetDateBeforeDays(days int) string {
func GetDateTimeBeforeDays(days int) string {
return time.Now().Add(-time.Hour * time.Duration(days) * 24).Format("2006-01-02 15:04:05")
}
func GetDateAfterDays(days int) string {
return time.Now().Add(time.Hour * time.Duration(days) * 24).Format("2006-01-02")
}

View File

@@ -30,3 +30,18 @@ func GetMD5LOWER(s string) string {
func GetMD5Upper(s string) string {
return strings.ToUpper(GetMD5LOWER(s))
}
/**
** 将map数据变成key=value形式的字符串
*/
func MapToString(m map[string]string) string {
res := ""
for k, v := range m {
res = res + k + "=" + v + "&"
}
suffix := strings.TrimSuffix(res, "&")
return suffix
}

View File

@@ -24,3 +24,16 @@ func SortMap(m map[string]string) []string {
sort.Strings(arr)
return arr
}
/**
** 按照key的ascii值从小到大给map排序
*/
func SortMapByKeys(m map[string]string) map[string]string {
keys := SortMap(m)
tmp := make(map[string]string)
for _, key := range keys {
tmp[key] = m[key]
}
return tmp
}