|
@@ -4,6 +4,7 @@ import com.fs.common.exception.CustomException;
|
|
|
import com.fs.wxcid.ServiceUtils;
|
|
import com.fs.wxcid.ServiceUtils;
|
|
|
import com.fs.wxcid.dto.common.ApiResponse;
|
|
import com.fs.wxcid.dto.common.ApiResponse;
|
|
|
import com.fs.wxcid.dto.common.ApiResponseCommon;
|
|
import com.fs.wxcid.dto.common.ApiResponseCommon;
|
|
|
|
|
+import com.fs.wxcid.dto.common.BaseResponse;
|
|
|
import com.fs.wxcid.dto.friend.*;
|
|
import com.fs.wxcid.dto.friend.*;
|
|
|
import com.fs.wxcid.dto.login.RequestBaseVo;
|
|
import com.fs.wxcid.dto.login.RequestBaseVo;
|
|
|
import com.fs.wxcid.service.FriendService;
|
|
import com.fs.wxcid.service.FriendService;
|
|
@@ -71,6 +72,53 @@ public class FriendServiceImpl implements FriendService {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ApiResponseCommon<SearchContactResponse> searchContact(String authKey, SearchContactRequest request) {
|
|
|
|
|
+ log.info("开始搜索联系人,authKey: {}, request: {}", authKey, request);
|
|
|
|
|
+
|
|
|
|
|
+ String url = BASE_URL + "/friend/SearchContact?key=" + authKey;
|
|
|
|
|
+
|
|
|
|
|
+ ApiResponseCommon<SearchContactResponse> response = WxWorkHttpUtil.postWithType(
|
|
|
|
|
+ url,
|
|
|
|
|
+ request,
|
|
|
|
|
+ new TypeReference<ApiResponseCommon<SearchContactResponse>>() {}
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ // 校验响应
|
|
|
|
|
+ if (response.getCode() != 200 || response.getData() == null) {
|
|
|
|
|
+ throw new CustomException("搜索联系人失败: " + response.getText());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SearchContactResponse data = response.getData();
|
|
|
|
|
+ String userNameStr = data.getUserNameStr();
|
|
|
|
|
+ String antispamTicket = data.getAntispamTicket();
|
|
|
|
|
+
|
|
|
|
|
+ log.info("搜索成功 - V3: {}, V4: {}",
|
|
|
|
|
+ userNameStr != null ? userNameStr : "null",
|
|
|
|
|
+ antispamTicket != null ? antispamTicket : "null"
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ return response;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public ApiResponseCommon<BaseResponse> verifyUser(String authKey, AgreeAddRequest request) {
|
|
|
|
|
+ String url = BASE_URL + "/friend/VerifyUser?key=" + authKey;
|
|
|
|
|
+
|
|
|
|
|
+ ApiResponseCommon<BaseResponse> response = WxWorkHttpUtil.postWithType(
|
|
|
|
|
+ url,
|
|
|
|
|
+ request,
|
|
|
|
|
+ new TypeReference<ApiResponseCommon<BaseResponse>>() {}
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ // 校验通用响应
|
|
|
|
|
+ if (response.getCode() != 200 || response.getData() == null) {
|
|
|
|
|
+ throw new CustomException("发起好友验证失败: " + response.getText());
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("好友验证请求已成功发送");
|
|
|
|
|
+ return response;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public ContactListResponse getContactListNotKey(Long accountId) {
|
|
public ContactListResponse getContactListNotKey(Long accountId) {
|
|
|
GetContactListRequest request = new GetContactListRequest();
|
|
GetContactListRequest request = new GetContactListRequest();
|