diff --git a/app/admin/controller/Goods.php b/app/admin/controller/Goods.php index aa057294..e161e755 100644 --- a/app/admin/controller/Goods.php +++ b/app/admin/controller/Goods.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('操作成功'); } /** diff --git a/app/job/service/goods/GoodsStoreImport.php b/app/job/service/goods/GoodsStoreImport.php index 5e79308c..e5c46f93 100644 --- a/app/job/service/goods/GoodsStoreImport.php +++ b/app/job/service/goods/GoodsStoreImport.php @@ -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 "
"; + // 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 ""; - // print_r($region_text); - // print_r($region); - // exit(); + // echo ""; + // print_r($region_text); + // print_r($region); + // exit(); // 整理商品数据 $data = [ 'cmmdty_model' => $original["A"], diff --git a/app/store/model/Goods.php b/app/store/model/Goods.php index c6086968..bd8d31c5 100644 --- a/app/store/model/Goods.php +++ b/app/store/model/Goods.php @@ -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]]); } /** * 修改商品状态 diff --git a/app/store/model/Store.php b/app/store/model/Store.php index 3891ae32..0bbf86e5 100644 --- a/app/store/model/Store.php +++ b/app/store/model/Store.php @@ -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; } } diff --git a/config/allowapi.php b/config/allowapi.php new file mode 100644 index 00000000..babc3798 --- /dev/null +++ b/config/allowapi.php @@ -0,0 +1,4 @@ +