liugc 1 год назад
Родитель
Сommit
ecb3b27fb2

+ 108 - 0
app/adminapi/controller/export/ExportController.php

@@ -0,0 +1,108 @@
+<?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\export;
+
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\export\ExportLists;
+use app\adminapi\logic\export\ExportLogic;
+use app\adminapi\validate\export\ExportValidate;
+
+
+/**
+ * Export控制器
+ * Class ExportController
+ * @package app\adminapi\controller
+ */
+class ExportController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function lists()
+    {
+        return $this->dataLists(new ExportLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function add()
+    {
+        $params = (new ExportValidate())->post()->goCheck('add');
+        $result = ExportLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(ExportLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function edit()
+    {
+        $params = (new ExportValidate())->post()->goCheck('edit');
+        $result = ExportLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(ExportLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function delete()
+    {
+        $params = (new ExportValidate())->post()->goCheck('delete');
+        ExportLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function detail()
+    {
+        $params = (new ExportValidate())->goCheck('detail');
+        $result = ExportLogic::detail($params);
+        return $this->data($result);
+    }
+
+
+}

+ 17 - 28
app/adminapi/controller/master_worker/EngineerBillController.php

@@ -18,6 +18,10 @@ 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;
 
 /**
@@ -44,35 +48,20 @@ class EngineerBillController extends BaseAdminController
     {
         $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'));
-        $lists =  Db::name('master_worker')->alias('a')->field([
-            'a.id','a.real_name','a.nickname','a.worker_number','e.account_holder','e.bank_name','e.opening_branch','e.account as bank_account',
-            Db::raw("IFNULL(c.maxid,0) as maxid"),Db::raw("IFNULL(d.left_amount,0) as left_amount")
-        ])
-            ->leftJoin([Db::name('master_worker_account_log')
-                ->where('create_time','between',[strtotime($firstDay),strtotime($lastDay)])
-                ->field('worker_id as master_worker_id, max(id) as maxid')
-                ->group('worker_id')
-                ->buildSql() => 'c'], 'a.id = c.master_worker_id')
-            ->leftJoin('master_worker_account_log d', 'c.maxid = d.id')
-            ->leftJoin('bank_account e', 'a.id = e.worker_id')
-            //->where('d.left_amount', '>', 0)
-            ->select()->toArray();
-        //$lists = $lists['lists'];
-        header('Content-Type: text/csv; charset=utf-8');
-        header('Content-Disposition: attachment; filename='.$firstDay.'-'.$lastDay.'.csv');
-        $output = fopen('php://output', 'w');
-        fputcsv($output, array('工程师ID', '工程师编号', '工程师姓名', '工程师银行卡号', '工程师开户行及支行信息','上月最后结算余额'));
-        foreach ($lists as $row) {
-            fputcsv($output, array(
-                $row['id'],
-                $row['worker_number'],
-                $row['nickname'],
-                $row['bank_account'],
-                $row['bank_name'].$row['opening_branch'],
-                $row['left_amount']
-            ));
+        $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());
         }
-        fclose($output);
+        // 暂时 - 立即生成导出文件
+        (new ExcelExportService)->download($result);
+        return $this->success('添加成功-'.$result, [], 1, 1);
     }
 
 }

+ 7 - 18
app/adminapi/controller/master_worker/EngineerSettlementController.php

@@ -20,6 +20,9 @@ use app\adminapi\controller\BaseAdminController;
 use app\adminapi\lists\master_worker\EngineerSettlementLists;
 use app\adminapi\logic\master_worker\EngineerSettlementLogic;
 use app\adminapi\validate\master_worker\EngineerSettlementValidate;
+use excel\ExcelWriter;
+use PhpOffice\PhpSpreadsheet\Spreadsheet;
+use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
 
 
 /**
@@ -113,24 +116,10 @@ class EngineerSettlementController extends BaseAdminController
     public function download()
     {
         $lists = EngineerSettlementLogic::downloadLists();
-        header('Content-Type: text/csv; charset=utf-8');
-        header('Content-Disposition: attachment; filename=engineer_settlement.csv');
-        $output = fopen('php://output', 'w');
-        fputcsv($output, array('工程师ID', '工程师编号', '工程师姓名', '工程师原始余额', '工程师总结算金额', '工程师扣款金额', '工程师最终结算金额', '结算时间', '结算明细备注'));
-        foreach ($lists as $row) {
-            fputcsv($output, array(
-                $row['master_worker_id'],
-                $row['worker_number'],
-                $row['engineer_name'],
-                $row['original_balance'],
-                $row['total_settlement_amount'],
-                $row['deduction_amount'],
-                $row['final_settlement_amount'],
-                $row['settlement_time'],
-                $row['settlement_details_remarks']
-            ));
-        }
-        fclose($output);
+        (new ExcelWriter())->generateExcelFile([
+            '工程师ID', '工程师编号', '工程师姓名', '工程师原始余额', '工程师总结算金额', '工程师扣款金额', '工程师最终结算金额', '结算时间', '结算明细备注'
+        ], $lists,'template', ['master_worker_id','worker_number','engineer_name','original_balance','total_settlement_amount','deduction_amount',
+            'final_settlement_amount','settlement_time','settlement_details_remarks']);
     }
 
 }

+ 78 - 0
app/adminapi/lists/export/ExportLists.php

@@ -0,0 +1,78 @@
+<?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\export;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\export\Export;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * Export列表
+ * Class ExportLists
+ * @package app\adminapi\lists
+ */
+class ExportLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['download_type', 'download_fun', 'params', 'name', 'down_num', 'status', 'expiration_time', 'file_url', 'generate_status', 'clear_status', 'admin_id', 'createtime', 'updatetime'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function lists(): array
+    {
+        return Export::where($this->searchWhere)
+            ->field(['id', 'download_type', 'download_fun', 'params', 'name', 'down_num', 'status', 'expiration_time', 'file_url', 'generate_status', 'clear_status', 'admin_id', 'createtime', 'updatetime'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function count(): int
+    {
+        return Export::where($this->searchWhere)->count();
+    }
+
+}

+ 130 - 0
app/adminapi/logic/export/ExportLogic.php

@@ -0,0 +1,130 @@
+<?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\logic\export;
+
+
+use app\common\model\export\Export;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * Export逻辑
+ * Class ExportLogic
+ * @package app\adminapi\logic
+ */
+class ExportLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public static function add(array $params)
+    {
+        Db::startTrans();
+        try {
+            $export = Export::create([
+                'download_type' => $params['download_type'],
+                'download_fun' => $params['download_fun'],
+                'params' => isset($params['params'])?$params['params']:[],
+                'name' => $params['name'],
+                'down_num' => isset($params['down_num'])?$params['down_num']:0,
+                'status' => isset($params['status'])?$params['status']:0,
+                'expiration_time' => isset($params['expiration_time'])?$params['expiration_time']:0,
+                'file_url' => isset($params['file_url'])?$params['file_url']:'',
+                'generate_status' => isset($params['generate_status'])?$params['generate_status']:0,
+                'clear_status' => isset($params['clear_status'])?$params['clear_status']:0,
+                'admin_id' => isset($params['admin_id'])?$params['admin_id']:0,
+                'createtime' => isset($params['createtime'])?$params['createtime']:time(),
+                'updatetime' => isset($params['updatetime'])?$params['updatetime']:time(),
+            ]);
+            $exportId = $export->id??0;
+            Db::commit();
+            return $exportId;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            Export::where('id', $params['id'])->update([
+                'download_type' => $params['download_type'],
+                'download_fun' => $params['download_fun'],
+                'params' => $params['params'],
+                'name' => $params['name'],
+                'down_num' => $params['down_num'],
+                'status' => $params['status'],
+                'expiration_time' => $params['expiration_time'],
+                'file_url' => $params['file_url'],
+                'generate_status' => $params['generate_status'],
+                'clear_status' => $params['clear_status'],
+                'admin_id' => $params['admin_id'],
+                'createtime' => $params['createtime'],
+                'updatetime' => $params['updatetime'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public static function delete(array $params): bool
+    {
+        return Export::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public static function detail($params): array
+    {
+        return Export::findOrEmpty($params['id'])->toArray();
+    }
+}

+ 2 - 2
app/adminapi/logic/master_worker/EngineerSettlementLogic.php

@@ -143,11 +143,11 @@ class EngineerSettlementLogic extends BaseLogic
     }
     public static function downloadLists(): array
     {
-        return EngineerSettlement::where('id','>',0)
+        return [EngineerSettlement::where('id','>',0)
             ->field(['id', 'master_worker_id', 'worker_number', 'engineer_name', 'original_balance', 'total_settlement_amount', 'deduction_amount', 'final_settlement_amount', 'settlement_time', 'settlement_details_remarks'])
             ->order(['id' => 'desc'])
             ->select()
-            ->toArray();
+            ->toArray()[0]];
     }
 
     public static function engineerSettlementValidate($params)

+ 116 - 0
app/adminapi/validate/export/ExportValidate.php

@@ -0,0 +1,116 @@
+<?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\validate\export;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * Export验证器
+ * Class ExportValidate
+ * @package app\adminapi\validate
+ */
+class ExportValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'download_type' => 'require',
+        'download_fun' => 'require',
+        'name' => 'require',
+        'down_num' => 'require',
+        'status' => 'require',
+        'generate_status' => 'require',
+        'clear_status' => 'require',
+        'admin_id' => 'require',
+        'createtime' => 'require',
+        'updatetime' => 'require',
+
+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'download_type' => '下载类型:0=无,1=最后结算余额',
+        'download_fun' => '执行方法',
+        'name' => '文件名称',
+        'down_num' => '下载次数',
+        'status' => '是否过期:0=未到期,1=已到期',
+        'generate_status' => '生成状态:0=文件生成中,1=文件生成完成,2=文件生成失败',
+        'clear_status' => '清理状态:0=未清理,1=已清理',
+        'admin_id' => '操作人',
+        'createtime' => '创建时间',
+        'updatetime' => '修改时间',
+
+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return ExportValidate
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['download_type','download_fun','name','down_num','status','generate_status','clear_status','admin_id','createtime','updatetime']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return ExportValidate
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','download_type','download_fun','name','down_num','status','generate_status','clear_status','admin_id','createtime','updatetime']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return ExportValidate
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return ExportValidate
+     * @author likeadmin
+     * @date 2024/11/18 13:31
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 45 - 0
app/common/model/export/Export.php

@@ -0,0 +1,45 @@
+<?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\common\model\export;
+
+
+use app\common\model\BaseModel;
+
+
+
+/**
+ * Export模型
+ * Class Export
+ * @package app\common\model
+ */
+class Export extends BaseModel
+{
+    
+    protected $name = 'export';
+    protected $type = [
+        'params' =>  'array',
+    ];
+
+    public function getCreateTimeAttr($value,$data)
+    {
+        return !empty($data['createtime'])?date('Y-m-d H:i:s',$data['createtime']):'';
+    }
+    public function getUpdateTimeAttr($value,$data)
+    {
+        return !empty($data['updatetime'])?date('Y-m-d H:i:s',$data['updatetime']):'';
+    }
+
+
+}

+ 96 - 0
app/common/service/ExcelExportService.php

@@ -0,0 +1,96 @@
+<?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\common\service;
+
+
+use app\common\enum\FileEnum;
+use app\common\model\export\Export;
+use app\common\model\file\File;
+use app\common\service\storage\Driver as StorageDriver;
+use excel\ExcelWriter;
+use Exception;
+use think\facade\Db;
+use think\facade\Log;
+
+
+class ExcelExportService
+{
+
+    private $sheet;
+
+    public function __construct()
+    {
+        $this->sheet = new ExcelWriter();
+    }
+
+    public function download($id)
+    {
+        try{
+            Log::info("download-export:{$id}");
+            $infoExport = Export::findOrEmpty($id);
+            if(!$infoExport->isEmpty()){
+                $download_fun = $infoExport['download_fun'];
+                $filename = $infoExport['name'];
+                $params = $infoExport['params']?:[];
+                // 是否存在该函数
+                if(!method_exists($this,$download_fun)){
+                    throw new Exception('下载函数不存在');
+                }
+                $this->$download_fun($infoExport,$filename,$params);
+            }
+        }catch (\Exception $e){
+            Log::info("download-error:{$id}:".$e->getMessage());
+            throw new Exception($e->getMessage());
+        }
+    }
+
+
+    /**
+     * @notes 工程师 -上月最后结算余额 导出
+     */
+    public function EngineerBillDownload($infoExport,$filename,$params)
+    {
+        try{
+            if($params){ }
+            $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'));
+            $lists =  Db::name('master_worker')->alias('a')->field([
+                    'a.id','a.real_name','a.nickname','a.worker_number','e.account_holder','e.bank_name','e.opening_branch','e.account as bank_account',
+                    Db::raw("IFNULL(c.maxid,0) as maxid"),Db::raw("IFNULL(d.left_amount,0) as left_amount")
+                ])
+                ->leftJoin([Db::name('master_worker_account_log')
+                    ->where('create_time','between',[strtotime($firstDay),strtotime($lastDay)])
+                    ->field('worker_id as master_worker_id, max(id) as maxid')
+                    ->group('worker_id')
+                    ->buildSql() => 'c'], 'a.id = c.master_worker_id')
+                ->leftJoin('master_worker_account_log d', 'c.maxid = d.id')
+                ->leftJoin('bank_account e', 'a.id = e.worker_id')
+                //->where('d.left_amount', '>', 0)
+                ->select()->toArray();
+            $filename = ($filename?:'').('-'.date('YmdHis').'-'.$infoExport->id);
+            $this->sheet->generateExcelFile([
+                '工程师ID', '工程师编号', '工程师姓名', '工程师银行卡号', '工程师开户行及支行信息','上月最后结算余额'
+            ], $lists,$filename, ['id','worker_number','nickname','bank_account','bank_name','left_amount']);
+            $infoExport->file_url = $this->sheet->fileUrl();
+            $infoExport->generate_status = 1;
+            $infoExport->updatetime = time();
+            $infoExport->save();
+            return $infoExport->file_url;
+        }catch (\Exception $e){
+            throw new Exception($e->getMessage());
+        }
+    }
+
+}

+ 1 - 1
composer.json

@@ -26,7 +26,7 @@
         "topthink/think-multi-app": "^1.0",
         "topthink/think-view": "^2.0",
         "dragonmantank/cron-expression": "^3.3",
-        "phpoffice/phpspreadsheet": "^1.22",
+        "phpoffice/phpspreadsheet": "^3.4",
         "qiniu/php-sdk": "7.4",
         "qcloud/cos-sdk-v5": "^2.5",
         "aliyuncs/oss-sdk-php": "^2.4",

BIN
public/fubenxiaz.xls


+ 0 - 2
public/la_engineer_settlement-ok.csv

@@ -1,2 +0,0 @@
-工程师ID,工程师编号,工程师姓名,工程师原始余额,工程师总结算金额,工程师扣款金额,工程师最终结算金额,结算时间,结算明细备注
-3,100003,刘又易,43,3,0,0,2024/11/17 15:15,备注备注备注备注备注

BIN
public/la_engineer_settlement-ok.xlsx


+ 0 - 134
public/test.php

@@ -1,134 +0,0 @@
-<?php
-
-//echo phpinfo();
-
-echo md5('d917' . md5('admin123456' . 'd917'));
-
-
-
-
-
-exit;
-// 原始数组
-$array = [1, 2, 3, 4];
-
-// 在数组前插入单个元素
-array_unshift($array, 0);
-
-// 输出数组
-//print_r($array);
-
-$params = [
-    "field_json" => '[{"field_name":"field_0","field_title":"对对对","field_type":"img","field_default":"","field_select":""},{"field_name":"field_0","field_title":"对对对","field_type":"text","field_default":"","field_select":""}]'
-];
-
-$field_arr = json_decode($params["field_json"], true);
-
-// 提取所有 field_name 的值
-$field_names = array_column($field_arr, 'field_name');
-
-// 统计每个 field_name 出现的次数
-$counts = array_count_values($field_names);
-
-// 检查是否有重复的 field_name
-$has_duplicates = false;
-foreach ($counts as $count) {
-    if ($count > 1) {
-        $has_duplicates = true;
-        break;
-    }
-}
-
-if ($has_duplicates) {
-    echo "存在重复的 field_name";
-} else {
-    echo "没有重复的 field_name";
-}
-
-exit;
-
-exit(bcmul(31, 0.6,2));
-
-
-
-
-
-
-
-for ($i=0;$i<21;$i++){
-    echo htmlentities("<option value=\"field_".$i."\" <%=(row['field_name']==='field_".$i."')?'selected':''%>>field_".$i."</option>") ;
-}
-
-
-
-
-exit;
-
-
-function test($brandId,$length)
-{
-    $curl = curl_init();
-    curl_setopt_array($curl, [
-        CURLOPT_URL => "https://app-h5.lbdj.com/lbdj/app/lbquickquire/cat",
-        CURLOPT_RETURNTRANSFER => true,
-        //CURLOPT_SSL_VERIFYHOST => false,
-        CURLOPT_ENCODING => "",
-        CURLOPT_MAXREDIRS => 10,
-        CURLOPT_TIMEOUT => 30,
-        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
-        CURLOPT_CUSTOMREQUEST => "POST",
-        CURLOPT_POSTFIELDS => "{\"brandId\":{$brandId}}",
-        CURLOPT_HTTPHEADER => [
-            "Accept: application/json, text/plain, */*",
-            //"Accept-Encoding: gzip, deflate, br",
-            "Accept-Language: zh-CN,zh;q=0.9",
-            "Connection: keep-alive",
-            "Content-Length: {$length}",
-            "Content-Type: application/json;charset=UTF-8",
-            "Cookie: acw_tc=34319d4491b04ebe2b691ff410b16af6e363ef70a00b0094e5926395976b93d5; Hm_lvt_0a0557e9ee345c3a8a84a78387287708=1729650726; Hm_lpvt_0a0557e9ee345c3a8a84a78387287708=1729650726; HMACCOUNT=D2861F0CC49DB840; Admin-Token-PT=mini_eafdc0063aca4d4d82361e1ea879aa9e",
-            "Host: app-h5.lbdj.com",
-            "Origin: https://app-h5.lbdj.com",
-            "Referer: https://app-h5.lbdj.com/mine/selectclassType",
-            "Sec-Fetch-Dest: empty",
-            "Sec-Fetch-Mode: cors",
-            "Sec-Fetch-Site: same-origin",
-            "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090c11)XWEB/11275",
-            "appProduct: share",
-            "deviceType: miniprogram",
-            "token: mini_eafdc0063aca4d4d82361e1ea879aa9e",
-            "versionCode: 97"
-        ],
-        CURLOPT_PROXY => '127.0.0.1', // 代理地址
-        CURLOPT_PROXYPORT => 8888,   // 代理端口
-        CURLOPT_SSL_VERIFYPEER => true, // 启用 SSL 证书验证
-        CURLOPT_CAINFO => 'FiddlerRoot.pem', // 指定 CA 证书文件路径
-        CURLOPT_SSL_VERIFYHOST => 2  // 验证主机名
-    ]);
-    $response = curl_exec($curl);
-    $err = curl_error($curl);
-    $info = curl_getinfo($curl);
-    curl_close($curl);
-    return $response;
-}
-
-
-$prams = array(
-    ['brandId' => 6,'length' => 13],
-    ['brandId' => 21,'length' => 14],
-    ['brandId' => 237,'length' => 15]
-);
-foreach ($prams as $item){
-    echo test($item['brandId'],$item['length']);
-    echo '<br>';
-    echo '<br>';
-    echo '<br>';
-}
-
-exit;
-
-
-$s = '湖北省武汉市武昌区和平大道450号武汉工人文化宫5号楼维也纳国际酒店(武汉楚河汉街积玉桥店)';
-$s = '武汉楚河汉街积玉桥店';
-echo iconv_strlen($s)>15?mb_substr($s,0,15,'UTF-8').'...':$s;
-
-