first commit

This commit is contained in:
Your Name
2026-01-19 14:19:22 +08:00
commit fe2d9c1868
4777 changed files with 665503 additions and 0 deletions

View File

@@ -0,0 +1,299 @@
<?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\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\user\UserTerminalEnum;
use app\common\lists\{ListsSearchInterface,ListsExtendInterface};
use app\common\model\user\{User,UserInfo};
use app\common\model\finance\{RechargeRecord,WithdrawRecord};
/**
* 用户列表
* Class UserAgentLists
* @package app\adminapi\lists\user
*/
class UserAgentLists extends BaseAdminDataLists implements ListsSearchInterface,ListsExtendInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author bd
* @date 2024/01/31 14:07
*/
public function setSearch(): array
{
return [
'=' => ['u.sn','u.is_open','u.is_agent','u.country_code','u.register_ip','u.login_ip'],
];
}
/**
* @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['member_id'])) {
$where[] = ['umr.member_id', '=', $this->params['member_id']];
}
// 邮箱地址
if (!empty($this->params['email'])) {
$where[] = ['ui.email', '=', $this->params['email']];
}
// 邮箱认证
if (!empty($this->params['auth_email'])) {
$where[] = ['ui.auth_email', '=', $this->params['auth_email']];
}
// 所在代数
if (!empty($this->params['level'])) {
$where[] = ['ur.level', '=', $this->params['level']];
}
// 下单时间
if (!empty($this->params['create_time_start']) && !empty($this->params['create_time_end'])) {
$time = [strtotime($this->params['create_time_start']), strtotime($this->params['create_time_end'])];
$where[] = ['u.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 段誉
* @date 2022/9/22 15:50
*/
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['recharge_withdraw_min'])) {
$recharge_withdraw_min = $this->params['recharge_withdraw_min'];
$where .= " AND u.total_recharge - u.total_withdraw >= $recharge_withdraw_min ";
}
// 金额范围
if (!empty($this->params['recharge_withdraw_max'])) {
$recharge_withdraw_max = $this->params['recharge_withdraw_max'];
$where .= " AND u.total_recharge - u.total_withdraw <= $recharge_withdraw_max ";
}
$field = "u.id,u.sn,u.nickname,u.sex,u.avatar,u.account,u.mobile,u.country_code,u.auto_member,u.is_lh,u.is_sn,u.is_open,u.is_agent,u.channel,u.user_money,u.user_point,u.total_recharge,u.total_withdraw,u.total_income,u.total_income_invest,u.total_invest,u.create_time,u.register_ip,u.register_isp,u.remark2,u.login_ip,u.login_time";
$field .= ',ui.email,ui.auth_email';
$field .= ',ur.level';
$lists = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join('user_relation_agent ur', 'u.id = ur.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->field($field)
->append(['team_num','team_recharge','team_withdraw','item_num','today_item_num','vip_name','unused_money','team_report','agent_team_top','register_ip_num','login_ip_num','mine'])
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order('u.id desc')
->select()
->toArray();
// foreach ($lists as &$item) {
// $item['total_recharge_ing'] = round(RechargeRecord::where(['status' => 0,'user_id' => $item['id']])->sum('amount'), 2);
// $item['total_withdraw_ing'] = round(WithdrawRecord::where(['status' => 0,'user_id' => $item['id']])->sum('amount'), 2);
// }
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/9/22 15:51
*/
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['recharge_withdraw_min'])) {
$recharge_withdraw_min = $this->params['recharge_withdraw_min'];
$where .= " AND u.total_recharge - u.total_withdraw >= $recharge_withdraw_min ";
}
// 金额范围
if (!empty($this->params['recharge_withdraw_max'])) {
$recharge_withdraw_max = $this->params['recharge_withdraw_max'];
$where .= " AND u.total_recharge - u.total_withdraw <= $recharge_withdraw_max ";
}
return User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join('user_relation_agent ur', 'u.id = ur.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.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['recharge_withdraw_min'])) {
$recharge_withdraw_min = $this->params['recharge_withdraw_min'];
$where .= " AND u.total_recharge - u.total_withdraw >= $recharge_withdraw_min ";
}
// 金额范围
if (!empty($this->params['recharge_withdraw_max'])) {
$recharge_withdraw_max = $this->params['recharge_withdraw_max'];
$where .= " AND u.total_recharge - u.total_withdraw <= $recharge_withdraw_max ";
}
$total_recharge = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join('user_relation_agent ur', 'u.id = ur.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->sum('u.total_recharge');
$total_withdraw = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join('user_relation_agent ur', 'u.id = ur.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->sum('u.total_withdraw');
$total_money = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join('user_relation_agent ur', 'u.id = ur.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->sum('u.user_money');
$recharge_ing = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join('user_relation_agent ur', 'u.id = ur.user_id')
->join('recharge_record rr', 'u.id = rr.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where(['rr.status' => 0])
->where($this->queryWhere())
->where($this->searchWhere)
->sum('rr.amount');
$withdraw_ing = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join('user_relation_agent ur', 'u.id = ur.user_id')
->join('withdraw_record wr', 'u.id = wr.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where(['wr.status' => 0])
->where($this->queryWhere())
->where($this->searchWhere)
->sum('wr.amount');
return [
'total_money' => round($total_money, 2),
'total_recharge' => round($total_recharge, 2),
'total_withdraw' => round($total_withdraw, 2),
'recharge_withdraw' => round($total_recharge - $total_withdraw, 2),
'recharge_ing' => round($recharge_ing, 2),
'withdraw_ing' => round($withdraw_ing, 2),
];
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserGroup;
use app\common\lists\ListsSearchInterface;
/**
* 用户分组列表
* Class UserGroupLists
* @package app\adminapi\listsuser
*/
class UserGroupLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/04/25 01:04
*/
public function setSearch(): array
{
return [
'=' => ['name'],
];
}
/**
* @notes 获取用户分组列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/04/25 01:04
*/
public function lists(): array
{
return UserGroup::where($this->searchWhere)
->field(['id', 'name'])
->append(['rule_num','user_num'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取用户分组数量
* @return int
* @author BD
* @date 2024/04/25 01:04
*/
public function count(): int
{
return UserGroup::where($this->searchWhere)->count();
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserGroupRule;
use app\common\lists\ListsSearchInterface;
/**
* 分组规则列表
* Class UserGroupRuleLists
* @package app\adminapi\listsuser
*/
class UserGroupRuleLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/04/25 01:30
*/
public function setSearch(): array
{
return [
'=' => ['group_id'],
];
}
/**
* @notes 获取分组规则列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/04/25 01:30
*/
public function lists(): array
{
return UserGroupRule::where($this->searchWhere)
->field(['id', 'group_id', 'num', 'money_type', 'money', 'money_percentage', 'commission_type', 'commission', 'commission_percentage'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取分组规则数量
* @return int
* @author BD
* @date 2024/04/25 01:30
*/
public function count(): int
{
return UserGroupRule::where($this->searchWhere)->count();
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserInfo;
use app\common\lists\ListsSearchInterface;
/**
* 用户信息列表
* Class UserInfoLists
* @package app\adminapi\listsuser
*/
class UserInfoLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/06/08 17:51
*/
public function setSearch(): array
{
return [
'=' => ['ui.user_id', 'ui.email', 'ui.google_key', 'ui.card_name', 'ui.card_num', 'ui.auth_email', 'ui.auth_google', 'ui.auth_card', 'ui.create_time'],
];
}
/**
* @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[] = ['ui.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/06/08 17:51
*/
public function lists(): array
{
$field = 'ui.id,ui.user_id,ui.email,ui.google_key,ui.google_qrcode,ui.card_name,ui.card_num,ui.card_img1,ui.card_img2,ui.card_img3,ui.auth_email,ui.auth_google,ui.auth_card,ui.create_time,ui.card_time';
$field .= ',u.account,u.sn as u_sn,u.mobile';
return UserInfo::alias('ui')
->join('user u', 'u.id = ui.user_id')
->field($field)
->where("auth_card != 0")
->where($this->queryWhere())
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['ui.card_time' => 'desc' ,'ui.id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取用户信息数量
* @return int
* @author BD
* @date 2024/06/08 17:51
*/
public function count(): int
{
return UserInfo::alias('ui')
->join('user u', 'u.id = ui.user_id')
->where("auth_card != 0")
->where($this->queryWhere())
->where($this->searchWhere)
->count();
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserKadan;
use app\common\lists\ListsSearchInterface;
/**
* 卡单规则列表
* Class UserKadanLists
* @package app\adminapi\listsuser
*/
class UserKadanLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/04/24 17:00
*/
public function setSearch(): array
{
return [
'=' => [ 'user_id'],
];
}
/**
* @notes 获取卡单规则列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/04/24 17:00
*/
public function lists(): array
{
return UserKadan::where($this->searchWhere)
->field(['id', 'user_id', 'sn', 'num', 'money', 'commission', 'status', 'create_time', 'finish_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取卡单规则数量
* @return int
* @author BD
* @date 2024/04/24 17:00
*/
public function count(): int
{
return UserKadan::where($this->searchWhere)->count();
}
}

View File

@@ -0,0 +1,341 @@
<?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\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\user\UserTerminalEnum;
use app\common\lists\{ListsExcelInterface,ListsSearchInterface,ListsExtendInterface};
use app\common\model\user\{User,UserInfo,UserMineRecord};
use app\common\model\finance\{RechargeRecord,WithdrawRecord};
/**
* 用户列表
* Class UserLists
* @package app\adminapi\lists\user
*/
class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsSearchInterface,ListsExtendInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author bd
* @date 2024/01/31 14:07
*/
public function setSearch(): array
{
return [
'=' => ['u.sn','u.is_open','u.is_agent','u.country_code','u.register_ip','u.login_ip'],
];
}
/**
* @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['member_id'])) {
$where[] = ['umr.member_id', '=', $this->params['member_id']];
}
// 邮箱地址
if (!empty($this->params['email'])) {
$where[] = ['ui.email', '=', $this->params['email']];
}
// 邮箱认证
if (!empty($this->params['auth_email'])) {
$where[] = ['ui.auth_email', '=', $this->params['auth_email']];
}
// 下单时间
if (!empty($this->params['create_time_start']) && !empty($this->params['create_time_end'])) {
$time = [strtotime($this->params['create_time_start']), strtotime($this->params['create_time_end'])];
$where[] = ['u.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 段誉
* @date 2022/9/22 15:50
*/
public function lists(): array
{
$where = " 1 = 1 ";
// 金额范围
if (!empty($this->params['recharge_withdraw_min'])) {
$recharge_withdraw_min = $this->params['recharge_withdraw_min'];
$where .= " AND u.total_recharge - u.total_withdraw >= $recharge_withdraw_min ";
}
// 金额范围
if (!empty($this->params['recharge_withdraw_max'])) {
$recharge_withdraw_max = $this->params['recharge_withdraw_max'];
$where .= " AND u.total_recharge - u.total_withdraw <= $recharge_withdraw_max ";
}
$field = "u.id,u.sn,u.nickname,u.sex,u.avatar,u.account,u.mobile,u.country_code,u.auto_member,u.is_lh,u.is_transfer,u.is_sn,u.is_open,u.is_agent,u.agent_name,u.channel,u.user_money,u.user_point,u.total_recharge,u.total_withdraw,u.total_income_invest,u.total_invest,u.total_income_mine,u.create_time,u.register_ip,u.register_isp,u.remark2,u.login_ip,u.login_time";
$field .= ',ui.email,ui.auth_email';
$join_table = "user_info t";
$join_require = 't.user_id = u.id';
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
$join_table = "user_relation_agent ur";
$join_require = 'u.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 = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join($join_table, $join_require)
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->field($field)
->append(['team_num','team_recharge','team_withdraw','item_num','today_item_num','vip_name','unused_money','team_report','team_top','register_ip_num','login_ip_num','register_country','mine'])
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order('u.id desc')
->select()
->toArray();
foreach ($lists as &$item) {
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
$item['recharge_withdraw'] = round($item['total_recharge'] - $item['total_withdraw'], 2);
if(isset($item['level']) && isset($item['team_top']['level'])){
$item['team_top']['level'] = $item['level'];
}
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2022/9/22 15:51
*/
public function count(): int
{
$where = " 1 = 1 ";
// 金额范围
if (!empty($this->params['recharge_withdraw_min'])) {
$recharge_withdraw_min = $this->params['recharge_withdraw_min'];
$where .= " AND u.total_recharge - u.total_withdraw >= $recharge_withdraw_min ";
}
// 金额范围
if (!empty($this->params['recharge_withdraw_max'])) {
$recharge_withdraw_max = $this->params['recharge_withdraw_max'];
$where .= " AND u.total_recharge - u.total_withdraw <= $recharge_withdraw_max ";
}
$join_table = "user_info t";
$join_require = 't.user_id = u.id';
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
$join_table = "user_relation_agent ur";
$join_require = 'u.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 User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join($join_table, $join_require)
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->count();
}
public function extend(): array
{
$where = " 1 = 1 ";
// 金额范围
if (!empty($this->params['recharge_withdraw_min'])) {
$recharge_withdraw_min = $this->params['recharge_withdraw_min'];
$where .= " AND u.total_recharge - u.total_withdraw >= $recharge_withdraw_min ";
}
// 金额范围
if (!empty($this->params['recharge_withdraw_max'])) {
$recharge_withdraw_max = $this->params['recharge_withdraw_max'];
$where .= " AND u.total_recharge - u.total_withdraw <= $recharge_withdraw_max ";
}
$join_table = "user_info t";
$join_require = 't.user_id = u.id';
if(isset($this->params['parent_sn']) && $this->params['parent_sn'] !=""){
$join_table = "user_relation_agent ur";
$join_require = 'u.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_recharge = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join($join_table, $join_require)
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->sum('u.total_recharge');
$total_withdraw = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join($join_table, $join_require)
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->sum('u.total_withdraw');
$total_money = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join($join_table, $join_require)
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where($this->queryWhere())
->where($this->searchWhere)
->sum('u.user_money');
$recharge_ing = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join($join_table, $join_require)
->join('recharge_record rr', 'u.id = rr.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where(['rr.status' => 0])
->where($this->queryWhere())
->where($this->searchWhere)
->sum('rr.amount');
$withdraw_ing = User::alias('u')
->join('user_info ui', 'u.id = ui.user_id')
->join($join_table, $join_require)
->join('withdraw_record wr', 'u.id = wr.user_id')
->leftjoin('user_member_record umr', 'u.id = umr.user_id')
->where($where)
->where(['wr.status' => 0])
->where($this->queryWhere())
->where($this->searchWhere)
->sum('wr.amount');
return [
'total_money' => round($total_money, 2),
'total_recharge' => round($total_recharge, 2),
'total_withdraw' => round($total_withdraw, 2),
'recharge_withdraw' => round($total_recharge - $total_withdraw, 2),
'recharge_ing' => round($recharge_ing, 2),
'withdraw_ing' => round($withdraw_ing, 2),
];
}
/**
* @notes 导出文件名
* @return string
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setFileName(): string
{
return '用户列表';
}
/**
* @notes 导出字段
* @return string[]
* @author 段誉
* @date 2022/11/24 16:17
*/
public function setExcelFields(): array
{
return [
'sn' => '用户ID',
'country_code' => '国家区号',
'account' => '手机号',
'sn' => '邀请码',
'email' => '邮箱',
'vip_name' => '会员等级',
'level_top_account' => '一代',
'level_level' => '用户层级',
'team_level1' => '推广情况1级',
'team_level2' => '推广情况2级',
'team_level3' => '推广情况3级',
'total_recharge' => '总充值',
'total_withdraw' => '总提现',
'recharge_withdraw' => '充提差',
'channel' => '注册来源',
'create_time' => '注册时间',
];
}
}

View File

@@ -0,0 +1,97 @@
<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserMineRecord;
use app\common\lists\ListsSearchInterface;
/**
* 挖矿记录列表
* Class UserMineRecordLists
* @package app\adminapi\listsuser
*/
class UserMineRecordLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2025/01/01 15:47
*/
public function setSearch(): array
{
return [
'=' => ['umr.sn'],
];
}
/**
* @notes 搜索条件
* @author BD
* @date 2024/03/19 02:29
*/
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[] = ['umr.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 2025/01/01 15:47
*/
public function lists(): array
{
$field = 'umr.*';
$field .= ',u.account,u.sn as u_sn,u.mobile';
$records = UserMineRecord::alias('umr')
->join('user u', 'u.id = umr.user_id')
->field($field)
->where($this->queryWhere())
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['umr.id' => 'desc'])
->select()
->toArray();
return $records;
}
/**
* @notes 获取挖矿记录数量
* @return int
* @author BD
* @date 2025/01/01 15:47
*/
public function count(): int
{
return UserMineRecord::alias('umr')
->join('user u', 'u.id = umr.user_id')
->where($this->queryWhere())
->where($this->searchWhere)
->count();
}
}

View File

@@ -0,0 +1,96 @@
<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserNotice;
use app\common\lists\ListsSearchInterface;
/**
* 用户消息列表
* Class UserNoticeLists
* @package app\adminapi\listsuser
*/
class UserNoticeLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/05/26 00:36
*/
public function setSearch(): array
{
return [
'=' => ['un.title', 'un.read', 'un.notice_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[] = ['un.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/05/26 00:36
*/
public function lists(): array
{
$field = 'un.id,un.user_id,un.title,un.content,un.read,un.notice_type,un.create_time';
$field .= ',u.account,u.sn as u_sn,u.mobile';
return UserNotice::alias('un')
->join('user u', 'u.id = un.user_id')
->field($field)
->where($this->queryWhere())
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['un.id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取用户消息数量
* @return int
* @author BD
* @date 2024/05/26 00:36
*/
public function count(): int
{
return UserNotice::alias('un')
->join('user u', 'u.id = un.user_id')
->where($this->queryWhere())
->where($this->searchWhere)
->count();
}
}

View File

@@ -0,0 +1,109 @@
<?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\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\{UserRelation,UserRelationAgent};
use app\common\lists\ListsSearchInterface;
/**
* 用户关系列表
* Class UserRelationLists
* @package app\adminapi\listsuser
*/
class UserRelationLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/01/12 17:21
*/
public function setSearch(): array
{
return [
'=' => ['a1.level'],
];
}
/**
* @notes 搜索条件
* @author 段誉
* @date 2023/2/24 15:26
*/
public function queryWhere()
{
$where = [];
if (!empty($this->params['user_info'])) {
$where[] = ['u1.sn|u1.account|u1.mobile', '=', $this->params['user_info']];
}
if (!empty($this->params['parent_info'])) {
$where[] = ['u2.sn|u2.account|u2.mobile', '=', $this->params['parent_info']];
}
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/12 17:21
*/
public function lists(): array
{
$field = 'a1.id,a1.user_id,a1.parent_id,a1.level,a1.create_time,u1.sn as u1_sn,u1.account as u1_account,u1.mobile as u1_mobile,u1.user_money as u1_user_money,u1.total_recharge as u1_total_recharge,u1.total_withdraw u1_total_withdraw,u2.sn as u2_sn,u2.account as u2_account,u2.mobile as u2_mobile';
return UserRelationAgent::alias('a1')
->join('user u1', 'u1.id = a1.user_id')
->join('user u2', 'u2.id = a1.parent_id')
->field($field)
->append(['team_top'])
->where($this->searchWhere)
->where($this->queryWhere())
->limit($this->limitOffset, $this->limitLength)
->order(['a1.id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取用户关系数量
* @return int
* @author BD
* @date 2024/01/12 17:21
*/
public function count(): int
{
return UserRelationAgent::alias('a1')
->join('user u1', 'u1.id = a1.user_id')
->join('user u2', 'u2.id = a1.parent_id')
->where($this->searchWhere)
->where($this->queryWhere())
->count();
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserTron;
use app\common\lists\ListsSearchInterface;
/**
* 波场钱包列表
* Class UserTronLists
* @package app\adminapi\listsuser
*/
class UserTronLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/05/04 23:38
*/
public function setSearch(): array
{
return [
'=' => ['type'],
];
}
/**
* @notes 获取波场钱包列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/05/04 23:38
*/
public function lists(): array
{
return UserTron::where($this->searchWhere)
->field(['id', 'user_id', 'address', 'key', 'qrcode', 'money_trx', 'money_usdt', 'sort', 'type', 'create_time'])
->append(['user_info'])
->limit($this->limitOffset, $this->limitLength)
->order(['sort' => 'desc','id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取波场钱包数量
* @return int
* @author BD
* @date 2024/05/04 23:38
*/
public function count(): int
{
return UserTron::where($this->searchWhere)->count();
}
}