|
|
|
@ -283,7 +283,9 @@ class ProductController extends AdminController |
|
|
|
|
|
|
|
//列表切换上下架按钮
|
|
|
|
if ($form->isEditing() && !is_null($form->status) && is_null($form->title)) { |
|
|
|
if (in_array($form->model()->status, $user_status)) { |
|
|
|
if (empty($form->model()->spec->toArray())) { |
|
|
|
return $form->response()->error('请先设置产品规格')->refresh(); |
|
|
|
} else if (in_array($form->model()->status, $user_status)) { |
|
|
|
$form->status = $form->status == 1 ? ProductStatus::ON_SALE : ProductStatus::SOLD_OUT; |
|
|
|
$form->model()->update(['status' => $form->status]); |
|
|
|
return $form->response()->success('更新成功')->refresh(); |
|
|
|
|