浏览代码

用户接口

lizhen_gitee 9 月之前
父节点
当前提交
be91a99246

+ 65 - 0
application/api/controller/Caozuoguifan.php

@@ -0,0 +1,65 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use think\Db;
+/**
+ * 操作规范
+ */
+class Caozuoguifan extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+
+    public function index()
+    {
+        //所有分类
+        $typelist = Db::name('caozuoguifan_type')
+            ->where('company_id',$this->auth->company_id)
+            ->order('id' , 'asc')
+            ->select();
+
+        //第一个分类的内容
+        $list = [];
+        if(!empty($typelist)){
+            $list = Db::name('caozuoguifan')->field('content',true)
+                ->where('company_id',$this->auth->company_id)
+                ->where('type_id',$typelist[0]['id'])
+                ->autopage()
+                ->select();
+            $list = list_domain_image($list,['image']);
+        }
+
+        $rs = [
+            'typelist' => $typelist,
+            'list'     => $list,
+        ];
+
+        $this->success(1, $rs);
+    }
+
+    //操作规范
+    public function lists(){
+        $type_id = input('type_id',0);
+
+        $list = Db::name('caozuoguifan')
+            ->where('company_id',$this->auth->company_id)
+            ->where('type_id',$type_id)
+            ->autopage()
+            ->select();
+
+        $this->success(1, $list);
+    }
+
+    //详情
+    public function info(){
+        $id = input('id',0);
+        $list = Db::name('caozuoguifan')
+            ->where('id',$id)
+            ->find();
+        $list = info_domain_image($list, ['image']);
+
+        $this->success(1, $list);
+    }
+}

+ 11 - 1
application/api/controller/Dongtai.php

@@ -15,7 +15,7 @@ class Dongtai extends Api
     public function dongtai()
     {
         $zgs_id = 0;
-        $list = Db::name('dongtai')
+        $list = Db::name('dongtai')->field('content',true)
             ->where('company_id','IN',[$this->auth->company_id,$zgs_id])
             ->order('id' , 'desc')
             ->autopage()
@@ -24,4 +24,14 @@ class Dongtai extends Api
 
         $this->success(1, $list);
     }
+
+    public function info(){
+        $id = input('id',0);
+        $list = Db::name('dongtai')
+            ->where('id',$id)
+            ->find();
+        $list = info_domain_image($list, ['image']);
+
+        $this->success(1, $list);
+    }
 }

+ 2 - 1
application/api/controller/Index.php

@@ -33,8 +33,9 @@ class Index extends Api
         $banner = list_domain_image($banner, ['image']);
 
         //负责人
-        $header = Db::name('user_company')->field('header,header_mobile')
+        $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']);
 
         //关于我们
         $aboutus = Db::name('company')->field('aboutus,aboutus_image')

+ 11 - 1
application/api/controller/Zhengce.php

@@ -15,7 +15,7 @@ class Zhengce extends Api
     public function zhengce()
     {
         $zgs_id = 0;
-        $list = Db::name('zhengce')
+        $list = Db::name('zhengce')->field('content',true)
             ->where('company_id','IN',[$this->auth->company_id,$zgs_id])
             ->order('id' , 'desc')
             ->autopage()
@@ -24,4 +24,14 @@ class Zhengce extends Api
 
         $this->success(1, $list);
     }
+
+    public function info(){
+        $id = input('id',0);
+        $list = Db::name('zhengce')
+            ->where('id',$id)
+            ->find();
+        $list = info_domain_image($list, ['image']);
+
+        $this->success(1, $list);
+    }
 }