From 6a99e83107428159d321c1b77cb994e0b2f92fe5 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 10 Oct 2023 10:25:05 +0800
Subject: [PATCH] redbagprod
---
src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java | 2
src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java | 31 ++++++++++
src/main/resources/templates/febs/views/modules/chat/userList.html | 41 +++++++++++--
src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java | 15 +++++
src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java | 4 +
src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java | 20 ++++++
src/main/resources/application-prod.yml | 4
src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java | 23 +++++++
src/main/resources/mapper/modules/ChatUserMapper.xml | 14 ++++
src/main/resources/application.yml | 2
src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html | 8 ++
11 files changed, 153 insertions(+), 11 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java
index aec2763..6691826 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminChatController.java
@@ -66,6 +66,29 @@
}
/**
+ * 用户列表---开启
+ *
+ * @param userId
+ * @return
+ */
+ @GetMapping("openSwitchIsRobot/{userId}")
+ @ControllerEndpoint(operation = "会员列表---开启", exceptionMessage = "操作失败")
+ public FebsResponse openSwitchIsRobot(@NotNull(message = "{required}") @PathVariable String userId) {
+ return iAdminChatService.openSwitchIsRobot(userId);
+ }
+ /**
+ * 用户列表---关闭
+ *
+ * @param userId
+ * @return
+ */
+ @GetMapping("closeSwitchIsRobot/{userId}")
+ @ControllerEndpoint(operation = "会员列表---关闭", exceptionMessage = "操作失败")
+ public FebsResponse closeSwitchIsRobot(@NotNull(message = "{required}") @PathVariable String userId) {
+ return iAdminChatService.closeSwitchIsRobot(userId);
+ }
+
+ /**
* 用户列表-系统拨付
*/
@PostMapping("updateSystemPay")
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java b/src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java
index a84807a..09f7039 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/ChatUser.java
@@ -78,6 +78,26 @@
* 版本信息
*/
private String version;
+
+ /**
+ * 邀请码
+ */
+ private String inviteId;
+
+ /**
+ * 父级邀请码
+ */
+ private String referrerId;
+
+ /**
+ * 邀请码链
+ */
+ private String referrerIds;
+
+ /**
+ * 是否是机器人 0:否 1:是
+ */
+ private Integer isRobot;
/**
* 注册时间
*/
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java
index cd987c5..cbb40b3 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/ChatUserMapper.java
@@ -33,4 +33,6 @@
void updateWithdrawStateById(@Param("state")int i,@Param("id")String id);
void updateAmountFlowListByWithdrawId(@Param("id")String id, @Param("userId")String userId, @Param("state")int i);
+
+ void updateIsRobotByUserId(@Param("userId")String userId, @Param("isRobot")int i);
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java b/src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java
index 197a51d..620c028 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IAdminChatService.java
@@ -30,4 +30,8 @@
FebsResponse agreeEvent(String id);
FebsResponse disagreeEvent(String id);
+
+ FebsResponse openSwitchIsRobot(String userId);
+
+ FebsResponse closeSwitchIsRobot(String userId);
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java
index 6e218ca..49a1b50 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java
@@ -2,6 +2,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.mall.YesOrNoEnum;
import cc.mrbird.febs.mall.dto.AdminSystemPayDto;
import cc.mrbird.febs.mall.entity.ChatAmountFlow;
@@ -23,6 +24,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
import java.math.BigDecimal;
@@ -33,6 +35,7 @@
public class AdminChatServiceImpl extends ServiceImpl<ChatUserMapper, ChatUser> implements IAdminChatService {
private final ChatAmountFlowMapper chatAmountFlowMapper;
+ private final RedisUtils redisUtils;
@Override
public IPage<AdminChatUserVo> getUserList(ChatUser chatUser, QueryRequest request) {
@@ -58,6 +61,14 @@
return new FebsResponse().fail().message("会员信息不存在");
}
this.baseMapper.updateStatusByUserId(userId,YesOrNoEnum.NO.getCode());
+ if (chatUser != null) {
+ // 清理token
+ String token = chatUser.getToken();
+ if (!StringUtils.isEmpty(token)) {
+ String TOKEN_REDIS_APP = "token:app:";
+ redisUtils.del(TOKEN_REDIS_APP + token);
+ }
+ }
return new FebsResponse().success();
}
@@ -148,4 +159,24 @@
return new FebsResponse().success();
}
+ @Override
+ public FebsResponse openSwitchIsRobot(String userId) {
+ ChatUser chatUser = this.baseMapper.selectByUserId(userId);
+ if(ObjectUtil.isEmpty(chatUser)) {
+ return new FebsResponse().fail().message("会员信息不存在");
+ }
+ this.baseMapper.updateIsRobotByUserId(userId,1);
+ return new FebsResponse().success();
+ }
+
+ @Override
+ public FebsResponse closeSwitchIsRobot(String userId) {
+ ChatUser chatUser = this.baseMapper.selectByUserId(userId);
+ if(ObjectUtil.isEmpty(chatUser)) {
+ return new FebsResponse().fail().message("会员信息不存在");
+ }
+ this.baseMapper.updateIsRobotByUserId(userId,0);
+ return new FebsResponse().success();
+ }
+
}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java
index 4e200c6..141dada 100644
--- a/src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java
+++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserVo.java
@@ -32,4 +32,19 @@
* 账户可用
*/
private BigDecimal avaAmount;
+
+ /**
+ * 邀请码
+ */
+ private String inviteId;
+
+ /**
+ * 邀请码
+ */
+ private String phone;
+
+ /**
+ * 是否是机器人 0:否 1:是
+ */
+ private Integer isRobot;
}
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index c10711f..1246144 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -24,7 +24,7 @@
# Redis数据库索引(默认为 0)
database: 2
# Redis服务器地址
- host: 127.0.0.1
+ host: 154.91.195.148
# Redis服务器连接端口
port: 6379
# Redis 密码
@@ -44,7 +44,7 @@
# rabbitmq 配置
rabbitmq:
- host: 127.0.0.1
+ host: 154.91.195.148
port: 5672
username: xc_rabbit
password: xuncong123
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 3538ebe..08d60c0 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -5,7 +5,7 @@
spring:
profiles:
- active: dev
+ active: prod
servlet:
multipart:
diff --git a/src/main/resources/mapper/modules/ChatUserMapper.xml b/src/main/resources/mapper/modules/ChatUserMapper.xml
index b040b45..556cd0f 100644
--- a/src/main/resources/mapper/modules/ChatUserMapper.xml
+++ b/src/main/resources/mapper/modules/ChatUserMapper.xml
@@ -7,7 +7,10 @@
a.user_id userId,
a.nick_name nickName,
a.chat_no chatNo,
+ a.phone phone,
a.status status,
+ a.invite_id inviteId,
+ a.is_robot isRobot,
date_format(a.create_time, '%Y-%m-%d %H:%m:%s') createTime,
IFNULL(sum(b.total_amount), 0) totalAmount,
IFNULL(sum(b.ava_amount), 0) avaAmount
@@ -18,8 +21,8 @@
<if test="record.nickName != null and record.nickName != ''">
and a.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%'))
</if>
- <if test="record.chatNo != null and record.chatNo != ''">
- and a.chat_no = #{record.chatNo}
+ <if test="record.inviteId != null and record.inviteId != ''">
+ and a.invite_id = #{record.inviteId}
</if>
<if test="record.status != null and record.status != ''">
and a.status = #{record.status}
@@ -154,4 +157,11 @@
update chat_amount_flow set state = #{state} where user_id = #{userId} and relation_id = #{id}
</update>
+ <update id="updateIsRobotByUserId">
+ update chat_user
+ set
+ is_robot = #{isRobot}
+ where user_id = #{userId}
+ </update>
+
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html b/src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html
index 80b2a9b..0f00bf7 100644
--- a/src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html
+++ b/src/main/resources/templates/febs/views/modules/chat/chatAmountFlow.html
@@ -25,6 +25,10 @@
<option value="4">转账</option>
<option value="5">创建群聊</option>
<option value="6">系统拨付</option>
+ <option value="7">团队奖励</option>
+ <option value="8">集团奖励</option>
+ <option value="9">中雷补偿</option>
+ <option value="10">中雷扣除</option>
</select>
</div>
</div>
@@ -64,6 +68,10 @@
4: {title: '转账', color: 'orange'},
5: {title: '创建群聊', color: 'green'},
6: {title: '系统拨付', color: 'blue'},
+ 7: {title: '团队奖励', color: 'blue'},
+ 8: {title: '集团奖励', color: 'blue'},
+ 9: {title: '中雷补偿', color: 'blue'},
+ 10: {title: '中雷扣除', color: 'blue'},
}[d.type];
}}
<span class="layui-badge febs-bg-{{type.color}}">{{ type.title }}</span>
diff --git a/src/main/resources/templates/febs/views/modules/chat/userList.html b/src/main/resources/templates/febs/views/modules/chat/userList.html
index 8f7e381..988ac81 100644
--- a/src/main/resources/templates/febs/views/modules/chat/userList.html
+++ b/src/main/resources/templates/febs/views/modules/chat/userList.html
@@ -14,9 +14,9 @@
</div>
</div>
<div class="layui-inline">
- <label class="layui-form-label">微聊号:</label>
+ <label class="layui-form-label">邀请码:</label>
<div class="layui-input-inline">
- <input type="text" placeholder="微聊号" name="chatNo" autocomplete="off" class="layui-input">
+ <input type="text" placeholder="邀请码" name="inviteId" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
@@ -60,6 +60,13 @@
<input type="checkbox" value={{d.userId}} lay-text="正常|禁用" checked lay-skin="switch" lay-filter="switchStatus">
{{# } else { }}
<input type="checkbox" value={{d.userId}} lay-text="正常|禁用" lay-skin="switch" lay-filter="switchStatus">
+ {{# } }}
+</script>
+<script type="text/html" id="switchIsRobot">
+ {{# if(d.isRobot === 1) { }}
+ <input type="checkbox" value={{d.userId}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchIsRobot">
+ {{# } else { }}
+ <input type="checkbox" value={{d.userId}} lay-text="是|否" lay-skin="switch" lay-filter="switchIsRobot">
{{# } }}
</script>
<style>
@@ -110,7 +117,7 @@
function getQueryParams() {
return {
nickName: $searchForm.find('input[name="nickName"]').val().trim(),
- chatNo: $searchForm.find('input[name="chatNo"]').val().trim(),
+ inviteId: $searchForm.find('input[name="inviteId"]').val().trim(),
status: $searchForm.find("select[name='status']").val()
};
}
@@ -125,12 +132,14 @@
totalRow: true ,// 开启合计行
cols: [[
{type: 'checkbox'},
- {field: 'userId', title: '标识', minWidth: 150,align:'left', totalRowText: '合计:',align:'center'},
- {field: 'nickName', title: '昵称', minWidth: 100,align:'left',align:'center'},
- {field: 'chatNo', title: '微聊号', minWidth: 150,align:'left',align:'center'},
+ // {field: 'userId', title: '标识', minWidth: 150,align:'left'},
+ {field: 'nickName', title: '昵称', minWidth: 100,align:'left', totalRowText: '合计:',align:'center'},
+ {field: 'inviteId', title: '邀请码', minWidth: 100,align:'left',align:'center'},
+ {field: 'phone', title: '注册号码', minWidth: 150,align:'left',align:'center'},
{field: 'totalAmount', title: '账户总额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.totalAmount) }}',align:'center'},
{field: 'avaAmount', title: '账户余额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.avaAmount) }}',align:'center'},
{field: 'status', title: '账号状态', templet: '#switchStatus', minWidth: 80,align:'center'},
+ {field: 'isRobot', title: '机器人', templet: '#switchIsRobot', minWidth: 80,align:'center'},
{field: 'createTime', title: '注册时间', minWidth: 180,align:'center'},
]]
});
@@ -201,5 +210,25 @@
});
}
+ form.on('switch(switchIsRobot)', function (data) {
+ if (data.elem.checked) {
+ openSwitchIsRobot(data.value);
+ } else {
+ closeSwitchIsRobot(data.value);
+ }
+ })
+ function openSwitchIsRobot(userId) {
+ febs.get(ctx + 'admin/chat/openSwitchIsRobot/' + userId, null, function () {
+ febs.alert.success('操作成功');
+ $query.click();
+ });
+ }
+ function closeSwitchIsRobot(userId) {
+ febs.get(ctx + 'admin/chat/closeSwitchIsRobot/' + userId, null, function () {
+ febs.alert.success('操作成功');
+ $query.click();
+ });
+ }
+
})
</script>
\ No newline at end of file
--
Gitblit v1.9.1