|
@@ -109,6 +109,14 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
|
|
|
|
|
private final ChatgptUserRestrictionMapper chatgptUserRestrictionMapper;
|
|
private final ChatgptUserRestrictionMapper chatgptUserRestrictionMapper;
|
|
|
|
|
|
|
|
|
|
+ private final MidjourneyUserMapper midjourneyUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final ClaudeUserMapper claudeUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final LumaUserMapper lumaUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final GrokUserMapper grokUserMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public String getGptSession(String account, String password) {
|
|
public String getGptSession(String account, String password) {
|
|
|
String officialSession = "";
|
|
String officialSession = "";
|
|
@@ -841,6 +849,63 @@ public class ChatGptAccountServiceImpl implements ChatGptAccountService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String getMirrorToken(long userId, Long relationId) {
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
|
|
+ .eq(GroupsRelation::getId, relationId)
|
|
|
|
|
+ .gt(GroupsRelation::getExpiryTime, DateTime.now())
|
|
|
|
|
+ .in(GroupsRelation::getUserId, userIdList)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (relation == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("车票不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
|
|
|
|
|
+ GoodsDonSku sku = skuMapper.selectById(groupsTrips.getSkuId());
|
|
|
|
|
+ Long goodsId = sku.getGoodsId();
|
|
|
|
|
+ if (goodsId == Constant.MJ_GID) {
|
|
|
|
|
+ MidjourneyUser user = midjourneyUserMapper.selectOne(Wrappers.lambdaQuery(MidjourneyUser.class)
|
|
|
|
|
+ .eq(MidjourneyUser::getRelationId, relationId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (user != null) {
|
|
|
|
|
+ return user.getUserToken();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (goodsId == Constant.GPT_PLUS_GID) {
|
|
|
|
|
+ ChatgptUser chatgptUser = chatgptUserMapper.selectOne(Wrappers.lambdaQuery(ChatgptUser.class)
|
|
|
|
|
+ .eq(ChatgptUser::getRelationId, relationId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (chatgptUser != null) {
|
|
|
|
|
+ return chatgptUser.getUserToken();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (goodsId == Constant.CALUDE_GOODS_ID) {
|
|
|
|
|
+ ClaudeUser claudeUser = claudeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeUser.class)
|
|
|
|
|
+ .eq(ClaudeUser::getRelationId, relationId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (claudeUser != null) {
|
|
|
|
|
+ return claudeUser.getUserToken();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (goodsId == Constant.GROK_GOODS_ID) {
|
|
|
|
|
+ GrokUser grokUser = grokUserMapper.selectOne(Wrappers.lambdaQuery(GrokUser.class)
|
|
|
|
|
+ .eq(GrokUser::getRelationId, relationId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (grokUser != null) {
|
|
|
|
|
+ return grokUser.getUserToken();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (goodsId == Constant.LUMA_GOODS_ID) {
|
|
|
|
|
+ LumaUser lumaUser = lumaUserMapper.selectOne(Wrappers.lambdaQuery(LumaUser.class)
|
|
|
|
|
+ .eq(LumaUser::getRelationId, relationId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ if (lumaUser != null) {
|
|
|
|
|
+ return lumaUser.getUserToken();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("车票不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private synchronized ChatgptUser createTrialUser(String clientIP) {
|
|
private synchronized ChatgptUser createTrialUser(String clientIP) {
|
|
|
//固定 sku id
|
|
//固定 sku id
|
|
|
GoodsDonSku goodsDonSku = skuMapper.selectById(535L);
|
|
GoodsDonSku goodsDonSku = skuMapper.selectById(535L);
|