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