|
@@ -0,0 +1,58 @@
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+namespace app\api\controller;
|
|
|
|
+
|
|
|
|
+use app\common\controller\Api;
|
|
|
|
+use think\Db;
|
|
|
|
+
|
|
|
|
+class Package extends Api
|
|
|
|
+{
|
|
|
|
+ protected $noNeedLogin = '*';
|
|
|
|
+ protected $noNeedRight = '*';
|
|
|
|
+ protected $model = null;
|
|
|
|
+
|
|
|
|
+ public function _initialize()
|
|
|
|
+ {
|
|
|
|
+ parent::_initialize();
|
|
|
|
+ $this->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,
|
|
|
|
+ ];
|
|
|
|
+ if (!empty($servicetypeId)) {
|
|
|
|
+ $where['servicetype_id'] = $servicetypeId;
|
|
|
|
+ }
|
|
|
|
+ if(!empty($keyword)){
|
|
|
|
+ $where['p.title|p.info'] = ['LIKE','%'.$keyword.'%'];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $list = Db::name('package')->alias('p')
|
|
|
|
+ ->field('p.*,type.title as servicetype_title')
|
|
|
|
+ ->join('servicetype type','p.servicetype_id = type.id','LEFT')
|
|
|
|
+ ->where($where)->order('p.id desc')->autopage()->select();
|
|
|
|
+
|
|
|
|
+ $list = list_domain_image($list,['images','content_images']);
|
|
|
|
+ $this->success('获取成功',$list);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //详情
|
|
|
|
+ public function info()
|
|
|
|
+ {
|
|
|
|
+ $id = input('id',0);
|
|
|
|
+ $info = Db::name('package')->alias('p')
|
|
|
|
+ ->field('p.*,type.title as servicetype_title')
|
|
|
|
+ ->join('servicetype type','p.servicetype_id = type.id','LEFT')
|
|
|
|
+ ->where('p.id',$id)->find();
|
|
|
|
+ $info = info_domain_image($info,['images','content_images']);
|
|
|
|
+ $this->success(1,$info);
|
|
|
|
+ }
|
|
|
|
+}
|