123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- /**
- * 首页接口
- */
- class Index extends Api
- {
- protected $noNeedLogin = [''];
- protected $noNeedRight = [''];
- /**
- * 默认
- */
- public function index()
- {
- $this->success('请求成功');
- }
- /**
- * 首页
- */
- public function home(){
- //轮播
- $banner = Db::name('banner')->field('id, title, image, url')
- ->where('company_id',$this->auth->company_id)
- ->where(['status' => 1])
- ->order(['weigh' => 'desc', 'id' => 'desc'])
- ->select();
- $banner = list_domain_image($banner, ['image']);
- //负责人
- $header = Db::name('user_company')->field('header,header_mobile,header_avatar')
- ->where('user_id',$this->auth->id)->find();
- $header = info_domain_image($header,['header_avatar']);
-
- $header['jishuguifan'] = localpath_to_netpath(config('site.user_index_jishuguifan'));
- $header['caozuoguifan'] = localpath_to_netpath(config('site.user_index_caozuoguifan'));
- //关于我们
- $aboutus = Db::name('company')->field('aboutus,aboutus_image')
- ->where('id',$this->auth->company_id)->find();
- $aboutus = info_domain_image($aboutus,['aboutus_image']);
- //最新动态
- $zgs_id = 1;
- $dongtai = Db::name('dongtai')->field('id,title,image,updatetime')
- ->where('company_id','IN',[$this->auth->company_id,$zgs_id])
- ->order('id' , 'desc')
- ->limit(3)
- ->select();
- $dongtai = list_domain_image($dongtai, ['image']);
- //维保公司的客服
- // $kefu_id = Db::name('pc_admin')->where('company_id',$this->auth->company_id)->order('is_kefu desc,id asc')->value('id');
- $kefu_id = $this->auth->company_id;
- //
- $result = [
- 'banner' => $banner,
- 'header' => $header,
- 'aboutus' => $aboutus,
- 'dongtai' => $dongtai,
- 'huojing' => 119,
- 'headermobile' => $header['header_mobile'],
- 'im_kefu' => 'kefu_'.$kefu_id,
- ];
- $this->success(1, $result);
- }
- /**
- * 关于我们
- */
- public function aboutus(){
- //关于我们
- $aboutus = Db::name('company')->field('aboutus,aboutus_image')
- ->where('id',$this->auth->company_id)->find();
- $aboutus = info_domain_image($aboutus,['aboutus_image']);
- $this->success(1, $aboutus);
- }
- /**
- * 维保信息
- */
- public function weiboinfo(){
- $info = Db::name('user_company')->where('user_id',$this->auth->id)->find();
- $info = info_domain_image($info,['header_avatar']);
- $info['weituo_info'] = $info['weituo'].'消防设施维护保养';
- $this->success(1, $info);
- }
- }
|