更新時間:2019-11-20
用戶可以查詢所有部門里面聯(lián)系人的詳細信息。
已完成組件的初始化和登錄。
傳入的參數(shù)TSDK_S_SEARCH_CONTACTS_PARAM即為搜索聯(lián)系人請求參數(shù),包括:
搜索關(guān)鍵字、當前需要查找的頁面索引(從1開始)、是否精確查找,以及當前查詢序號。建議應(yīng)用程序設(shè)置的查詢序號從0開始遞增,最大值0xFFFFFFFD(0xFFFFFFFE為SDK內(nèi)部保留值)。
部門ID,若填寫則在指定部門下查詢。
- (void)searchContactWithParam:(SearchParam *)searchParam { TSDK_S_SEARCH_CONTACTS_PARAM *tsdkSearchParam = (TSDK_S_SEARCH_CONTACTS_PARAM *)malloc(sizeof(TSDK_S_SEARCH_CONTACTS_PARAM)); memset(tsdkSearchParam, 0, sizeof(TSDK_S_SEARCH_CONTACTS_PARAM)); if (searchParam.acSearchItem.length > 0 && searchParam.acSearchItem != nil) { strcpy(tsdkSearchParam->search_keyword, [searchParam.acSearchItem UTF8String]); } tsdkSearchParam->page_index = searchParam.ulPageIndex; tsdkSearchParam->is_exact_search = searchParam.ulExactSearch; if (searchParam.acDepId.length > 0 && searchParam.acDepId != nil && ![searchParam.acDepId isEqualToString:@"-1"]) { strcpy(tsdkSearchParam->department_id, [searchParam.acDepId UTF8String]); } tsdkSearchParam->seq_no = searchParam.ulSeqNo; TSDK_RESULT result = tsdk_search_contacts(tsdkSearchParam); DDLogInfo(@"tsdk_search_contacts result: %d",result); free(tsdkSearchParam); }
查詢到的聯(lián)系人信息包括:UC帳號、姓名、工號、IP號碼、部門名字、職務(wù)、郵箱、手機號碼、座機號碼、家庭電話、性別、郵編、地址、簽名和硬終端等內(nèi)容。
case TSDK_E_EADDR_EVT_SEARCH_CONTACTS_RESULT: { DDLogInfo(@"TSDK_E_EADDR_EVT_SEARCH_CONTACTS_RESULT"); BOOL result = notification.param1 == TSDK_SUCCESS; if (!result) { DDLogError(@"TSDK_E_EADDR_EVT_SEARCH_CONTACTS_RESULT,error:%@",[NSString stringWithUTF8String:(TSDK_CHAR *)notification.data]); return; } TSDK_S_SEARCH_CONTACTS_RESULT *searchContactorResult = (TSDK_S_SEARCH_CONTACTS_RESULT *)notification.data; if (searchContactorResult == NULL) { DDLogWarn(@"handleSearchContact result is empty."); return; } int pageIndex = searchContactorResult->page; int totalNum = searchContactorResult->total_num; TSDK_S_CONTACTS_INFO *pstContactorInfo = searchContactorResult->contact_info; //查詢配置自己軟終端號 if (notification.param2 == 100) { if (pstContactorInfo != NULL) { ContactInfo *contactInfo = [ContactInfo contactInfoTransformFrom:pstContactorInfo[0]]; [[ManagerService callService] configBussinessAccount:contactInfo.terminal token:nil]; [eSpaceDBService sharedInstance].localDataManager = [[ESpaceLocalDataManager alloc] initWithUserAccount:contactInfo.staffAccount]; } return; } NSMutableArray *contactArray = [[NSMutableArray alloc] init]; // 搜索到的聯(lián)系人結(jié)果放入聯(lián)系人數(shù)組,傳遞給界面使用 for (int i = 0; i< totalNum; i++) { int lastTotal = totalNum - PAGE_ITEM_SIZE*(pageIndex-1); int endIndex = (lastTotal < PAGE_ITEM_SIZE) ? lastTotal : PAGE_ITEM_SIZE ; if (i == endIndex) { NSDictionary *resultInfo = @{ TUP_CONTACT_EVENT_RESULT_KEY : [NSNumber numberWithBool:result],TUP_CONTACT_KEY:contactArray }; [self respondsContactDelegateWithType:CONTACT_E_SEARCH_CONTACT_RESULT result:resultInfo]; return; } ContactInfo *contactInfo = [ContactInfo contactInfoTransformFrom:pstContactorInfo[i]]; DDLogInfo(@"contactInfo.personName: %@",contactInfo.personName); [contactArray addObject:contactInfo]; } NSDictionary *resultInfo = @{ TUP_CONTACT_EVENT_RESULT_KEY : [NSNumber numberWithBool:result],TUP_CONTACT_KEY:contactArray }; [self respondsContactDelegateWithType:CONTACT_E_SEARCH_CONTACT_RESULT result:resultInfo]; } break;
無。