|
|
@@ -0,0 +1,31 @@
|
|
|
+package com.fs.wxcid.service.impl;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.fs.common.exception.CustomException;
|
|
|
+import com.fs.wxcid.dto.common.ApiResponseCommon;
|
|
|
+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.stereotype.Service;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class UserServiceImpl implements UserService {
|
|
|
+ private static final String BASE_URL = "http://114.117.215.244:7006";
|
|
|
+ @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);
|
|
|
+ }
|
|
|
+
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+}
|