初始版本
This commit is contained in:
135
server/app/adminapi/lists/finance/AccountLogLists.php
Executable file
135
server/app/adminapi/lists/finance/AccountLogLists.php
Executable file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\accountLog\AccountLog;
|
||||
use app\common\service\FileService;
|
||||
|
||||
class AccountLogLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:30 下午
|
||||
*/
|
||||
public function where()
|
||||
{
|
||||
$where = [];
|
||||
if (isset($this->params['change_object']) && $this->params['change_object'] != '') {
|
||||
$where[] = ['al.change_object','=',$this->params['change_object']];
|
||||
}else {
|
||||
$where[] = ['al.change_object','=',AccountLogEnum::MONEY];
|
||||
}
|
||||
if (isset($this->params['user_info']) && $this->params['user_info'] != '') {
|
||||
$where[] = ['u.sn|u.mobile|u.nickname|u.account','like','%'.$this->params['user_info'].'%'];
|
||||
}
|
||||
if (isset($this->params['change_type']) && $this->params['change_type'] != '') {
|
||||
$where[] = ['al.change_type','=',$this->params['change_type']];
|
||||
}
|
||||
// 开始时间
|
||||
if(isset($this->params['start_time']) && $this->params['start_time'] != '') {
|
||||
$where[] = ['al.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
// 结束时间
|
||||
if(isset($this->params['end_time']) && $this->params['end_time'] != '') {
|
||||
$where[] = ['al.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
if (isset($this->params['order_sn']) && $this->params['order_sn'] != '') {
|
||||
$where[] = ['al.association_sn','=',$this->params['order_sn']];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 账户流水记录列表
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:32 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = AccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->field('al.id,u.sn as user_sn,u.avatar,u.nickname,u.mobile,al.change_amount,al.left_amount,al.action,al.change_type,al.association_sn,al.create_time')
|
||||
->append(['change_type_desc'])
|
||||
->where(self::where())
|
||||
->limit($this->limitOffset,$this->limitLength)
|
||||
->order('al.id','desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$list) {
|
||||
$list['avatar'] = empty($list['avatar']) ? '' : FileService::getFileUrl($list['avatar']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 账户流水记录数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:32 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return AccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->where(self::where())
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
// '数据库字段名(支持别名) => 'Excel表字段名'
|
||||
'user_sn' => '用户编号',
|
||||
'nickname' => '用户昵称',
|
||||
'change_amount' => '变动金额',
|
||||
'left_amount' => '剩余金额',
|
||||
'change_type_desc' => '变动类型',
|
||||
'association_sn' => '来源单号',
|
||||
'create_time' => '记录时间',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出表名
|
||||
* @return string
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '账户流水记录列表';
|
||||
}
|
||||
}
|
||||
128
server/app/adminapi/lists/finance/CoachAccountLogLists.php
Executable file
128
server/app/adminapi/lists/finance/CoachAccountLogLists.php
Executable file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\accountLog\AccountLog;
|
||||
use app\common\model\accountLog\CoachAccountLog;
|
||||
|
||||
class CoachAccountLogLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:30 下午
|
||||
*/
|
||||
public function where()
|
||||
{
|
||||
$where = [];
|
||||
$changeObject = $this->params['change_object'] ?? CoachAccountLogEnum::MONEY;
|
||||
$where[] = ['AL.change_object','=',$changeObject];
|
||||
if (isset($this->params['user_info']) && $this->params['user_info'] != '') {
|
||||
$where[] = ['C.sn|C.mobile|C.name','like','%'.$this->params['user_info'].'%'];
|
||||
}
|
||||
if (isset($this->params['change_type']) && $this->params['change_type'] != '') {
|
||||
$where[] = ['AL.change_type','=',$this->params['change_type']];
|
||||
}
|
||||
// 开始时间
|
||||
if(isset($this->params['start_time']) && $this->params['start_time'] != '') {
|
||||
$where[] = ['AL.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
// 结束时间
|
||||
if(isset($this->params['end_time']) && $this->params['end_time'] != '') {
|
||||
$where[] = ['AL.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
if (isset($this->params['order_sn']) && $this->params['order_sn'] != '') {
|
||||
$where[] = ['AL.association_sn','=',$this->params['order_sn']];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 账户流水记录列表
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:32 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = CoachAccountLog::alias('AL')
|
||||
->join('coach C', 'C.id = AL.coach_id')
|
||||
->field('AL.id,C.sn as user_sn,C.name,C.mobile,AL.change_amount,AL.left_amount,AL.action,AL.change_type,AL.association_sn,AL.create_time')
|
||||
->append(['change_type_desc'])
|
||||
->where(self::where())
|
||||
->limit($this->limitOffset,$this->limitLength)
|
||||
->order('AL.id','desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 账户流水记录数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:32 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CoachAccountLog::alias('AL')
|
||||
->join('coach C', 'C.id = AL.coach_id')
|
||||
->where(self::where())
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
// '数据库字段名(支持别名) => 'Excel表字段名'
|
||||
'user_sn' => '用户编号',
|
||||
'nickname' => '用户昵称',
|
||||
'change_amount' => '变动金额',
|
||||
'left_amount' => '剩余金额',
|
||||
'change_type_desc' => '变动类型',
|
||||
'association_sn' => '来源单号',
|
||||
'create_time' => '记录时间',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出表名
|
||||
* @return string
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '账户流水记录列表';
|
||||
}
|
||||
}
|
||||
131
server/app/adminapi/lists/finance/RechargeLists.php
Executable file
131
server/app/adminapi/lists/finance/RechargeLists.php
Executable file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\RechargeOrder;
|
||||
use app\common\service\FileService;
|
||||
|
||||
class RechargeLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:30 下午
|
||||
*/
|
||||
public function where()
|
||||
{
|
||||
$where = [];
|
||||
if (isset($this->params['sn']) && $this->params['sn'] != '') {
|
||||
$where[] = ['ro.sn','=',$this->params['sn']];
|
||||
}
|
||||
if (isset($this->params['user_info']) && $this->params['user_info'] != '') {
|
||||
$where[] = ['u.sn|u.mobile|u.nickname|u.account','like','%'.$this->params['user_info'].'%'];
|
||||
}
|
||||
if (isset($this->params['pay_way']) && $this->params['pay_way'] != '') {
|
||||
$where[] = ['ro.pay_way','=',$this->params['pay_way']];
|
||||
}
|
||||
if (isset($this->params['pay_status']) && $this->params['pay_status'] != '') {
|
||||
$where[] = ['ro.pay_status','=',$this->params['pay_status']];
|
||||
}
|
||||
// 开始时间
|
||||
if(isset($this->params['start_time']) && $this->params['start_time'] != '') {
|
||||
$where[] = ['ro.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
// 结束时间
|
||||
if(isset($this->params['end_time']) && $this->params['end_time'] != '') {
|
||||
$where[] = ['ro.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值明细列表
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 6:43 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = RechargeOrder::alias('ro')
|
||||
->join('user u', 'u.id = ro.user_id')
|
||||
->field('ro.id,u.avatar,u.nickname,ro.sn,ro.order_amount,ro.pay_way,ro.pay_status,ro.pay_time,ro.create_time')
|
||||
->append(['pay_way_desc','pay_status_desc'])
|
||||
->where(self::where())
|
||||
->limit($this->limitOffset,$this->limitLength)
|
||||
->order('ro.id','desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$list) {
|
||||
$list['avatar'] = empty($list['avatar']) ? '' : FileService::getFileUrl($list['avatar']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值明细数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/12/2 6:43 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return RechargeOrder::alias('ro')
|
||||
->join('user u', 'u.id = ro.user_id')
|
||||
->where(self::where())
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
// '数据库字段名(支持别名) => 'Excel表字段名'
|
||||
'nickname' => '用户昵称',
|
||||
'sn' => '充值单号',
|
||||
'order_amount' => '充值金额',
|
||||
'pay_way_desc' => '支付方式',
|
||||
'pay_status_desc' => '支付状态',
|
||||
'pay_time' => '支付时间',
|
||||
'create_time' => '提交时间',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出表名
|
||||
* @return string
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '充值明细列表';
|
||||
}
|
||||
}
|
||||
127
server/app/adminapi/lists/finance/ShopAccountLogLists.php
Executable file
127
server/app/adminapi/lists/finance/ShopAccountLogLists.php
Executable file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\accountLog\ShopAccountLog;
|
||||
|
||||
class ShopAccountLogLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
{
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:30 下午
|
||||
*/
|
||||
public function where()
|
||||
{
|
||||
$where = [];
|
||||
$changeObject = $this->params['change_object'] ?? CoachAccountLogEnum::MONEY;
|
||||
$where[] = ['AL.change_object','=',$changeObject];
|
||||
if (isset($this->params['user_info']) && $this->params['user_info'] != '') {
|
||||
$where[] = ['S.sn|S.mobile','like','%'.$this->params['user_info'].'%'];
|
||||
}
|
||||
if (isset($this->params['change_type']) && $this->params['change_type'] != '') {
|
||||
$where[] = ['AL.change_type','=',$this->params['change_type']];
|
||||
}
|
||||
// 开始时间
|
||||
if(isset($this->params['start_time']) && $this->params['start_time'] != '') {
|
||||
$where[] = ['AL.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
// 结束时间
|
||||
if(isset($this->params['end_time']) && $this->params['end_time'] != '') {
|
||||
$where[] = ['AL.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
if (isset($this->params['order_sn']) && $this->params['order_sn'] != '') {
|
||||
$where[] = ['AL.association_sn','=',$this->params['order_sn']];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 账户流水记录列表
|
||||
* @return array
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:32 下午
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = ShopAccountLog::alias('AL')
|
||||
->join('shop S', 'S.id = AL.shop_id')
|
||||
->field('AL.id,S.sn as user_sn,S.name,S.mobile,AL.change_amount,AL.left_amount,AL.action,AL.change_type,AL.association_sn,AL.create_time')
|
||||
->append(['change_type_desc'])
|
||||
->where(self::where())
|
||||
->limit($this->limitOffset,$this->limitLength)
|
||||
->order('AL.id','desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 账户流水记录数量
|
||||
* @return int
|
||||
* @author ljj
|
||||
* @date 2022/12/2 5:32 下午
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return ShopAccountLog::alias('AL')
|
||||
->join('shop S', 'S.id = AL.shop_id')
|
||||
->where(self::where())
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出字段
|
||||
* @return string[]
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setExcelFields(): array
|
||||
{
|
||||
return [
|
||||
// '数据库字段名(支持别名) => 'Excel表字段名'
|
||||
'user_sn' => '用户编号',
|
||||
'nickname' => '用户昵称',
|
||||
'change_amount' => '变动金额',
|
||||
'left_amount' => '剩余金额',
|
||||
'change_type_desc' => '变动类型',
|
||||
'association_sn' => '来源单号',
|
||||
'create_time' => '记录时间',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 导出表名
|
||||
* @return string
|
||||
* @author ljj
|
||||
* @date 2023/4/12 2:40 下午
|
||||
*/
|
||||
public function setFileName(): string
|
||||
{
|
||||
return '账户流水记录列表';
|
||||
}
|
||||
}
|
||||
142
server/app/adminapi/lists/finance/WithdrawLists.php
Executable file
142
server/app/adminapi/lists/finance/WithdrawLists.php
Executable file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\finance;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\shop\Shop;
|
||||
use app\common\model\withdraw\WithdrawApply;
|
||||
use app\common\service\FileService;
|
||||
|
||||
class WithdrawLists extends BaseAdminDataLists implements ListsExtendInterface
|
||||
{
|
||||
public function setWhere()
|
||||
{
|
||||
$source = $this->params['source'] ?? 1;
|
||||
$type = $this->params['type'] ?? '';
|
||||
$keyword = $this->params['keyword'] ?? '';
|
||||
$channel = $this->params['channel'] ?? '';
|
||||
$startTime = $this->params['start_time'] ?? '';
|
||||
$endTime = $this->params['end_time'] ?? '';
|
||||
$status = $this->params['status'] ?? '';
|
||||
$where = [];
|
||||
$where[] = ['source','=',$source];
|
||||
if($keyword){
|
||||
if(1 == $source){
|
||||
$ids = Coach::where('sn|name','like','%'.$keyword.'%')->field('id')->select()->toArray();
|
||||
$ids = array_column($ids,'id');
|
||||
}else{
|
||||
$ids = Shop::where('sn|name','like','%'.$keyword.'%')->field('id')->select()->toArray();
|
||||
$ids = array_column($ids,'id');
|
||||
}
|
||||
$where[] = ['relation_id','in',$ids];
|
||||
}
|
||||
if($channel){
|
||||
//渠道
|
||||
if(1 == $channel){
|
||||
$where[] = ['apply_type','=',1];
|
||||
}else{
|
||||
$where[] = ['apply_type','=',2];
|
||||
}
|
||||
}
|
||||
|
||||
if($type){
|
||||
$where[] = ['type','=',$type];
|
||||
}
|
||||
if($startTime){
|
||||
$where[] = ['create_time','>',$startTime];
|
||||
}
|
||||
if($endTime){
|
||||
$where[] = ['create_time','<',$endTime];
|
||||
}
|
||||
switch ($status){
|
||||
case 1:
|
||||
$where[] = ['status','=',1];
|
||||
break;
|
||||
case 2:
|
||||
$where[] = ['status','=',4];
|
||||
break;
|
||||
case 3:
|
||||
$where[] = ['status','in',[2,5]];
|
||||
break;
|
||||
case 4:
|
||||
$where[] = ['status','in',[2,3,6]];
|
||||
break;
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = WithdrawApply::where($this->setWhere())
|
||||
->append(['status_desc','apply_type_desc','type_desc'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->withoutField('delete_time')
|
||||
->order('id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
$source = $this->params['source'] ?? 1;
|
||||
$relationLists = [];
|
||||
$relationIds = array_column($lists,'relation_id');
|
||||
if(1 == $source){
|
||||
$relationLists = Coach::where(['id'=>$relationIds])->column('name,sn,work_photo','id');
|
||||
}else{
|
||||
$relationLists = Shop::where(['id'=>$relationIds])->column('name,sn,logo','id');
|
||||
}
|
||||
foreach ($lists as $key => $value){
|
||||
if(1 == $source){
|
||||
$lists[$key]['relation_info'] = [
|
||||
'name' => $relationLists[$value['relation_id']]['name'] ?? '',
|
||||
'sn' => $relationLists[$value['relation_id']]['sn'] ?? '',
|
||||
'image' => FileService::getFileUrl($relationLists[$value['relation_id']]['work_photo'] ?? '')
|
||||
];
|
||||
}else{
|
||||
$lists[$key]['relation_info'] = [
|
||||
'name' => $relationLists[$value['relation_id']]['name'] ?? '',
|
||||
'sn' => $relationLists[$value['relation_id']]['sn'] ?? '',
|
||||
'image' => FileService::getFileUrl($relationLists[$value['relation_id']]['logo'] ?? '')
|
||||
];
|
||||
}
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return WithdrawApply::where($this->setWhere())->count();
|
||||
}
|
||||
|
||||
|
||||
public function extend()
|
||||
{
|
||||
$whereLists = $this->setWhere();
|
||||
foreach ($whereLists as $key => $where){
|
||||
if($where[0] == 'status'){
|
||||
unset($whereLists[$key]);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'all_count' => WithdrawApply::where($whereLists)->count(),
|
||||
'wait_audit' => WithdrawApply::where($whereLists)->where('status','=',1)->count(),
|
||||
'withdraw_ing' => WithdrawApply::where($whereLists)->where('status','=',4)->count(),
|
||||
'withdraw_success' => WithdrawApply::where($whereLists)->where('status','in',[2,5])->count(),
|
||||
'withdraw_failt' => WithdrawApply::where($whereLists)->where('status','in',[2,3,6])->count(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user