| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 | 
							- <?php
 
- namespace app\admin\controller\life;
 
- use app\admin\controller\BaseController;
 
- use app\admin\server\life\FoodServer;
 
- class Food extends BaseController
 
- {
 
-     /**
 
-      * Notes:获取健康美食列表
 
-      * @return \support\Response
 
-      * User: ZQ
 
-      * Date: 2022/10/17
 
-      */
 
-     public function getFoodList()
 
-     {
 
-         [$page, $limit] = $this->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, '修改成功');
 
-     }
 
- }
 
 
  |