Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
web_log
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9b4245db
authored
Jan 06, 2021
by
lzzzzl
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增登录校验
parent
b08ea6b2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletions
utils/util.go
utils/util.go
View file @
9b4245db
package
utils
import
"os"
import
(
"encoding/json"
"io/ioutil"
"os"
)
func
PathExists
(
path
string
)
(
bool
,
error
)
{
_
,
err
:=
os
.
Stat
(
path
)
...
...
@@ -12,3 +16,21 @@ func PathExists(path string) (bool, error) {
}
return
false
,
err
}
// (fileSize string, lastTime string)
func
PathFileInfo
(
path
string
)
string
{
files
,
_
:=
ioutil
.
ReadDir
(
path
)
var
index
int
var
infos
=
make
([]
map
[
string
]
interface
{},
len
(
files
))
for
_
,
file
:=
range
files
{
infos
[
index
]
=
make
(
map
[
string
]
interface
{})
infos
[
index
][
"file_size"
]
=
file
.
Size
()
infos
[
index
][
"last_modify"
]
=
file
.
ModTime
()
.
Unix
()
infos
[
index
][
"file_name"
]
=
file
.
Name
()
index
++
}
data
,
_
:=
json
.
Marshal
(
infos
)
return
string
(
data
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment