diff --git a/src/api/system/shortlink/index.ts b/src/api/system/shortlink/index.ts new file mode 100644 index 000000000..c578f86fa --- /dev/null +++ b/src/api/system/shortlink/index.ts @@ -0,0 +1,145 @@ +import request from '@/config/axios' + +export interface ShortLinkVO { + id?: number + originalUrl: string + shortCode?: string + shortUrl?: string + title?: string + description?: string + expireTime?: number + status?: boolean + forever?: boolean + clickCount?: number + createTime?: Date + updateTime?: Date +} + +export interface ShortLinkPageReqVO extends PageParam { + originalUrl?: string + shortCode?: string + title?: string + status?: boolean + createTime?: Date[] +} + +export interface ShortLinkStatisticsVO { + id: number + shortCode: string + originalUrl: string + title: string + clickCount: number + todayClickCount: number + weekClickCount: number + monthClickCount: number + lastClickTime?: Date +} + +export interface ShortLinkClickLogVO { + id: number + shortCode: string + clickTime: Date + userIp: string + userAgent: string + referer?: string + country?: string + province?: string + city?: string +} + +export interface ShortLinkClickLogPageReqVO extends PageParam { + shortCode?: string + userIp?: string + clickTime?: Date[] +} + +// 查询短链列表 +export const getShortLinkPage = async (params: ShortLinkPageReqVO) => { + return await request.get({ url: `/system/short-link/page`, params }) +} + +// 查询短链详情 +export const getShortLink = async (id: number) => { + return await request.get({ url: `/system/short-link/get?id=` + id }) +} + +// 新增短链 +export const createShortLink = async (data: ShortLinkVO) => { + return await request.post({ url: `/system/short-link/create`, data }) +} + +// 修改短链 +export const updateShortLink = async (data: ShortLinkVO) => { + return await request.put({ url: `/system/short-link/update`, data }) +} + +// 删除短链 +export const deleteShortLink = async (id: number) => { + return await request.delete({ url: `/system/short-link/delete?id=` + id }) +} + +// 批量删除短链 +export const deleteShortLinkBatch = async (ids: number[]) => { + return await request.delete({ url: `/system/short-link/delete-batch`, data: ids }) +} + +// 更新短链状态 +export const updateShortLinkStatus = async (id: number, status: boolean) => { + const v = status ? 1 : 0 + return await request.put({ url: `/system/short-link/update-status?id=` + id + `&status=` + v }) +} + +// 导出短链 Excel +export const exportShortLink = async (params: ShortLinkPageReqVO) => { + return await request.download({ url: `/system/short-link/export-excel`, params }) +} + +// 批量生成短链 +export const batchCreateShortLink = async (urls: string[]) => { + return await request.post({ url: `/system/short-link/batch-create`, data: { urls } }) +} + +// 获取短链访问日志分页 +export const getShortLinkAccessLogPage = async (params: ShortLinkClickLogPageReqVO) => { + return await request.get({ url: `/system/short-link/access-log/page`, params }) +} + +// 获取短链主域名 +export const getShortLinkDomain = async () => { + return await request.get({ url: `/system/short-link/domain` }) +} + +// 修改短链主域名 +export const updateShortLinkDomain = async (newDomain: string) => { + return await request.put({ url: `/system/short-link/domain`, params: { newDomain } }) +} + +// 获取短链概览统计 +export const getShortLinkOverviewStats = async (params: { startTime?: string; endTime?: string }) => { + return await request.get({ url: `/system/short-link/statistics/overview`, params }) +} + +// 获取短链趋势统计 +export const getShortLinkTrendStats = async (days: number) => { + return await request.get({ url: `/system/short-link/statistics/trend`, params: { days } }) +} + +// 获取短链状态分布统计 +export const getShortLinkStatusStats = async () => { + return await request.get({ url: `/system/short-link/statistics/status` }) +} + +// 获取短链地域访问统计 +export const getShortLinkRegionStats = async (params: { startTime?: string; endTime?: string }) => { + return await request.get({ url: `/system/short-link/statistics/region`, params }) +} + +// 获取短链设备类型统计 +export const getShortLinkDeviceStats = async (params: { startTime?: string; endTime?: string }) => { + return await request.get({ url: `/system/short-link/statistics/device`, params }) +} + +// 获取短链访问时段统计 +export const getShortLinkHourStats = async (date?: string) => { + return await request.get({ url: `/system/short-link/statistics/hour`, params: { date } }) +} diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index 794778cad..775c873b0 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -50,6 +50,29 @@ const remainingRouter: AppRouteRecordRaw[] = [ noTagsView: true } }, + { + path: '/system', + component: Layout, + name: 'SystemHidden', + meta: { + hidden: true + }, + children: [ + { + path: 'shortlink/statistics', + component: () => import('@/views/system/shortlink/statistics.vue'), + name: 'SystemShortLinkStatistics', + meta: { + noCache: true, + hidden: true, + canTo: true, + icon: 'ep:data-analysis', + title: '短链统计', + activeMenu: '/system/shortlink' + } + } + ] + }, { path: '/', component: Layout, diff --git a/src/views/system/shortlink/AccessLogDialog.vue b/src/views/system/shortlink/AccessLogDialog.vue new file mode 100644 index 000000000..91fdd2798 --- /dev/null +++ b/src/views/system/shortlink/AccessLogDialog.vue @@ -0,0 +1,139 @@ + + + diff --git a/src/views/system/shortlink/BatchCreateDialog.vue b/src/views/system/shortlink/BatchCreateDialog.vue new file mode 100644 index 000000000..a156034fd --- /dev/null +++ b/src/views/system/shortlink/BatchCreateDialog.vue @@ -0,0 +1,231 @@ + + + \ No newline at end of file diff --git a/src/views/system/shortlink/DomainDialog.vue b/src/views/system/shortlink/DomainDialog.vue new file mode 100644 index 000000000..53b967b2f --- /dev/null +++ b/src/views/system/shortlink/DomainDialog.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/views/system/shortlink/ShortLinkForm.vue b/src/views/system/shortlink/ShortLinkForm.vue new file mode 100644 index 000000000..73476f647 --- /dev/null +++ b/src/views/system/shortlink/ShortLinkForm.vue @@ -0,0 +1,195 @@ + + + diff --git a/src/views/system/shortlink/StatisticsDialog.vue b/src/views/system/shortlink/StatisticsDialog.vue new file mode 100644 index 000000000..4341ba331 --- /dev/null +++ b/src/views/system/shortlink/StatisticsDialog.vue @@ -0,0 +1,403 @@ + + + + + \ No newline at end of file diff --git a/src/views/system/shortlink/index.vue b/src/views/system/shortlink/index.vue new file mode 100644 index 000000000..29c6e1235 --- /dev/null +++ b/src/views/system/shortlink/index.vue @@ -0,0 +1,349 @@ + + + diff --git a/src/views/system/shortlink/statistics.vue b/src/views/system/shortlink/statistics.vue new file mode 100644 index 000000000..2a50ac4c9 --- /dev/null +++ b/src/views/system/shortlink/statistics.vue @@ -0,0 +1,317 @@ + + + + + +