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
da1bfa2e
Commit
da1bfa2e
authored
Jun 14, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
im check
parent
9f9b92a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
cp_relation.go
domain/model/cp_m/cp_relation.go
+2
-2
cp_relation.go
route/cp_r/cp_relation.go
+29
-3
No files found.
domain/model/cp_m/cp_relation.go
View file @
da1bfa2e
...
...
@@ -149,9 +149,9 @@ func GetCpInvite(model *domain.Model, userId, userIdInvite uint64, status cp_e.C
return
res
,
nil
}
func
GetCpInviteById
(
model
*
domain
.
Model
,
id
uint64
,
status
cp_e
.
CpInviteStatus
)
(
*
CpInvite
,
error
)
{
func
GetCpInviteById
(
model
*
domain
.
Model
,
id
,
userId
uint64
)
(
*
CpInvite
,
error
)
{
res
:=
new
(
CpInvite
)
err
:=
model
.
DB
()
.
Model
(
CpInvite
{})
.
Where
(
CpInvite
{
Id
:
id
,
Status
:
status
}
)
.
First
(
&
res
)
.
Error
err
:=
model
.
DB
()
.
Model
(
CpInvite
{})
.
Where
(
CpInvite
{
Id
:
id
})
.
Where
(
"user_id = ? or invite_userId = ?"
,
userId
,
userId
)
.
First
(
&
res
)
.
Error
if
err
!=
nil
{
if
err
==
gorm
.
ErrRecordNotFound
{
return
nil
,
nil
...
...
route/cp_r/cp_relation.go
View file @
da1bfa2e
...
...
@@ -479,15 +479,27 @@ func CheckCpImExpire(c *gin.Context) (*mycontext.MyContext, error) {
}
model
:=
domain
.
CreateModelContext
(
myCtx
)
var
resId
common
.
MsgIdType
switch
msgType
{
case
1
:
// 邀请的消息im检查是否过期
cpRecord
,
err
:=
cp_m
.
GetCpInviteById
(
model
,
msgId
,
cp_e
.
CpInvite
)
cpRecord
,
err
:=
cp_m
.
GetCpInviteById
(
model
,
msgId
,
userId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"CheckCpImExpire userId:%d, msgType:%d, msgId:%d, err:%v"
,
userId
,
msgType
,
msgId
,
err
)
return
myCtx
,
err
}
if
cpRecord
==
nil
||
cpRecord
.
Id
==
0
{
return
myCtx
,
myerr
.
ToLocal
(
msg
.
GetErrByLanguage
(
model
,
common
.
MSG_ID_ALREADY_EXPIRED
,
lang
,
comerr
.
AlreadyExpired
))
model
.
Log
.
Errorf
(
"CheckCpImExpire userId:%d, msgType:%d, msgId:%d, err:%v"
,
userId
,
msgType
,
msgId
,
bizerr
.
InvalidParameter
)
return
myCtx
,
bizerr
.
InvalidParameter
}
switch
cpRecord
.
Status
{
case
cp_e
.
CpInvite
:
if
userId
==
cpRecord
.
UserId
{
// 发起人
resId
=
common
.
MSG_ID_ALREADY_EXPIRED
}
case
cp_e
.
CpInviteAccept
,
cp_e
.
CpInviteRefuse
:
resId
=
common
.
MSG_ID_ALREADY_EXPIRED
case
cp_e
.
CpInviteExpired
:
resId
=
common
.
MSG_ID_ALREADY_EXPIRED
}
case
2
:
// 解除的消息im检查是否过期
cpCancel
,
err
:=
cp_m
.
GetCpCancelById
(
model
,
msgId
,
cp_e
.
CpCancel
)
...
...
@@ -496,8 +508,22 @@ func CheckCpImExpire(c *gin.Context) (*mycontext.MyContext, error) {
return
myCtx
,
err
}
if
cpCancel
==
nil
||
cpCancel
.
Id
==
0
{
return
myCtx
,
myerr
.
ToLocal
(
msg
.
GetErrByLanguage
(
model
,
common
.
MSG_ID_ALREADY_EXPIRED
,
lang
,
comerr
.
AlreadyExpired
))
model
.
Log
.
Errorf
(
"CheckCpImExpire userId:%d, msgType:%d, msgId:%d, err:%v"
,
userId
,
msgType
,
msgId
,
bizerr
.
InvalidParameter
)
return
myCtx
,
bizerr
.
InvalidParameter
}
switch
cpCancel
.
Status
{
case
cp_e
.
CpCancel
:
if
userId
==
cpCancel
.
UserId
{
// 发起人
resId
=
common
.
MSG_ID_ALREADY_EXPIRED
}
case
cp_e
.
CpCancelRevoke
,
cp_e
.
CpCancelAccept
:
resId
=
common
.
MSG_ID_ALREADY_EXPIRED
case
cp_e
.
CpCancelAcceptAuto
:
resId
=
common
.
MSG_ID_ALREADY_EXPIRED
}
}
if
resId
>
0
{
return
myCtx
,
myerr
.
ToLocal
(
msg
.
GetErrByLanguage
(
model
,
resId
,
lang
,
comerr
.
AlreadyExpired
))
}
resp
.
ResponseOk
(
c
,
cp_cv
.
CheckCpImRes
{})
...
...
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