|
|
|
@ -86,9 +86,20 @@ class Goods extends Controller |
|
|
|
|
foreach ($params['list'] as $value) { |
|
|
|
|
$res = "无货"; |
|
|
|
|
$goods = GoodsModel::where('goods_id', $value['goods_id'])->find(); |
|
|
|
|
//限制销售区域 |
|
|
|
|
$city = Region::withoutGlobalScope()->where('name', $params['city'])->where('level', 2)->find(); |
|
|
|
|
if ($goods['region'] && !in_array($city->id, json_decode($goods['region']))) { |
|
|
|
|
$data = [ |
|
|
|
|
'state' => "无货", |
|
|
|
|
'goods_name' => $goods['goods_name'], |
|
|
|
|
'goods_id' => $goods['goods_id'], |
|
|
|
|
]; |
|
|
|
|
$return[] = $data; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
switch ($goods->channel) { |
|
|
|
|
case 'sn': |
|
|
|
|
$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(); |
|
|
|
|
$suning = new \app\common\service\Suning(); |
|
|
|
|
$goods->num = $param['num'] ?? 1; |
|
|
|
@ -98,7 +109,7 @@ class Goods extends Controller |
|
|
|
|
break; |
|
|
|
|
case 'jd': |
|
|
|
|
$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(); |
|
|
|
|
$jd = new \app\common\service\Jd(); |
|
|
|
|
$arr = []; |
|
|
|
|