forked from golang/hotime
Compare commits
No commits in common. "master" and "v1.2.67" have entirely different histories.
2
code.go
2
code.go
@ -46,7 +46,7 @@ var TptProject = Proj{
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (column["info"] == nil || column.GetBool("info")) && column.GetString("link") != "" {
|
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
|
||||||
seStr := "id," + column.GetString("value")
|
seStr := "id," + column.GetString("value")
|
||||||
if that.MakeCodeRouter[hotimeName].TableColumns[column.GetString("link")]["phone"] != nil {
|
if that.MakeCodeRouter[hotimeName].TableColumns[column.GetString("link")]["phone"] != nil {
|
||||||
seStr = seStr + ",phone"
|
seStr = seStr + ",phone"
|
||||||
|
@ -208,7 +208,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
|||||||
for _, ColumnName := range that.RuleConfig {
|
for _, ColumnName := range that.RuleConfig {
|
||||||
if (ColumnName.GetBool("strict") && coloum.GetString("name") == ColumnName.GetString("name")) ||
|
if (ColumnName.GetBool("strict") && coloum.GetString("name") == ColumnName.GetString("name")) ||
|
||||||
(!ColumnName.GetBool("strict") && strings.Contains(coloum.GetString("name"), ColumnName.GetString("name"))) ||
|
(!ColumnName.GetBool("strict") && strings.Contains(coloum.GetString("name"), ColumnName.GetString("name"))) ||
|
||||||
(v.GetString("name")+"."+coloum.GetString("name") == ColumnName.GetString("name")) {
|
(info.GetString("name")+"."+coloum.GetString("name") == ColumnName.GetString("name")) {
|
||||||
//全部都不需要则不加入
|
//全部都不需要则不加入
|
||||||
if ColumnName.GetBool("edit") == false && ColumnName.GetBool("list") == false && ColumnName.GetBool("info") == false {
|
if ColumnName.GetBool("edit") == false && ColumnName.GetBool("list") == false && ColumnName.GetBool("info") == false {
|
||||||
coloum["notUse"] = true
|
coloum["notUse"] = true
|
||||||
@ -728,12 +728,12 @@ func (that *MakeCode) Add(table string, user Map, req *http.Request) Map {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
//if user[v.GetString("name")] != nil {
|
if user[v.GetString("name")] != nil {
|
||||||
//
|
|
||||||
// data[v.GetString("name")] = user[v.GetString("name")]
|
data[v.GetString("name")] = user[v.GetString("name")]
|
||||||
// continue
|
continue
|
||||||
//
|
|
||||||
//}
|
}
|
||||||
|
|
||||||
if v.GetBool("must") {
|
if v.GetBool("must") {
|
||||||
return nil
|
return nil
|
||||||
|
@ -38,8 +38,8 @@ func StrFirstToUpper(str string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 时间转字符串,第二个参数支持1-5对应显示年月日时分秒
|
// 时间转字符串,第二个参数支持1-5对应显示年月日时分秒
|
||||||
func Time2Str(t time.Time, qu ...interface{}) string {
|
func Time2Str(t *time.Time, qu ...interface{}) string {
|
||||||
if t.Unix() < 0 {
|
if t == nil || t.Unix() < 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
tp := 5
|
tp := 5
|
||||||
|
@ -102,7 +102,7 @@ func (that Map) GetBool(key string, err ...*Error) bool {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that Map) GetTime(key string, err ...*Error) time.Time {
|
func (that Map) GetTime(key string, err ...*Error) *time.Time {
|
||||||
|
|
||||||
v := ObjToTime((that)[key], err...)
|
v := ObjToTime((that)[key], err...)
|
||||||
return v
|
return v
|
||||||
|
@ -20,7 +20,7 @@ func (that *Obj) ToInt(err ...Error) int {
|
|||||||
return ObjToInt(that.Data, &that.Error)
|
return ObjToInt(that.Data, &that.Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *Obj) ToTime(err ...Error) time.Time {
|
func (that *Obj) ToTime(err ...Error) *time.Time {
|
||||||
if len(err) != 0 {
|
if len(err) != 0 {
|
||||||
that.Error = err[0]
|
that.Error = err[0]
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func ObjToSlice(obj interface{}, e ...*Error) Slice {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
func ObjToTime(obj interface{}, e ...*Error) time.Time {
|
func ObjToTime(obj interface{}, e ...*Error) *time.Time {
|
||||||
|
|
||||||
tInt := ObjToInt64(obj)
|
tInt := ObjToInt64(obj)
|
||||||
//字符串类型,只支持标准mysql datetime格式
|
//字符串类型,只支持标准mysql datetime格式
|
||||||
@ -107,27 +107,27 @@ func ObjToTime(obj interface{}, e ...*Error) time.Time {
|
|||||||
if len(tStr) > 18 {
|
if len(tStr) > 18 {
|
||||||
t, e := time.Parse("2006-01-02 15:04:05", tStr)
|
t, e := time.Parse("2006-01-02 15:04:05", tStr)
|
||||||
if e == nil {
|
if e == nil {
|
||||||
return t
|
return &t
|
||||||
}
|
}
|
||||||
} else if len(tStr) > 15 {
|
} else if len(tStr) > 15 {
|
||||||
t, e := time.Parse("2006-01-02 15:04", tStr)
|
t, e := time.Parse("2006-01-02 15:04", tStr)
|
||||||
if e == nil {
|
if e == nil {
|
||||||
return t
|
return &t
|
||||||
}
|
}
|
||||||
} else if len(tStr) > 12 {
|
} else if len(tStr) > 12 {
|
||||||
t, e := time.Parse("2006-01-02 15", tStr)
|
t, e := time.Parse("2006-01-02 15", tStr)
|
||||||
if e == nil {
|
if e == nil {
|
||||||
return t
|
return &t
|
||||||
}
|
}
|
||||||
} else if len(tStr) > 9 {
|
} else if len(tStr) > 9 {
|
||||||
t, e := time.Parse("2006-01-02", tStr)
|
t, e := time.Parse("2006-01-02", tStr)
|
||||||
if e == nil {
|
if e == nil {
|
||||||
return t
|
return &t
|
||||||
}
|
}
|
||||||
} else if len(tStr) > 6 {
|
} else if len(tStr) > 6 {
|
||||||
t, e := time.Parse("2006-01", tStr)
|
t, e := time.Parse("2006-01", tStr)
|
||||||
if e == nil {
|
if e == nil {
|
||||||
return t
|
return &t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,27 +136,27 @@ func ObjToTime(obj interface{}, e ...*Error) time.Time {
|
|||||||
//纳秒级别
|
//纳秒级别
|
||||||
if len(ObjToStr(tInt)) > 16 {
|
if len(ObjToStr(tInt)) > 16 {
|
||||||
t := time.Time{}.Add(time.Nanosecond * time.Duration(tInt))
|
t := time.Time{}.Add(time.Nanosecond * time.Duration(tInt))
|
||||||
return t
|
return &t
|
||||||
//微秒级别
|
//微秒级别
|
||||||
} else if len(ObjToStr(tInt)) > 13 {
|
} else if len(ObjToStr(tInt)) > 13 {
|
||||||
t := time.Time{}.Add(time.Microsecond * time.Duration(tInt))
|
t := time.Time{}.Add(time.Microsecond * time.Duration(tInt))
|
||||||
return t
|
return &t
|
||||||
//毫秒级别
|
//毫秒级别
|
||||||
} else if len(ObjToStr(tInt)) > 10 {
|
} else if len(ObjToStr(tInt)) > 10 {
|
||||||
t := time.Time{}.Add(time.Millisecond * time.Duration(tInt))
|
t := time.Time{}.Add(time.Millisecond * time.Duration(tInt))
|
||||||
return t
|
return &t
|
||||||
//秒级别
|
//秒级别
|
||||||
} else if len(ObjToStr(tInt)) > 9 {
|
} else if len(ObjToStr(tInt)) > 9 {
|
||||||
t := time.Time{}.Add(time.Second * time.Duration(tInt))
|
t := time.Time{}.Add(time.Second * time.Duration(tInt))
|
||||||
return t
|
return &t
|
||||||
} else if len(ObjToStr(tInt)) > 3 {
|
} else if len(ObjToStr(tInt)) > 3 {
|
||||||
t, e := time.Parse("2006", ObjToStr(tInt))
|
t, e := time.Parse("2006", ObjToStr(tInt))
|
||||||
if e == nil {
|
if e == nil {
|
||||||
return t
|
return &t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return time.Time{}
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ObjToFloat64(obj interface{}, e ...*Error) float64 {
|
func ObjToFloat64(obj interface{}, e ...*Error) float64 {
|
||||||
|
@ -15,7 +15,7 @@ func (that Slice) GetString(key int, err ...*Error) string {
|
|||||||
return ObjToStr((that)[key])
|
return ObjToStr((that)[key])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that Slice) GetTime(key int, err ...*Error) time.Time {
|
func (that Slice) GetTime(key int, err ...*Error) *time.Time {
|
||||||
|
|
||||||
v := ObjToTime((that)[key], err...)
|
v := ObjToTime((that)[key], err...)
|
||||||
return v
|
return v
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"admin": {
|
"admin": {
|
||||||
"sql": {
|
"sql": {
|
||||||
"org_id": "org_id",
|
"org_id": "org_id",
|
||||||
"parent_ids[~]": "%,id,%",
|
|
||||||
"role_id": "role_id",
|
"role_id": "role_id",
|
||||||
"zone_id": "zone_id"
|
"zone_id": "zone_id"
|
||||||
},
|
},
|
||||||
@ -56,9 +55,7 @@
|
|||||||
"table": "proj"
|
"table": "proj"
|
||||||
},
|
},
|
||||||
"role": {
|
"role": {
|
||||||
"sql": {
|
"sql": {},
|
||||||
"id": "role_id"
|
|
||||||
},
|
|
||||||
"stop": true,
|
"stop": true,
|
||||||
"table": "role"
|
"table": "role"
|
||||||
},
|
},
|
||||||
@ -127,6 +124,38 @@
|
|||||||
"icon": "Setting",
|
"icon": "Setting",
|
||||||
"label": "系统管理",
|
"label": "系统管理",
|
||||||
"menus": [
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "项目分类",
|
||||||
|
"table": "category"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "日志管理",
|
||||||
|
"table": "logs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "项目管理",
|
||||||
|
"table": "proj"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
"show",
|
"show",
|
||||||
@ -148,8 +177,8 @@
|
|||||||
"info",
|
"info",
|
||||||
"download"
|
"download"
|
||||||
],
|
],
|
||||||
"label": "联络人管理",
|
"label": "微信信息",
|
||||||
"table": "user"
|
"table": "wechat"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
@ -160,8 +189,20 @@
|
|||||||
"info",
|
"info",
|
||||||
"download"
|
"download"
|
||||||
],
|
],
|
||||||
"label": "项目分类",
|
"label": "车辆管理",
|
||||||
"table": "category"
|
"table": "car"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "客户管理",
|
||||||
|
"table": "company"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
@ -175,6 +216,18 @@
|
|||||||
"label": "标签管理",
|
"label": "标签管理",
|
||||||
"table": "out_tag"
|
"table": "out_tag"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "用章管理",
|
||||||
|
"table": "seal_tag"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
"show",
|
"show",
|
||||||
@ -196,16 +249,56 @@
|
|||||||
"info",
|
"info",
|
||||||
"download"
|
"download"
|
||||||
],
|
],
|
||||||
"label": "车辆管理",
|
"label": "联络人管理",
|
||||||
"table": "car"
|
"table": "user"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
"show",
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
"download"
|
"download"
|
||||||
],
|
],
|
||||||
"label": "日志管理",
|
"label": "人员管理",
|
||||||
"table": "logs"
|
"table": "admin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "城市管理",
|
||||||
|
"table": "city"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "供应商管理",
|
||||||
|
"table": "channel"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "部门管理",
|
||||||
|
"table": "org"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
@ -231,90 +324,6 @@
|
|||||||
"label": "标签管理",
|
"label": "标签管理",
|
||||||
"table": "visit_tag"
|
"table": "visit_tag"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "城市管理",
|
|
||||||
"table": "city"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "项目管理",
|
|
||||||
"table": "proj"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "客户管理",
|
|
||||||
"table": "company"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "项目归口",
|
|
||||||
"table": "department"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "部门管理",
|
|
||||||
"table": "org"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "用章管理",
|
|
||||||
"table": "seal_tag"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "微信信息",
|
|
||||||
"table": "wechat"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
"show",
|
"show",
|
||||||
@ -336,58 +345,12 @@
|
|||||||
"info",
|
"info",
|
||||||
"download"
|
"download"
|
||||||
],
|
],
|
||||||
"label": "人员管理",
|
"label": "项目归口",
|
||||||
"table": "admin"
|
"table": "department"
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "供应商管理",
|
|
||||||
"table": "channel"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "sys"
|
"name": "sys"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show"
|
|
||||||
],
|
|
||||||
"icon": "Setting",
|
|
||||||
"label": "任务执行",
|
|
||||||
"menus": [
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "任务执行",
|
|
||||||
"table": "task_admin"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"auth": [
|
|
||||||
"show",
|
|
||||||
"add",
|
|
||||||
"delete",
|
|
||||||
"edit",
|
|
||||||
"info",
|
|
||||||
"download"
|
|
||||||
],
|
|
||||||
"label": "任务管理",
|
|
||||||
"table": "task"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"name": "sys:task"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"auth": [
|
"auth": [
|
||||||
"show"
|
"show"
|
||||||
@ -409,6 +372,40 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "sys:sea"
|
"name": "sys:sea"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show"
|
||||||
|
],
|
||||||
|
"icon": "Setting",
|
||||||
|
"label": "任务管理",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "任务管理",
|
||||||
|
"table": "task"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "任务执行",
|
||||||
|
"table": "task_admin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "sys:task"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user