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
51a91b2b
Commit
51a91b2b
authored
Jun 14, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/cp-new' into feature/3.9.0
parents
4bfa212a
eb7ea01b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
anniversary.go
domain/model/cp_m/anniversary.go
+20
-20
No files found.
domain/model/cp_m/anniversary.go
View file @
51a91b2b
...
@@ -14,15 +14,15 @@ import (
...
@@ -14,15 +14,15 @@ import (
// CpAnniversary cp纪念日
// CpAnniversary cp纪念日
type
CpAnniversary
struct
{
type
CpAnniversary
struct
{
mysql
.
Entity
mysql
.
Entity
Type
cp_e
.
AnniversaryItemType
Type
cp_e
.
AnniversaryItemType
CpId
mysql
.
ID
CpId
mysql
.
ID
UserId1
mysql
.
ID
UserId1
mysql
.
ID
UserId2
mysql
.
ID
UserId2
mysql
.
ID
Content
string
Content
string
Timestamp
int64
Timestamp
int64
IsRemind
bool
IsRemind
bool
Reminded
mysql
.
YesNo
LastRemindTime
int64
Sort
int
Sort
int
}
}
// 初始化6个cp纪念日
// 初始化6个cp纪念日
...
@@ -70,15 +70,15 @@ func GetTranslate(msgId uint, lang string) string {
...
@@ -70,15 +70,15 @@ func GetTranslate(msgId uint, lang string) string {
// 添加cp纪念日
// 添加cp纪念日
func
AddCpAnniversary
(
model
*
domain
.
Model
,
Type
cp_e
.
AnniversaryItemType
,
cp
CpRelationTmp
,
content
string
,
ts
int64
,
isRemind
bool
,
sort
int
)
error
{
func
AddCpAnniversary
(
model
*
domain
.
Model
,
Type
cp_e
.
AnniversaryItemType
,
cp
CpRelationTmp
,
content
string
,
ts
int64
,
isRemind
bool
,
sort
int
)
error
{
return
model
.
DB
()
.
Model
(
CpAnniversary
{})
.
Create
(
&
CpAnniversary
{
return
model
.
DB
()
.
Model
(
CpAnniversary
{})
.
Create
(
&
CpAnniversary
{
CpId
:
cp
.
ID
,
CpId
:
cp
.
ID
,
Type
:
Type
,
Type
:
Type
,
UserId1
:
cp
.
UserId1
,
UserId1
:
cp
.
UserId1
,
UserId2
:
cp
.
UserId2
,
UserId2
:
cp
.
UserId2
,
Content
:
content
,
Content
:
content
,
Timestamp
:
ts
,
Timestamp
:
ts
,
IsRemind
:
isRemind
,
IsRemind
:
isRemind
,
Reminded
:
mysql
.
NO
,
LastRemindTime
:
0
,
Sort
:
sort
,
Sort
:
sort
,
})
.
Error
})
.
Error
}
}
...
@@ -116,7 +116,7 @@ func GetNeedRemindCpAnniversary(model *domain.Model) []CpAnniversary {
...
@@ -116,7 +116,7 @@ func GetNeedRemindCpAnniversary(model *domain.Model) []CpAnniversary {
Where
(
"`timestamp` >= ?"
,
time
.
Now
()
.
Unix
()
-
86400
)
.
Where
(
"`timestamp` >= ?"
,
time
.
Now
()
.
Unix
()
-
86400
)
.
Where
(
"`timestamp` < ?"
,
time
.
Now
()
.
Unix
())
.
Where
(
"`timestamp` < ?"
,
time
.
Now
()
.
Unix
())
.
Where
(
"is_remind = 1"
)
.
Where
(
"is_remind = 1"
)
.
Where
(
"
reminded = ?"
,
mysql
.
NO
)
.
Where
(
"
last_remind_time < ?"
,
time
.
Now
()
.
AddDate
(
-
1
,
0
,
0
)
.
Unix
())
.
// 一年前提醒过
Find
(
&
res
)
.
Error
;
err
!=
nil
{
Find
(
&
res
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetNeedRemindCpAnniversary fail:%v"
,
err
)
model
.
Log
.
Errorf
(
"GetNeedRemindCpAnniversary fail:%v"
,
err
)
}
}
...
@@ -138,5 +138,5 @@ func GetUserTodayCpAnniversary(model *domain.Model, cpId mysql.ID) []CpAnniversa
...
@@ -138,5 +138,5 @@ func GetUserTodayCpAnniversary(model *domain.Model, cpId mysql.ID) []CpAnniversa
}
}
func
UpdateCpAnniversaryReminded
(
model
*
domain
.
Model
,
id
mysql
.
ID
)
error
{
func
UpdateCpAnniversaryReminded
(
model
*
domain
.
Model
,
id
mysql
.
ID
)
error
{
return
model
.
DB
()
.
Model
(
CpAnniversary
{})
.
Where
(
"id = ?"
,
id
)
.
Update
(
"
reminded"
,
mysql
.
YES
)
.
Error
return
model
.
DB
()
.
Model
(
CpAnniversary
{})
.
Where
(
"id = ?"
,
id
)
.
Update
(
"
last_remind_time"
,
time
.
Now
()
.
Unix
()
)
.
Error
}
}
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