159 lines
4.7 KiB
PHP
159 lines
4.7 KiB
PHP
![]() |
<?php
|
|||
|
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | ThinkAdmin
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 官方网站: https://thinkadmin.top
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | 开源协议 ( https://mit-license.org )
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
|
|||
|
// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
|
|||
|
namespace app\merchant\controller;
|
|||
|
|
|||
|
use think\admin\Controller;
|
|||
|
use app\merchant\service\MerchantLogService;
|
|||
|
use app\merchant\service\MerchantService;
|
|||
|
use app\merchant\service\OrderService;
|
|||
|
use app\channel\service\ChannelService;
|
|||
|
use app\channel\service\ProductService;
|
|||
|
use app\merchant\service\MerchantLogHistoryService;
|
|||
|
/**
|
|||
|
* 商户资金管理
|
|||
|
* Class Merchant
|
|||
|
* @package app\merchant\controller
|
|||
|
*/
|
|||
|
class Account extends Controller
|
|||
|
{
|
|||
|
|
|||
|
/**
|
|||
|
* 绑定数据表
|
|||
|
* @var string
|
|||
|
*/
|
|||
|
public $table = 'MerchantAccountLog';
|
|||
|
|
|||
|
/**
|
|||
|
* 充值信息列表
|
|||
|
* @auth true
|
|||
|
* @menu true
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
*/
|
|||
|
public function index()
|
|||
|
{
|
|||
|
$id = input('id');
|
|||
|
$this->info = MerchantService::instance()->getInfo($id);
|
|||
|
$this->title = '【' . $this->info['name'] . '】交易明细列表';
|
|||
|
$data_type = input('data_type', 1);
|
|||
|
if ($data_type == 2) {
|
|||
|
$this->table = 'MerchantAccountLogHistory';
|
|||
|
}
|
|||
|
$this->data_type = $data_type;
|
|||
|
$query = $this->_query($this->table);
|
|||
|
$query->where(array('is_yue' => 1));
|
|||
|
$query->equal('mid,type,oper,account_type')->like('order_id')->dateBetween('create_at,order_date');
|
|||
|
$query->where(['mid' => $id]);
|
|||
|
// 列表排序并显示
|
|||
|
if (input('output') === 'json') {
|
|||
|
$result = $query->order('id desc')->page(true, false);
|
|||
|
$this->success('获取数据列表成功', $result);
|
|||
|
} else {
|
|||
|
$query->order('id desc')->page();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 表单数据处理
|
|||
|
* @param array $data
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
*/
|
|||
|
protected function _form_filter(&$data)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 列表数据处理
|
|||
|
* @param array $data
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
*/
|
|||
|
protected function _index_page_filter(array &$data)
|
|||
|
{
|
|||
|
$merchant = MerchantService::instance();
|
|||
|
$this->type = $this->type();
|
|||
|
$this->account_type = $this->account_type();
|
|||
|
foreach ($data as $k => $v) {
|
|||
|
$data[$k]['merchant'] = $this->info;
|
|||
|
|
|||
|
$data[$k]['oper_name'] = $this->type($v['type']);
|
|||
|
|
|||
|
if ($v['account_type'] == 2) {
|
|||
|
$data[$k]['account_name'] = '授信账户';
|
|||
|
} else {
|
|||
|
$data[$k]['account_name'] = '余额账户';
|
|||
|
}
|
|||
|
|
|||
|
if ($data[$k]['num'] > 0) {
|
|||
|
if ($v['oper'] == 1) {
|
|||
|
$data[$k]['snum'] = '+' . $data[$k]['num'];
|
|||
|
} else {
|
|||
|
$data[$k]['snum'] = '-' . $data[$k]['num'];
|
|||
|
}
|
|||
|
} else {
|
|||
|
$data[$k]['snum'] = $data[$k]['num'];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if ($this->data_type == 2) {
|
|||
|
$this->total = MerchantLogHistoryService::instance()->total($this->info['id'], $this->info);
|
|||
|
} else {
|
|||
|
$this->total = MerchantLogService::instance()->total($this->info['id'], $this->info);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected function type($type = false)
|
|||
|
{
|
|||
|
$config = array
|
|||
|
(
|
|||
|
'' => '全部',
|
|||
|
1 => '充值',
|
|||
|
2 => '扣减',
|
|||
|
3 => '下单成功扣减',
|
|||
|
4 => '下单失败返还',
|
|||
|
5 => '满额返点',
|
|||
|
6 => '授信',
|
|||
|
);
|
|||
|
|
|||
|
if (!$type) {
|
|||
|
return $config;
|
|||
|
} else {
|
|||
|
return $config[$type];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected function account_type($type = false)
|
|||
|
{
|
|||
|
$config = array
|
|||
|
(
|
|||
|
'' => '全部',
|
|||
|
2 => '授信账户',
|
|||
|
1 => '余额账户',
|
|||
|
);
|
|||
|
|
|||
|
if (!$type) {
|
|||
|
return $config;
|
|||
|
} else {
|
|||
|
return $config[$type];
|
|||
|
}
|
|||
|
}
|
|||
|
}
|