mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改返利统计
This commit is contained in:
parent
be94d21b75
commit
66c2834602
@ -33,6 +33,9 @@ class UserBalance extends Controller
|
||||
public function index()
|
||||
{
|
||||
$this->title = '余额充值记录';
|
||||
// 统计用户余额
|
||||
$this->balance = UserBalanceService::instance()->amount(0);
|
||||
// 创建查询对象
|
||||
$query = $this->_query($this->table);
|
||||
// 用户搜索查询
|
||||
$db = $this->_query('DataUser')->like('phone#user_phone,nickname#user_nickname')->db();
|
||||
|
@ -87,6 +87,8 @@ class UserTransfer extends Controller
|
||||
public function index()
|
||||
{
|
||||
$this->title = '用户提现管理';
|
||||
$this->transfer = UserTransferService::instance()->amount(0);
|
||||
// 创建查询对象
|
||||
$query = $this->_query($this->table)->order('id desc');
|
||||
// 用户条件搜索
|
||||
$db = $this->_query('DataUser')->like('phone,username|nickname#nickname')->db();
|
||||
|
@ -21,12 +21,17 @@ class UserBalanceService extends Service
|
||||
*/
|
||||
public function amount(int $uuid, array $nots = []): array
|
||||
{
|
||||
$total = abs($this->app->db->name('DataUserBalance')->where("uid='{$uuid}' and amount>0 and deleted=0")->sum('amount'));
|
||||
$count = abs($this->app->db->name('DataUserBalance')->where("uid='{$uuid}' and amount<0 and deleted=0")->sum('amount'));
|
||||
if (empty($nots)) {
|
||||
$this->app->db->name('DataUser')->where(['id' => $uuid])->update(['balance_total' => $total, 'balance_used' => $count]);
|
||||
if ($uuid > 0) {
|
||||
$total = abs($this->app->db->name('DataUserBalance')->whereRaw("uid='{$uuid}' and amount>0 and deleted=0")->sum('amount'));
|
||||
$count = abs($this->app->db->name('DataUserBalance')->whereRaw("uid='{$uuid}' and amount<0 and deleted=0")->sum('amount'));
|
||||
if (empty($nots)) {
|
||||
$this->app->db->name('DataUser')->where(['id' => $uuid])->update(['balance_total' => $total, 'balance_used' => $count]);
|
||||
} else {
|
||||
$count -= $this->app->db->name('DataUserBalance')->whereRaw("uid={$uuid}")->whereIn('code', $nots)->sum('amount');
|
||||
}
|
||||
} else {
|
||||
$count -= $this->app->db->name('DataUserBalance')->whereRaw("uid={$uuid}")->whereIn('code', $nots)->sum('amount');
|
||||
$total = abs($this->app->db->name('DataUserBalance')->whereRaw("amount>0 and deleted=0")->sum('amount'));
|
||||
$count = abs($this->app->db->name('DataUserBalance')->whereRaw("amount<0 and deleted=0")->sum('amount'));
|
||||
}
|
||||
return [$total, $count];
|
||||
}
|
||||
|
@ -24,6 +24,27 @@ class UserTransferService extends Service
|
||||
'transfer_banks' => '线下转账到银行卡账户',
|
||||
];
|
||||
|
||||
/**
|
||||
* 同步刷新用户返利
|
||||
* @param integer $uuid
|
||||
* @return array [total, count, audit, locks]
|
||||
*/
|
||||
public function amount(int $uuid): array
|
||||
{
|
||||
if ($uuid > 0) {
|
||||
$total = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=1")->sum('amount'));
|
||||
$audit = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=1 and status<3")->sum('amount'));
|
||||
$locks = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status=3")->sum('amount'));
|
||||
$count = abs($this->app->db->name('DataUserTransfer')->whereRaw("uid='{$uuid}' and status>=4")->sum('amount'));
|
||||
} else {
|
||||
$total = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=1")->sum('amount'));
|
||||
$audit = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=1 and status<3")->sum('amount'));
|
||||
$locks = abs($this->app->db->name('DataUserTransfer')->whereRaw("status=3")->sum('amount'));
|
||||
$count = abs($this->app->db->name('DataUserTransfer')->whereRaw("status>=4")->sum('amount'));
|
||||
}
|
||||
return [$total, $count, $audit, $locks];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取转账类型
|
||||
* @return array
|
||||
|
@ -7,7 +7,10 @@
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="think-box-shadow">
|
||||
<div class="layui-badge layui-bg-cyan text-left notselect block shadow margin-0 padding-10 padding-left-20 border-radius-5 font-s15">
|
||||
余额统计:已产生返利累计 {$balance.0|default=0.00} 元,累计已使用 {$balance.1|default=0.00} 元,剩余可使用 {$balance.0-$balance.1} 元。
|
||||
</div>
|
||||
<div class="think-box-shadow margin-top-10">
|
||||
{include file='user_balance/index_search'}
|
||||
<table class="layui-table margin-top-10" lay-skin="line">
|
||||
{notempty name='list'}
|
||||
|
@ -7,7 +7,7 @@
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="layui-badge think-bg-violet text-left notselect block shadow margin-0 padding-10 padding-left-20 border-radius-5 font-s15">
|
||||
<div class="layui-badge layui-bg-cyan text-left notselect block shadow margin-0 padding-10 padding-left-20 border-radius-5 font-s15">
|
||||
统计:已产生返利累计 {$rebate.0|default=0.00} 元( 不含锁定 {$rebate.2|default='0.00'} 元 ),累计已提现 {$total.1|default=0.00} 元。
|
||||
</div>
|
||||
<div class="think-box-shadow margin-top-10">
|
||||
|
@ -15,8 +15,9 @@
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="layui-badge think-bg-violet text-left notselect block shadow margin-0 padding-10 padding-left-20 border-radius-5 font-s15">
|
||||
统计:已产生提现累计 {$transfer.0|default=0.00} 元( 含待审核 {$transfer.2|default='0.00'} 元 ),累计已提现 {$transfer.1|default=0.00} 元。
|
||||
<div class="layui-badge layui-bg-cyan text-left notselect block shadow margin-0 padding-10 padding-left-20 border-radius-5 font-s15">
|
||||
<!-- 0 $total, 1 $count, 2 $audit, 3 $locks -->
|
||||
统计:已产生提现累计 {$transfer.0|default=0.00} 元( 含待转账 {$transfer.3|default='0.00'} 元,含待审核 {$transfer.2|default='0.00'} 元 ),累计已提现 {$transfer.1|default=0.00} 元。
|
||||
</div>
|
||||
<div class="think-box-shadow margin-top-10">
|
||||
{include file='user_transfer/index_search'}
|
||||
|
Loading…
x
Reference in New Issue
Block a user