|
|
@@ -5,6 +5,7 @@ import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.IoKit;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.model.entity.ChatgptSession;
|
|
|
import com.cyksj.model.entity.ChatgptUser;
|
|
|
import com.cyksj.model.request.gpt.ConversationRequest;
|
|
|
import com.cyksj.model.response.ConversationLimitResponse;
|
|
|
@@ -62,6 +63,33 @@ public class MirrorController {
|
|
|
response.sendRedirect(chatGptAccountService.getLoginUrl(userId, relationId));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * GPT车票跳转登录
|
|
|
+ *
|
|
|
+ * @param userToken 用户token
|
|
|
+ * @param carId 车票id
|
|
|
+ * @return 登陆结果
|
|
|
+ */
|
|
|
+ @GetMapping("/gpt/oauth")
|
|
|
+ public Result<String> gptOauth(@RequestParam("usertoken") String userToken, @RequestParam("carid") String carId) {
|
|
|
+ try {
|
|
|
+ ChatgptUser user = chatGptAccountService.findByUserTokenAndExpireTimeAfter(userToken, LocalDateTime.now());
|
|
|
+ if (user == null) {
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().setMsg("用户不存在或已过期").setCode(0).toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ ChatgptSession session = chatGptAccountService.checkSession(carId);
|
|
|
+ if (session.getIsCar()) {
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().setMsg("登陆成功").setCode(1).toResult();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("服务器错误", e);
|
|
|
+ return GatewayResponse.FAIL.newBuilder().setMsg("服务器错误").setCode(0).toResult();
|
|
|
+ }
|
|
|
+ return GatewayResponse.FAIL.newBuilder().setMsg("服务器错误").setCode(0).toResult();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* GPT车队跳转登录
|
|
|
*
|