<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2020/1/29
 * Time: 0:38
 */

namespace app\index\controller;
use app\index\logic\workercheck;
use app\index\logic\workermanger;
use think\Controller;
use app\index\logic\paylogic;

class Worker extends Controller {
    /*
     * 20200306
     * 修改该方法，获取指定项目的员工
     * 为了简便，取消了开头自动获取所有项目员工的方法，降低前端体验，但并不重要，
     * 因多个方法共用此方法，所以必须加上判断
     * @todo 这个方法要从前端分开，目前这样是不太对的，违背了架构的原则
     */
    public function getallworker() {
        $queryinfo = request()->param();
        $pagenum = $queryinfo['pageNum'];
        $pagesize = $queryinfo['pageSize'];

        $workerlogic = new workermanger();
        if (array_key_exists('sprojectid', $queryinfo)) {
            $sourceprj = $queryinfo['sprojectid'];
            $w_list = $workerlogic->getprjworkerlist($pagenum, $pagesize, $sourceprj);
        } else {
            // $sourceprj=0;
            $w_list = $workerlogic->getallworkerlist($pagenum, $pagesize);
        }
        //
        if ($w_list) {
            $res_r['code'] = 200;
            $res_r['resultData']['list'] = $w_list;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230214
     * 获取所有的工人，
     * 但是按公司获取
     */
    public function getallworkerbycid() {
        $queryinfo = request()->param();
        $pagenum = $queryinfo['pageNum'];
        $pagesize = $queryinfo['pageSize'];

        $workerlogic = new workermanger();

        // $sourceprj=0;
        $cid = $queryinfo['companyid'];
        $w_list = $workerlogic->getallworkerlistbycid($pagenum, $pagesize, $cid);

        //
        if ($w_list) {
            $res_r['code'] = 200;
            $res_r['resultData']['list'] = $w_list;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }
    /**
     * 在职导出
     *
     * @return void
     * @author wj
     * @date 2025-03-14
     */
    public function getallworkerbycid_export() {
        $queryinfo = request()->param();
        $pagenum = $queryinfo['pageNum'];
        $pagesize = $queryinfo['pageSize'];
        $workerlogic = new workermanger();
        $w_list = [];
        if (isset($queryinfo['companyid']) && !empty($queryinfo['companyid'])) {
            $cid = $queryinfo['companyid'];
            $w_list = $workerlogic->getallworkerlistbycid($pagenum, $pagesize, $cid);
        }

        if (isset($queryinfo['wname']) && !empty($queryinfo['wname'])) {
            $wname = $queryinfo['wname'];
            $w_list = $workerlogic->getworkerinfobyname($queryinfo);
        }
        if (empty($w_list)) {
            $this->error("无列表信息");
        }

        //wname 用户姓名 pname 所在工地 shengfengid 身份证号 dayprice 日工资 workclass 工种 telno 手机号  wage 年龄 cardno 银行卡
        vendor('PHPExcel.PHPExcel');
        $objPHPExcel = new \PHPExcel();
        $pageindex = 0;
        $objPHPExcel->setActiveSheetIndex($pageindex);
        //5.设置表格头（即excel表格的第一行）
        $objPHPExcel->setActiveSheetIndex($pageindex)
            ->setCellValue('A1', '用户姓名')
            ->setCellValue('B1', '所在工地')
            ->setCellValue('C1', '身份证号')
            ->setCellValue('D1', '日工资')
            ->setCellValue('E1', '工种')
            ->setCellValue('F1', '手机号')
            ->setCellValue('G1', '年龄')
            ->setCellValue('H1', '银行卡');
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('A')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('B')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('C')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('D')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('E')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('F')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('G')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getStyle('H')->getAlignment()
            ->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('A')->setWidth(20);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('B')->setWidth(50);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('C')->setWidth(50);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('D')->setWidth(20);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('E')->setWidth(20);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('F')->setWidth(50);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('G')->setWidth(20);
        $objPHPExcel->setActiveSheetIndex($pageindex)->getColumnDimension('H')->setWidth(50);
        $rowindex = 2;
        foreach ($w_list as $key => $value) {
            $wname = $value['wname'];
            $pname = isset($value['pname']) ? $value['pname'] : "";
            $shengfengid = " " . $value['shengfengid'];
            $dayprice = $value['dayprice'];
            $workclass = $value['workclass'];
            $telno = $value['telno'];
            $wage = $value['wage'];
            $cardno = " " . $value['cardno'];
            $objPHPExcel->getActiveSheet()->setCellValue('A' . $rowindex, $wname);
            $objPHPExcel->getActiveSheet()->setCellValue('B' . $rowindex, $pname);
            $objPHPExcel->getActiveSheet()->setCellValue('C' . $rowindex, $shengfengid);
            $objPHPExcel->getActiveSheet()->setCellValue('D' . $rowindex, $dayprice);
            $objPHPExcel->getActiveSheet()->setCellValue('E' . $rowindex, $workclass);
            $objPHPExcel->getActiveSheet()->setCellValue('F' . $rowindex, $telno);
            $objPHPExcel->getActiveSheet()->setCellValue('G' . $rowindex, $wage);
            $objPHPExcel->getActiveSheet()->setCellValue('H' . $rowindex, $cardno);
            $rowindex += 1;
        }
        $title = '在职员工';
        $objPHPExcel->getActiveSheet()->setTitle($title);
        $filename = $title . "_" . date('ymd', time()) . '.xls';
        $filename = urlencode($filename);

        //9.设置浏览器窗口下载表格
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");
        header('Content-Type: text/html; charset=utf-8');
        header('Content-Disposition:inline;filename="' . $filename . '"');
        //生成excel文件
        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        //下载文件在浏览器窗口
        $objWriter->save('php://output');
    }
    /**
     * 查询已不在公司项目的历史工作人员
     * 仅限于森一人员使用
     *
     * @return void
     * @author wj
     * @date 2025-02-17
     */
    public function getnotinprojectuserlist() {
        $queryinfo = request()->param();
        $pagenum = $queryinfo['pageNum'];
        $pagesize = $queryinfo['pageSize'];

        $workerlogic = new workermanger();
        $w_list = $workerlogic->getnotinprojectuserlist($pagenum, $pagesize);
        if ($w_list) {
            $res_r['code'] = 200;
            $res_r['resultData']['list'] = $w_list;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }

    public function addworker() {
        $workerinfo = request()->param();

        $workerlogic = new workermanger();

        // $workerinfo=htmlspecialchars_decode($workerinfo);
        $newid = $workerlogic->saveworker($workerinfo);

        if ($newid > 0) {
            $res_r['code'] = 200;
            $res_r['resultData']['code'] = 200;
            $res_r['resultData']['newid'] = $newid;
        } else {
            $res_r['code'] = 200;
            $res_r['resultData']['code'] = 0;
            if ($newid == -1) {
                $res_r['resultData']['msg'] = '号码重复';
            } else {
                $res_r['resultData']['msg'] = '添加失败';
            }

        }

        return json_encode($res_r, 320);
    }

    /*
     * 20200312
     * 请求日期所需的出勤人数
     */
    public function querywcountbydate() {
        $queryinfo = request()->param();
        $l_w = new workermanger();

        $worker_countlist = $l_w->getcheckcountbydate($queryinfo);
        if ($worker_countlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $worker_countlist;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230214
     * 获取本公司的员工的出勤人数统计
     */
    public function querywcountbydatecid() {
        $queryinfo = request()->param();
        $l_w = new workermanger();

        $worker_countlist = $l_w->getcheckcountbydatecompany($queryinfo);
        if ($worker_countlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $worker_countlist;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210303
     * 获取所有的未处理调出人员
     */
    public function queryunoprtrans() {
        $queryinfo = request()->param();
        $l_w = new workermanger();

        $workerlist = $l_w->getuntransworker($queryinfo);
        if ($workerlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $workerlist;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20200205
     * steelxu
     *  web端提交项目工人数据
     */
    public function suboprtransprj() {
        $qryinfo = request()->param();

        $workerlogic = new workermanger();
        $qryinfo['workerlist'] = htmlspecialchars_decode($qryinfo['workerlist']);
        $wokerlist = json_decode($qryinfo['workerlist'], true);
        $prjinfo = $workerlogic->oprtransferlist($qryinfo['pid'], $wokerlist);

        if ($prjinfo) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $prjinfo;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '修改失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210311
     * 根据姓名请求资料
     */
    public function querywinfobyname() {
        $queryinfo = request()->param();
        $l_w = new workermanger();

        $workerlist = $l_w->getworkerinfobyname($queryinfo);
        if ($workerlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $workerlist;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210416
     * 定时自动更新工人年龄
     */
    public function oprworkerage() {
        $l_w = new workermanger();
        $l_w->updatewaggbybirthday();
    }

    /*
     * 20210427
     * 更新
     */
    public function subupdworkerinfo() {
        $queryinfo = request()->param();
        $l_w = new workermanger();

        $wcount = $l_w->updateworkerinfobyid($queryinfo);
        if ($wcount == 1) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $wcount;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '更新失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210508
     * 获取用户的支款记录
     */
    public function querypaylistbyuser() {
        $queryinfo = request()->param();
        $l_p = new paylogic();

        $paylist = $l_p->getpayrecordbyuid($queryinfo);
        if ($paylist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $paylist;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230224
     */
    public function querypaylistbyuserforapp() {
        $queryinfo = request()->param();
        $l_p = new paylogic();

        $paylist = $l_p->getpayrecordbyuid($queryinfo);
        if ($paylist) {
            $res_r['code'] = 200;
            $res_r['msg'] = "请求成功";
            $res_r['data'] = $paylist;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '查询失败';
            $res_r['data'] = $paylist;
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210430
     * 提交位置信息
     */
    public function subuserlocation() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $nid = $l_f->saveuserlocation($queryinfo);

        if ($nid > 0) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $nid;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);

    }

    /*
     * 20210502
     *
     */
    public function queryuserlocationlist() {

        $l_m = new workermanger();
        $rlist = $l_m->getlocationlist();

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210511
     *
     */
    public function querygroupprovince() {
        $l_m = new workermanger();
        $rlist = $l_m->getlocationgroupprovince();

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210511
     *
     */
    public function querygroupcity() {
        $l_m = new workermanger();
        $rlist = $l_m->getlocationgroupcity();

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210515
     */
    public function queryprjlocation() {
        $l_m = new workermanger();
        $rlist = $l_m->getprjlocation();

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }
    /*
     * 20230215
     * 只获取自己公司的项目
     */
    public function querymyprjlocation() {
        $queryinfo = request()->param();
        $l_m = new workermanger();
        $rlist = $l_m->getmyprjlocation($queryinfo);

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210515
     * 按项目请求项目人数
     */
    public function queryworkercountgroupprj() {
        $l_m = new workermanger();
        $rlist = $l_m->getworkerlocationcountgprj();

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }
    /*
     * 20230215
     * 公司按项目请求项目人数
     */
    public function queryworkercountgroupprjbycid() {
        $queryinfo = request()->param();
        $l_m = new workermanger();
        $rlist = $l_m->getworkerlocationcountgprjbycid($queryinfo);

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210516
     * 提交公告
     */
    public function subnewnotice() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $nid = $l_f->savenewnotice($queryinfo);

        if ($nid > 0) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $nid;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210517
     */
    public function queryallnotice() {
        $l_m = new workermanger();
        $rlist = $l_m->getallnotice();

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230215
     */
    public function querynoticebycid() {
        $queryinfo = request()->param();
        $l_m = new workermanger();

        $rlist = $l_m->getnoticebycid($queryinfo);

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210517
     */
    public function querynewmsg() {
        $queryinfo = request()->param();
        $l_m = new workermanger();
        $rlist = $l_m->getnewnotice($queryinfo);

        if ($rlist) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $rlist;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '无数据';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210517
     * 提交公告阅读记录
     */
    public function subnewnoticeread() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $nid = $l_f->updatenoticereadstatus($queryinfo);

        if ($nid > 0) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $nid;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20210517
     */
    public function querypaylistbyuplogid() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $nid = $l_f->getpaylistbyuplogid($queryinfo);

        if ($nid > 0) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $nid;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230130
     */
    public function subnewworkerfromwatercat() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $nid = $l_f->savenewworkerfromwatercat($queryinfo);

        if ($nid > 0) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $nid;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230224
     */
    public function subnewworkerfromwatercatapp() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $nid = $l_f->savenewworkerfromwatercat($queryinfo);

        if ($nid > 0) {
            $res_r['code'] = 200;
            $res_r['msg'] = '提交成功';
            $res_r['data'] = $nid;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '未成功';
            $res_r['data'] = $nid;
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230131
     * 根据电话号码返回用户信息
     */
    public function queryworkerinfobytel() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->getworkerinfobytel($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230222
     */
    public function queryworkerinfobytelforapp() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->getworkerinfobytel($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['msg'] = '查询成功';
            $res_r['data'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '未成功';
            $res_r['data'] = $winfo;
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230131
     */
    public function subnewinventworker() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->addnewinvent($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['msg'] = '邀请已发出';
            $res_r['data'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '邀请未发出';
            $res_r['data'] = $winfo;
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230222
     *
     */
    public function subnewinventworkerforapp() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->addnewinvent($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230131
     */
    public function queryinventinfobywid() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->getinventinfobywid($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230224
     */
    public function queryinventinfobywidforapp() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->getinventinfobywid($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['msg'] = '请求成功';
            $res_r['data'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '无数据';
            $res_r['data'] = $winfo;
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230201
     */
    public function subacceptinvent() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->updateprjbyinvent($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['resultData'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['errmsg'] = '未成功,查看是否在范围内';
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230223
     */
    public function subacceptinventforapp() {
        $queryinfo = request()->param();
        $l_f = new workermanger();
        $winfo = $l_f->updateprjbyinvent($queryinfo);

        if ($winfo) {
            $res_r['code'] = 200;
            $res_r['msg'] = '进入工地成功';
            $res_r['data'] = $winfo;
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = '未成功,查看是否在范围内';
            $res_r['data'] = $winfo;
        }

        return json_encode($res_r, 320);
    }

    /*
     * 20230303
     */
    public function subworkerinclosechangeforapp() {
        $queryinfo = request()->param();
        $l_f = new workercheck();
        $winfo = $l_f->oprinencloseinfo($queryinfo);

        if ($winfo['status'] == 1) {
            $res_r['code'] = 200;
            $res_r['msg'] = $winfo['msg'];
            $res_r['data'] = $winfo['data'];
        } else {
            $res_r['code'] = 0;
            $res_r['msg'] = $winfo['msg'];
            $res_r['data'] = $winfo['data'];
        }

        return json_encode($res_r, 320);
    }
    /**
     * 获取工人日工资列表
     *
     * @return void
     * @author wj
     * @date 2025-02-17
     */
    public function getdaypricerecodelist() {
        $queryinfo = request()->param();
        $l_f = new workercheck();
        $result = $l_f->getdaypricerecodelist($queryinfo);
        if (empty($result['status'])) {
            $res_r['code'] = 0;
        }
        $res_r['msg'] = $result['msg'];
        $res_r['data'] = $result['data'];
        return json_encode($res_r, 320);
    }
}
