| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | 
							- <?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.'%'];
 
-         }
 
-         $field = 'p.id,p.company_id,p.title,p.info,p.images,p.price,p.oldprice,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);
 
-         $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();
 
-         $afterTime = time() + 86400 * $info['days'];
 
-         $info['days_text'] = !empty($info['days']) ? date('Y年m月d日', $afterTime) : '';
 
-         $info = info_domain_image($info,['images','content_images']);
 
-         $this->success(1,$info);
 
-     }
 
- }
 
 
  |