lqmac 7 months ago
parent 5bc8bbea1b
commit 978de26bfa
  1. 3
      app/api/controller/Goods.php
  2. 7
      app/api/model/Goods.php
  3. 4
      app/api/service/Goods.php
  4. 3
      app/store/controller/Goods.php

@ -315,9 +315,10 @@ class Goods extends Controller
*/
public function recommendedNew(): Json
{
$param = $this->request->param();
$service = new GoodsService;
$goodsList = $service->recommendedNew();
$goodsList = $service->recommendedNew($param);
return $this->renderSuccess(compact('goodsList'));
}
/**

@ -575,6 +575,13 @@ class Goods extends GoodsModel
$goodsInfo->skuList = GoodsSkuModel::where('spu_id', $goodsInfo->spu_id)->select();
}
foreach ($goodsInfo->skuList as &$value) {
//处理苏宁商品,京东价拖的问题
if (in_array($goodsInfo['channel'], ['sn','sn1']) && $goodsInfo['link_other'] && $value->goods_id == $goodsId) {
$value->goods_sku_no = $goodsInfo['goods_no_other'];
}
}
// 判断商品是否存在
if (empty($goodsInfo) || $goodsInfo['is_delete']) {
throwError('很抱歉,商品信息不存在');

@ -177,7 +177,7 @@ class Goods extends GoodsService
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function recommendedNew(): array
public function recommendedNew(array $param = []): array
{
// 获取商品推荐数据
$setting = $this->getRecommendedSetting();
@ -192,6 +192,7 @@ class Goods extends GoodsService
'status' => 10,
'goodsIds' => implode(",",$setting['params']['goodsIds']),
'sortType' => "all",
'page' => $param['page'] ?? 1,
], 10);
} else {
// 数据来源:自动
@ -199,6 +200,7 @@ class Goods extends GoodsService
'status' => 10,
'categoryId' => $setting['params']['auto']['category'],
'sortType' => $setting['params']['auto']['goodsSort'],
'page' => $param['page'] ?? 1,
], 10);
}

@ -295,7 +295,8 @@ class Goods extends Controller
return $this->renderSuccess('删除成功');
}
public function export(){
ini_set('memory_limit', '2024M');
set_time_limit(0);
$model = new GoodsModel;
$params = $this->request->param();
$params['store_id'] = $this->storeId;

Loading…
Cancel
Save