初始版本
This commit is contained in:
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 '账户流水记录列表';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user