Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aon-tg-messenger
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
Odysseus
aon-tg-messenger
Commits
873e75af
Commit
873e75af
authored
Aug 05, 2024
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update db update
parent
1fb03814
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
db.go
dao/db.go
+10
-4
docker-compose.yml
docker-compose.yml
+2
-2
No files found.
dao/db.go
View file @
873e75af
...
...
@@ -11,7 +11,10 @@ import (
func
(
d
*
Dao
)
CreateUser
(
user
*
dbModel
.
User
)
(
err
error
)
{
return
d
.
db
.
Clauses
(
clause
.
OnConflict
{
Columns
:
[]
clause
.
Column
{{
Name
:
"user_id"
},
{
Name
:
"chat_id"
}},
DoUpdates
:
clause
.
Assignments
(
map
[
string
]
interface
{}{
"left_at"
:
gorm
.
Expr
(
"NULL"
)}),
DoUpdates
:
clause
.
Assignments
(
map
[
string
]
interface
{}{
"left_at"
:
gorm
.
Expr
(
"NULL"
),
"updated_at"
:
gorm
.
Expr
(
"NOW()"
),
}),
})
.
Create
(
user
)
.
Error
}
...
...
@@ -19,7 +22,10 @@ func (d *Dao) IncrMessageCount(a *dbModel.Active) (err error) {
a
.
MsgCount
=
1
return
d
.
db
.
Clauses
(
clause
.
OnConflict
{
Columns
:
[]
clause
.
Column
{{
Name
:
"user_id"
},
{
Name
:
"chat_id"
},
{
Name
:
"unix_day"
}},
DoUpdates
:
clause
.
Assignments
(
map
[
string
]
interface
{}{
"msg_count"
:
gorm
.
Expr
(
fmt
.
Sprintf
(
"%s.msg_count + ?"
,
a
.
TableName
()),
1
)}),
DoUpdates
:
clause
.
Assignments
(
map
[
string
]
interface
{}{
"msg_count"
:
gorm
.
Expr
(
fmt
.
Sprintf
(
"%s.msg_count + ?"
,
a
.
TableName
()),
1
),
"updated_at"
:
gorm
.
Expr
(
"NOW()"
),
}),
})
.
Create
(
a
)
.
Error
}
...
...
docker-compose.yml
View file @
873e75af
...
...
@@ -15,7 +15,7 @@ services:
volumes
:
-
./conf/tg-messenger/config.toml:/config.toml
-
./
data
/tg-messenger/db.crt:/app/db.crt
-
./
conf
/tg-messenger/db.crt:/app/db.crt
-
./data/tg-messenger/api-log:/app
command
:
-
"
/bin/sh"
...
...
@@ -34,7 +34,7 @@ services:
volumes
:
-
./conf/tg-messenger/config.toml:/config.toml
-
./
data
/tg-messenger/db.crt:/app/db.crt
-
./
conf
/tg-messenger/db.crt:/app/db.crt
-
./data/tg-messenger/messenger-log:/app
command
:
-
"
/bin/sh"
...
...
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