更新采集
This commit is contained in:
parent
e8f6d18fe9
commit
49d51b4d82
@ -57,7 +57,7 @@ use app\common\service\TopClient;
|
|||||||
use app\controller\api\Ceshi;
|
use app\controller\api\Ceshi;
|
||||||
use taobao\request\TbkItemInfoGetRequest;
|
use taobao\request\TbkItemInfoGetRequest;
|
||||||
use app\common\repositories\store\product\ProductRepository;
|
use app\common\repositories\store\product\ProductRepository;
|
||||||
use think\facade\App;
|
use crmeb\services\UploadService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Auth
|
* Class Auth
|
||||||
@ -69,7 +69,6 @@ class Auth extends BaseController
|
|||||||
{
|
{
|
||||||
public function caiji()
|
public function caiji()
|
||||||
{
|
{
|
||||||
$url= env('SHOP_URL', 'https://test.shop.lihaink.cn');
|
|
||||||
$parmas = $this->request->param();
|
$parmas = $this->request->param();
|
||||||
$query = parse_url($parmas['url']);
|
$query = parse_url($parmas['url']);
|
||||||
$itemId = $this->convertUrlQuery($query['query']);
|
$itemId = $this->convertUrlQuery($query['query']);
|
||||||
@ -82,19 +81,16 @@ class Auth extends BaseController
|
|||||||
$res = $resp->results->n_tbk_item;
|
$res = $resp->results->n_tbk_item;
|
||||||
$arr = json_decode(json_encode($res), true);
|
$arr = json_decode(json_encode($res), true);
|
||||||
$images = [];
|
$images = [];
|
||||||
$filename = basename($arr['pict_url']); // 获取文件名
|
$upload = UploadService::create();
|
||||||
$destination = public_path('uploads').'img/' . $filename; // 目标路径
|
$dir = 'def/' . date('Y-m-d');
|
||||||
$pict_url= $url.'/uploads/img/'.$filename;
|
|
||||||
file_put_contents($destination, file_get_contents($arr['pict_url']));
|
$oss = $upload->to($dir)->stream(file_get_contents($arr['pict_url']));
|
||||||
// if($resp && isset($resp->small_images) && isset($resp->small_images->string)){
|
|
||||||
|
$pict_url = $oss->filePath;
|
||||||
foreach ($arr['small_images']['string'] as $k => $v) {
|
foreach ($arr['small_images']['string'] as $k => $v) {
|
||||||
// halt($v);
|
$oss = $upload->to($dir)->stream(file_get_contents($v));
|
||||||
$filename = basename($v); // 获取文件名
|
$images[] = $oss->filePath;
|
||||||
$destination = public_path('uploads').'img/' . $filename; // 目标路径
|
|
||||||
file_put_contents($destination, file_get_contents($v));
|
|
||||||
$images[]=$url.'/uploads/img/'.$filename;
|
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
$data = [
|
$data = [
|
||||||
"image" => $pict_url,
|
"image" => $pict_url,
|
||||||
"slider_image" => $images,
|
"slider_image" => $images,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user