Commit 411ec283 by wangshouyong

25171

parent 7a811d04
...@@ -24,6 +24,7 @@ import type { ...@@ -24,6 +24,7 @@ import type {
UpdateArticleShowLatestDto, UpdateArticleShowLatestDto,
LocateCommentParams, LocateCommentParams,
CommentLocationDto, CommentLocationDto,
PushRecallResultDto,
} from './types' } from './types'
import type { BackendServicePageResult, PageSearchParams } from '@/utils/request/types' import type { BackendServicePageResult, PageSearchParams } from '@/utils/request/types'
import { SpecificVideoRewardEnum, BooleanFlag } from '@/constants' import { SpecificVideoRewardEnum, BooleanFlag } from '@/constants'
...@@ -228,7 +229,7 @@ export const updateArticleRecommendAndSort = (data: UpdateArticleRecommendAndSor ...@@ -228,7 +229,7 @@ export const updateArticleRecommendAndSort = (data: UpdateArticleRecommendAndSor
* 已经撤回的批次会自动跳过,重复调用失败可以重试。能不能点由列表 pushInfo.recallable 决定。 * 已经撤回的批次会自动跳过,重复调用失败可以重试。能不能点由列表 pushInfo.recallable 决定。
*/ */
export const recallPush = (articleId: number) => { export const recallPush = (articleId: number) => {
return service.request({ return service.request<PushRecallResultDto>({
url: `/cultureEventPushPersons/recallPush?articleId=${articleId}`, url: `/cultureEventPushPersons/recallPush?articleId=${articleId}`,
method: 'POST', method: 'POST',
}) })
......
...@@ -308,6 +308,21 @@ export interface ArticlePushInfoDto { ...@@ -308,6 +308,21 @@ export interface ArticlePushInfoDto {
} }
/** /**
* 撤回/取消推送的结果。后端撤回失败时不会抛异常(部分批次成功时状态要保留),
* HTTP 仍然是 200,所以前端必须看 failCount 才知道到底撤没撤掉。
*/
export interface PushRecallResultDto {
/** 本次需要撤回的批次数 */
total: number
successCount: number
failCount: number
/** 是否属于「取消尚未执行的定时推送」 */
cancelled: boolean
/** 结果说明,可直接展示给用户 */
message: string
}
/**
* 专栏选项 * 专栏选项
*/ */
export interface ColumnOptionDto { export interface ColumnOptionDto {
......
...@@ -133,8 +133,14 @@ const handleRecallPush = async (row: ArticleItemDto) => { ...@@ -133,8 +133,14 @@ const handleRecallPush = async (row: ArticleItemDto) => {
: '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。', : '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。',
type: 'warning', type: 'warning',
}) })
await recallPush(row.id) // 后端撤回失败时不抛异常(部分批次成功的状态要保留),HTTP 还是 200,
push.success(isScheduled ? '取消定时推送成功' : '撤回成功') // 所以这里必须看 failCount,否则会出现"提示撤回成功、状态却没变"
const { data } = await recallPush(row.id)
if (data?.failCount) {
push.warning(data.message || '部分批次撤回失败,可稍后重试')
} else {
push.success(data?.message || (isScheduled ? '取消定时推送成功' : '撤回成功'))
}
refresh() refresh()
} }
</script> </script>
......
...@@ -134,8 +134,14 @@ const handleRecallPush = async (row: ArticleItemDto) => { ...@@ -134,8 +134,14 @@ const handleRecallPush = async (row: ArticleItemDto) => {
: '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。', : '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。',
type: 'warning', type: 'warning',
}) })
await recallPush(row.id) // 后端撤回失败时不抛异常(部分批次成功的状态要保留),HTTP 还是 200,
push.success(isScheduled ? '取消定时推送成功' : '撤回成功') // 所以这里必须看 failCount,否则会出现"提示撤回成功、状态却没变"
const { data } = await recallPush(row.id)
if (data?.failCount) {
push.warning(data.message || '部分批次撤回失败,可稍后重试')
} else {
push.success(data?.message || (isScheduled ? '取消定时推送成功' : '撤回成功'))
}
refresh() refresh()
} }
</script> </script>
......
...@@ -137,8 +137,14 @@ const handleRecallPush = async (row: ArticleItemDto) => { ...@@ -137,8 +137,14 @@ const handleRecallPush = async (row: ArticleItemDto) => {
: '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。', : '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。',
type: 'warning', type: 'warning',
}) })
await recallPush(row.id) // 后端撤回失败时不抛异常(部分批次成功的状态要保留),HTTP 还是 200,
push.success(isScheduled ? '取消定时推送成功' : '撤回成功') // 所以这里必须看 failCount,否则会出现"提示撤回成功、状态却没变"
const { data } = await recallPush(row.id)
if (data?.failCount) {
push.warning(data.message || '部分批次撤回失败,可稍后重试')
} else {
push.success(data?.message || (isScheduled ? '取消定时推送成功' : '撤回成功'))
}
refresh() refresh()
} }
</script> </script>
......
...@@ -133,8 +133,14 @@ const handleRecallPush = async (row: ArticleItemDto) => { ...@@ -133,8 +133,14 @@ const handleRecallPush = async (row: ArticleItemDto) => {
: '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。', : '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。',
type: 'warning', type: 'warning',
}) })
await recallPush(row.id) // 后端撤回失败时不抛异常(部分批次成功的状态要保留),HTTP 还是 200,
push.success(isScheduled ? '取消定时推送成功' : '撤回成功') // 所以这里必须看 failCount,否则会出现"提示撤回成功、状态却没变"
const { data } = await recallPush(row.id)
if (data?.failCount) {
push.warning(data.message || '部分批次撤回失败,可稍后重试')
} else {
push.success(data?.message || (isScheduled ? '取消定时推送成功' : '撤回成功'))
}
refresh() refresh()
} }
</script> </script>
......
...@@ -147,8 +147,14 @@ const handleRecallPush = async (row: ArticleItemDto) => { ...@@ -147,8 +147,14 @@ const handleRecallPush = async (row: ArticleItemDto) => {
: '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。', : '确定要撤回这条推送吗?已经收到通知的用户不会撤回消息。',
type: 'warning', type: 'warning',
}) })
await recallPush(row.id) // 后端撤回失败时不抛异常(部分批次成功的状态要保留),HTTP 还是 200,
push.success(isScheduled ? '取消定时推送成功' : '撤回成功') // 所以这里必须看 failCount,否则会出现"提示撤回成功、状态却没变"
const { data } = await recallPush(row.id)
if (data?.failCount) {
push.warning(data.message || '部分批次撤回失败,可稍后重试')
} else {
push.success(data?.message || (isScheduled ? '取消定时推送成功' : '撤回成功'))
}
refresh() refresh()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment