REAPI/app/setting/controller/AccountLog.php

94 lines
2.3 KiB
PHP
Raw Permalink Normal View History

2024-09-29 15:43:18 +08:00
<?php
namespace app\setting\controller;
use think\admin\Controller;
/**
* 公户账单
* Class ChannelProduct
* @package app\channel\controller
*/
class AccountLog extends Controller
{
/**
* 绑定数据表
* @var string
*/
private $table = 'stat_account_log';
/**
* 公户账单管理
* @auth true
* @menu true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
$this->title = '公户账单管理';
$query = $this->_query($this->table);
$query->where(array('type' => 3))->equal('day,oper')->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 _page_filter(&$data)
{
$this->day = date('Y-m-d');
}
/**
* 添加公户账单
* @auth true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function add()
{
$this->day = date('Y-m-d');
$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->day = date('Y-m-d');
$this->_form($this->table, 'form');
}
/**
* 删除公户账单
* @auth true
* @throws \think\db\exception\DbException
*/
public function remove()
{
$this->_delete($this->table);
}
}