更新联营物料

parent 3e446127
...@@ -1194,3 +1194,18 @@ function unicodeDecode($unicode_str){ ...@@ -1194,3 +1194,18 @@ function unicodeDecode($unicode_str){
if(empty($arr)) return ''; if(empty($arr)) return '';
return $arr['str']; return $arr['str'];
} }
//计时函数
function G($start,$end='',$dec=4)
{
static $_info = array();
if (!empty($end))
{
if(!isset($_info[$end])) $_info[$end] = microtime(TRUE);
$sconds = number_format(($_info[$end]-$_info[$start]), $dec) * 1000;
return "{$sconds}ms";
}
else
{
$_info[$start] = microtime(TRUE);
}
}
\ No newline at end of file
...@@ -21,7 +21,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -21,7 +21,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, SerializesModels;
private $id; private $id;
const limit = 100; //分页条数 const limit = 1000; //分页条数
public function __construct($id) public function __construct($id)
{ {
$this->id=$id; $this->id=$id;
...@@ -33,6 +33,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -33,6 +33,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue
public function handle() public function handle()
{ {
set_time_limit(0); set_time_limit(0);
G('a');
$UploadLogModel=new UploadLogModel(); $UploadLogModel=new UploadLogModel();
$LogInfo=$UploadLogModel->LogInfo($this->id); $LogInfo=$UploadLogModel->LogInfo($this->id);
...@@ -78,6 +79,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -78,6 +79,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue
'goods_id'=>$searchArr['data']['goods_id'] 'goods_id'=>$searchArr['data']['goods_id']
]; ];
$res = $ServerMicModel->synchronization($micData,2); $res = $ServerMicModel->synchronization($micData,2);
if ($res['code'] > 0){ if ($res['code'] > 0){
$UploadLogModel->UpdateLogArr($this->id,'1002:没有数据',3,$log); $UploadLogModel->UpdateLogArr($this->id,'1002:没有数据',3,$log);
return true; return true;
...@@ -107,7 +109,9 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -107,7 +109,9 @@ class JopExportGoodsComList extends Job implements ShouldQueue
sleep(1); sleep(1);
$s['scroll_id'] = $searchArr['data']['scroll_id']; $s['scroll_id'] = $searchArr['data']['scroll_id'];
$s['limit'] = self::limit; $s['limit'] = self::limit;
G("d");
$searchArr = $ServerEsModel->searchSku($s); $searchArr = $ServerEsModel->searchSku($s);
echo "查询es耗时:".G('d','e')."<br/>";
if ($searchArr['error_code'] > 0){ if ($searchArr['error_code'] > 0){
$UploadLogModel->UpdateLogArr($this->id,'1003:没有数据',3,$log); $UploadLogModel->UpdateLogArr($this->id,'1003:没有数据',3,$log);
...@@ -117,7 +121,10 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -117,7 +121,10 @@ class JopExportGoodsComList extends Job implements ShouldQueue
$micData = [ $micData = [
'goods_id'=>$searchArr['data']['goods_id'] 'goods_id'=>$searchArr['data']['goods_id']
]; ];
G("f");
//print_r($micData);
$res = $ServerMicModel->synchronization($micData,2); $res = $ServerMicModel->synchronization($micData,2);
echo "查询基石耗时:".G('f','h')."<br/>";
if ($res['code'] > 0){ if ($res['code'] > 0){
$UploadLogModel->UpdateLogArr($this->id,'1004:没有数据',3,$log); $UploadLogModel->UpdateLogArr($this->id,'1004:没有数据',3,$log);
return true; return true;
...@@ -149,6 +156,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -149,6 +156,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue
$Url=$UploadFileModel->SaveDownFile($filename); $Url=$UploadFileModel->SaveDownFile($filename);
fclose($x); fclose($x);
unlink($filePath); unlink($filePath);
echo "总耗时:".G('a','c');
if(!$Url){ if(!$Url){
$UploadLogModel->UpdateLogArr($this->id,'导出失败',3,$log); $UploadLogModel->UpdateLogArr($this->id,'导出失败',3,$log);
return true; return true;
......
...@@ -40,9 +40,10 @@ class UploadLogModel extends Model ...@@ -40,9 +40,10 @@ class UploadLogModel extends Model
foreach ($data as $key => &$v) { foreach ($data as $key => &$v) {
$v['create_time'] =timeToDate($v['create_time']); $v['create_time'] =timeToDate($v['create_time']);
$v['type_name'] = @UploadLogMap::$type[$v['type']]; $v['type_name'] = @UploadLogMap::$type[$v['type']];
if ($v['type'] == UploadLogMap::type_import_sku){ //如果是导入sku,查询状态 if ($v['type'] == UploadLogMap::type_import_sku && array_key_exists($v['extend'],$foostoneLogStatus)){ //如果是导入sku,查询状态
$v['status'] = @UploadLogMap::$status[$foostoneLogStatus[$v['extend']]['status']]; $v['status'] = @UploadLogMap::$status[$foostoneLogStatus[$v['extend']]['status']];
$v['log'] = implode(',',@$foostoneLogStatus[$v['extend']]['log']); $v['log'] = implode(',',@$foostoneLogStatus[$v['extend']]['log']);
$v['file_path'] =@$foostoneLogStatus[$v['extend']]['file_name']['down'];
}else{ }else{
$v['status'] = @UploadLogMap::$status[$v['status']]; $v['status'] = @UploadLogMap::$status[$v['status']];
} }
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
,{field:'create_time', title: '上传时间',align:'center'} ,{field:'create_time', title: '上传时间',align:'center'}
,{field:'', title: '操作',fixed: 'right',align:'center',templet: function(d){ ,{field:'', title: '操作',fixed: 'right',align:'center',templet: function(d){
if(d.file_path != ""){ if(d.file_path != ""){
return '<button style="cursor:pointer;font-size: 14px; color:blue" href="'+d.file_path+'">下载文件</button>' return '<a style="cursor:pointer;font-size: 14px; color:blue" href="'+d.file_path+'">下载上传结果</a>'
}else{ }else{
return "" return ""
} }
......
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