WIN-2308041133\Administrator 8 months ago
parent
commit
a0ba603bb3

+ 40 - 0
application/api/controller/Platform.php

@@ -0,0 +1,40 @@
+<?php
+
+
+namespace app\api\controller;
+
+use think\Db;
+use fast\Tree;
+use app\common\controller\Api;
+
+/**
+ * 首页接口
+ */
+class Platform extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+    public function index()
+    {
+        $config=$this->config();
+        $configs=config('site');
+        $map['ishot']=2;
+        $map['endtimesjc']=['>',time()];
+        if(input('uid',0)>0){
+            $map['uid']=input('uid');
+        }
+        $list =  model('Platform')
+            ->with('users')
+            ->where($map)
+            ->limit(10)
+            ->select();
+
+        $data=['config'=>$config,'doctor'=>$list];
+        $this->success('请求成功',$data);
+    }
+    public function test(){
+        $this->success('请求成功');
+    }
+
+
+}

+ 32 - 0
application/common/model/VideoShare.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+/**
+ * 会员模型
+ */
+class VideoShare extends Model
+{
+    // 表名
+    protected $name = 'video_share';
+    // 开启自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    // 追加属性
+    protected $append = [
+
+    ];
+    // 定义关联关系
+    public function videolist()
+    {
+        return $this->belongsTo('Videolist', 'vid', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+    public function user()
+    {
+        return $this->belongsTo('User', 'uid', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+}

+ 36 - 0
application/common/model/VideoUser.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+/**
+ * 会员模型
+ */
+class VideoUser extends Model
+{
+    // 表名
+    protected $name = 'video_user';
+    // 开启自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    // 追加属性
+    protected $append = [
+
+    ];
+    // 定义关联关系
+    public function videolist()
+    {
+        return $this->belongsTo('Videolist', 'vid', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+    public function platform()
+    {
+        return $this->belongsTo('Platform', 'platform_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+    public function user()
+    {
+        return $this->belongsTo('User', 'uid', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+}