|
|
@@ -1,7 +1,10 @@
|
|
|
package com.cyksj.service.gpt.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.common.constant.Constant;
|
|
|
@@ -10,10 +13,12 @@ import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.mapper.GptQuickLinkRecordMapper;
|
|
|
import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
import com.cyksj.model.entity.GptQuickLinkRecord;
|
|
|
+import com.cyksj.model.entity.SysConfig;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.response.GptQuickLinkResp;
|
|
|
import com.cyksj.service.chatgpt.ChatGptAccountService;
|
|
|
import com.cyksj.service.gpt.GptQuickLinkService;
|
|
|
+import com.cyksj.service.sys.SysConfigService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.param.Operator;
|
|
|
@@ -44,6 +49,8 @@ public class GptQuickLinkServiceImpl implements GptQuickLinkService {
|
|
|
|
|
|
private final ChatGptAccountService chatGptAccountService;
|
|
|
|
|
|
+ private final SysConfigService sysConfigService;
|
|
|
+
|
|
|
@Override
|
|
|
public GptQuickLinkRecord createQuickLink(Long userId) {
|
|
|
// 检查用户是否有GPT镜像车票
|
|
|
@@ -116,7 +123,7 @@ public class GptQuickLinkServiceImpl implements GptQuickLinkService {
|
|
|
GroupsRelationView groupsRelationView = validGptTicket.get(0);
|
|
|
Long relationId = groupsRelationView.getId();
|
|
|
//获取gpt镜像访问url
|
|
|
- String url = chatGptAccountService.getCarLoginUrl(null, userId, relationId, Constant.GPT_CARD_ID);
|
|
|
+ String url = chatGptAccountService.getCarLoginUrl(getGptDomain(), userId, relationId, Constant.GPT_CARD_ID);
|
|
|
resp.setUrl(url);
|
|
|
}
|
|
|
}
|
|
|
@@ -135,4 +142,21 @@ public class GptQuickLinkServiceImpl implements GptQuickLinkService {
|
|
|
.build());
|
|
|
return relationViews;
|
|
|
}
|
|
|
+
|
|
|
+ public String getGptDomain() {
|
|
|
+ SysConfig gptNewDomain = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
+ .eq(SysConfig::getSysKey, "mirror_gpt_new_domain")
|
|
|
+ .last("limit 1"));
|
|
|
+ if (gptNewDomain != null) {
|
|
|
+ String sysValue = gptNewDomain.getSysValue();
|
|
|
+ if (JSONUtil.isJsonArray(sysValue)) {
|
|
|
+ List<String> domainList = JSONUtil.parseArray(sysValue).toList(String.class);
|
|
|
+ if (CollUtil.isNotEmpty(domainList)) {
|
|
|
+ int randomInt = RandomUtil.randomInt(domainList.size());
|
|
|
+ return domainList.get(randomInt);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|