|
@@ -10,7 +10,7 @@ export async function getPredictions(
|
|
|
},
|
|
|
options?: { [key: string]: any },
|
|
|
) {
|
|
|
- return request<API.PredictionList>('http://admin.dzhhzy.com/api/prediction', {
|
|
|
+ return request<API.PredictionList>(`${API_URL}/api/prediction`, {
|
|
|
method: 'GET',
|
|
|
params: {
|
|
|
...params,
|
|
@@ -29,11 +29,11 @@ export async function searchPredictions(
|
|
|
firstTeamToScore?: 'home' | 'away' | 'no_goal';
|
|
|
totalGoals?: number;
|
|
|
pointsEarned?: number;
|
|
|
- isCorrect?: boolean;
|
|
|
+ // isCorrect?: boolean;
|
|
|
},
|
|
|
options?: { [key: string]: any },
|
|
|
) {
|
|
|
- return request<API.PredictionList>('http://admin.dzhhzy.com/api/prediction', {
|
|
|
+ return request<API.PredictionList>(`${API_URL}/api/prediction`, {
|
|
|
method: 'GET',
|
|
|
params: {
|
|
|
action: 'searchPredictions',
|
|
@@ -44,7 +44,7 @@ export async function searchPredictions(
|
|
|
}
|
|
|
|
|
|
export async function addPrediction(options?: { [key: string]: any }) {
|
|
|
- return request<API.PredictionList>('http://admin.dzhhzy.com/api/prediction', {
|
|
|
+ return request<API.PredictionList>(`${API_URL}/api/prediction`, {
|
|
|
method: 'POST',
|
|
|
data: {
|
|
|
...(options || {}),
|
|
@@ -55,7 +55,7 @@ export async function addPrediction(options?: { [key: string]: any }) {
|
|
|
export async function updatePrediction(id: string, options?: { [key: string]: any }) {
|
|
|
console.log('Sending update request for id:', id);
|
|
|
console.log('Update data:', options);
|
|
|
- return request<API.PredictionList>('http://admin.dzhhzy.com/api/prediction', {
|
|
|
+ return request<API.PredictionList>(`${API_URL}/api/prediction`, {
|
|
|
method: 'PUT',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -69,7 +69,7 @@ export async function updatePrediction(id: string, options?: { [key: string]: an
|
|
|
|
|
|
export async function deletePrediction(id: string) {
|
|
|
console.log('Sending delete request for id:', id);
|
|
|
- return request<API.PredictionList>(`http://admin.dzhhzy.com/api/prediction?id=${id}`, {
|
|
|
+ return request<API.PredictionList>(`${API_URL}/api/prediction?id=${id}`, {
|
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -77,19 +77,9 @@ export async function deletePrediction(id: string) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-// export async function deleteMatch(id: string) {
|
|
|
-// console.log('Sending delete request for id:', id);
|
|
|
-// return request<API.MatchList>(`http://admin.dzhhzy.com/api/match?id=${id}`, {
|
|
|
-// method: 'DELETE',
|
|
|
-// headers: {
|
|
|
-// 'Content-Type': 'application/json',
|
|
|
-// },
|
|
|
-// });
|
|
|
-// }
|
|
|
-
|
|
|
export async function batchDeletePredictions(ids: string[]) {
|
|
|
console.log('Sending batch delete request for ids:', ids);
|
|
|
- return request<API.PredictionList>(`http://admin.dzhhzy.com/api/prediction?ids=${ids}`, {
|
|
|
+ return request<API.PredictionList>(`${API_URL}/api/prediction?ids=${ids}`, {
|
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -107,7 +97,7 @@ export async function getMatches(
|
|
|
},
|
|
|
options?: { [key: string]: any },
|
|
|
) {
|
|
|
- return request<API.MatchList>('http://admin.dzhhzy.com/api/match?action=getMatches', {
|
|
|
+ return request<API.MatchList>(`${API_URL}/api/match?action=getMatches`, {
|
|
|
method: 'GET',
|
|
|
params: {
|
|
|
...params,
|
|
@@ -117,7 +107,7 @@ export async function getMatches(
|
|
|
}
|
|
|
|
|
|
export async function addMatch(options?: { [key: string]: any }) {
|
|
|
- return request<API.MatchList>('http://admin.dzhhzy.com/api/match', {
|
|
|
+ return request<API.MatchList>(`${API_URL}/api/match`, {
|
|
|
method: 'POST',
|
|
|
data: {
|
|
|
method: 'update',
|
|
@@ -129,7 +119,7 @@ export async function addMatch(options?: { [key: string]: any }) {
|
|
|
export async function updateMatch(id: string, options?: { [key: string]: any }) {
|
|
|
console.log('Sending update request for id:', id);
|
|
|
console.log('Update data:', options);
|
|
|
- return request<API.MatchList>('http://admin.dzhhzy.com/api/match', {
|
|
|
+ return request<API.MatchList>(`${API_URL}/api/match`, {
|
|
|
method: 'PUT',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -143,7 +133,7 @@ export async function updateMatch(id: string, options?: { [key: string]: any })
|
|
|
|
|
|
export async function deleteMatch(id: string) {
|
|
|
console.log('Sending delete request for id:', id);
|
|
|
- return request<API.MatchList>(`http://admin.dzhhzy.com/api/match?id=${id}`, {
|
|
|
+ return request<API.MatchList>(`${API_URL}/api/match?id=${id}`, {
|
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -156,7 +146,7 @@ export async function batchDeleteMatches(ids: string[]) {
|
|
|
|
|
|
const idsString = ids.join(',');
|
|
|
|
|
|
- return request<API.MatchList>(`http://admin.dzhhzy.com/api/match?ids=${idsString}`, {
|
|
|
+ return request<API.MatchList>(`${API_URL}/api/match?ids=${idsString}`, {
|
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -174,7 +164,7 @@ export async function getUsers(
|
|
|
},
|
|
|
options?: { [key: string]: any },
|
|
|
) {
|
|
|
- return request<API.UserList>('http://admin.dzhhzy.com/api/user', {
|
|
|
+ return request<API.UserList>(`${API_URL}/api/user`, {
|
|
|
method: 'GET',
|
|
|
params: {
|
|
|
...params,
|
|
@@ -184,7 +174,7 @@ export async function getUsers(
|
|
|
}
|
|
|
|
|
|
export async function addUser(options?: { [key: string]: any }) {
|
|
|
- return request<API.UserList>('http://admin.dzhhzy.com/api/user', {
|
|
|
+ return request<API.UserList>(`${API_URL}/api/user`, {
|
|
|
method: 'POST',
|
|
|
data: {
|
|
|
method: 'add',
|
|
@@ -196,7 +186,7 @@ export async function addUser(options?: { [key: string]: any }) {
|
|
|
export async function updateUser(id: string, options?: { [key: string]: any }) {
|
|
|
console.log('Sending update request for user id:', id);
|
|
|
console.log('Update data:', options);
|
|
|
- return request<API.UserList>('http://admin.dzhhzy.com/api/user', {
|
|
|
+ return request<API.UserList>(`${API_URL}/api/user`, {
|
|
|
method: 'PUT',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -210,7 +200,7 @@ export async function updateUser(id: string, options?: { [key: string]: any }) {
|
|
|
|
|
|
export async function deleteUser(id: string) {
|
|
|
console.log('Sending delete request for user id:', id);
|
|
|
- return request<API.UserList>(`http://admin.dzhhzy.com/api/user?id=${id}`, {
|
|
|
+ return request<API.UserList>(`${API_URL}/api/user?id=${id}`, {
|
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -223,7 +213,7 @@ export async function batchDeleteUsers(ids: string[]) {
|
|
|
|
|
|
const idsString = ids.join(',');
|
|
|
|
|
|
- return request<API.UserList>(`http://admin.dzhhzy.com/api/user?ids=${idsString}`, {
|
|
|
+ return request<API.UserList>(`${API_URL}/api/user?ids=${idsString}`, {
|
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -234,7 +224,7 @@ export async function batchDeleteUsers(ids: string[]) {
|
|
|
|
|
|
/** 登录接口 POST /api/login/account */
|
|
|
export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
|
|
|
- return request<API.LoginResult>('http://admin.dzhhzy.com/api/auth/login', {
|
|
|
+ return request<API.LoginResult>(`${API_URL}/api/auth/login`, {
|
|
|
method: 'POST',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -245,7 +235,7 @@ export async function login(body: API.LoginParams, options?: { [key: string]: an
|
|
|
}
|
|
|
|
|
|
export async function register(body: API.LoginParams, options?: { [key: string]: any }) {
|
|
|
- return request<API.RegisterResult>('http://admin.dzhhzy.com/api/auth/register', {
|
|
|
+ return request<API.RegisterResult>(`${API_URL}/api/auth/register`, {
|
|
|
method: 'POST',
|
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
@@ -265,34 +255,90 @@ export async function register(body: API.LoginParams, options?: { [key: string]:
|
|
|
// });
|
|
|
// }
|
|
|
|
|
|
-/** 退出登录接口 POST /api/login/outLogin */
|
|
|
-export async function outLogin(options?: { [key: string]: any }) {
|
|
|
- return request<Record<string, any>>('/api/login/outLogin', {
|
|
|
+// 修改积分历史
|
|
|
+export async function updateUserPoints(userId: string, points: number, reason: string) {
|
|
|
+ console.log('发送积分更新请求,用户ID:', userId);
|
|
|
+ console.log('积分变更:', points);
|
|
|
+ console.log('变更原因:', reason);
|
|
|
+
|
|
|
+ return request<API.PointHistoryResponse>(`${API_URL}/api/point-history`, {
|
|
|
method: 'POST',
|
|
|
- ...(options || {}),
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ },
|
|
|
+ data: JSON.stringify({
|
|
|
+ userId,
|
|
|
+ points,
|
|
|
+ reason,
|
|
|
+ }),
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-/** 此处后端没有提供注释 GET /api/notices */
|
|
|
-export async function getNotices(options?: { [key: string]: any }) {
|
|
|
- return request<API.NoticeIconList>('/api/notices', {
|
|
|
+// 获取积分历史
|
|
|
+export async function getUserPointHistory(
|
|
|
+ params: {
|
|
|
+ userId: string;
|
|
|
+ current?: number;
|
|
|
+ pageSize?: number;
|
|
|
+ },
|
|
|
+ options?: { [key: string]: any },
|
|
|
+) {
|
|
|
+ return request<API.PointHistoryList>(`${API_URL}/api/point-history`, {
|
|
|
method: 'GET',
|
|
|
+ params: {
|
|
|
+ ...params,
|
|
|
+ },
|
|
|
+ ...(options || {}),
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 删除单个积分历史记录
|
|
|
+export async function deletePointHistory(id: string) {
|
|
|
+ console.log('发送删除请求,积分历史记录ID:', id);
|
|
|
+ return request<API.PointHistoryList>(`${API_URL}/api/point-history?id=${id}`, {
|
|
|
+ method: 'DELETE',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ },
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 批量删除积分历史记录
|
|
|
+export async function batchDeletePointHistory(ids: string[]) {
|
|
|
+ console.log('发送批量删除请求,积分历史记录IDs:', ids);
|
|
|
+ const idsString = ids.join(',');
|
|
|
+ return request<API.PointHistoryList>(`${API_URL}/api/point-history?ids=${idsString}`, {
|
|
|
+ method: 'DELETE',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ },
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+export async function updatePredictionsForMatch(matchId: string) {
|
|
|
+ return request<API.updatePredictionsForMatchRes>(`${API_URL}/api/updateForMatch`, {
|
|
|
+ method: 'POST',
|
|
|
+ data: { matchId },
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 退出登录接口 POST /api/login/outLogin */
|
|
|
+export async function outLogin(options?: { [key: string]: any }) {
|
|
|
+ return request<Record<string, any>>('/api/login/outLogin', {
|
|
|
+ method: 'POST',
|
|
|
...(options || {}),
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-/** 获取规则列表 GET /api/rule */
|
|
|
-export async function rule(
|
|
|
+//活动
|
|
|
+export async function getActivity(
|
|
|
params: {
|
|
|
- // query
|
|
|
- /** 当前的页码 */
|
|
|
current?: number;
|
|
|
- /** 页面的容量 */
|
|
|
pageSize?: number;
|
|
|
},
|
|
|
options?: { [key: string]: any },
|
|
|
) {
|
|
|
- return request<API.RuleList>('/api/rule', {
|
|
|
+ return request<API.ActivityList>(`${API_URL}/api/activity`, {
|
|
|
method: 'GET',
|
|
|
params: {
|
|
|
...params,
|
|
@@ -301,35 +347,43 @@ export async function rule(
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-/** 更新规则 PUT /api/rule */
|
|
|
-export async function updateRule(options?: { [key: string]: any }) {
|
|
|
- return request<API.RuleListItem>('/api/rule', {
|
|
|
+// export async function getActivityById(id: string, options?: { [key: string]: any }) {
|
|
|
+// return request<API.ActivityList>(`${API_URL}/api/activity/${id}`, {
|
|
|
+// method: 'GET',
|
|
|
+// ...(options || {}),
|
|
|
+// });
|
|
|
+// }
|
|
|
+
|
|
|
+export async function createActivity(options?: { [key: string]: any }) {
|
|
|
+ return request<API.ActivityList>(`${API_URL}/api/activity`, {
|
|
|
method: 'POST',
|
|
|
data: {
|
|
|
- method: 'update',
|
|
|
...(options || {}),
|
|
|
},
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-/** 新建规则 POST /api/rule */
|
|
|
-export async function addRule(options?: { [key: string]: any }) {
|
|
|
- return request<API.RuleListItem>('/api/rule', {
|
|
|
- method: 'POST',
|
|
|
- data: {
|
|
|
- method: 'post',
|
|
|
- ...(options || {}),
|
|
|
+export async function updateActivity(id: string, options?: { [key: string]: any }) {
|
|
|
+ console.log('Sending update request for activity id:', id);
|
|
|
+ console.log('Update data:', options);
|
|
|
+ return request<API.ActivityList>(`${API_URL}/api/activity`, {
|
|
|
+ method: 'PUT',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
},
|
|
|
+ data: JSON.stringify({
|
|
|
+ id,
|
|
|
+ ...(options || {}),
|
|
|
+ }),
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-/** 删除规则 DELETE /api/rule */
|
|
|
-export async function removeRule(options?: { [key: string]: any }) {
|
|
|
- return request<Record<string, any>>('/api/rule', {
|
|
|
- method: 'POST',
|
|
|
- data: {
|
|
|
- method: 'delete',
|
|
|
- ...(options || {}),
|
|
|
+export async function deleteActivity(id: string) {
|
|
|
+ console.log('Sending delete request for activity id:', id);
|
|
|
+ return request<{ success: boolean }>(`${API_URL}/api/activity?id=${id}`, {
|
|
|
+ method: 'DELETE',
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
},
|
|
|
});
|
|
|
}
|