更新
This commit is contained in:
parent
46c51afb2a
commit
05e5fe5016
@ -204,26 +204,26 @@ class StoreCategory extends BaseController
|
||||
$lv = $this->request->param('lv',null);
|
||||
if (!is_null($lv)) $lv = $lv + 1;
|
||||
$data = $this->repository->getList($type,$lv);
|
||||
if ($lv) {
|
||||
$ret = $data;
|
||||
} else {
|
||||
$ret = [];
|
||||
foreach ($data as $key => $value) {
|
||||
if (isset($value['children'])) {
|
||||
$level = [];
|
||||
foreach ($value['children'] as $child) {
|
||||
if (isset($child['children'])) {
|
||||
$level[] = $child;
|
||||
}
|
||||
}
|
||||
if (isset($level) && !empty($level)) {
|
||||
$value['children'] = $level;
|
||||
$ret[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return app('json')->success($ret);
|
||||
// if ($lv) {
|
||||
// $ret = $data;
|
||||
// } else {
|
||||
// $ret = [];
|
||||
// foreach ($data as $key => $value) {
|
||||
// if (isset($value['children'])) {
|
||||
// $level = [];
|
||||
// foreach ($value['children'] as $child) {
|
||||
// if (isset($child['children'])) {
|
||||
// $level[] = $child;
|
||||
// }
|
||||
// }
|
||||
// if (isset($level) && !empty($level)) {
|
||||
// $value['children'] = $level;
|
||||
// $ret[] = $value;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,11 +86,11 @@ class Product extends BaseController
|
||||
{
|
||||
$params = $this->request->params($this->repository::CREATE_PARAMS);
|
||||
$data = $this->repository->checkParams($params,$this->request->merId());
|
||||
$cate_id=StoreCategory::where('pid',$data['cate_id'])->where('level',2)->value('store_category_id');
|
||||
if(!$cate_id){
|
||||
return app('json')->fail('请先添加第三级分类');
|
||||
}
|
||||
$data['cate_id']=$cate_id;
|
||||
// $cate_id=StoreCategory::where('pid',$data['cate_id'])->where('level',2)->value('store_category_id');
|
||||
// if(!$cate_id){
|
||||
// return app('json')->fail('请先添加第三级分类');
|
||||
// }
|
||||
// $data['cate_id']=$cate_id;
|
||||
$data['mer_id'] = $this->request->merId();
|
||||
if ($data['is_gift_bag'] && !$this->repository->checkMerchantBagNumber($data['mer_id']))
|
||||
return app('json')->fail('礼包数量超过数量限制');
|
||||
|
Loading…
x
Reference in New Issue
Block a user