Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
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
hujiebin
hilo-group
Commits
bd5b7076
Commit
bd5b7076
authored
Mar 10, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
家族成员
parent
78416234
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
group_power_invite.go
domain/model/groupPower_m/group_power_invite.go
+50
-0
No files found.
domain/model/groupPower_m/group_power_invite.go
0 → 100644
View file @
bd5b7076
package
groupPower_m
import
(
"git.hilo.cn/hilo-common/resource/mysql"
"gorm.io/gorm"
"hilo-group/myerr"
"time"
)
type
GroupPowerInviteJoin
struct
{
Id
uint64
`json:"id"`
UserId
uint64
`json:"user_id"`
GroupPowerId
uint64
`json:"group_power_id"`
CreatedTime
time
.
Time
`json:"created_time"`
UpdatedTime
time
.
Time
`json:"updated_time"`
InviteUserId
uint64
`json:"invite_user_id"`
IsAccept
int8
`json:"is_accept"`
}
func
InsertGroupPowerInviteJoin
(
userId
,
inviteUserId
,
familyId
uint64
)
error
{
nowTime
:=
time
.
Now
()
sql
:=
"insert into group_power_invite_join(user_id,invite_user_id,group_power_id,is_accept,created_time,updated_time) "
+
"value(?,?,?,?,?,?) on duplicate key update is_accept=?,created_time=?,updated_time=?"
err
:=
mysql
.
Db
.
Exec
(
sql
,
userId
,
inviteUserId
,
familyId
,
0
,
nowTime
,
nowTime
,
0
,
nowTime
,
nowTime
)
.
Error
if
err
!=
nil
{
return
myerr
.
WrapErr
(
err
)
}
return
nil
}
func
GetGroupPowerInviteJoin
(
userId
,
familyId
uint64
)
(
*
GroupPowerInviteJoin
,
error
)
{
res
:=
new
(
GroupPowerInviteJoin
)
err
:=
mysql
.
Db
.
Where
(
GroupPowerInviteJoin
{
UserId
:
userId
,
GroupPowerId
:
familyId
})
.
Where
(
"is_accept=0"
)
.
First
(
&
res
)
.
Error
if
err
!=
nil
{
if
err
==
gorm
.
ErrRecordNotFound
{
return
nil
,
nil
}
else
{
return
nil
,
myerr
.
WrapErr
(
err
)
}
}
return
res
,
nil
}
func
AcceptGroupPowerInviteJoin
(
userId
,
familyId
uint64
)
error
{
err
:=
mysql
.
Db
.
Exec
(
"update group_power_invite_join set is_accept = 1 where user_id=? and group_power_id=?"
,
userId
,
familyId
)
.
Error
if
err
!=
nil
{
return
myerr
.
WrapErr
(
err
)
}
return
nil
}
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