lqmac 5 months ago
parent 7b9b49cfea
commit 14a9ea91d9
  1. 42
      app/admin/controller/Store.php
  2. 3
      app/api/controller/Goods.php

@ -383,27 +383,27 @@ class Store extends Controller
//删除分类 //删除分类
Category::where('store_id', $storeId)->delete(); Category::where('store_id', $storeId)->delete();
GoodsSku::where('store_id', $storeId)->delete(); // GoodsSku::where('store_id', $storeId)->delete();
GoodsImage::where('store_id', $storeId)->delete(); // GoodsImage::where('store_id', $storeId)->delete();
GoodsSpecRel::where('store_id', $storeId)->delete(); // GoodsSpecRel::where('store_id', $storeId)->delete();
GoodsModel::where('store_id', $storeId)->delete(); // GoodsModel::where('store_id', $storeId)->delete();
// $page = 1; $page = 1;
// while (TRUE) { while (TRUE) {
// $goods_list = GoodsModel::where('store_id', $storeId)->field('goods_id')->page($page)->limit(2000)->select(); $goods_list = GoodsModel::where('store_id', $storeId)->where('channel','<>', 'zy')->field('goods_id')->page($page)->limit(2000)->select();
// if ($goods_list->isEmpty()) { if ($goods_list->isEmpty()) {
// return $this->renderSuccess(); return $this->renderSuccess();
// } }
// $goods_ids = array_column($goods_list->toArray(), "goods_id"); $goods_ids = array_column($goods_list->toArray(), "goods_id");
// //删除商品sku //删除商品sku
// GoodsSku::whereIn('goods_id', $goods_ids)->delete(); GoodsSku::whereIn('goods_id', $goods_ids)->delete();
// //删除商品图片 //删除商品图片
// GoodsImage::whereIn('goods_id', $goods_ids)->delete(); GoodsImage::whereIn('goods_id', $goods_ids)->delete();
// //删除商品规格 //删除商品规格
// GoodsSpecRel::whereIn('goods_id', $goods_ids)->delete(); GoodsSpecRel::whereIn('goods_id', $goods_ids)->delete();
// //删除商品 //删除商品
// GoodsModel::whereIn('goods_id', $goods_ids)->delete(); GoodsModel::whereIn('goods_id', $goods_ids)->delete();
// $page++; $page++;
// } }
return $this->renderSuccess(); return $this->renderSuccess();
} }

@ -124,6 +124,7 @@ class Goods extends Controller
case 'jd': case 'jd':
case 'jd1': case 'jd1':
case 'jd2': case 'jd2':
case 'zy':
$province = Region::withoutGlobalScope()->where('name', $params['province'])->where('level', 1)->find(); $province = Region::withoutGlobalScope()->where('name', $params['province'])->where('level', 1)->find();
//$city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find(); //$city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find();
$district = Region::withoutGlobalScope()->where('name', $params['district'])->where('level', 3)->find(); $district = Region::withoutGlobalScope()->where('name', $params['district'])->where('level', 3)->find();
@ -131,6 +132,8 @@ class Goods extends Controller
$arr = []; $arr = [];
$ret = $jd->getGoodsStock($province->jd_code, $city->jd_code, $district->jd_code, $goods['goods_no'], $value['num'] ?? 1); $ret = $jd->getGoodsStock($province->jd_code, $city->jd_code, $district->jd_code, $goods['goods_no'], $value['num'] ?? 1);
// echo "<pre>";
// print_r($ret);
//var_dump($ret); //var_dump($ret);
if ($ret) { if ($ret) {
$res = $ret['stockResp']['desc'] ?? "无货"; $res = $ret['stockResp']['desc'] ?? "无货";

Loading…
Cancel
Save