scene('info')->check($request->get())) { return json_fail($validate->getError()); } return GoodsService::info($request->get('goods_id')); } /** * @Desc 添加商品 * @Author Gorden * @Date 2024/3/11 10:21 * * @param Request $request * @return Response */ public function insert(Request $request): Response { $params = $request->post(); $validate = new GoodsValidate(); if (!$validate->scene('add')->check($params)) { return json_fail($validate->getError()); } return GoodsService::insert($params); } /** * @Desc 修改商品 * @Author Gorden * @Date 2024/3/28 13:22 * * @param Request $request * @return Response */ public function update(Request $request): Response { $validate = new GoodsValidate(); if (!$validate->scene('update')->check($request->post())) { return json_fail($validate->getError()); } return GoodsService::update($request->post()); } /** * @Desc 删除商品 * @Author Gorden * @Date 2024/3/28 13:22 * * @param Request $request * @return Response */ public function delete(Request $request) { $ids = $request->post('goods_id'); return GoodsService::delete($ids); } }