|
|
@ -91,8 +91,13 @@ class Goods extends Controller |
|
|
|
foreach ($params['list'] as $value) { |
|
|
|
foreach ($params['list'] as $value) { |
|
|
|
$res = "无货"; |
|
|
|
$res = "无货"; |
|
|
|
$goods = GoodsModel::where('goods_id', $value['goods_id'])->find(); |
|
|
|
$goods = GoodsModel::where('goods_id', $value['goods_id'])->find(); |
|
|
|
|
|
|
|
if (!$goods) { |
|
|
|
|
|
|
|
return $this->renderError('商品不存在'); |
|
|
|
|
|
|
|
} |
|
|
|
//限制销售区域 |
|
|
|
//限制销售区域 |
|
|
|
$city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find(); |
|
|
|
$city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find(); |
|
|
|
|
|
|
|
// var_dump($goods); |
|
|
|
|
|
|
|
// exit(); |
|
|
|
if ($goods['region'] && !in_array($city->id, json_decode($goods['region']))) { |
|
|
|
if ($goods['region'] && !in_array($city->id, json_decode($goods['region']))) { |
|
|
|
$data = [ |
|
|
|
$data = [ |
|
|
|
'state' => "无货", |
|
|
|
'state' => "无货", |
|
|
@ -124,8 +129,9 @@ 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); |
|
|
|
|
|
|
|
//var_dump($ret); |
|
|
|
if ($ret) { |
|
|
|
if ($ret) { |
|
|
|
$res = $ret['stockResp']['desc']; |
|
|
|
$res = $ret['stockResp']['desc'] ?? "无货"; |
|
|
|
if (strpos($res, "无货") !== false) { |
|
|
|
if (strpos($res, "无货") !== false) { |
|
|
|
$res = "无货"; |
|
|
|
$res = "无货"; |
|
|
|
} elseif (strpos($res, "有货") == false) { |
|
|
|
} elseif (strpos($res, "有货") == false) { |
|
|
|