117 lines
3.7 KiB
PHP
117 lines
3.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\setting\controller;
|
|||
|
|
|||
|
use think\admin\Controller;
|
|||
|
use app\channel\service\AccountService;
|
|||
|
use app\merchant\service\MerchantService;
|
|||
|
/**
|
|||
|
* 特殊商户资金管理
|
|||
|
* Class Merchant
|
|||
|
* @package app\merchant\controller
|
|||
|
*/
|
|||
|
class MerchantAccount extends Controller
|
|||
|
{
|
|||
|
|
|||
|
/**
|
|||
|
* 绑定数据表
|
|||
|
* @var string
|
|||
|
*/
|
|||
|
public $table = 'MerchantAccount';
|
|||
|
|
|||
|
/**
|
|||
|
* 充值信息列表
|
|||
|
* @auth true
|
|||
|
* @menu true
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
*/
|
|||
|
public function index()
|
|||
|
{
|
|||
|
$this->title = '商户对账数据';
|
|||
|
$this->day = date('Y-m-d');
|
|||
|
$query = $this->_query($this->table);
|
|||
|
$query->equal('mid')->dateBetween('create_at');
|
|||
|
$field = '*,(replace(day, "-", "")+0) as day_num';
|
|||
|
$order = 'day_num desc,id desc';
|
|||
|
|
|||
|
$query->field($field);
|
|||
|
// 列表排序并显示
|
|||
|
if (input('output') === 'json') {
|
|||
|
$result = $query->order($order)->page(true, false);
|
|||
|
$this->success('获取数据列表成功', $result);
|
|||
|
} else {
|
|||
|
$query->order($order)->page();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 表单数据处理
|
|||
|
* @param array $data
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
*/
|
|||
|
protected function _form_filter(&$data)
|
|||
|
{
|
|||
|
$this->merchants = $this->app->db->name('MerchantList')->whereRaw('id in(6,42)')->where(['is_deleted' => 0, 'status' => 1])->select()->toArray();
|
|||
|
$this->day = date('Y-m-d');
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 列表数据处理
|
|||
|
* @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)
|
|||
|
{
|
|||
|
$this->merchants = $this->app->db->name('MerchantList')->whereRaw('id in(6,42)')->where(['is_deleted' => 0, 'status' => 1])->select()->toArray();
|
|||
|
|
|||
|
foreach ($data as $k => $v) {
|
|||
|
$data[$k]['merchant'] = MerchantService::instance()->getInfo($v['mid']);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 添加商户
|
|||
|
* @auth true
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
*/
|
|||
|
public function add()
|
|||
|
{
|
|||
|
$this->_applyFormToken();
|
|||
|
$this->_form($this->table, 'form');
|
|||
|
}
|
|||
|
|
|||
|
/**
|
|||
|
* 编辑商户
|
|||
|
* @auth true
|
|||
|
* @throws \think\db\exception\DataNotFoundException
|
|||
|
* @throws \think\db\exception\DbException
|
|||
|
* @throws \think\db\exception\ModelNotFoundException
|
|||
|
*/
|
|||
|
public function edit()
|
|||
|
{
|
|||
|
$this->_applyFormToken();
|
|||
|
$this->_form($this->table, 'form');
|
|||
|
}
|
|||
|
}
|