getPage(); $keywords = $this->request->get('keywords'); $result = FoodServer::getFoodList($page, $limit, $keywords); return json_success($result, '成功'); } /** * Notes:获取所有健康美食单品 * @return \support\Response * User: ZQ * Date: 2022/10/17 */ public function getFoodAll() { $food_category_id = $this->request->get('food_category_id',''); $result = FoodServer::getFoodAll($food_category_id); return json_success($result, '成功'); } /** * Notes:修改健康美食 * @return \support\Response * User: ZQ * Date: 2022/10/17 */ public function updateFood() { $food_id = $this->request->post('food_id'); $food_name = $this->request->post('food_name'); $food_img = $this->request->post('food_img'); $food_price = $this->request->post('food_price'); $food_category_id = $this->request->post('food_category_id'); $food_pack_price = $this->request->post('food_pack_price'); $food_materials = $this->request->post('food_materials',''); $food_condiment = $this->request->post('food_condiment',''); $food_type = $this->request->post('food_type'); $food_package = $this->request->post('food_package',''); $food_label = $this->request->post('food_label'); $food_content = $this->request->post('food_content',''); $food_status = $this->request->post('food_status'); //新增字段 $food_silde = $this->request->post('food_silde',''); $food_shop_id = $this->request->post('food_shop_id'); $food_storage = $this->request->post('food_storage'); $food_packaging = $this->request->post('food_packaging'); $food_varieties = $this->request->post('food_varieties'); $food_attr = $this->request->post('food_attr'); $food_postage_id = $this->request->post('food_postage_id'); $food_weight = $this->request->post('food_weight',''); $food_cater_time = $this->request->post('food_cater_time',''); $food_cater_type = $this->request->post('food_cater_type',''); $food_package_num = $this->request->post('food_package_num',''); $food_week = $this->request->post('food_week',''); $admin_id = $this->request->admin_id; $this->validateCheck('life\FoodValidate', ['food_id'=>$food_id,'food_name'=>$food_name,'food_img'=>$food_img,'food_price'=>$food_price,'food_category_id'=>$food_category_id,'food_pack_price'=>$food_pack_price,'food_type'=>$food_type,'food_label'=>$food_label,'food_status'=>$food_status,'food_content'=>$food_content], 'update'); $result = FoodServer::updateFood($food_silde, $food_shop_id, $food_storage, $food_packaging, $food_varieties, $food_attr, $food_postage_id, $food_weight, $food_id, $food_name, $food_img, $food_price, $food_category_id, $food_pack_price, $food_materials, $food_condiment, $food_type, $food_package, $food_label, $food_status, $food_content,$food_cater_time,$food_cater_type,$food_package_num, $food_week, $admin_id); return json_success($result, '修改成功'); } /** * Notes:删除健康美食 * @return \support\Response * User: ZQ * Date: 2022/10/17 */ public function delFood() { $food_id = $this->request->get('food_id'); $admin_id = $this->request->admin_id; $this->validateCheck('life\FoodValidate', ['food_id' => $food_id], 'info'); $result = FoodServer::delFood($food_id,$admin_id); if ($result){ return json_success($result, '删除成功'); }else{ throw new \Exception('删除失败!'); } } /** * Notes:添加健康美食 * @return \support\Response * User: ZQ * Date: 2022/10/17 */ public function addFood() { $food_name = $this->request->post('food_name'); $food_img = $this->request->post('food_img'); $food_price = $this->request->post('food_price'); $food_category_id = $this->request->post('food_category_id'); $food_pack_price = $this->request->post('food_pack_price'); $food_materials = $this->request->post('food_materials',''); $food_condiment = $this->request->post('food_condiment',''); $food_type = $this->request->post('food_type'); $food_package = $this->request->post('food_package',''); $food_label = $this->request->post('food_label'); $food_content = $this->request->post('food_content',''); $food_status = $this->request->post('food_status'); //新增字段 $food_silde = $this->request->post('food_silde',''); $food_shop_id = $this->request->post('food_shop_id'); $food_storage = $this->request->post('food_storage'); $food_packaging = $this->request->post('food_packaging'); $food_varieties = $this->request->post('food_varieties'); $food_attr = $this->request->post('food_attr'); $food_postage_id = $this->request->post('food_postage_id'); $food_weight = $this->request->post('food_weight',''); $food_cater_time = $this->request->post('food_cater_time',''); $food_cater_type = $this->request->post('food_cater_type',''); $food_package_num = $this->request->post('food_package_num',''); $food_week = $this->request->post('food_week',''); $admin_id = $this->request->admin_id; $this->validateCheck('life\FoodValidate', ['food_name'=>$food_name,'food_img'=>$food_img,'food_price'=>$food_price,'food_category_id'=>$food_category_id,'food_pack_price'=>$food_pack_price,'food_type'=>$food_type,'food_label'=>$food_label,'food_content'=>$food_content,'food_status'=>$food_status], 'create'); $result = FoodServer::insertFood($food_silde, $food_shop_id, $food_storage, $food_packaging, $food_varieties, $food_attr, $food_postage_id, $food_weight, $food_name, $food_img, $food_price, $food_category_id, $food_pack_price, $food_materials, $food_condiment, $food_type, $food_package, $food_label, $food_status, $food_content,$food_cater_time,$food_cater_type,$food_package_num, $food_week, $admin_id); return json_success($result, '添加成功'); } /** * Notes:查询健康美食详情 * @return \support\Response * User: ZQ * Date: 2022/10/17 */ public function foodInfo() { $food_id = $this->request->get('food_id'); $this->validateCheck('life\FoodValidate', ['food_id' => $food_id], 'info'); $result = FoodServer::foodInfo($food_id); return json_success($result, '成功'); } /** * Notes:健康美食上架下架 * @return \support\Response * User: ZQ * Date: 2022/10/17 */ public function updateStatus() { $food_id = $this->request->get('food_id'); $food_status = $this->request->get('food_status'); $this->validateCheck('life\FoodValidate', ['food_id' => $food_id], 'info'); $result = FoodServer::updateStatus($food_id, $food_status); return json_success($result, '修改成功'); } }