Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-user
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenweijian
hilo-user
Commits
38042739
Commit
38042739
authored
Jun 17, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据header的Timezone获取时区
parent
b4589560
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
anniversary.go
route/cp_r/anniversary.go
+2
-3
space.go
route/cp_r/space.go
+2
-2
cp_test.go
test/cp_test.go
+12
-1
No files found.
route/cp_r/anniversary.go
View file @
38042739
...
@@ -14,7 +14,6 @@ import (
...
@@ -14,7 +14,6 @@ import (
"hilo-user/req"
"hilo-user/req"
"hilo-user/resp"
"hilo-user/resp"
"strconv"
"strconv"
"time"
)
)
type
PostPutAnniversaryReq
struct
{
type
PostPutAnniversaryReq
struct
{
...
@@ -95,8 +94,8 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -95,8 +94,8 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) {
return
myCtx
,
err
return
myCtx
,
err
}
}
model
:=
domain
.
CreateModelContext
(
myCtx
)
model
:=
domain
.
CreateModelContext
(
myCtx
)
loc
,
err
:=
time
.
LoadLocation
(
c
.
GetHeader
(
mycontext
.
TIMEZONE
))
loc
:=
timezone_e
.
GetFixedTimezone
(
c
.
GetHeader
(
mycontext
.
TIMEZONE
))
if
err
!
=
nil
{
if
loc
=
=
nil
{
user
,
err
:=
user_m
.
GetUser
(
model
,
userId
)
user
,
err
:=
user_m
.
GetUser
(
model
,
userId
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myCtx
,
err
return
myCtx
,
err
...
...
route/cp_r/space.go
View file @
38042739
...
@@ -36,8 +36,8 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -36,8 +36,8 @@ func CpSpace(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
loc
,
err
:=
time
.
LoadLocation
(
c
.
GetHeader
(
mycontext
.
TIMEZONE
))
loc
:=
timezone_e
.
GetFixedTimezone
(
c
.
GetHeader
(
mycontext
.
TIMEZONE
))
if
err
!
=
nil
{
if
loc
=
=
nil
{
if
userInfo
.
Language
==
"ar"
{
if
userInfo
.
Language
==
"ar"
{
loc
=
timezone_e
.
KSATimezoneLoc
loc
=
timezone_e
.
KSATimezoneLoc
}
}
...
...
test/cp_test.go
View file @
38042739
package
test
package
test
import
(
import
(
"git.hilo.cn/hilo-common/_const/enum/timezone_e"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/domain"
"hilo-user/domain/model/cp_m"
"hilo-user/domain/model/cp_m"
"testing"
"testing"
"time"
)
)
func
TestInitCpAnniversary
(
t
*
testing
.
T
)
{
func
TestInitCpAnniversary
(
t
*
testing
.
T
)
{
...
@@ -16,6 +18,15 @@ func TestInitCpAnniversary(t *testing.T) {
...
@@ -16,6 +18,15 @@ func TestInitCpAnniversary(t *testing.T) {
}
}
func
TestCalcNextAnniversary
(
t
*
testing
.
T
)
{
func
TestCalcNextAnniversary
(
t
*
testing
.
T
)
{
t2
:=
cp_m
.
CalcNextAnniversary
(
1686211996
)
t2
:=
cp_m
.
CalcNextAnniversary
(
1686211996
,
time
.
Local
)
println
(
t2
)
println
(
t2
)
}
}
func
TestCalLoc
(
t
*
testing
.
T
)
{
loc
:=
timezone_e
.
GetFixedTimezone
(
"GMT+8"
)
println
(
time
.
Now
()
.
In
(
loc
)
.
Format
(
"2006-01-02 15:04:05"
))
loc
=
timezone_e
.
GetFixedTimezone
(
"GMT+3"
)
println
(
time
.
Now
()
.
In
(
loc
)
.
Format
(
"2006-01-02 15:04:05"
))
loc
=
timezone_e
.
GetFixedTimezone
(
"GMT+5"
)
println
(
time
.
Now
()
.
In
(
loc
)
.
Format
(
"2006-01-02 15:04:05"
))
}
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