浏览代码

用户端接口

lizhen_gitee 9 月之前
父节点
当前提交
878b21d80c

+ 27 - 0
application/api/controller/Banner.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use think\Db;
+/**
+ * 轮播图
+ */
+class Banner extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+
+    //轮播图
+    public function banner()
+    {
+        $list = Db::name('banner')->field('id, title, image, url')
+            ->where('company_id',$this->auth->company_id)
+            ->where(['status' => 1])
+            ->order(['weigh' => 'desc', 'id' => 'desc'])
+            ->select();
+        $list = list_domain_image($list, ['image']);
+
+        $this->success(1, $list);
+    }
+}

+ 27 - 0
application/api/controller/Dongtai.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use think\Db;
+/**
+ * 最新动态
+ */
+class Dongtai extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+
+    public function dongtai()
+    {
+        $zgs_id = 0;
+        $list = Db::name('dongtai')
+            ->where('company_id','IN',[$this->auth->company_id,$zgs_id])
+            ->order('id' , 'desc')
+            ->autopage()
+            ->select();
+        $list = list_domain_image($list, ['image']);
+
+        $this->success(1, $list);
+    }
+}

+ 45 - 3
application/api/controller/Index.php

@@ -3,14 +3,14 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
-
+use think\Db;
 /**
  * 首页接口
  */
 class Index extends Api
 {
-    protected $noNeedLogin = ['*'];
-    protected $noNeedRight = ['*'];
+    protected $noNeedLogin = [''];
+    protected $noNeedRight = [''];
 
     /**
      * 首页
@@ -20,4 +20,46 @@ class Index extends Api
     {
         $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')
+            ->where('user_id',$this->auth->id)->find();
+        $header = info_domain_image($header,['header_mobile']);
+
+        //关于我们
+        $aboutus = Db::name('company')->field('aboutus,aboutus_image')
+            ->where('id',$this->auth->company_id)->find();
+        $aboutus = info_domain_image($aboutus,['header_mobile']);
+
+        //最新动态
+        $zgs_id = 0;
+        $dongtai = Db::name('dongtai')
+            ->where('company_id','IN',[$this->auth->company_id,$zgs_id])
+            ->order('id' , 'desc')
+            ->limit(3)
+            ->select();
+        $dongtai = list_domain_image($dongtai, ['image']);
+
+        //
+        $result = [
+            'banner'  => $banner,
+            'header'  => $header,
+            'aboutus' => $aboutus,
+            'dongtai' => $dongtai,
+            '119'     => 119,
+        ];
+
+        $this->success(1, $result);
+    }
+
+
 }

+ 27 - 0
application/api/controller/Zhengce.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use think\Db;
+/**
+ * 最新政策
+ */
+class Zhengce extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+
+    public function zhengce()
+    {
+        $zgs_id = 0;
+        $list = Db::name('zhengce')
+            ->where('company_id','IN',[$this->auth->company_id,$zgs_id])
+            ->order('id' , 'desc')
+            ->autopage()
+            ->select();
+        $list = list_domain_image($list, ['image']);
+
+        $this->success(1, $list);
+    }
+}

+ 1 - 1
application/extra/upload.php

@@ -9,7 +9,7 @@ return [
     /**
      * CDN地址
      */
-    'cdnurl'    => '',
+    'cdnurl'    => 'http://weibao.com',
     /**
      * 文件保存格式
      */