lqmac 9 months ago
parent 862bef1486
commit cfa6e38991
  1. 4
      app/admin/controller/Goods.php
  2. 10
      app/common/model/Goods.php
  3. 2
      app/job/service/goods/Collector.php
  4. 16
      app/store/model/goods/Import.php

@ -33,7 +33,9 @@ class Goods extends Controller
{ {
// 获取列表记录 // 获取列表记录
$model = new GoodsModel; $model = new GoodsModel;
$list= $model->getList($this->request->param()); $params = $this->request->param();
$params['store_id'] = 0;
$list= $model->getList($params);
return $this->renderSuccess(compact('list')); return $this->renderSuccess(compact('list'));
} }

@ -177,6 +177,7 @@ class Goods extends BaseModel
*/ */
public function getList(array $param = [], int $listRows = 15) public function getList(array $param = [], int $listRows = 15)
{ {
// 筛选条件 // 筛选条件
$query = $this->getQueryFilter($param); $query = $this->getQueryFilter($param);
// 设置显示的销量 goods_sales // 设置显示的销量 goods_sales
@ -305,10 +306,10 @@ class Goods extends BaseModel
!empty($params['goodsNo']) && $filter[] = ['goods_no', 'like', "%{$params['goodsNo']}%"]; !empty($params['goodsNo']) && $filter[] = ['goods_no', 'like', "%{$params['goodsNo']}%"];
//wmc //wmc
if (isset($param['is_brand']) && $param['is_brand'] != '') { if (isset($param['is_brand']) && $param['is_brand'] !== '') {
$filter[] = ['is_brand', '=', $param['is_brand']]; $filter[] = ['is_brand', '=', $param['is_brand']];
} }
if (isset($param['is_new']) && $param['is_new'] != '') { if (isset($param['is_new']) && $param['is_new'] !== '') {
$filter[] = ['is_new', '=', $param['is_new']]; $filter[] = ['is_new', '=', $param['is_new']];
} }
if (!empty($param['store_id']) && $a == 0) { if (!empty($param['store_id']) && $a == 0) {
@ -320,10 +321,13 @@ class Goods extends BaseModel
$query->order('paihang asc'); $query->order('paihang asc');
} }
//是否店内 //是否店内
if (isset($param['is_in_store']) && $param['is_in_store'] != '') { if (isset($param['is_in_store']) && $param['is_in_store'] !== '') {
$filter[] = ['is_in_store', '=', $params['is_in_store']]; $filter[] = ['is_in_store', '=', $params['is_in_store']];
} }
if (isset($param['store_id']) && $param['store_id'] !== '') {
$filter[] = ['goods.store_id', '=', $params['store_id']];
}
// 实例化新查询对象 // 实例化新查询对象
return $query->where($filter); return $query->where($filter);
} }

@ -284,7 +284,7 @@ class Collector extends BaseService
'newSkuList' => [], 'newSkuList' => [],
'store_id' => $storeId, 'store_id' => $storeId,
]; ];
if (isset($form['channel']) { if (isset($form['channel'])) {
$data['channel'] = $form['channel']; $data['channel'] = $form['channel'];
} }
// 整理商品的价格和库存总量 // 整理商品的价格和库存总量

@ -75,22 +75,10 @@ class Import extends ImportModel
$this->checkLimit($execlData); $this->checkLimit($execlData);
self::$storeId = 0; self::$storeId = 0;
// $service = new \app\job\service\goods\Collector();
// foreach ($execlData as $item) {
// $data = [
// 'cmmdty_model' => $item["A"],
// 'channel' => "jd",
// 'goods_no' => $item["C"],
// 'categoryIds' => explode(",", $item["E"]),
// 'imageStorage' => 10,//下载图片到本地
// 'goods_type' => 10,//实物
// 'goods_status' => 10,//上架
// 'store_id' => self::$storeId,
// ];
// $service->single($item['D'], $data, self::$storeId);
// }
// 新增商品导入记录 // 新增商品导入记录
$recordId = $this->addRecord(\count($execlData)); $recordId = $this->addRecord(\count($execlData));
// 调度计划任务 // 调度计划任务
$this->adminDispatchJob($execlData, $recordId); $this->adminDispatchJob($execlData, $recordId);
return true; return true;

Loading…
Cancel
Save