更新联营物料

parent e4c488cc
...@@ -177,6 +177,10 @@ class ApiController extends Controller ...@@ -177,6 +177,10 @@ class ApiController extends Controller
Export(2,"没完成"); Export(2,"没完成");
} }
} }
//商品列表
private function ApiSkuList($request){
ExportLayui2((new ServerFoostoneModel($request->appid,$request->key))->SkuList($request->input(),2));
}
//批量上传联营物料 //批量上传联营物料
private function ApiUploadSkuList($request,$id){ private function ApiUploadSkuList($request,$id){
$res = (new UploadLogModel())->uploadSkuFile($request->appid,$request->key,$request->mobile,$request->account_id); $res = (new UploadLogModel())->uploadSkuFile($request->appid,$request->key,$request->mobile,$request->account_id);
......
...@@ -1166,6 +1166,9 @@ function getHostUrl($sys,$current_domain='') ...@@ -1166,6 +1166,9 @@ function getHostUrl($sys,$current_domain='')
if($current_domain === "yunxin.liexin.com") if($current_domain === "yunxin.liexin.com")
{ {
return Config('yunxin_conf.'.$sys.'.local'); return Config('yunxin_conf.'.$sys.'.local');
}elseif ($current_domain === "yunxin.liexin.net")
{
return Config('yunxin_conf.'.$sys.'.local');
}elseif ($current_domain === "yunxin.ichunt.com") }elseif ($current_domain === "yunxin.ichunt.com")
{ {
return Config('yunxin_conf.'.$sys.'.release'); return Config('yunxin_conf.'.$sys.'.release');
......
...@@ -21,6 +21,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -21,6 +21,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, SerializesModels;
private $id; private $id;
const limit = 100; //分页条数
public function __construct($id) public function __construct($id)
{ {
$this->id=$id; $this->id=$id;
...@@ -31,6 +32,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -31,6 +32,7 @@ class JopExportGoodsComList extends Job implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
set_time_limit(0);
$UploadLogModel=new UploadLogModel(); $UploadLogModel=new UploadLogModel();
$LogInfo=$UploadLogModel->LogInfo($this->id); $LogInfo=$UploadLogModel->LogInfo($this->id);
...@@ -50,8 +52,8 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -50,8 +52,8 @@ class JopExportGoodsComList extends Job implements ShouldQueue
fputcsv($x,$Arr); //写入表头 fputcsv($x,$Arr); //写入表头
#查询es数据 #查询es数据
$s = [ $s = [
'p'=>1, 'is_scroll'=>1, //游标
'offset'=>1000, 'offset'=>self::limit,
'supplier_id'=>17, 'supplier_id'=>17,
'canal/condition'=>$query['supplier_com_code'], 'canal/condition'=>$query['supplier_com_code'],
]; ];
...@@ -62,39 +64,77 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -62,39 +64,77 @@ class JopExportGoodsComList extends Job implements ShouldQueue
$searchArr = (new ServerEsModel())->searchSku($s); $searchArr = (new ServerEsModel())->searchSku($s);
$total = @$searchArr['data']['total']; $total = @$searchArr['data']['total'];
if (@$searchArr['error_code'] > 0 || !count($total) ){ if (@$searchArr['error_code'] > 0 || !count($total) ){
$UploadLogModel->UpdateLogArr($this->id,'没有数据',3,$log); $UploadLogModel->UpdateLogArr($this->id,'1001:没有数据',3,$log);
return true; return true;
} }
$ServerEsModel = new ServerEsModel(); $ServerEsModel = new ServerEsModel();
$ServerMicModel = new ServerMicModel(); $ServerMicModel = new ServerMicModel();
$count = ceil($total/1000);
for ($p = 1; $p < $count + 1; $p++) { $count = ceil($total/self::limit); //总页数
#先写入第一页
$micData = [
'goods_id'=>$searchArr['data']['goods_id']
];
$res = $ServerMicModel->synchronization($micData,2);
if ($res['code'] > 0){
$UploadLogModel->UpdateLogArr($this->id,'1002:没有数据',3,$log);
return true;
}
foreach ($res['data'] as $k=>&$v){
if(!$v) continue;
$out = [
'goods_id'=>$k."\t",
'goods_name'=>@$v['goods_name'],
'goods_type_name'=> @GoodsMap::$goods_type[$v['goods_type']],
'supplier_name'=>@$v['supplier_name'],
'brand_name'=>@$v['brand_name'],
'canal'=>@$v['canal'],
'encoded'=>@$v['encoded'],
'stock'=>@$v['stock'],
'goods_status_name'=>@GoodsMap::$status[$v['goods_status']],
'expire'=>@GoodsMap::$expire[$v['status']],
'update_time'=>timeToDate($v['update_time']),
];
foreach ($out as $k1=>&$v1){
$v1= iconv('utf-8', 'gbk', $v1);
}
fputcsv($x,$out);
}
if ($count > 1) {
for ($i=2; $i<=$count; $i++) {
sleep(1); sleep(1);
$query['p'] = $p; $s['scroll_id'] = $searchArr['data']['scroll_id'];
$query['limit'] = 1000; $s['limit'] = self::limit;
$searchArr = $ServerEsModel->searchSku($s); $searchArr = $ServerEsModel->searchSku($s);
if ($searchArr['error_code'] > 0){ if ($searchArr['error_code'] > 0){
break; $UploadLogModel->UpdateLogArr($this->id,'1003:没有数据',3,$log);
return true;
} }
$p = [
$micData = [
'goods_id'=>$searchArr['data']['goods_id'] 'goods_id'=>$searchArr['data']['goods_id']
]; ];
$res = $ServerMicModel->synchronization($p,2); $res = $ServerMicModel->synchronization($micData,2);
if ($res['code'] > 0){
$UploadLogModel->UpdateLogArr($this->id,'1004:没有数据',3,$log);
return true;
}
foreach ($res['data'] as $k=>&$v){ foreach ($res['data'] as $k=>&$v){
if(!$v) continue;
$out = [ $out = [
'goods_id'=>$k, 'goods_id'=>$k."\t",
'goods_name'=>$v['goods_name'], 'goods_name'=>@$v['goods_name'],
'goods_type_name'=> GoodsMap::$goods_type[$v['goods_type']], 'goods_type_name'=> @GoodsMap::$goods_type[$v['goods_type']],
'supplier_name'=>$v['supplier_name'], 'supplier_name'=>@$v['supplier_name'],
'brand_name'=>$v['brand_name'], 'brand_name'=>@$v['brand_name'],
'canal'=>$v['canal'], 'canal'=>@$v['canal'],
'encoded'=>$v['encoded'], 'encoded'=>@$v['encoded'],
'stock'=>$v['stock'], 'stock'=>@$v['stock'],
'goods_status_name'=>GoodsMap::$status[$v['goods_status']], 'goods_status_name'=>@GoodsMap::$status[$v['goods_status']],
'expire'=>GoodsMap::$expire[$v['status']], 'expire'=>@GoodsMap::$expire[$v['status']],
'update_time'=>timeToDate($v['update_time']), 'update_time'=>timeToDate($v['update_time']),
]; ];
foreach ($out as $k1=>&$v1){ foreach ($out as $k1=>&$v1){
...@@ -103,6 +143,8 @@ class JopExportGoodsComList extends Job implements ShouldQueue ...@@ -103,6 +143,8 @@ class JopExportGoodsComList extends Job implements ShouldQueue
fputcsv($x,$out); fputcsv($x,$out);
} }
} }
}
$UploadFileModel=new UploadLogModel(); $UploadFileModel=new UploadLogModel();
$Url=$UploadFileModel->SaveDownFile($filename); $Url=$UploadFileModel->SaveDownFile($filename);
fclose($x); fclose($x);
......
...@@ -66,7 +66,7 @@ class ServerMicModel ...@@ -66,7 +66,7 @@ class ServerMicModel
]; ];
$res = $this->synchronization($p,2); $res = $this->synchronization($p,2);
foreach ($res['data'] as $k=>&$v){ foreach ($res['data'] as $k=>&$v){
$v['goods_id'] = $k; $v['goods_id'] = sprintf("%s", $k);;
$v['update_time'] = timeToDate($v['update_time']); $v['update_time'] = timeToDate($v['update_time']);
$v['goods_status_name'] = GoodsMap::$status[$v['goods_status']]; $v['goods_status_name'] = GoodsMap::$status[$v['goods_status']];
$v['expire'] = GoodsMap::$expire[$v['status']]; $v['expire'] = GoodsMap::$expire[$v['status']];
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
namespace App\Model; namespace App\Model;
use App\Jobs\UploadChangePrice; use App\Jobs\UploadChangePrice;
use App\Map\UploadLogMap;
use App\Model\Server\ServerFoostoneModel; use App\Model\Server\ServerFoostoneModel;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use RedisDB; use RedisDB;
use Request; use Request;
use App\map\UploadLogMap;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use DB; use DB;
...@@ -29,6 +29,7 @@ class UploadLogModel extends Model ...@@ -29,6 +29,7 @@ class UploadLogModel extends Model
//查数据 //查数据
$list=$this->where('type',$type)->where("create_uid",$create_uid)->orderBy('id','desc')->paginate($limit,['*'],'p',$p)->toArray(); $list=$this->where('type',$type)->where("create_uid",$create_uid)->orderBy('id','desc')->paginate($limit,['*'],'p',$p)->toArray();
$data = $list['data']; $data = $list['data'];
if ($type == UploadLogMap::type_import_sku){ if ($type == UploadLogMap::type_import_sku){
//如果是联营sku导入,查询状态 //如果是联营sku导入,查询状态
$ids = arrayToCommaStr($data,'extend',1); $ids = arrayToCommaStr($data,'extend',1);
......
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
,loading:true ,loading:true
,first: true //不显示首页 ,first: true //不显示首页
,last: false //不显示尾页 ,last: false //不显示尾页
,page:layui.laypage.render({
'prev':"上一页",
"layout":['prev', 'next']
})
,cols: [[ ,cols: [[
{field:'goods_id', title: '商品ID',width:190,align:'center',templet: function(d){ {field:'goods_id', title: '商品ID',width:190,align:'center',templet: function(d){
return d.goods_id return d.goods_id
...@@ -47,6 +51,7 @@ ...@@ -47,6 +51,7 @@
{field:'brand_name', title: '制造商',align:'center'}, {field:'brand_name', title: '制造商',align:'center'},
{field:'canal', title: '渠道标签',align:'center'}, {field:'canal', title: '渠道标签',align:'center'},
{field:'goods_images', title: '图片',align:'center',templet: function(d){ {field:'goods_images', title: '图片',align:'center',templet: function(d){
return ""
if(d.goods_images == ""){ if(d.goods_images == ""){
return d.goods_images return d.goods_images
}else{ }else{
......
...@@ -65,7 +65,7 @@ function common_export(url,data) { ...@@ -65,7 +65,7 @@ function common_export(url,data) {
alert_err(res.msg) alert_err(res.msg)
return false; return false;
} }
layer.msg('后台正在导出,请别关闭页面并耐心等待...', { layer.msg('后台正在导出,如果数据量过多需要几分钟,请别关闭网页并耐心等待...', {
icon: 16 icon: 16
,time:0 ,time:0
,shade: 0.6 ,shade: 0.6
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<span>查询</span> <span>查询</span>
</a> </a>
</div> </div>
<a href="" style="color:red">下载导入模板</a> <a href="http://img.ichunt.com/doc/excel/template/%E4%BA%91%E8%8A%AF%E8%81%94%E8%90%A5sku%E4%B8%8A%E4%BC%A0%E6%A8%A1%E6%9D%BF.csv" style="color:red">下载导入模板</a>
<div class="lineBlock input-inline va-m" id="BatchAdd"> <div class="lineBlock input-inline va-m" id="BatchAdd">
<a href="javascript:;" class="export-btn"> <a href="javascript:;" class="export-btn">
<i class="iconfont icon-daochu-"></i> <i class="iconfont icon-daochu-"></i>
......
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