lqmac 8 months ago
parent e98675d392
commit bb722423b1
  1. 2
      app/admin/controller/Goods.php
  2. 22
      app/job/service/goods/GoodsStoreImport.php
  3. 4
      app/store/model/Goods.php
  4. 1
      app/store/model/Store.php
  5. 4
      config/allowapi.php

@ -231,7 +231,7 @@ class Goods extends Controller
$categoryIds = $model->dealCategory($categoryIds);
\app\store\model\GoodsCategoryRel::updates($goodsId, $categoryIds);
}
$model->whereIn('goods_id', $goodsIds)->update(['cate_status'=>1]);
$model->whereIn('goods_id', $goodsIds)->update(['cate_status'=>1,'update_time' => time()]);
return $this->renderSuccess('操作成功');
}
/**

@ -201,9 +201,6 @@ class GoodsStoreImport extends BaseService
*/
public function createData(array $original, int $storeId): array
{
//$channel = Channel::where('name', $original["B"])->find();
//批量导入销售区域处理
$region = [];
$region_text = [];
@ -227,7 +224,8 @@ class GoodsStoreImport extends BaseService
foreach ($regions as $key => $value) {
$regionsnew[$value['pid']][] = $value;
}
// echo "<pre>";
// print_r($regionsnew);
foreach ($regionsnew as $pid => $value) {
$privince = Region::withoutGlobalScope()->where('id', $pid)->find();
$region_text[$pid]['name'] = $privince['name'] ?? "";
@ -239,11 +237,19 @@ class GoodsStoreImport extends BaseService
}
$region_text[$pid]['citys'] = $citys;
}
unset($pid);
foreach ($region_text as $pid => &$item) {
//如果传入的是整个省份
if (count($item['citys']) == Region::withoutGlobalScope()->whereIn('pid', $pid)->count()) {
$item['citys'] = [];
}
}
}
// echo "<pre>";
// print_r($region_text);
// print_r($region);
// exit();
// echo "<pre>";
// print_r($region_text);
// print_r($region);
// exit();
// 整理商品数据
$data = [
'cmmdty_model' => $original["A"],

@ -183,7 +183,7 @@ class Goods extends GoodsModel
public function setIsPool(array $goodsIds, int $is_pool): bool
{
// 批量更新记录
return static::updateBase(['is_pool' => $is_pool], [['goods_id', 'in', $goodsIds]]);
return static::updateBase(['is_pool' => $is_pool,'update_time' => time()], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态
@ -194,7 +194,7 @@ class Goods extends GoodsModel
public function setIsSale(array $goodsIds, int $is_sale): bool
{
// 批量更新记录
return static::updateBase(['is_sale' => $is_sale], [['goods_id', 'in', $goodsIds]]);
return static::updateBase(['is_sale' => $is_sale,'update_time' => time()], [['goods_id', 'in', $goodsIds]]);
}
/**
* 修改商品状态

@ -30,6 +30,7 @@ class Store extends StoreModel
{
// 是否删除图片
!isset($data['logo_image_id']) && $data['logo_image_id'] = 0;
$data['fliter_condition'] = json_encode($data['fliter_condition'], JSON_UNESCAPED_UNICODE);
return $this->save($data) !== false;
}
}

@ -0,0 +1,4 @@
<?php
return [
"/store/platformList"
];
Loading…
Cancel
Save