Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
9dcff60d
Commit
9dcff60d
authored
Mar 02, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新deviceToken调整
parent
fafab232
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
core/src/main/java/com/wecloud/im/controller/ImClientController.java
+4
-2
core/src/main/java/com/wecloud/im/controller/TokenController.java
+0
-1
core/src/main/java/com/wecloud/im/externalaccess/service/UserService.java
+4
-0
core/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
+18
-3
No files found.
core/src/main/java/com/wecloud/im/controller/ImClientController.java
View file @
9dcff60d
package
com
.
wecloud
.
im
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.wecloud.im.entity.ImApplication
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.param.ClientInfoParam
;
...
...
@@ -93,8 +94,9 @@ public class ImClientController extends BaseController {
*/
@PostMapping
(
"/addDeviceInfo"
)
@ApiOperation
(
value
=
"添加或修改推送设备信息(每次请求都会覆盖之前的数据)"
)
public
ApiResult
<
Boolean
>
addDeviceInfo
(
@Validated
(
Add
.
class
)
@RequestBody
ClientDeviceUpdateParam
imClientDevice
)
throws
Exception
{
boolean
flag
=
imClientService
.
updateDeviceInfo
(
imClientDevice
);
public
ApiResult
<
Boolean
>
addDeviceInfo
(
@Validated
(
Add
.
class
)
@RequestBody
ClientDeviceUpdateParam
param
)
throws
Exception
{
log
.
info
(
"添加或修改推送设备信息入参 {}"
,
JSON
.
toJSONString
(
param
));
boolean
flag
=
imClientService
.
updateDeviceInfo
(
param
);
return
ApiResult
.
result
(
flag
);
}
...
...
core/src/main/java/com/wecloud/im/controller/TokenController.java
View file @
9dcff60d
...
...
@@ -36,7 +36,6 @@ public class TokenController extends BaseController {
@PostMapping
(
"/verify"
)
@ApiOperation
(
value
=
"根据sign申请token"
,
notes
=
"校验客户方生成的签名字符串,验证通过则下发token"
)
public
ApiResult
<
TokenVo
>
verify
(
@RequestBody
ImTokenVerify
imTokenVerify
)
throws
NacosException
{
return
imClientLoginService
.
verifySign
(
imTokenVerify
);
}
...
...
core/src/main/java/com/wecloud/im/externalaccess/service/UserService.java
View file @
9dcff60d
...
...
@@ -65,6 +65,9 @@ public class UserService extends BaseServiceImpl<UserMapper, User> {
private
ImClientService
imClientService
;
@Autowired
private
ImClientDeviceService
imClientDeviceService
;
@Autowired
private
ImFriendService
imFriendService
;
@Autowired
...
...
@@ -150,6 +153,7 @@ public class UserService extends BaseServiceImpl<UserMapper, User> {
imClientDevice
.
setDeviceType
(
param
.
getDeviceType
());
imClientDevice
.
setCreateTime
(
new
Date
());
imClientDevice
.
setUpdateTime
(
new
Date
());
imClientDeviceService
.
save
(
imClientDevice
);
}
LoginSuccessDto
loginSuccessDto
=
new
LoginSuccessDto
();
...
...
core/src/main/java/com/wecloud/im/service/impl/ImClientServiceImpl.java
View file @
9dcff60d
...
...
@@ -32,6 +32,7 @@ import com.wecloud.im.service.ImClientService;
import
com.wecloud.im.vo.ClientInfoVo
;
import
com.wecloud.im.vo.GetInfoListVo
;
import
com.wecloud.im.vo.MyInfoVo
;
import
com.wecloud.utils.SnowflakeUtil
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.exception.BusinessException
;
import
io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl
;
...
...
@@ -49,6 +50,7 @@ import org.springframework.cache.annotation.Cacheable;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -220,13 +222,26 @@ public class ImClientServiceImpl extends BaseServiceImpl<ImClientMapper, ImClien
JwtToken
currentJwtToken
=
JwtUtil
.
getCurrentJwtToken
();
imClientDeviceService
.
removeOldToken
(
currentClient
.
getId
(),
currentJwtToken
.
getToken
());
}
// 修改
return
imClientDeviceService
.
update
(
new
UpdateWrapper
<
ImClientDevice
>().
lambda
()
ImClientDevice
clientDeviceToUpdate
=
imClientDeviceService
.
getOne
(
new
QueryWrapper
<
ImClientDevice
>().
lambda
()
.
eq
(
ImClientDevice:
:
getFkAppid
,
currentClient
.
getFkAppid
())
.
eq
(
ImClientDevice:
:
getFkClientId
,
currentClient
.
getId
())
.
eq
(
ImClientDevice:
:
getDeviceType
,
param
.
getDeviceType
())
.
set
(
ImClientDevice:
:
getDeviceToken
,
param
.
getDeviceToken
())
);
if
(
clientDeviceToUpdate
==
null
)
{
ImClientDevice
imClientDevice
=
new
ImClientDevice
();
imClientDevice
.
setId
(
SnowflakeUtil
.
getId
());
imClientDevice
.
setFkAppid
(
currentClient
.
getFkAppid
());
imClientDevice
.
setFkClientId
(
currentClient
.
getId
());
imClientDevice
.
setValid
(
1
);
imClientDevice
.
setDeviceType
(
param
.
getDeviceType
());
imClientDevice
.
setCreateTime
(
new
Date
());
imClientDevice
.
setUpdateTime
(
new
Date
());
imClientDeviceService
.
save
(
imClientDevice
);
}
else
{
clientDeviceToUpdate
.
setDeviceToken
(
param
.
getDeviceToken
());
imClientDeviceService
.
updateById
(
clientDeviceToUpdate
);
}
return
true
;
}
@Override
...
...
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