2024-03-27 09:25:37 +00:00
|
|
|
|
# coding=utf-8
|
|
|
|
|
|
"""
|
|
|
|
|
|
@project: maxkb
|
|
|
|
|
|
@Author:虎
|
|
|
|
|
|
@file: application_statistics_api.py
|
|
|
|
|
|
@date:2024/3/27 15:09
|
|
|
|
|
|
@desc:
|
|
|
|
|
|
"""
|
|
|
|
|
|
from drf_yasg import openapi
|
|
|
|
|
|
|
|
|
|
|
|
from common.mixins.api_mixin import ApiMixin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ApplicationStatisticsApi(ApiMixin):
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
def get_request_params_api():
|
|
|
|
|
|
return [openapi.Parameter(name='application_id',
|
|
|
|
|
|
in_=openapi.IN_PATH,
|
|
|
|
|
|
type=openapi.TYPE_STRING,
|
|
|
|
|
|
required=True,
|
|
|
|
|
|
description='应用id'),
|
|
|
|
|
|
openapi.Parameter(name='history_day',
|
|
|
|
|
|
in_=openapi.IN_QUERY,
|
|
|
|
|
|
type=openapi.TYPE_NUMBER,
|
|
|
|
|
|
required=True,
|
|
|
|
|
|
description='历史天数'),
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class ChatRecordAggregate(ApiMixin):
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
def get_response_body_api():
|
|
|
|
|
|
return openapi.Schema(
|
|
|
|
|
|
type=openapi.TYPE_OBJECT,
|
2024-03-27 09:34:46 +00:00
|
|
|
|
required=['star_num', 'trample_num', 'tokens_num', 'chat_record_count'],
|
2024-03-27 09:25:37 +00:00
|
|
|
|
properties={
|
|
|
|
|
|
'star_num': openapi.Schema(type=openapi.TYPE_NUMBER, title="点赞数量",
|
|
|
|
|
|
description="点赞数量"),
|
|
|
|
|
|
|
|
|
|
|
|
'trample_num': openapi.Schema(type=openapi.TYPE_NUMBER, title="点踩数量", description="点踩数量"),
|
2024-03-27 09:34:46 +00:00
|
|
|
|
'tokens_num': openapi.Schema(type=openapi.TYPE_NUMBER, title="token使用数量",
|
2024-03-27 09:25:37 +00:00
|
|
|
|
description="token使用数量"),
|
|
|
|
|
|
'chat_record_count': openapi.Schema(type=openapi.TYPE_NUMBER, title="对话次数",
|
|
|
|
|
|
description="对话次数"),
|
|
|
|
|
|
'day': openapi.Schema(type=openapi.TYPE_STRING,
|
|
|
|
|
|
title="日期",
|
|
|
|
|
|
description="日期,只有查询趋势的时候才有该字段"),
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CustomerCountTrend(ApiMixin):
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
def get_response_body_api():
|
|
|
|
|
|
return openapi.Schema(
|
|
|
|
|
|
type=openapi.TYPE_OBJECT,
|
|
|
|
|
|
required=['added_count'],
|
|
|
|
|
|
properties={
|
|
|
|
|
|
'added_count': openapi.Schema(type=openapi.TYPE_NUMBER, title="新增数量", description="新增数量"),
|
|
|
|
|
|
|
|
|
|
|
|
'day': openapi.Schema(type=openapi.TYPE_STRING,
|
|
|
|
|
|
title="时间",
|
|
|
|
|
|
description="时间"),
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class CustomerCount(ApiMixin):
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
def get_response_body_api():
|
|
|
|
|
|
return openapi.Schema(
|
|
|
|
|
|
type=openapi.TYPE_OBJECT,
|
|
|
|
|
|
required=['added_count'],
|
|
|
|
|
|
properties={
|
|
|
|
|
|
'today_added_count': openapi.Schema(type=openapi.TYPE_NUMBER, title="今日新增数量",
|
|
|
|
|
|
description="今日新增数量"),
|
|
|
|
|
|
'added_count': openapi.Schema(type=openapi.TYPE_NUMBER, title="新增数量", description="新增数量"),
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|