mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2025-10-16 10:08:00 +08:00
修改网关代码的结构,调整了逻辑,删除了许多无用的代码
This commit is contained in:
47
gateway/utils/bank.go
Normal file
47
gateway/utils/bank.go
Normal file
File diff suppressed because one or more lines are too long
@@ -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")
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user