| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?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\controller\master_worker;
- use app\adminapi\controller\BaseAdminController;
- use app\adminapi\lists\master_worker\EngineerBillLists;
- use app\adminapi\logic\export\ExportLogic;
- use app\common\service\ExcelExportService;
- use excel\ExcelWriter;
- use phpseclib3\Common\Functions\Strings;
- use think\facade\Db;
- /**
- * EngineerSettlement控制器
- * Class EngineerSettlementController
- * @package app\adminapi\controller
- */
- class EngineerBillController extends BaseAdminController
- {
- /**
- * @notes 获取列表
- * @return \think\response\Json
- * @author likeadmin
- * @date 2024/11/15 17:21
- */
- public function lists()
- {
- return $this->dataLists(new EngineerBillLists());
- }
- public function download()
- {
- $firstDay = date('Y-m-01 00:00:00', strtotime('first day of last month'));
- $lastDay = date('Y-m-t 23:59:59', strtotime('last day of last month'));
- $filename = date('Y-m-d',strtotime($firstDay))."-至-".date('Y-m-d',strtotime($lastDay))."最后结算余额";
- $result = ExportLogic::add([
- 'download_type' => 1,
- 'download_fun' => 'EngineerBillDownload',
- 'params' => ['firstDay'=>$firstDay,'lastDay'=>$lastDay],
- 'name' => $filename,
- 'admin_id' => $this->adminId,
- ]);
- if (false === $result) {
- return $this->fail(ExportLogic::getError());
- }
- // 暂时 - 立即生成导出文件
- (new ExcelExportService)->download($result);
- return $this->success('添加成功-'.$result, [], 1, 1);
- }
- }
|