15669368801 4 年之前
父节点
当前提交
6796b8c852
共有 2 个文件被更改,包括 7 次插入20 次删除
  1. 5 5
      app/adminapi/controller/v1/company/Company.php
  2. 2 15
      app/models/company/CompanyModel.php

+ 5 - 5
app/adminapi/controller/v1/company/Company.php

@@ -86,11 +86,11 @@ class Company extends AuthController
      */
     public function read($id)
     {
-        if ($id) {
-            $info = ArticleModel::where('n.id', $id)->alias('n')->field('n.*,c.content')->join('ArticleContent c', 'c.nid=n.id', 'left')->find();
-            if (!$info) return $this->fail('数据不存在!');
-            $info['cid'] = intval($info['cid']);
-        }
+        // if ($id) {
+        //     $info = ArticleModel::where('n.id', $id)->alias('n')->field('n.*,c.content')->join('ArticleContent c', 'c.nid=n.id', 'left')->find();
+        //     if (!$info) return $this->fail('数据不存在!');
+        //     $info['cid'] = intval($info['cid']);
+        // }
         $info = CompanyModel::getOne($id);
         return $this->success(compact('info'));
     }

+ 2 - 15
app/models/company/CompanyModel.php

@@ -43,22 +43,9 @@ class CompanyModel extends BaseModel
     {
         $info = self::where('is_del', 0)->find($id);
         if ($info) {
-            if ($info['start_time'])
-                $start_time = date('Y-m-d H:i:s', $info['start_time']);
-
-            if ($info['end_time'])
-                $end_time = date('Y-m-d H:i:s', $info['end_time']);
-            if (isset($start_time) && isset($end_time))
-                $info['section_time'] = [$start_time, $end_time];
-            else
-                $info['section_time'] = [];
-            unset($info['start_time'], $info['end_time']);
+            $info['example'] = ExampleModel::where(['cid' => $id])->order('sort desc, id asc')->select();
+            $info['designer'] = DesignerModel::where(['cid' => $id])->order('sort desc, id asc')->select();
         }
-        if ($info['poster'])
-            $info['poster'] = json_decode($info['poster'], true);
-        else
-            $info['poster'] = [];
-        $info['brokerage'] = StoreRechargeCardBrokerage::where(['cid' => $id])->order('role asc, level asc')->select();
         return $info;
     }