Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
homekeeper
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Peter Cheng
homekeeper
Commits
35999478
Commit
35999478
authored
Jun 20, 2019
by
Peter Cheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正時間計算方式
parent
6df3bbad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
punchclock.go
controllers/punchclock.go
+10
-9
No files found.
controllers/punchclock.go
View file @
35999478
...
@@ -84,15 +84,15 @@ func calcLeaveScope(params *beans.Punchclock) (diffDay int, diffHour int, diffMi
...
@@ -84,15 +84,15 @@ func calcLeaveScope(params *beans.Punchclock) (diffDay int, diffHour int, diffMi
_diffHour
:=
0
_diffHour
:=
0
_diffMinute
:=
0
_diffMinute
:=
0
if
beginTime
<
1200
{
//有跨午休
if
beginTime
<
1200
{
//有跨午休
_diffHour
,
_diffMinute
=
calcTime
(
beginHour
,
"18"
,
beginMinute
,
"0"
,
true
)
_diffHour
,
_diffMinute
=
calcTime
(
beginHour
,
"18"
,
beginMinute
,
"0
0
"
,
true
)
}
else
{
//沒跨午休
}
else
{
//沒跨午休
_diffHour
,
_diffMinute
=
calcTime
(
beginHour
,
"18"
,
beginMinute
,
"0"
,
false
)
_diffHour
,
_diffMinute
=
calcTime
(
beginHour
,
"18"
,
beginMinute
,
"0
0
"
,
false
)
}
}
diffDay
=
calcDate
(
beginYear
,
beginMonth
,
beginDay
,
endYear
,
endMonth
,
endDay
)
diffDay
=
calcDate
(
beginYear
,
beginMonth
,
beginDay
,
endYear
,
endMonth
,
endDay
)
if
endTime
>
133
0
{
//有跨午休
if
endTime
>
=
120
0
{
//有跨午休
diffHour
,
diffMinute
=
calcTime
(
"8"
,
endHour
,
"30"
,
endMinute
,
true
)
diffHour
,
diffMinute
=
calcTime
(
"
0
8"
,
endHour
,
"30"
,
endMinute
,
true
)
}
else
{
//沒跨午休
}
else
{
//沒跨午休
diffHour
,
diffMinute
=
calcTime
(
"8"
,
endHour
,
"30"
,
endMinute
,
false
)
diffHour
,
diffMinute
=
calcTime
(
"
0
8"
,
endHour
,
"30"
,
endMinute
,
false
)
}
}
diffHour
=
diffHour
+
_diffHour
diffHour
=
diffHour
+
_diffHour
diffMinute
=
diffMinute
+
_diffMinute
diffMinute
=
diffMinute
+
_diffMinute
...
@@ -108,7 +108,7 @@ func setCarry(diffDay int, diffHour int, diffMinute int) (_diffDay int, _diffHou
...
@@ -108,7 +108,7 @@ func setCarry(diffDay int, diffHour int, diffMinute int) (_diffDay int, _diffHou
_diffMinute
=
diffMinute
_diffMinute
=
diffMinute
_diffHour
=
diffMinute
/
60
+
_diffHour
_diffHour
=
diffMinute
/
60
+
_diffHour
_diffMinute
=
diffMinute
%
60
_diffMinute
=
diffMinute
%
60
_diffDay
=
_diff
Hour
/
8
+
_diffDay
_diffDay
=
_diff
Day
+
_diffHour
/
8
_diffHour
=
_diffHour
%
8
_diffHour
=
_diffHour
%
8
return
_diffDay
,
_diffHour
,
_diffMinute
return
_diffDay
,
_diffHour
,
_diffMinute
}
}
...
@@ -163,18 +163,19 @@ func calcDate(beginYear string, beginMonth string, beginDay string, endYear stri
...
@@ -163,18 +163,19 @@ func calcDate(beginYear string, beginMonth string, beginDay string, endYear stri
now
:=
begin
.
Format
(
cfg
.
TimeFormat
)
now
:=
begin
.
Format
(
cfg
.
TimeFormat
)
nowDate
:=
strings
.
Split
(
now
,
" "
)[
0
]
nowDate
:=
strings
.
Split
(
now
,
" "
)[
0
]
nowArr
:=
strings
.
Split
(
nowDate
,
"-"
)
nowArr
:=
strings
.
Split
(
nowDate
,
"-"
)
if
begin
.
Equal
(
end
)
{
break
}
if
isHoliday
(
nowArr
[
0
],
nowArr
[
1
],
nowArr
[
2
])
{
if
isHoliday
(
nowArr
[
0
],
nowArr
[
1
],
nowArr
[
2
])
{
add
,
_
:=
time
.
ParseDuration
(
"24h"
)
add
,
_
:=
time
.
ParseDuration
(
"24h"
)
begin
=
begin
.
Add
(
add
)
begin
=
begin
.
Add
(
add
)
continue
continue
}
}
if
!
begin
.
Before
(
end
)
{
break
}
add
,
_
:=
time
.
ParseDuration
(
"24h"
)
add
,
_
:=
time
.
ParseDuration
(
"24h"
)
begin
=
begin
.
Add
(
add
)
begin
=
begin
.
Add
(
add
)
diffDay
++
diffDay
++
}
}
diffDay
--
//去掉當天的加一
}
}
return
diffDay
return
diffDay
...
...
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