<?php
require_once('../config.php');
$flagFile = APPLICATION_PATH . '/../data/log/fixhs.lock';
if (@file_exists($flagFile)) {
    echo 'The running.'."\r\n";
    echo $flagFile."\r\n";
    //exit();
}
function baoguandan(){

    $full_path = "F:/baiducloud/百度云同步盘/工作电脑2016/F/工作文档/进口系统/2018年/沙田/处理/2021年/12月/10/bz2022-2.xlsx";

    $copypath = "F:/baiducloud/百度云同步盘/工作电脑2016/F/工作文档/进口系统/2018年/沙田/处理/2021年/12月/10/baoguandan2022-o";

    $filepath = "F:/baiducloud/百度云同步盘/工作电脑2016/F/工作文档/进口系统/2018年/沙田/处理/2021年/12月/10/pingming2022";


    $titile = array(
        'id' => 'id',
        '序号' => 'xuhao',
        '统一编号' => 'tybh',
        '品名' => 'bgdh',
        '改为'=>'gm',
        'check' => 'check',
    );
    $resultArray = Common_Upload::readXlsFromTitle($full_path, $titile);
    echo "<pre>";
    print_r($resultArray);
    //exit;

    $csvfile = $copypath."/file.csv";

    foreach ($resultArray as $k=>$r){
        //$file1 = $filepath."/".$r['tybh'].".pdf";
        $file2 = $filepath."/".$r['bgdh'].".pdf";
        //echo $file2;
        //$desfile = $copypath."/".$r['bgdh'].".pdf";
        $desfile = $copypath."/".$r['gm'].".pdf";
        //echo $desfile;
        //exit;
        $str = "";
        $find = 0;
        /*if(file_exists($file1)){
            copy($file1,$desfile);
            $str .= "ecode|";
            $find = 1;
            unlink($file1);
        }*/
        if(file_exists($file2)){
            copy($file2,$desfile);
            $str .= "bgcode|";
            $find = 2;
            unlink($file2);
        }
        $resultArray[$k]['check'] = $find;
        //exit;
    }
    foreach ($resultArray as $kr=>$rr){

    }
    $str = var_export($resultArray,true);
    file_put_contents($csvfile,$str);
}

baoguandan();

