Skip to content

Commit

Permalink
添加当新用户注册时关注频道功能
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyrian2012 committed Aug 20, 2022
1 parent 9310bf1 commit 5200cda
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 3 deletions.
5 changes: 4 additions & 1 deletion config/im.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ im.use_random_name=true
# 新用户注册时,自动添加机器人为好友。这里可以修改为添加销售人员id,或者客服人员id,用户跟客户进行沟通。
im.new_user_robot_friend=true
im.robot_friend_id=FireRobot
im.robot_welcome=您好,我是人见人爱、花见花开、天下第一帅的机器人小火!可以跟我聊天哦!
im.robot_welcome=您好,我是人见人爱、花见花开、天下第一帅的机器人小火!可以跟我聊天哦!

# 新用户注册时,自动关注频道。如果不需要关注,下面配置内容设置为空就OK了。
im.new_user_subscribe_channel_id="vwzqmws2k"
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<log4j2.version>2.17.2</log4j2.version>
<wfc.sdk.version>0.89</wfc.sdk.version>
<wfc.sdk.version>0.92</wfc.sdk.version>
</properties>

<dependencies>
Expand Down
Binary file removed src/lib/common-0.89.jar
Binary file not shown.
Binary file modified src/lib/common-0.92.jar
Binary file not shown.
Binary file removed src/lib/sdk-0.89.jar
Binary file not shown.
Binary file modified src/lib/sdk-0.92.jar
Binary file not shown.
10 changes: 10 additions & 0 deletions src/main/java/cn/wildfirechat/app/IMConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public void setUse_random_name(boolean use_random_name) {
String robot_friend_id;
String robot_welcome;

String new_user_subscribe_channel_id;

public String getAdmin_url() {
return admin_url;
}
Expand Down Expand Up @@ -82,4 +84,12 @@ public String getRobot_welcome() {
public void setRobot_welcome(String robot_welcome) {
this.robot_welcome = robot_welcome;
}

public String getNew_user_subscribe_channel_id() {
return new_user_subscribe_channel_id;
}

public void setNew_user_subscribe_channel_id(String new_user_subscribe_channel_id) {
this.new_user_subscribe_channel_id = new_user_subscribe_channel_id;
}
}
9 changes: 8 additions & 1 deletion src/main/java/cn/wildfirechat/app/ServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,19 @@ private RestResult onLoginSuccess(HttpServletResponse httpResponse, String mobil
}

if (mIMConfig.new_user_robot_friend && !StringUtils.isEmpty(mIMConfig.robot_friend_id)) {
;
RelationAdmin.setUserFriend(user.getUserId(), mIMConfig.robot_friend_id, true, null);
if (!StringUtils.isEmpty(mIMConfig.robot_welcome)) {
sendTextMessage(mIMConfig.robot_friend_id, user.getUserId(), mIMConfig.robot_welcome);
}
}

if (!StringUtils.isEmpty(mIMConfig.new_user_subscribe_channel_id)) {
try {
GeneralAdmin.subscribeChannel(mIMConfig.getNew_user_subscribe_channel_id(), user.getUserId());
} catch (Exception e) {

}
}
} else {
if (!StringUtils.isEmpty(mIMConfig.welcome_for_back_user)) {
sendTextMessage("admin", user.getUserId(), mIMConfig.welcome_for_back_user);
Expand Down

0 comments on commit 5200cda

Please sign in to comment.