<?php
/**
 * Created by PhpStorm.
 * User: sicilon_IT
 * Date: 2020/1/30
 * Time: 12:43
 */

namespace app\index\controller;
use app\index\logic\checkmanger;
use think\Controller;

class Checkopr extends Controller{
    public function getoprinfo(){
        $queryinfo=request() -> param();

        $opr_l=new checkmanger();
        //20200203修改，不分班次
       // $recordinfo=$opr_l->getprjcheckoprbywid($queryinfo['wid'],$queryinfo['checkdate'],$queryinfo['checkshift']);
        $recordinfo=$opr_l->getheadcheckoprwithdate($queryinfo['wid'],$queryinfo['checkdate']);
        if (empty($recordinfo)){
            $res_r['code']=0;
            $res_r['msg']='无考勤数据';
        }else{
            $res_r['code']=200;
            $res_r['resultData']=$recordinfo;
        }
        return json_encode($res_r,320);
    }

    /*
     * 20230222
     */
    public function getoprinfoforapp(){
        $queryinfo=request() -> param();

        $opr_l=new checkmanger();
        //20200203修改，不分班次
        // $recordinfo=$opr_l->getprjcheckoprbywid($queryinfo['wid'],$queryinfo['checkdate'],$queryinfo['checkshift']);
        $recordinfo=$opr_l->getheadcheckoprwithdate($queryinfo['wid'],$queryinfo['checkdate']);
        if (empty($recordinfo)){
            $res_r['code']=0;
            $res_r['msg']='无考勤数据';
            $res_r['data']=$recordinfo;
        }else{
            $res_r['code']=200;
            $res_r['msg']='请求居功';
            $res_r['data']=$recordinfo;
        }
        return json_encode($res_r,320);
    }

    public function getoprdetailbyhead(){
        $queryinfo=request() -> param();

        $opr_l=new checkmanger();
        //20200203日修改为从日记录表中查询
        //$recordlist=$opr_l->getchecklistbyhead($queryinfo['headid'],$queryinfo['checkdate'],$queryinfo['checkshift']);
        $recordlist=$opr_l->getchecklistbyheadwithdate($queryinfo['headid'],$queryinfo['checkdate']);

        if (empty($recordlist)){
            $res_r['code']=0;
            $res_r['msg']='无考勤数据';
        }else{
            $res_r['code']=200;
            $res_r['resultData']=$recordlist;
        }
        return json_encode($res_r,320);
    }

    /*
     *
     */
    public function getoprdetailbyheadforapp(){
        $queryinfo=request() -> param();

        $opr_l=new checkmanger();
        //20200203日修改为从日记录表中查询
        //$recordlist=$opr_l->getchecklistbyhead($queryinfo['headid'],$queryinfo['checkdate'],$queryinfo['checkshift']);
        $recordlist=$opr_l->getchecklistbyheadwithdate($queryinfo['headid'],$queryinfo['checkdate']);

        if (empty($recordlist)){
            $res_r['code']=0;
            $res_r['msg']='无考勤数据';
            $res_r['data']=$recordlist;
        }else{
            $res_r['code']=200;
            $res_r['msg']='请求成功';
            $res_r['data']=$recordlist;
        }
        return json_encode($res_r,320);
    }

    /*
     * 20200403
     * 请求某位项目经理的所有记录
     */
    public function queryoprlistbyhid(){
        $queryinfo=request() -> param();

      $l_opr=new checkmanger();
       $rlist=$l_opr->getoprinfobyhid($queryinfo);
        if (empty($rlist)){
            $res_r['code']=0;
            $res_r['msg']='无考勤数据';
        }else{
            $res_r['code']=200;
            $res_r['resultData']=$rlist;
        }
        return json_encode($res_r,320);

    }
}

