ConsultGood.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\controller;
  4. use app\admin\model\ConsultTemp;use think\App;use think\Request;
  5. class ConsultGood extends Base
  6. {
  7. private $model;
  8. public function __construct(App $app) {
  9. parent::__construct($app);
  10. $this->model=new ConsultTemp();
  11. }
  12. public function info(){
  13. $param =$this->request->param(["id"],"post","trim");
  14. $info = $this->model->with(['brand','cat','unit'])->findOrEmpty($param['id']);
  15. if($info->isEmpty())$this->error("未找到信息");
  16. $place = ['provice_code'=>'','city_code'=>'','area_code'=>''];
  17. if($info['delivery_place']!=''){
  18. list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(',',$info['delivery_place']);
  19. }
  20. $info['delivery_place_cn']=GetAddr(json_encode($place));
  21. $place = ['provice_code'=>'','city_code'=>'','area_code'=>''];
  22. if($info['origin_place']!=''){
  23. list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(',',$info['origin_place']);
  24. }
  25. $info['origin_place_cn']=GetAddr(json_encode($place));
  26. $this->success("获取成功",$info);
  27. }
  28. public function getList(){
  29. $param= $this->request->param(["bidNo"=>""],"post","trim");
  30. $list = $this->model->with(["brand","cat","unit"])->where("bidNo",$param['bidNo'])->select();
  31. $this->success('获取成功',$list);
  32. }
  33. public function delete(){
  34. $param= $this->request->param(['id'=>''],'post','trim');
  35. $info = $this->model->findOrEmpty($param['id']);
  36. if($info->isEmpty())$this->error('未找到信息');
  37. $del= $info->delete();
  38. $del?$this->success('删除成功'):$this->error("删除失败");
  39. }
  40. }