73 lines
1.8 KiB
PHP
73 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace app\api\lists\user;
|
|
|
|
use app\admin\lists\BaseAdminDataLists;
|
|
use app\common\lists\ListsSearchInterface;
|
|
use app\common\model\user\User;
|
|
use app\common\model\user\UserFeedback;
|
|
use app\common\model\user_label\UserLabel;
|
|
use app\common\model\user_recharge\UserRecharge;
|
|
|
|
//用户充值表
|
|
class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 设置搜索条件
|
|
* @return \string[][]
|
|
* @author likeadmin
|
|
* @date 2024/05/13 16:56
|
|
*/
|
|
public function setSearch(): array
|
|
{
|
|
return [
|
|
'=' => ['store_id','recharge_type'],
|
|
];
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取用户充值表列表
|
|
* @return array
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author likeadmin
|
|
* @date 2024/05/13 16:56
|
|
*/
|
|
public function lists(): array
|
|
{
|
|
return UserRecharge::where($this->searchWhere)
|
|
->limit($this->limitOffset, $this->limitLength)
|
|
->order(['id' => 'desc'])
|
|
->select()->each(function($data){
|
|
$data['label_name']='';
|
|
if($data['recharge_type']=='INDUSTRYMEMBERS'){
|
|
$find =User::where('id',$data['uid'])->find();
|
|
$data['real_name']=$find['real_name']??'';
|
|
if($find &&$find['label_id']>0){
|
|
$data['label_name']=UserLabel::where('label_id',$find['label_id'])->value('label_name');
|
|
}
|
|
}else{
|
|
$data['real_name'] =User::where('id',$data['uid'])->value('real_name');
|
|
}
|
|
return $data;
|
|
})
|
|
->toArray();
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取用户充值表数量
|
|
* @return int
|
|
* @author likeadmin
|
|
* @date 2024/05/13 16:56
|
|
*/
|
|
public function count(): int
|
|
{
|
|
return UserRecharge::where($this->searchWhere)->count();
|
|
}
|
|
|
|
} |