model = Db::name('package'); } //列表 public function getList() { $servicetypeId = input('servicetype_id',0); $companyId = input('company_id',$this->auth->company_id); $keyword = input('keyword',''); $where = [ 'p.company_id' => $companyId, 'p.status' => 1, 'p.num' => ['gt',0], ]; if (!empty($servicetypeId)) { $where['servicetype_id'] = $servicetypeId; } if(!empty($keyword)){ $where['p.title|p.info'] = ['LIKE','%'.$keyword.'%']; } $field = 'p.id,p.company_id,p.title,p.info,p.images,p.price,p.oldprice,p.num,type.title as servicetype_title'; $list = Db::name('package')->alias('p') ->field($field) ->join('servicetype type','p.servicetype_id = type.id','LEFT') ->where($where)->order('p.id desc')->autopage()->select(); $list = list_domain_image($list,['images']); $this->success('获取成功',$list); } //详情 public function getInfo() { $id = input('id',0); $where['p.id'] = $id; $where['p.num'] = ['gt',0]; $info = Db::name('package')->alias('p') ->field('p.*,type.title as servicetype_title') ->join('servicetype type','p.servicetype_id = type.id','LEFT') ->where($where)->find(); $info = info_domain_image($info,['images','content_images']); $this->success(1,$info); } }