Commit 821d21b5 by 杨树贤

查看上传时间修复

parent 70be81ad
Showing with 7 additions and 5 deletions
......@@ -280,15 +280,17 @@ class SkuService
//获取第一次上传sku时间和最后一次上传sku时间
public static function getUploadTimeBySupplierCodes($supplierCodes = [], $type = 'first')
{
$supplierCodeInSql = implode(',', $supplierCodes);
$supplierCodesTemp = array_map(function ($value){
return "'" . $value . "'";
}, $supplierCodes);
$supplierCodeInSql = implode(',', $supplierCodesTemp);
if ($type == 'last') {
$rawSql = 'SELECT supplier_code,create_time FROM (SELECT supplier_code,max(create_time) AS create_time FROM lie_sku_upload_log GROUP BY supplier_code) AS temp WHERE supplier_code IN ( ? )';
$rawSql = 'SELECT supplier_code,create_time FROM (SELECT supplier_code,max(create_time) AS create_time FROM lie_sku_upload_log GROUP BY supplier_code) AS temp WHERE supplier_code IN ('.$supplierCodeInSql.')';
} else {
$rawSql = 'SELECT supplier_code,create_time FROM (SELECT supplier_code,min(create_time) AS create_time FROM lie_sku_upload_log GROUP BY supplier_code) AS temp WHERE supplier_code IN ( ? )';
$rawSql = 'SELECT supplier_code,create_time FROM (SELECT supplier_code,min(create_time) AS create_time FROM lie_sku_upload_log GROUP BY supplier_code) AS temp WHERE supplier_code IN ('.$supplierCodeInSql.')';
}
$data = DB::connection('spu')
->select($rawSql, [$supplierCodeInSql]);
->select($rawSql);
$result = [];
foreach ($supplierCodes as $supplierCode) {
$result[$supplierCode] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment