91 lines
2.6 KiB
PHP
91 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace app\admin\lists\user_recharge;
|
|
|
|
|
|
use app\admin\lists\BaseAdminDataLists;
|
|
use app\common\model\user_recharge\UserRecharge;
|
|
use app\common\lists\ListsSearchInterface;
|
|
use app\common\model\user\User;
|
|
|
|
/**
|
|
* 充值记录列表
|
|
* Class UserRechargeLists
|
|
* @package app\admin\listsuser_recharge
|
|
*/
|
|
class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 设置搜索条件
|
|
* @return \string[][]
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function setSearch(): array
|
|
{
|
|
return [
|
|
'=' => ['paid', 'pay_time'],
|
|
'between_time'=>'create_time'
|
|
];
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取充值记录列表
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function lists(): array
|
|
{
|
|
return UserRecharge::where($this->searchWhere)
|
|
->field(['id', 'uid', 'order_id', 'price', 'recharge_type', 'paid', 'pay_time','status','refund_time'])
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
->order(['id' => 'desc'])
|
|
->select()->each(function ($item) {
|
|
$id = $item['uid'];
|
|
$user=User::where('id', $item['uid'])->field('real_name,nickname')->find();
|
|
if($user){
|
|
$item['nickname'] =$user['real_name']!=''?$user['real_name'].'|'.$id:$user['nickname'].'|'.$id;
|
|
}
|
|
if($item['pay_time']>0){
|
|
$item['pay_time']=date('Y-m-d H:i:s',$item['pay_time']);
|
|
}else{
|
|
$item['pay_time']='';
|
|
}
|
|
if($item['refund_time']>0){
|
|
$item['refund_time']=date('Y-m-d H:i:s',$item['refund_time']);
|
|
}else{
|
|
$item['refund_time']='';
|
|
}
|
|
if($item['paid']==1){
|
|
$item['paid_name']='已支付';
|
|
}else{
|
|
$item['paid_name']='未支付';
|
|
}
|
|
if($item['status']== -1){
|
|
$item['paid_name']='已退款';
|
|
}
|
|
return $item;
|
|
})
|
|
->toArray();
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取充值记录数量
|
|
* @return int
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function count(): int
|
|
{
|
|
return UserRecharge::where($this->searchWhere)->count();
|
|
}
|
|
|
|
} |