Commit b41068f1 authored by xianyang's avatar xianyang

优化业务类型

parent be10e445
...@@ -257,18 +257,26 @@ def get_finance_info(unique_tag, page, size, start_time, end_time, is_list=None) ...@@ -257,18 +257,26 @@ def get_finance_info(unique_tag, page, size, start_time, end_time, is_list=None)
return res return res
def get_account_type(db: Session, **data): def get_account_type(**data):
"""礼物类型配置列表""" """礼物类型配置列表"""
finance_filters = [] condition = []
if data.get("key_name"): if data.get("key_name"):
finance_filters.append(AccountType.key_name.like(f'%{data.get("key_name")}%')) condition.append(f" keyName like '%{data.get('key_name')}%'")
if data.get("key_value"): if data.get("key_value"):
finance_filters.append(AccountType.key_value.like(f'%{data.get("key_value")}%')) condition.append(f" keyValue like '%{data.get('key_value')}%'")
if data.get("type") or data.get("type") == 0: if data.get("type") or data.get("type") == 0:
finance_filters.append(AccountType.type == data.get("type")) condition.append(f" type={data.get('type')}")
querydata, count = QueryAllData(db, AccountType, data, finance_filters).query_data() if condition:
data = [QueryAllData.serialization(item) for item in querydata] total_sql = f"select count(id) as num from fi_account_type where {' and '.join(condition)}"
return data, count gift_sql = f"select id,keyName,keyValue,type from fi_account_type where {' and '.join(condition)} limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
else:
total_sql = f"select count(id) as num from fi_account_type"
gift_sql = f"select id,keyName,keyValue,type from fi_account_type limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
total = LinkMysql(env.DB_3YV2).query_mysql(total_sql)
output = LinkMysql(env.DB_3YV2).query_mysql(gift_sql)
if output:
return output, total[0]['num']
return [], 0
def update_account_type(db: Session, data): def update_account_type(db: Session, data):
......
...@@ -7,6 +7,7 @@ from app.api.account import schemas, crud ...@@ -7,6 +7,7 @@ from app.api.account import schemas, crud
from app.api.account.crud import AccountStatistics, SpecificAccountQuery from app.api.account.crud import AccountStatistics, SpecificAccountQuery
from app.api.statement import crud as statement_crud from app.api.statement import crud as statement_crud
from libs import functions from libs import functions
from libs.functions import get_date_list
from libs.result_format import HttpResultResponse, HttpMessage from libs.result_format import HttpResultResponse, HttpMessage
from libs.token_verify import login_required from libs.token_verify import login_required
...@@ -126,7 +127,7 @@ def finance_fix(page: int, ...@@ -126,7 +127,7 @@ def finance_fix(page: int,
type: int = None, type: int = None,
token=Depends(login_required), db: Session = Depends(get_db)): token=Depends(login_required), db: Session = Depends(get_db)):
"""出入账目配置列表""" """出入账目配置列表"""
res, num = crud.get_account_type(db, key_name=key_name, key_value=key_value, type=type, page=page, size=size) res, num = crud.get_account_type(key_name=key_name, key_value=key_value, type=type, page=page, size=size)
return HttpResultResponse(total=num, data=res) return HttpResultResponse(total=num, data=res)
......
...@@ -17,12 +17,12 @@ TYPE_NAME = { ...@@ -17,12 +17,12 @@ TYPE_NAME = {
"bei_to_change_account": "购买bei+", "bei_to_change_account": "购买bei+",
"bei_to_cancel_account": "bei+订单退款", "bei_to_cancel_account": "bei+订单退款",
"signInDeductMoney": "补签", "signInDeductMoney": "补签",
"signInReward": "钻石奖励", "signInReward": "签到奖励",
"sign_in_backpack_account": "背包礼物奖励", "sign_in_backpack_account": "背包礼物奖励",
"live_support": "主播扶持分配", "live_support": "主播扶持分配",
"room_support": "直播间扶持 - 领取钻石奖励", "room_support": "直播间扶持 - 领取钻石奖励",
"lucky_gift_jackpot": "赠送幸运礼物", "lucky_gift_jackpot": "赠送幸运礼物",
"gameReward": "暴击奖励", "gameReward": "游戏奖励",
"userWithdrawal": "用户提现", "userWithdrawal": "用户提现",
"sendRedBox": "发送红包", "sendRedBox": "发送红包",
"userRedBox": "领红包,退还红包", "userRedBox": "领红包,退还红包",
...@@ -33,7 +33,7 @@ TYPE_NAME = { ...@@ -33,7 +33,7 @@ TYPE_NAME = {
"get_gift_red_packet": "礼物红包领取", "get_gift_red_packet": "礼物红包领取",
"send_gift_red_packet_back": "礼物红包退还", "send_gift_red_packet_back": "礼物红包退还",
"first_recharge_gift": "首充礼包", "first_recharge_gift": "首充礼包",
"user_clean_up": "用户余额清算(线上,线下)", "user_clean_up": "余额清算(线上,线下)",
"cleargiftstore": "背包礼物过期", "cleargiftstore": "背包礼物过期",
"daily_task": "任务奖励发放钻石", "daily_task": "任务奖励发放钻石",
"voiceChatFee": "语聊消费", "voiceChatFee": "语聊消费",
...@@ -42,7 +42,7 @@ TYPE_NAME = { ...@@ -42,7 +42,7 @@ TYPE_NAME = {
"PlatformLeakRepair": "平台补漏", "PlatformLeakRepair": "平台补漏",
"voice": "用户上麦", "voice": "用户上麦",
"MagicHegemony": "2021.11 魔法争霸赛活动", "MagicHegemony": "2021.11 魔法争霸赛活动",
"Points_mall_exchange": "商城积分兑换", "Points_mall_exchange": "积分商城兑换",
"privateMessageCharge": "私信收费", "privateMessageCharge": "私信收费",
"level_gift": "升级礼包", "level_gift": "升级礼包",
"zhou_xing_backpack_account": "周星奖励发放", "zhou_xing_backpack_account": "周星奖励发放",
...@@ -58,13 +58,15 @@ TYPE_NAME = { ...@@ -58,13 +58,15 @@ TYPE_NAME = {
"pledgeDeduction": "保证金扣减", "pledgeDeduction": "保证金扣减",
"guildExchangeDraw": "公会钻石结算", "guildExchangeDraw": "公会钻石结算",
"fanExpansion": "公会家族扩充", "fanExpansion": "公会家族扩充",
"guildTrafficPromotion": "公会流量推广", "guildTrafficPromotion": "流量推广",
"trafficPromotion": "流量购买",
"guildWithdrawal": "公会提现", "guildWithdrawal": "公会提现",
"guildWithdrawal_ServiceFee": "提现服务费", "guildWithdrawal_ServiceFee": "提现服务费",
"free_guild_profit_Exchange": "自由公会收益", "free_guild_profit_Exchange": "自由公会收益",
"subordinate_guild_ti_xian": "下级公会提现", "subordinate_guild_ti_xian": "下级公会提现",
"investmentIncome": "招商收益", "investmentIncome": "招商收益",
"platformRecharge": "财务后台内部转账", "platformRecharge": "转账",
"platformSubsidies": "平台补贴",
"currencyUpgrade": "旧币兑换(钻石)", "currencyUpgrade": "旧币兑换(钻石)",
"PlatformDeduction": "平台扣除", "PlatformDeduction": "平台扣除",
"thrid_game_transfer_user": "引流转盘奖励", "thrid_game_transfer_user": "引流转盘奖励",
...@@ -126,8 +128,16 @@ TYPE_NAME = { ...@@ -126,8 +128,16 @@ TYPE_NAME = {
"NewYearActivity": "春节活动", "NewYearActivity": "春节活动",
"OnePieceActivity": "航海活动奖励", "OnePieceActivity": "航海活动奖励",
"heart_season_buy_prop": "怦然心动道具购买", "heart_season_buy_prop": "怦然心动道具购买",
"baseSalaryExpend": "底薪", "baseSalaryExpend": "底薪收入",
"guildRecharge": "公会内充", "guildRecharge": "公会内充",
"blind_box_transfer_to_backpack": "商城礼物盲盒预支", "blind_box_transfer_to_backpack": "商城礼物盲盒预支",
"activity_fairy_star": "三月活动奖励" "activity_fairy_star": "三月活动奖励",
"inviteGift": "邀请礼包",
"activityReward": "活动奖励",
"taskReward": "任务奖励",
"luckyGiftReward": "幸运大暴击",
"parentAdd": "上级补差",
"januaryWishDrawal": "新语新愿",
"AprilPearlRecord": "四月镖客行活奖励",
"bei_out_of_account": "bei+订单收入",
} }
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