|
|
@ -124,9 +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(); |
|
|
|
|
|
|
|
$district = Region::withoutGlobalScope()->where('name', $params['district'])->where('level', 3)->find(); |
|
|
|
$district = Region::withoutGlobalScope()->where('name', $params['district'])->where('level', 3)->find(); |
|
|
|
$jd = new \app\common\service\Jd(); |
|
|
|
$jd = new \app\common\service\Jd(); |
|
|
|
$arr = []; |
|
|
|
$arr = []; |
|
|
@ -152,7 +150,32 @@ class Goods extends Controller |
|
|
|
]; |
|
|
|
]; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
|
|
|
|
if ($goods->is_use_jd_stock) {//是否使用京东库存 |
|
|
|
|
|
|
|
$province = Region::withoutGlobalScope()->where('name', $params['province'])->where('level', 1)->find(); |
|
|
|
|
|
|
|
$district = Region::withoutGlobalScope()->where('name', $params['district'])->where('level', 3)->find(); |
|
|
|
|
|
|
|
$jd = new \app\common\service\Jd(); |
|
|
|
|
|
|
|
$arr = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$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); |
|
|
|
|
|
|
|
if ($ret) { |
|
|
|
|
|
|
|
$res = $ret['stockResp']['desc'] ?? "无货"; |
|
|
|
|
|
|
|
if (strpos($res, "无货") !== false) { |
|
|
|
|
|
|
|
$res = "无货"; |
|
|
|
|
|
|
|
} elseif (strpos($res, "有货") == false) { |
|
|
|
|
|
|
|
$res = "有货"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$data = [ |
|
|
|
|
|
|
|
'state' => $res, |
|
|
|
|
|
|
|
'goods_name' => $goods['goods_name'], |
|
|
|
|
|
|
|
'goods_id' => $goods['goods_id'], |
|
|
|
|
|
|
|
//'promise_info' => $ret['promiseInfo'] ?? "预计72小时内发货", |
|
|
|
|
|
|
|
'promise_info' => "预计48小时内发货", |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} else { |
|
|
|
if ($goods->stock_total >= ($value['num'] ?? 1)) { |
|
|
|
if ($goods->stock_total >= ($value['num'] ?? 1)) { |
|
|
|
$res = "有货"; |
|
|
|
$res = "有货"; |
|
|
|
} |
|
|
|
} |
|
|
@ -162,6 +185,8 @@ class Goods extends Controller |
|
|
|
'goods_id' => $goods['goods_id'], |
|
|
|
'goods_id' => $goods['goods_id'], |
|
|
|
'promise_info' => "预计".(GoodsDeliveryTime::data()[$goods['delivery_time']]['name'] ?? "72小时")."内发货", |
|
|
|
'promise_info' => "预计".(GoodsDeliveryTime::data()[$goods['delivery_time']]['name'] ?? "72小时")."内发货", |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|