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
b0c5bc8e
Commit
b0c5bc8e
authored
Jan 13, 2022
by
lixiaozhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将好友相关的接口请求参数全部改成json的方式
parent
6131f748
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
10 deletions
+77
-10
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
+18
-10
core/src/main/java/com/wecloud/im/friend/param/ImFriendApplyParam.java
+21
-0
core/src/main/java/com/wecloud/im/friend/param/ImFriendApproveParam.java
+19
-0
core/src/main/java/com/wecloud/im/friend/param/ImFriendBaseParam.java
+19
-0
No files found.
core/src/main/java/com/wecloud/im/friend/controller/ImFriendController.java
View file @
b0c5bc8e
...
@@ -3,7 +3,10 @@ package com.wecloud.im.friend.controller;
...
@@ -3,7 +3,10 @@ package com.wecloud.im.friend.controller;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.entity.ImClient
;
import
com.wecloud.im.enums.FriendStateEnum
;
import
com.wecloud.im.enums.FriendStateEnum
;
import
com.wecloud.im.friend.param.ImFriendApplyDto
;
import
com.wecloud.im.friend.param.ImFriendApplyDto
;
import
com.wecloud.im.friend.param.ImFriendApplyParam
;
import
com.wecloud.im.friend.param.ImFriendApproveParam
;
import
com.wecloud.im.friend.param.ImFriendBaseDto
;
import
com.wecloud.im.friend.param.ImFriendBaseDto
;
import
com.wecloud.im.friend.param.ImFriendBaseParam
;
import
com.wecloud.im.friend.param.ImFriendPageParam
;
import
com.wecloud.im.friend.param.ImFriendPageParam
;
import
com.wecloud.im.friend.param.ImFriendRecommendDto
;
import
com.wecloud.im.friend.param.ImFriendRecommendDto
;
import
com.wecloud.im.friend.service.ImFriendService
;
import
com.wecloud.im.friend.service.ImFriendService
;
...
@@ -50,12 +53,15 @@ public class ImFriendController extends BaseController {
...
@@ -50,12 +53,15 @@ public class ImFriendController extends BaseController {
*/
*/
@PostMapping
(
"/info"
)
@PostMapping
(
"/info"
)
@ApiOperation
(
value
=
"查询好友信息,只有自己的好友才查得到"
)
@ApiOperation
(
value
=
"查询好友信息,只有自己的好友才查得到"
)
public
ApiResult
<
ImFriendApplyDto
>
getFriendInfo
(
@ApiParam
(
"好友的clientId"
)
String
friendClientId
)
{
public
ApiResult
<
ImFriendApplyDto
>
getFriendInfo
(
@RequestBody
ImFriendBaseParam
param
)
{
if
(
param
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCurentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
ImClient
friendClient
=
imClientService
.
getCacheImClient
(
currentClient
.
getFkAppid
(),
friendClientId
);
ImClient
friendClient
=
imClientService
.
getCacheImClient
(
currentClient
.
getFkAppid
(),
param
.
getFriendClientId
()
);
if
(
friendClient
==
null
)
{
if
(
friendClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
...
@@ -68,20 +74,22 @@ public class ImFriendController extends BaseController {
...
@@ -68,20 +74,22 @@ public class ImFriendController extends BaseController {
*/
*/
@PostMapping
(
"/apply"
)
@PostMapping
(
"/apply"
)
@ApiOperation
(
value
=
"申请添加好友"
)
@ApiOperation
(
value
=
"申请添加好友"
)
public
ApiResult
<
Boolean
>
applyFriend
(
@ApiParam
(
"好友的clientId"
)
String
friendClientId
,
@ApiParam
(
"备注好友名称"
)
String
friendName
,
public
ApiResult
<
Boolean
>
applyFriend
(
@RequestBody
ImFriendApplyParam
param
)
{
@ApiParam
(
"请求备注"
)
String
requestRemark
)
{
if
(
param
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCurentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
ImClient
friendClient
=
imClientService
.
getCacheImClient
(
currentClient
.
getFkAppid
(),
friendClientId
);
ImClient
friendClient
=
imClientService
.
getCacheImClient
(
currentClient
.
getFkAppid
(),
param
.
getFriendClientId
()
);
if
(
friendClient
==
null
)
{
if
(
friendClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
if
(
currentClient
.
getId
().
equals
(
friendClient
.
getId
()))
{
if
(
currentClient
.
getId
().
equals
(
friendClient
.
getId
()))
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
imFriendService
.
applyFriend
(
currentClient
,
friendClient
,
friendName
,
requestRemark
);
imFriendService
.
applyFriend
(
currentClient
,
friendClient
,
param
.
getFriendName
(),
param
.
getRequestRemark
()
);
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
...
@@ -104,20 +112,20 @@ public class ImFriendController extends BaseController {
...
@@ -104,20 +112,20 @@ public class ImFriendController extends BaseController {
*/
*/
@PostMapping
(
"/approve"
)
@PostMapping
(
"/approve"
)
@ApiOperation
(
value
=
"接受/拒绝好友申请"
)
@ApiOperation
(
value
=
"接受/拒绝好友申请"
)
public
ApiResult
<
Boolean
>
approveFriend
(
String
friendClientId
,
Boolean
agree
,
String
rejectRemark
)
{
public
ApiResult
<
Boolean
>
approveFriend
(
@RequestBody
ImFriendApproveParam
param
)
{
if
(
agree
==
null
)
{
if
(
param
==
null
||
param
.
getAgree
()
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
PARAMETER_EXCEPTION
,
null
);
}
}
ImClient
currentClient
=
imClientService
.
getCurentClient
();
ImClient
currentClient
=
imClientService
.
getCurentClient
();
if
(
currentClient
==
null
)
{
if
(
currentClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
ImClient
friendClient
=
imClientService
.
getCacheImClient
(
currentClient
.
getFkAppid
(),
friendClientId
);
ImClient
friendClient
=
imClientService
.
getCacheImClient
(
currentClient
.
getFkAppid
(),
param
.
getFriendClientId
()
);
if
(
friendClient
==
null
)
{
if
(
friendClient
==
null
)
{
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
return
ApiResult
.
fail
(
ApiCode
.
CLIENT_NOT_FOUNT
,
null
);
}
}
imFriendService
.
approveFriend
(
currentClient
.
getId
(),
friendClient
.
getId
(),
agree
,
rejectRemark
);
imFriendService
.
approveFriend
(
currentClient
.
getId
(),
friendClient
.
getId
(),
param
.
getAgree
(),
param
.
getRejectRemark
()
);
return
ApiResult
.
ok
();
return
ApiResult
.
ok
();
}
}
...
...
core/src/main/java/com/wecloud/im/friend/param/ImFriendApplyParam.java
0 → 100644
View file @
b0c5bc8e
package
com
.
wecloud
.
im
.
friend
.
param
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Description TODO
* @Author lixiaozhong
* @Date 2022/1/13 4:24 下午
*/
@Data
public
class
ImFriendApplyParam
extends
ImFriendBaseParam
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"备注好友名称"
)
private
String
friendName
;
@ApiModelProperty
(
"请求备注"
)
private
String
requestRemark
;
}
core/src/main/java/com/wecloud/im/friend/param/ImFriendApproveParam.java
0 → 100644
View file @
b0c5bc8e
package
com
.
wecloud
.
im
.
friend
.
param
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @Description TODO
* @Author lixiaozhong
* @Date 2022/1/13 4:24 下午
*/
@Data
public
class
ImFriendApproveParam
extends
ImFriendBaseParam
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"是否同意接受好友,true同意,false拒绝"
)
private
Boolean
agree
;
@ApiModelProperty
(
"拒绝理由,如果是同意就不用填啦"
)
private
String
rejectRemark
;
}
core/src/main/java/com/wecloud/im/friend/param/ImFriendBaseParam.java
0 → 100644
View file @
b0c5bc8e
package
com
.
wecloud
.
im
.
friend
.
param
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Description TODO
* @Author lixiaozhong
* @Date 2022/1/13 4:24 下午
*/
@Data
public
class
ImFriendBaseParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
"好友的client-id"
)
private
String
friendClientId
;
}
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