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
0877a9e4
Commit
0877a9e4
authored
Jun 17, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:纪念日bugfux
parent
8bbb009e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
anniversary.go
_const/enum/cp_e/anniversary.go
+3
-1
anniversary.go
domain/model/cp_m/anniversary.go
+8
-11
anniversary.go
route/cp_r/anniversary.go
+1
-1
No files found.
_const/enum/cp_e/anniversary.go
View file @
0877a9e4
...
...
@@ -5,5 +5,7 @@ type AnniversaryItemType int
const
(
AnniversaryItemTypeNormal
AnniversaryItemType
=
0
// 普通类型
AnniversaryItemTypeAvatar
AnniversaryItemType
=
1
// 头像类型
AnniversaryItemTypeAnniversary
AnniversaryItemType
=
2
// 纪念日类型(一年一度,如生日/结婚纪念日)
AnniversaryItemTypeBirthday1
AnniversaryItemType
=
2
// user1的生日
AnniversaryItemTypeBirthday2
AnniversaryItemType
=
3
// user2的生日
AnniversaryItemTypeAnniversary
AnniversaryItemType
=
4
// 纪念日
)
domain/model/cp_m/anniversary.go
View file @
0877a9e4
...
...
@@ -36,10 +36,10 @@ func InitCpAnniversary(model *domain.Model, cp CpRelation, lang string) error {
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
GetTranslate
(
259
,
lang
),
time
.
Now
()
.
Unix
(),
true
,
100
,
259
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemType
Anniversary
,
cp
,
fmt
.
Sprintf
(
GetTranslate
(
260
,
lang
),
users
[
cp
.
UserId1
]
.
Nick
),
0
,
true
,
0
,
260
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemType
Birthday1
,
cp
,
fmt
.
Sprintf
(
GetTranslate
(
260
,
lang
),
users
[
cp
.
UserId1
]
.
Nick
),
0
,
true
,
0
,
260
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemType
Anniversary
,
cp
,
fmt
.
Sprintf
(
GetTranslate
(
260
,
lang
),
users
[
cp
.
UserId2
]
.
Nick
),
0
,
true
,
0
,
260
);
err
!=
nil
{
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemType
Birthday2
,
cp
,
fmt
.
Sprintf
(
GetTranslate
(
260
,
lang
),
users
[
cp
.
UserId2
]
.
Nick
),
0
,
true
,
0
,
260
);
err
!=
nil
{
return
err
}
if
err
:=
AddCpAnniversary
(
model
,
cp_e
.
AnniversaryItemTypeNormal
,
cp
,
GetTranslate
(
261
,
lang
),
0
,
true
,
0
,
261
);
err
!=
nil
{
...
...
@@ -110,17 +110,14 @@ func GetAllCpAnniversary(model *domain.Model, userId mysql.ID, lang string) []Cp
}
var
userIds
=
[]
mysql
.
ID
{
relation
.
UserId1
,
relation
.
UserId2
}
users
,
_
:=
user_m
.
GetUserMapByIds
(
model
,
userIds
)
n
:=
0
for
i
,
v
:=
range
res
{
if
v
.
CreatedTime
.
Equal
(
v
.
UpdatedTime
)
&&
v
.
MsgId
>
0
{
res
[
i
]
.
Content
=
GetTranslate
(
v
.
MsgId
,
lang
)
if
v
.
MsgId
==
260
{
n
++
if
n
==
1
{
res
[
i
]
.
Content
=
fmt
.
Sprintf
(
GetTranslate
(
v
.
MsgId
,
lang
),
users
[
relation
.
UserId1
]
.
Nick
)
}
else
{
res
[
i
]
.
Content
=
fmt
.
Sprintf
(
GetTranslate
(
v
.
MsgId
,
lang
),
users
[
relation
.
UserId2
]
.
Nick
)
}
if
v
.
Type
==
cp_e
.
AnniversaryItemTypeBirthday1
{
res
[
i
]
.
Content
=
fmt
.
Sprintf
(
GetTranslate
(
v
.
MsgId
,
lang
),
users
[
relation
.
UserId1
]
.
Nick
)
}
else
if
v
.
Type
==
cp_e
.
AnniversaryItemTypeBirthday2
{
res
[
i
]
.
Content
=
fmt
.
Sprintf
(
GetTranslate
(
v
.
MsgId
,
lang
),
users
[
relation
.
UserId2
]
.
Nick
)
}
else
{
res
[
i
]
.
Content
=
GetTranslate
(
v
.
MsgId
,
lang
)
}
}
}
...
...
route/cp_r/anniversary.go
View file @
0877a9e4
...
...
@@ -133,7 +133,7 @@ func PageAnniversary(c *gin.Context) (*mycontext.MyContext, error) {
anniversary
:=
cp_m
.
GetAllCpAnniversary
(
model
,
userId
,
lang
)
for
_
,
v
:=
range
anniversary
{
timestamp
:=
v
.
Timestamp
if
v
.
Type
==
cp_e
.
AnniversaryItemTypeAnniversary
&&
timestamp
>
0
{
if
v
.
Type
>=
cp_e
.
AnniversaryItemTypeBirthday1
&&
timestamp
>
0
{
timestamp
=
cp_m
.
CalcNextAnniversary
(
timestamp
,
loc
)
}
// 客户端只认识0 1
...
...
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