|
|
@@ -230,19 +230,12 @@ public class MiniPopularizeFrontServiceImpl implements MiniPopularizeFrontServic
|
|
|
} else if (miniPopularizeUserConversationChat.getStatus() != MiniPopularizeUserConversationChat.Status.success) {
|
|
|
throw BusinessRuntimeException.getInstance("图片还未生成,无法进行修改");
|
|
|
}
|
|
|
- recoverNum.set(false);
|
|
|
+ recoverNum.set(true);
|
|
|
}
|
|
|
Long userId = conversation.getUserId();
|
|
|
+ //扣除次数
|
|
|
+ decrMiniUserGptNum(userId);
|
|
|
if (conversationId == null) {
|
|
|
- //查询当前用户信息
|
|
|
- MiniPopularizeUser user = miniPopularizeUserMapper.selectOne(Wrappers.lambdaQuery(MiniPopularizeUser.class).eq(MiniPopularizeUser::getUserId, userId));
|
|
|
- if (user.getNum() == 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("无可用次数");
|
|
|
- }
|
|
|
- int i = miniPopularizeUserMapper.decLumaNum(userId, 1, user.getNum());
|
|
|
- if (i == 0) {
|
|
|
- throw BusinessRuntimeException.getInstance("网络异常,请稍后再试");
|
|
|
- }
|
|
|
conversation.setConversationId(RandomUtil.randomString(32));
|
|
|
conversationMapper.insert(conversation);
|
|
|
conversationId = conversation.getConversationId();
|
|
|
@@ -355,4 +348,17 @@ public class MiniPopularizeFrontServiceImpl implements MiniPopularizeFrontServic
|
|
|
} else redisService.setNx(shareCountKey, 0l, RedisService.key.TG_MINI_USER_SAHRE_COUNT_KEY.getTimeout());
|
|
|
redisService.incr(shareCountKey, 1l);
|
|
|
}
|
|
|
+
|
|
|
+ private void decrMiniUserGptNum(Long userId) {
|
|
|
+ //查询当前用户信息
|
|
|
+ MiniPopularizeUser user = miniPopularizeUserMapper.selectOne(Wrappers.lambdaQuery(MiniPopularizeUser.class).eq(MiniPopularizeUser::getUserId, userId));
|
|
|
+ if (user.getNum() == 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("无可用次数");
|
|
|
+ }
|
|
|
+ int i = miniPopularizeUserMapper.decLumaNum(userId, 1, user.getNum());
|
|
|
+ if (i == 0) {
|
|
|
+ throw BusinessRuntimeException.getInstance("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|