更新采集
This commit is contained in:
parent
00d12f0079
commit
0454200bd4
@ -1157,13 +1157,10 @@ class ProductRepository extends BaseRepository
|
|||||||
|
|
||||||
public function apiProductDetail(array $where, int $productType, ?int $activityId, $userInfo = null)
|
public function apiProductDetail(array $where, int $productType, ?int $activityId, $userInfo = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$field = 'is_show,product_id,mer_id,image,slider_image,store_name,store_info,unit_name,price,cost,ot_price,stock,sales,video_link,product_type,extension_type,old_product_id,rate,guarantee_template_id,temp_id,once_max_count,pay_limit,once_min_count,integral_rate,delivery_way,delivery_free,type,cate_id,svip_price_type,svip_price,mer_svip_status';
|
$field = 'is_show,product_id,mer_id,image,slider_image,store_name,store_info,unit_name,price,cost,ot_price,stock,sales,video_link,product_type,extension_type,old_product_id,rate,guarantee_template_id,temp_id,once_max_count,pay_limit,once_min_count,integral_rate,delivery_way,delivery_free,type,cate_id,svip_price_type,svip_price,mer_svip_status';
|
||||||
$with = [
|
$with = [
|
||||||
'attr',
|
'attr',
|
||||||
'content' => function($query) {
|
'content',
|
||||||
$query->order('type ASC');
|
|
||||||
},
|
|
||||||
'attrValue',
|
'attrValue',
|
||||||
'oldAttrValue',
|
'oldAttrValue',
|
||||||
'merchant' => function ($query) {
|
'merchant' => function ($query) {
|
||||||
@ -1248,9 +1245,13 @@ class ProductRepository extends BaseRepository
|
|||||||
$res['attr'] = $attr;
|
$res['attr'] = $attr;
|
||||||
$res['sku'] = $sku;
|
$res['sku'] = $sku;
|
||||||
$res->append($append);
|
$res->append($append);
|
||||||
|
|
||||||
if ($res['content'] && $res['content']['type'] == 1) {
|
if ($res['content'] && $res['content']['type'] == 1) {
|
||||||
$res['content']['content'] = json_decode($res['content']['content']);
|
$content= json_decode($res['content']['content']);
|
||||||
|
if(isset($content['image'])){
|
||||||
|
$res['content']['content'] =$content;
|
||||||
|
}else{
|
||||||
|
$res['content']['content'] =['image'=>$content];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$res['merchant']['recommend'] = $this->getRecommend($res['product_id'], $res['mer_id']);
|
$res['merchant']['recommend'] = $this->getRecommend($res['product_id'], $res['mer_id']);
|
||||||
|
@ -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