|
|
@@ -2,30 +2,32 @@ package com.fs.wxcid.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
+import com.fs.wxcid.ServiceUtils;
|
|
|
import com.fs.wxcid.dto.common.ApiResponseCommon;
|
|
|
+import com.fs.wxcid.dto.login.LoginQrCodeResponseData;
|
|
|
+import com.fs.wxcid.dto.login.LoginStatusData;
|
|
|
+import com.fs.wxcid.dto.login.QrCodeRequest;
|
|
|
+import com.fs.wxcid.dto.login.RequestBaseVo;
|
|
|
import com.fs.wxcid.dto.user.UserProfileData;
|
|
|
import com.fs.wxcid.service.UserService;
|
|
|
import com.fs.wxwork.utils.WxWorkHttpUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class UserServiceImpl implements UserService {
|
|
|
private static final String BASE_URL = "http://114.117.215.244:7006";
|
|
|
+ @Autowired
|
|
|
+ private ServiceUtils serviceUtils;
|
|
|
@Override
|
|
|
- public ApiResponseCommon<UserProfileData> getProfile(String authKey) {
|
|
|
- String url = BASE_URL + "/user/GetProfile?key=" + authKey;
|
|
|
- ApiResponseCommon<UserProfileData> response = WxWorkHttpUtil.getWithType(
|
|
|
- url,
|
|
|
- new TypeReference<ApiResponseCommon<UserProfileData>>() {}
|
|
|
- );
|
|
|
-
|
|
|
- if (response.getCode() != 200) {
|
|
|
- String errorMsg = response.getText();
|
|
|
- throw new CustomException("获取个人信息失败: " + errorMsg);
|
|
|
+ public UserProfileData getProfile(Long accountId) {
|
|
|
+ try {
|
|
|
+ ApiResponseCommon<UserProfileData> response = serviceUtils.sendGet("/login/GetLoginStatus", RequestBaseVo.builder().accountId(accountId).data(null).build(), new TypeReference<ApiResponseCommon<UserProfileData>>() {});
|
|
|
+ return response.getData();
|
|
|
+ }catch (Exception e){
|
|
|
+ return new UserProfileData();
|
|
|
}
|
|
|
-
|
|
|
- return response;
|
|
|
}
|
|
|
}
|