netwolf103/ecommerce-zilingo

创建上传Zilingo的产品Excel文件

v0.1 2020-04-29 08:36 UTC

This package is auto-updated.

Last update: 2024-09-29 06:02:19 UTC


README

创建上传Zilingo的产品Excel文件

代码维护者

头像

张涛 netwolf103@gmail.com

微信: netwolf103

需求

"php": "^7.0",
"phpoffice/phpexcel": "1.8.2"

安装

composer require netwolf103/ecommerce-zilingo

使用方法

<?php
require_once "vendor/autoload.php";

use Netwolf103\Ecommerce\Zilingo\Product;

$varDir = sprintf('%s/var/1688/%s', dirname(dirname(__FILE__)), date('Y-m-d'));
if (!is_dir($varDir)) {
	printf("%s dir not exists.", $varDir);
	exit;
}

if ($handle = opendir($varDir)) {
    while (false !== ($file = readdir($handle))) {
		if ($file == '.' || $file == '..') {
			continue;
		}

		if(substr($file, -3) != 'csv') {
			continue;
		}

		$file 		= $varDir .'/'. $file;
		$fileExcel 	= $file .'.zilingo.xlsx';

		if (file_exists($fileExcel)) {
			continue;
		}

        $product = new Product($file);
        $product->saveExcel($fileExcel);
    }

    closedir($handle);
}