123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <?php
- namespace app\admin\controller\healthy;
- use app\admin\controller\BaseController;
- use app\admin\server\healthy\HealthyProductServer;
- class HealthyProduct extends BaseController
- {
- /**
- * Notes:获取健康产品列表
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/31
- */
- public function getProductList()
- {
- [$page, $limit] = $this->getPage();
- $keywords = $this->request->get('keywords');
- $result = HealthyProductServer::getProductList($page, $limit, $keywords);
- return json_success($result, '成功');
- }
- /**
- * Notes:获取所有健康产品
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/31
- */
- public function getProductAll()
- {
- $result = HealthyProductServer::getProductAll();
- return json_success($result, '成功');
- }
- /**
- * Notes:修改健康产品
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/31
- */
- public function updateProduct()
- {
- $product_id = $this->request->post('product_id');
- $product_name = $this->request->post('product_name');
- $product_shop_id = $this->request->post('product_shop_id');
- $product_pack_price = $this->request->post('product_pack_price');
- $product_postage_id = $this->request->post('product_postage_id');
- $product_category_id = $this->request->post('product_category_id');
- $product_label = $this->request->post('product_label','');
- $product_price = $this->request->post('product_price');
- $product_status = $this->request->post('product_status');
- $product_weight = $this->request->post('product_weight','');
- $product_image = $this->request->post('product_image','');
- $product_image_list = $this->request->post('product_image_list','');
- $product_limit = $this->request->post('product_limit','');
- $product_notice = $this->request->post('product_notice','');
- $product_guarantee = $this->request->post('product_guarantee','');
- $product_type = $this->request->post('product_type');
- $product_package = $this->request->post('product_package','');
- $product_rule = $this->request->post('product_rule','');
- $product_detail = $this->request->post('product_detail','');
- $product_sort = $this->request->post('product_sort','');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('healthy\HealthyProductValidate', ['product_id'=>$product_id,'product_name'=>$product_name,'product_price'=>$product_price,'product_pack_price'=>$product_pack_price,'product_category_id'=>$product_category_id,'product_shop_id'=>$product_shop_id,'product_status'=>$product_status,'product_postage_id'=>$product_postage_id,'product_weight'=>$product_weight,'product_type'=>$product_type], 'update');
- $result = HealthyProductServer::updateProduct($product_id, $product_name, $product_pack_price, $product_postage_id, $product_category_id, $product_weight, $product_label, $product_status, $product_image, $product_image_list, $product_limit, $product_notice, $product_guarantee, $product_type, $product_package, $product_rule, $product_shop_id, $product_price, $product_detail, $product_sort, $admin_id);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:删除健康产品
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/31
- */
- public function delProduct()
- {
- $product_id = $this->request->get('product_id');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('healthy\HealthyProductValidate', ['product_id' => $product_id], 'info');
- $result = HealthyProductServer::delProduct($product_id,$admin_id);
- if ($result){
- return json_success($result, '删除成功');
- }else{
- throw new \Exception('删除失败!');
- }
- }
- /**
- * Notes:添加健康产品
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/31
- */
- public function addProduct()
- {
- $product_name = $this->request->post('product_name');
- $product_shop_id = $this->request->post('product_shop_id');
- $product_pack_price = $this->request->post('product_pack_price');
- $product_postage_id = $this->request->post('product_postage_id');
- $product_category_id = $this->request->post('product_category_id');
- $product_label = $this->request->post('product_label','');
- $product_price = $this->request->post('product_price');
- $product_status = $this->request->post('product_status');
- $product_weight = $this->request->post('product_weight','');
- $product_image = $this->request->post('product_image','');
- $product_image_list = $this->request->post('product_image_list','');
- $product_limit = $this->request->post('product_limit','');
- $product_notice = $this->request->post('product_notice','');
- $product_guarantee = $this->request->post('product_guarantee','');
- $product_type = $this->request->post('product_type');
- $product_package = $this->request->post('product_package','');
- $product_rule = $this->request->post('product_rule','');
- $product_detail = $this->request->post('product_detail','');
- $product_sort = $this->request->post('product_sort','');
- $admin_id = $this->request->admin_id;
- $this->validateCheck('healthy\HealthyProductValidate', ['product_name'=>$product_name,'product_price'=>$product_price,'product_pack_price'=>$product_pack_price,'product_category_id'=>$product_category_id,'product_shop_id'=>$product_shop_id,'product_status'=>$product_status,'product_postage_id'=>$product_postage_id,'product_weight'=>$product_weight,'product_type'=>$product_type], 'create');
- $result = HealthyProductServer::insertProduct($product_name, $product_pack_price, $product_postage_id, $product_category_id, $product_weight, $product_label, $product_status, $product_image, $product_image_list, $product_limit, $product_notice, $product_guarantee, $product_type, $product_package, $product_rule, $product_shop_id, $product_price, $product_detail, $product_sort, $admin_id);
- return json_success($result, '添加成功');
- }
- /**
- * Notes:查询健康产品详情
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/31
- */
- public function productInfo()
- {
- $product_id = $this->request->get('product_id');
- $this->validateCheck('healthy\HealthyProductValidate', ['product_id' => $product_id], 'info');
- $result = HealthyProductServer::productInfo($product_id);
- return json_success($result, '成功');
- }
- /**
- * Notes:健康产品上架下架
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/09
- */
- public function updateStatus()
- {
- $product_id = $this->request->get('product_id');
- $product_status = $this->request->get('product_status');
- $this->validateCheck('healthy\HealthyProductValidate', ['product_id' => $product_id], 'info');
- $result = HealthyProductServer::updateStatus($product_id, $product_status);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:健康产品审核
- * @return \support\Response
- * User: ZQ
- * Date: 2022/10/09
- */
- public function autoProduct()
- {
- $product_id = $this->request->post('product_id');
- $product_auto = $this->request->post('product_auto');
- $product_msg = $this->request->post('product_msg','');
- $this->validateCheck('healthy\HealthyProductValidate', ['product_id' => $product_id], 'auto');
- $result = HealthyProductServer::autoProduct($product_id, $product_auto,$product_msg);
- return json_success($result, '审核成功');
- }
- }
|