getPage(); $keywords = $this->request->get('keywords'); $category_id = $this->request->get('category_id');//分类id $result = HomeGoodsServer::getGoodsList($page,$limit,$keywords,$category_id); return json_success($result, '成功'); } /** * Notes:修改项目 * @return \support\Response * User: YCP * Date: 2022/10/31 */ public function updateGoods() { $params = $this->request->post(); $admin_id = $this->request->admin_id; $this->validateCheck('home\HomeGoodsValidate', [ 'goods_id' => $params['goods_id']?? '', 'goods_category_id' => $params['goods_category_id']?? '', 'goods_name' => $params['goods_name']?? '', 'goods_img' => $params['goods_img']?? '', 'goods_mobile' => $params['goods_mobile']?? '', ], 'update'); $result = HomeGoodsServer::updateGoods($params, $admin_id); return json_success($result, '修改成功'); } /** * Notes:删除项目 * @return \support\Response * User: YCP * Date: 2022/10/31 */ public function delGoods() { $goods_id = $this->request->get('goods_id'); $admin_id = $this->request->admin_id; $this->validateCheck('home\HomeGoodsValidate', ['goods_id' => $goods_id], 'info'); $result = HomeGoodsServer::delGoods($goods_id,$admin_id); if ($result){ return json_success($result, '删除成功'); }else{ throw new \Exception('删除失败!'); } } /** * Notes:添加项目 * @return \support\Response * User: YCP * Date: 2022/10/31 */ public function addGoods() { $params = $this->request->post(); $admin_id = $this->request->admin_id; $this->validateCheck('home\HomeGoodsValidate', [ 'goods_category_id' => $params['goods_category_id']?? '', 'goods_name' => $params['goods_name']?? '', 'goods_img' => $params['goods_img']?? '', 'goods_mobile' => $params['goods_mobile']?? '', ], 'create'); $result = HomeGoodsServer::insertGoods($params, $admin_id); return json_success($result, '添加成功'); } /** * Notes:查询项目详情 * @return \support\Response * User: YCP * Date: 2022/10/31 */ public function goodsInfo() { $goods_id = $this->request->get('goods_id'); $this->validateCheck('home\HomeGoodsValidate', ['goods_id' => $goods_id], 'info'); $result = HomeGoodsServer::goodsInfo($goods_id); return json_success($result, '成功'); } }