generated from pkg/go-template
feat: murder项目整体迁移
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package util
|
||||
|
||||
import "strings"
|
||||
|
||||
type QueryMap map[string]string
|
||||
|
||||
// GetQueryMap 根据查询条件进行sql处理
|
||||
func GetQueryMap(s string) QueryMap {
|
||||
m := make(map[string]string)
|
||||
if s != "" {
|
||||
s = string([]byte(s)[1 : len([]byte(s))-1])
|
||||
for _, v := range strings.Split(s, ",") {
|
||||
split := strings.Split(v, "=")
|
||||
m[split[0]] = split[1]
|
||||
}
|
||||
}
|
||||
m["is_del"] = "0"
|
||||
return m
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package util
|
||||
|
||||
import "time"
|
||||
|
||||
var (
|
||||
cst *time.Location
|
||||
)
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
if cst, err = time.LoadLocation("Asia/Shanghai"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// 默认设置为中国时区
|
||||
time.Local = cst
|
||||
}
|
||||
|
||||
// CSTLayout China Standard Time Layout
|
||||
const CSTLayout = "2006-01-02 15:04:05"
|
||||
|
||||
func CSTLayoutString() string {
|
||||
ts := time.Now()
|
||||
return ts.In(cst).Format(CSTLayout)
|
||||
}
|
||||
Reference in New Issue
Block a user