zoujiajian 1 год назад
Родитель
Сommit
a7cf0329db

+ 10 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsGptCarController.java

@@ -136,7 +136,7 @@ public class CmsGptCarController {
 	 * 新增镜像车队账号
 	 */
 	@PostMapping("/post/mirror/car/session")
-	public Result<String> postMirrorCarSession(@RequestBody ChatgptSession chatgptSession) {
+	public Result<String> postMirrorCarSession(@RequestBody ChatgptSession chatgptSession) throws Exception {
 		Integer selectCount = chatgptSessionMapper.selectCount(Wrappers.lambdaQuery(ChatgptSession.class)
 				.eq(chatgptSession.getCarId() != null, ChatgptSession::getCarId, chatgptSession.getCarId()).or().eq(ChatgptSession::getEmail, chatgptSession.getEmail()));
 		if (selectCount > 0) {
@@ -172,6 +172,15 @@ public class CmsGptCarController {
 		refresh(chatgptSession.getId());
 		chatgptSessionMapper.updateById(chatgptSession);
 
+		//同步session的会员类型
+		if (StrUtil.isNotEmpty(chatgptSession.getOfficialSession())) {
+			String officialSession = chatgptSession.getOfficialSession();
+			JSONObject session = Jsons.parseObject(officialSession, JSONObject.class);
+			String accessToken = session.getStr("accessToken");
+			if (StrUtil.isNotEmpty(accessToken)) {
+				getGptAccountInfo(request, chatgptSession.getId(), accessToken);
+			}
+		}
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}