Skip to content

Commit

Permalink
v1.3.6: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mizuki1412 committed Apr 13, 2022
1 parent 84cac73 commit 3c19c68
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
4 changes: 2 additions & 2 deletions goland-live-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func NewWithSchema(schema string,tx ...*sqlx.Tx) *Dao {
```
func (dao *Dao) FindById(id int32) *$bean$ {
sql, args := sqlkit.Builder().Select("*").From(dao.GetTableD("$name$")).Where("id=?",id).MustSql()
return dao.scanOne(sql, args)
return dao.ScanOne(sql, args)
}
type ListParam struct {
Expand All @@ -305,7 +305,7 @@ type ListParam struct {
func (dao *Dao) List(param ListParam) []*$bean$ {
builder := sqlkit.Builder().Select("*").From(dao.GetTableD("$name$")).Where("off=false").OrderBy("id")
sql, args := builder.MustSql()
return dao.scan(sql, args)
return dao.ScanList(sql, args)
}
```

Expand Down
2 changes: 1 addition & 1 deletion library/filekit/file_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package filekit

import "strings"

// 转化文件中的 /
// TransferName 转化文件中的 /
func TransferName(name string) string {
return strings.ReplaceAll(name, "/", "-")
}
2 changes: 1 addition & 1 deletion library/timekit/time_transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func ParseString(dtString string, layout string) (time.Time, error) {
func Parse(dt string) (time.Time, error) {
var s time.Time
// 日期时间格式 + 毫秒形式
if ok, _ := regexp.Match("^[\\d]{13}$", []byte(dt)); ok {
if ok, _ := regexp.Match("^[\\d]+$", []byte(dt)); ok {
s0, err := cast.ToInt64E(dt)
if err != nil {
return s, err
Expand Down
17 changes: 4 additions & 13 deletions service/restkit/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"net/http"
"reflect"
"strings"
"time"
)

type Context struct {
Expand Down Expand Up @@ -232,18 +231,10 @@ func (ctx *Context) bindStruct(bean any) {
case "class.Time":
if !stringkit.IsNull(val) {
temp := class.Time{}
if len(val) == 13 && strings.Index(val, "-") < 0 {
s, err := cast.ToInt64E(val)
if err == nil {
//panic(exception.New("time cast error"))
temp.Set(time.UnixMilli(s))
}
} else {
s, err := timekit.Parse(val)
if err == nil {
//panic(exception.New("time cast error"))
temp.Set(s)
}
s, err := timekit.Parse(val)
if err == nil {
//panic(exception.New("time cast error"))
temp.Set(s)
}
fieldV.Set(reflect.ValueOf(temp))
}
Expand Down

0 comments on commit 3c19c68

Please sign in to comment.