first commit
This commit is contained in:
276
app/adminapi/lists/finance/AgentRechargeRecordLists.php
Normal file
276
app/adminapi/lists/finance/AgentRechargeRecordLists.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\finance\RechargeRecord;
|
||||
use app\common\model\user\{User,UserRelation,UserRelationAgent};
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 充值记录列表
|
||||
* Class AgentRechargeRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class AgentRechargeRecordLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExtendInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => [ 'rr.sn', 'rr.method_id', 'rr.status'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户编号
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.account|u.mobile', '=', $this->params['user_info']];
|
||||
}
|
||||
|
||||
// 用户编号
|
||||
if (!empty($this->params['u_sn'])) {
|
||||
$where[] = ['u.sn', '=', $this->params['u_sn']];
|
||||
}
|
||||
|
||||
// 所在代数
|
||||
if (!empty($this->params['level'])) {
|
||||
$where[] = ['ur.level', '=', $this->params['level']];
|
||||
}
|
||||
|
||||
// 下单时间
|
||||
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
|
||||
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
|
||||
$where[] = ['rr.create_time', 'between', $time];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取充值记录列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND rr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND rr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$field = 'rr.id,rr.sn,rr.user_id,rr.method_id,rr.amount,rr.amount_act,rr.account as method_account,rr.voucher,rr.rate,rr.symbol,rr.status,rr.user_money,rr.remark,rr.remark2,rr.create_time,rr.update_time';
|
||||
$field .= ',u.account,u.sn as u_sn,u.mobile,u.country_code,u.recharge_num,u.withdraw_num';
|
||||
$field .= ',ur.level';
|
||||
|
||||
|
||||
return RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join('user_relation_agent ur', 'rr.user_id = ur.user_id')
|
||||
->field($field)
|
||||
->append(['method','status_text','team_top'])
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['rr.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取充值记录数量
|
||||
* @return int
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND rr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND rr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
return RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join('user_relation_agent ur', 'rr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function extend(): array
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND rr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND rr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$total = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join('user_relation_agent ur', 'rr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
$ing = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join('user_relation_agent ur', 'rr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 0])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
$success = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join('user_relation_agent ur', 'rr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
|
||||
$success_count = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join('user_relation_agent ur', 'rr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
|
||||
$error = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join('user_relation_agent ur', 'rr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 2])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
|
||||
return [
|
||||
'total' => round($total, 2),
|
||||
'ing' => round($ing, 2),
|
||||
'success' => round($success, 2),
|
||||
'success_count' => $success_count,
|
||||
'error' => round($error, 2),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
160
app/adminapi/lists/finance/AgentUserFinanceLists.php
Normal file
160
app/adminapi/lists/finance/AgentUserFinanceLists.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\finance\UserFinance;
|
||||
use app\common\model\user\{User,UserRelation,UserRelationAgent};
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 资金明细列表
|
||||
* Class AgentUserFinanceLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class AgentUserFinanceLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => [ 'uf.sn', 'uf.change_type'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户编号
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.account|u.mobile', '=', $this->params['user_info']];
|
||||
}
|
||||
|
||||
// 所在代数
|
||||
if (!empty($this->params['level'])) {
|
||||
$where[] = ['ur.level', '=', $this->params['level']];
|
||||
}
|
||||
|
||||
// 下单时间
|
||||
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
|
||||
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
|
||||
$where[] = ['uf.create_time', 'between', $time];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取资金明细列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/03/07 13:10
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
$field = 'uf.id,uf.sn,uf.user_id,uf.change_type,uf.action,uf.change_amount,uf.left_amount,uf.source_sn,uf.remark,uf.create_time';
|
||||
$field .= ',u.account,u.sn as u_sn,u.mobile,u.country_code';
|
||||
$field .= ',ur.level';
|
||||
|
||||
return UserFinance::alias('uf')
|
||||
->join('user u', 'u.id = uf.user_id')
|
||||
->join('user_relation_agent ur', 'uf.user_id = ur.user_id')
|
||||
->field($field)
|
||||
->append(['team_top'])
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['uf.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取资金明细数量
|
||||
* @return int
|
||||
* @author BD
|
||||
* @date 2024/03/07 13:10
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
return UserFinance::alias('uf')
|
||||
->join('user u', 'u.id = uf.user_id')
|
||||
->join('user_relation_agent ur', 'uf.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
}
|
||||
280
app/adminapi/lists/finance/AgentWithdrawRecordLists.php
Normal file
280
app/adminapi/lists/finance/AgentWithdrawRecordLists.php
Normal file
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\finance\WithdrawRecord;
|
||||
use app\common\model\user\{User,UserRelation,UserRelationAgent};
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\withdraw\WithdrawWallet;
|
||||
|
||||
|
||||
/**
|
||||
* 提现记录列表
|
||||
* Class AgentWithdrawRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class AgentWithdrawRecordLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExtendInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => [ 'wr.sn', 'wr.method_id', 'wr.status'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户编号
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.account|u.mobile', '=', $this->params['user_info']];
|
||||
}
|
||||
|
||||
// 用户编号
|
||||
if (!empty($this->params['u_sn'])) {
|
||||
$where[] = ['u.sn', '=', $this->params['u_sn']];
|
||||
}
|
||||
|
||||
// 所在代数
|
||||
if (!empty($this->params['level'])) {
|
||||
$where[] = ['ur.level', '=', $this->params['level']];
|
||||
}
|
||||
|
||||
// 下单时间
|
||||
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
|
||||
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
|
||||
$where[] = ['wr.create_time', 'between', $time];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取提现记录列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:35
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND wr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND wr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$field = 'wr.id,wr.sn,wr.user_id,wr.method_id,wr.wallet_id,wr.amount,wr.amount_act,wr.rate,wr.symbol,wr.status,wr.status2,wr.charge,wr.remark,wr.user_money,wr.create_time,wr.update_time';
|
||||
|
||||
$field .= ',wr.type,wr.name,wr.bank_name,wr.account,wr.img';
|
||||
$field .= ',u.account as u_account,u.sn as u_sn,u.mobile,u.country_code,u.recharge_num,u.withdraw_num,u.remark2';
|
||||
$field .= ',ur.level';
|
||||
|
||||
$lists = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join('user_relation_agent ur', 'wr.user_id = ur.user_id')
|
||||
->field($field)
|
||||
->append(['method_name','status_text','act_amount','team_top'])
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['wr.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取提现记录数量
|
||||
* @return int
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:35
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND wr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND wr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
return WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join('user_relation_agent ur', 'wr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function extend(): array
|
||||
{
|
||||
//根据管理员ID获取代理
|
||||
$user = User::where(['agent_id' => $this->adminId])->findOrEmpty();
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
if (!$user->isEmpty()) {
|
||||
$top_id = $user['id'];
|
||||
$parent_id = $user['id'];
|
||||
//查询伞下用户
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$userParent = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
if (!$userParent->isEmpty()){
|
||||
$parent_id = $userParent['id'];
|
||||
}
|
||||
}
|
||||
$where .= " AND ur.top_id = $top_id AND ur.parent_id = $parent_id ";
|
||||
}else{
|
||||
$where .= " AND 1 = 2 ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND wr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND wr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$total = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join('user_relation_agent ur', 'wr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
$ing = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join('user_relation_agent ur', 'wr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 0])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
$success = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join('user_relation_agent ur', 'wr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
|
||||
$success_count = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join('user_relation_agent ur', 'wr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
|
||||
$error = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join('user_relation_agent ur', 'wr.user_id = ur.user_id')
|
||||
->where($where)
|
||||
->where(['status' => 2])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
|
||||
return [
|
||||
'total' => round($total, 2),
|
||||
'ing' => round($ing, 2),
|
||||
'success' => round($success, 2),
|
||||
'success_count' => $success_count,
|
||||
'error' => round($error, 2),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
310
app/adminapi/lists/finance/RechargeRecordLists.php
Normal file
310
app/adminapi/lists/finance/RechargeRecordLists.php
Normal file
@@ -0,0 +1,310 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\finance\RechargeRecord;
|
||||
use app\common\model\user\{User,UserRelation,UserRelationAgent};
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 充值记录列表
|
||||
* Class RechargeRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class RechargeRecordLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface,ListsExtendInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => [ 'rr.sn', 'rr.method_id', 'rr.status'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户编号
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.account|u.mobile', '=', $this->params['user_info']];
|
||||
}
|
||||
|
||||
// 用户编号
|
||||
if (!empty($this->params['u_sn'])) {
|
||||
$where[] = ['u.sn', '=', $this->params['u_sn']];
|
||||
}
|
||||
|
||||
// 下单时间
|
||||
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
|
||||
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
|
||||
$where[] = ['rr.create_time', 'between', $time];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取充值记录列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND rr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND rr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$field = 'rr.id,rr.sn,rr.user_id,rr.method_id,rr.amount,rr.amount_act,rr.account as method_account,rr.voucher,rr.rate,rr.symbol,rr.status,rr.user_money,rr.remark,rr.remark2,rr.create_time,rr.update_time';
|
||||
$field .= ',u.account,u.sn as u_sn,u.mobile,u.country_code,u.recharge_num,u.withdraw_num';
|
||||
|
||||
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = rr.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'rr.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
$field .= ',ur.level';
|
||||
}
|
||||
|
||||
$lists = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->field($field)
|
||||
->append(['method','status_text','team_top'])
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['rr.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
if(isset($item['level']) && isset($item['team_top']['level'])){
|
||||
$item['team_top']['level'] = $item['level'];
|
||||
}
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取充值记录数量
|
||||
* @return int
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND rr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND rr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = rr.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'rr.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
}
|
||||
|
||||
return RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function extend(): array
|
||||
{
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND rr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND rr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = rr.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'rr.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
}
|
||||
|
||||
$total = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
$ing = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 0])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
$success = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
|
||||
$success_count = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
|
||||
$error = RechargeRecord::alias('rr')
|
||||
->join('user u', 'u.id = rr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 2])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('rr.amount');
|
||||
|
||||
return [
|
||||
'total' => round($total, 2),
|
||||
'ing' => round($ing, 2),
|
||||
'success' => round($success, 2),
|
||||
'success_count' => $success_count,
|
||||
'error' => round($error, 2),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '充值记录';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'account' => '用户账号',
|
||||
'sn' => '订单编号',
|
||||
'method_name' => '充值方式',
|
||||
'amount' => '充值金额',
|
||||
'status_text' => '状态',
|
||||
'create_time' => '下单时间',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
161
app/adminapi/lists/finance/UserFinanceLists.php
Normal file
161
app/adminapi/lists/finance/UserFinanceLists.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\finance\UserFinance;
|
||||
use app\common\model\user\{User,UserRelation,UserRelationAgent};
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 资金明细列表
|
||||
* Class UserFinanceLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class UserFinanceLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => [ 'uf.sn', 'uf.frozen', 'uf.change_type'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户编号
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.account|u.mobile', '=', $this->params['user_info']];
|
||||
}
|
||||
|
||||
// 下单时间
|
||||
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
|
||||
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
|
||||
$where[] = ['uf.create_time', 'between', $time];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取资金明细列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/03/07 13:10
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = 'uf.id,uf.sn,uf.user_id,uf.change_type,uf.action,uf.change_amount,uf.left_amount,uf.source_sn,uf.remark,uf.create_time,uf.thaw_time,uf.frozen';
|
||||
$field .= ',u.account,u.sn as u_sn,u.mobile,u.country_code';
|
||||
|
||||
$where = " 1 = 1 ";
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = uf.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'uf.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
$field .= ',ur.level';
|
||||
}
|
||||
|
||||
$lists = UserFinance::alias('uf')
|
||||
->join('user u', 'u.id = uf.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->field($field)
|
||||
->append(['team_top'])
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['uf.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
if(isset($item['level']) && isset($item['team_top']['level'])){
|
||||
$item['team_top']['level'] = $item['level'];
|
||||
}
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取资金明细数量
|
||||
* @return int
|
||||
* @author BD
|
||||
* @date 2024/03/07 13:10
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$where = " 1 = 1 ";
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = uf.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'uf.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
}
|
||||
|
||||
return UserFinance::alias('uf')
|
||||
->join('user u', 'u.id = uf.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
}
|
||||
313
app/adminapi/lists/finance/WithdrawRecordLists.php
Normal file
313
app/adminapi/lists/finance/WithdrawRecordLists.php
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\finance\WithdrawRecord;
|
||||
use app\common\model\user\{User,UserRelation,UserRelationAgent};
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\withdraw\WithdrawWallet;
|
||||
|
||||
|
||||
/**
|
||||
* 提现记录列表
|
||||
* Class WithdrawRecordLists
|
||||
* @package app\adminapi\listsfinance
|
||||
*/
|
||||
class WithdrawRecordLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExcelInterface,ListsExtendInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => [ 'wr.sn', 'wr.method_id', 'wr.status'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:08
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户编号
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.account|u.mobile', '=', $this->params['user_info']];
|
||||
}
|
||||
|
||||
// 用户编号
|
||||
if (!empty($this->params['u_sn'])) {
|
||||
$where[] = ['u.sn', '=', $this->params['u_sn']];
|
||||
}
|
||||
|
||||
// 下单时间
|
||||
if (!empty($this->params['start_time']) && !empty($this->params['end_time'])) {
|
||||
$time = [strtotime($this->params['start_time']), strtotime($this->params['end_time'])];
|
||||
$where[] = ['wr.create_time', 'between', $time];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取提现记录列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:35
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND wr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND wr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$field = 'wr.id,wr.sn,wr.user_id,wr.method_id,wr.wallet_id,wr.amount,wr.amount_act,wr.rate,wr.symbol,wr.status,wr.status2,wr.charge,wr.remark,wr.remark_df,wr.user_money,wr.create_time,wr.update_time';
|
||||
|
||||
$field .= ',wr.type,wr.name,wr.bank_name,wr.account,wr.img';
|
||||
$field .= ',u.account as u_account,u.sn as u_sn,u.mobile,u.country_code,u.recharge_num,u.withdraw_num,u.remark2';
|
||||
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = wr.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'wr.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
|
||||
$field .= ',ur.level';
|
||||
}
|
||||
|
||||
$lists = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->field($field)
|
||||
->append(['method_name','status_text','act_amount','team_top'])
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['wr.id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
if(isset($item['level']) && isset($item['team_top']['level'])){
|
||||
$item['team_top']['level'] = $item['level'];
|
||||
}
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取提现记录数量
|
||||
* @return int
|
||||
* @author BD
|
||||
* @date 2024/02/25 12:35
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND wr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND wr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = wr.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'wr.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
}
|
||||
|
||||
return WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
|
||||
public function extend(): array
|
||||
{
|
||||
$where = " 1 = 1 ";
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_min'])) {
|
||||
$money_min = $this->params['money_min'];
|
||||
$where .= " AND wr.amount >= $money_min ";
|
||||
}
|
||||
|
||||
// 金额范围
|
||||
if (!empty($this->params['money_max'])) {
|
||||
$money_max = $this->params['money_max'];
|
||||
$where .= " AND wr.amount <= $money_max ";
|
||||
}
|
||||
|
||||
$join_table = "user t";
|
||||
$join_require = 't.id = wr.user_id';
|
||||
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
|
||||
$join_table = "user_relation_agent ur";
|
||||
$join_require = 'wr.user_id = ur.user_id';
|
||||
|
||||
$user = User::where(['sn' => $this->params['parent_sn']]) -> findOrEmpty();
|
||||
$parent_id = 0;
|
||||
if (!$user->isEmpty()) $parent_id = $user['id'];
|
||||
|
||||
$where .= " AND ur.parent_id = $parent_id ";
|
||||
|
||||
if(isset($this->params['level']) && $this->params['level'] !=""){
|
||||
$level = $this->params['level'];
|
||||
$where .= " AND ur.level = $level ";
|
||||
}
|
||||
}
|
||||
|
||||
$total = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
$ing = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 0])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
$success = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
|
||||
$success_count = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 1])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
|
||||
$error = WithdrawRecord::alias('wr')
|
||||
->join('user u', 'u.id = wr.user_id')
|
||||
->join($join_table, $join_require)
|
||||
->where($where)
|
||||
->where(['status' => 2])
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->sum('wr.amount');
|
||||
|
||||
return [
|
||||
'total' => round($total, 2),
|
||||
'ing' => round($ing, 2),
|
||||
'success' => round($success, 2),
|
||||
'success_count' => $success_count,
|
||||
'error' => round($error, 2),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出文件名
|
||||
* @return string
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '提现记录';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author bd
|
||||
* @date 2024/01/31 14:07
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
'account' => '用户账号',
|
||||
'sn' => '订单编号',
|
||||
'method_name' => '提现方式',
|
||||
'amount' => '提现金额',
|
||||
'charge' => '手续费',
|
||||
'status_text' => '状态',
|
||||
'create_time' => '下单时间',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user