优化:个人中心数据 统计信息优化(额度包含冻结中额度)

This commit is contained in:
wuhui_zzw 2024-04-03 16:56:25 +08:00
parent 775dc17169
commit cc6342b150
1 changed files with 5 additions and 7 deletions

View File

@ -173,21 +173,19 @@ class Auth extends BaseController
// 用户是否存在代理身份
$agentCount = app()->make(AgentRepository::class)->getSearchModel(['uid'=>$user->uid])->count();
$data['is_agent'] = $agentCount > 0;
// 用户持有可用酒卡额度
// 用户持有全部额度(冻结中 + 可用额度
$data['available'] = (float)app()->make(ExchangeQuotaRepository::class)
->searchModel(['uid'=>$user->uid])
->value('(surplus_quota - freeze_quota)');
->value('surplus_quota');
$data['vegetable_available'] = (float)app()->make(ExchangeQuotaRepository::class)
->searchModel(['uid'=>$user->uid,'quota_type'=>2])
->value('(surplus_quota - freeze_quota)');
->value('surplus_quota');
$data['wine_available'] = (float)app()->make(ExchangeQuotaRepository::class)
->searchModel(['uid'=>$user->uid,'quota_type'=>3])
->value('(surplus_quota - freeze_quota)');
->value('surplus_quota');
$data['oil_available'] = (float)app()->make(ExchangeQuotaRepository::class)
->searchModel(['uid'=>$user->uid,'quota_type'=>4])
->value('(surplus_quota - freeze_quota)');
->value('surplus_quota');
return app('json')->success($data);
}