初始化仓库
This commit is contained in:
119
app/adminapi/lists/finance/AccountLogLists.php
Normal file
119
app/adminapi/lists/finance/AccountLogLists.php
Normal file
@ -0,0 +1,119 @@
|
||||
<?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\enum\user\AccountLogEnum;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use app\common\service\FileService;
|
||||
|
||||
|
||||
/**
|
||||
* 账记流水列表
|
||||
* Class AccountLogLists
|
||||
* @package app\adminapi\lists\finance
|
||||
*/
|
||||
class AccountLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:26
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['al.change_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 搜索条件
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:26
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where = [];
|
||||
// 用户余额
|
||||
if (isset($this->params['type']) && $this->params['type'] == 'um') {
|
||||
$where[] = ['change_type', 'in', AccountLogEnum::getUserMoneyChangeType()];
|
||||
}
|
||||
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile|u.account', 'like', '%' . $this->params['user_info'] . '%'];
|
||||
}
|
||||
|
||||
if (!empty($this->params['start_time'])) {
|
||||
$where[] = ['al.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
|
||||
if (!empty($this->params['end_time'])) {
|
||||
$where[] = ['al.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:31
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$field = 'u.nickname,u.account,u.sn,u.avatar,u.mobile,al.action,al.change_amount,al.left_amount,al.change_type,al.source_sn,al.create_time';
|
||||
$lists = UserAccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->field($field)
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->order('al.id', 'desc')
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
$item['change_type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
|
||||
$symbol = $item['action'] == AccountLogEnum::INC ? '+' : '-';
|
||||
$item['change_amount'] = $symbol . $item['change_amount'];
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:36
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserAccountLog::alias('al')
|
||||
->join('user u', 'u.id = al.user_id')
|
||||
->where($this->queryWhere())
|
||||
->where($this->searchWhere)
|
||||
->count();
|
||||
}
|
||||
}
|
||||
79
app/adminapi/lists/finance/RefundLogLists.php
Normal file
79
app/adminapi/lists/finance/RefundLogLists.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?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\refund\RefundLog;
|
||||
|
||||
|
||||
/**
|
||||
* 退款日志列表
|
||||
* Class RefundLogLists
|
||||
* @package app\adminapi\lists\product
|
||||
*/
|
||||
class RefundLogLists extends BaseAdminDataLists
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查询条件
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:55
|
||||
*/
|
||||
public function queryWhere()
|
||||
{
|
||||
$where[] = ['record_id', '=', $this->params['record_id'] ?? 0];
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:56
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new RefundLog())
|
||||
->order(['id' => 'desc'])
|
||||
->where($this->queryWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->hidden(['refund_msg'])
|
||||
->append(['handler', 'refund_status_text'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:56
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new RefundLog())
|
||||
->where($this->queryWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
}
|
||||
143
app/adminapi/lists/finance/RefundRecordLists.php
Normal file
143
app/adminapi/lists/finance/RefundRecordLists.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?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\enum\RefundEnum;
|
||||
use app\common\lists\ListsExtendInterface;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\refund\RefundRecord;
|
||||
use app\common\service\FileService;
|
||||
|
||||
|
||||
/**
|
||||
* 退款记录列表
|
||||
* Class RefundRecordLists
|
||||
* @package app\adminapi\lists\product
|
||||
*/
|
||||
class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterface, ListsExtendInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查询条件
|
||||
* @return \string[][]
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['r.sn', 'r.order_sn', 'r.refund_type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 查询条件
|
||||
* @param bool $flag
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function queryWhere($flag = true)
|
||||
{
|
||||
$where = [];
|
||||
if (!empty($this->params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile|u.account', 'like', '%' . $this->params['user_info'] . '%'];
|
||||
}
|
||||
if (!empty($this->params['start_time'])) {
|
||||
$where[] = ['r.create_time', '>=', strtotime($this->params['start_time'])];
|
||||
}
|
||||
if (!empty($this->params['end_time'])) {
|
||||
$where[] = ['r.create_time', '<=', strtotime($this->params['end_time'])];
|
||||
}
|
||||
|
||||
if ($flag == true) {
|
||||
if (isset($this->params['refund_status']) && $this->params['refund_status'] != '') {
|
||||
$where[] = ['r.refund_status', '=', $this->params['refund_status']];
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
$lists = (new RefundRecord())->alias('r')
|
||||
->field('r.*,u.nickname,u.avatar')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->order(['r.id' => 'desc'])
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->append(['refund_type_text', 'refund_status_text', 'refund_way_text'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return (new RefundRecord())->alias('r')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 额外参数
|
||||
* @return mixed|null
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:51
|
||||
*/
|
||||
public function extend()
|
||||
{
|
||||
$count = (new RefundRecord())->alias('r')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->field([
|
||||
'count(r.id) as total',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_ING.', true, null)) as ing',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_SUCCESS.', true, null)) as success',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_ERROR.', true, null)) as error',
|
||||
])
|
||||
->where($this->searchWhere)
|
||||
->where($this->queryWhere(false))
|
||||
->select()->toArray();
|
||||
|
||||
return array_shift($count);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user