修复采集错误
This commit is contained in:
parent
05bd8b67be
commit
a6246fdaeb
@ -80,25 +80,26 @@ class Auth extends BaseController
|
||||
$req->setNumIids($itemId['itemId']);
|
||||
$resp = $c->execute($req);
|
||||
$res=$resp->results->n_tbk_item;
|
||||
$arr=json_decode(json_encode($res),true);
|
||||
$images=[];
|
||||
$filename = basename($res->pict_url); // 获取文件名
|
||||
$filename = basename($arr['pict_url']); // 获取文件名
|
||||
$destination = public_path('uploads').'img/' . $filename; // 目标路径
|
||||
$pict_url= $url.'/uploads/img/'.$filename;
|
||||
file_put_contents($destination, file_get_contents($res->pict_url));
|
||||
|
||||
if($resp && isset($resp->small_images) && isset($resp->small_images->string)){
|
||||
foreach($resp->small_images->string as $k=>$v){
|
||||
file_put_contents($destination, file_get_contents($arr['pict_url']));
|
||||
// if($resp && isset($resp->small_images) && isset($resp->small_images->string)){
|
||||
foreach($arr['small_images']['string'] as $k=>$v){
|
||||
// halt($v);
|
||||
$filename = basename($v); // 获取文件名
|
||||
$destination = public_path('uploads').'img/' . $filename; // 目标路径
|
||||
file_put_contents($destination, file_get_contents($v));
|
||||
$images[]=$url.'/uploads/img/'.$filename;
|
||||
}
|
||||
}
|
||||
// }
|
||||
$data=[
|
||||
"image" => $pict_url,
|
||||
"slider_image" =>$images,
|
||||
"store_name" => json_decode(json_encode($res->title),true)[0],
|
||||
"store_info" => json_decode(json_encode($res->cat_leaf_name),true)[0],
|
||||
"store_name" =>$arr['title'],
|
||||
"store_info" => $arr['cat_leaf_name'],
|
||||
"keyword" => "",
|
||||
"bar_code" => "",
|
||||
"guarantee_template_id" => "",
|
||||
@ -133,7 +134,7 @@ class Auth extends BaseController
|
||||
"attrValue" => [
|
||||
0 => [
|
||||
"image" => $pict_url,
|
||||
"price" => bcsub($res->reserve_price,($res->reserve_price*0.05),2),
|
||||
"price" => bcsub($arr['reserve_price'],($arr['reserve_price']*0.05),2),
|
||||
"cost" => 0,
|
||||
"ot_price" => 0,
|
||||
"svip_price" => null,
|
||||
@ -153,6 +154,7 @@ class Auth extends BaseController
|
||||
"mer_status" => 1,
|
||||
"rate" => 3,
|
||||
];
|
||||
halt($data);
|
||||
$a= app()->make( ProductRepository::class)->create($data,0,1);
|
||||
// 下载图片并保存到目标路径
|
||||
return app('json')->success($a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user