123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- declare (strict_types = 1);
- namespace app\admin\controller;
- use app\admin\model\ConsultTemp;use think\App;use think\Request;
- class ConsultGood extends Base
- {
- private $model;
- public function __construct(App $app) {
- parent::__construct($app);
- $this->model=new ConsultTemp();
- }
-
-
- public function info(){
- $param =$this->request->param(["id"],"post","trim");
- $info = $this->model->with(['brand','cat','unit'])->findOrEmpty($param['id']);
- if($info->isEmpty())$this->error("未找到信息");
- $place = ['provice_code'=>'','city_code'=>'','area_code'=>''];
- if($info['delivery_place']!=''){
- list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(',',$info['delivery_place']);
- }
- $info['delivery_place_cn']=GetAddr(json_encode($place));
- $place = ['provice_code'=>'','city_code'=>'','area_code'=>''];
- if($info['origin_place']!=''){
- list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(',',$info['origin_place']);
- }
- $info['origin_place_cn']=GetAddr(json_encode($place));
- $this->success("获取成功",$info);
- }
-
- public function getList(){
- $param= $this->request->param(["bidNo"=>""],"post","trim");
- $list = $this->model->with(["brand","cat","unit"])->where("bidNo",$param['bidNo'])->select();
- $this->success('获取成功',$list);
- }
-
- public function delete(){
- $param= $this->request->param(['id'=>''],'post','trim');
- $info = $this->model->findOrEmpty($param['id']);
- if($info->isEmpty())$this->error('未找到信息');
- $del= $info->delete();
- $del?$this->success('删除成功'):$this->error("删除失败");
- }
- }
|