wupengfei %!s(int64=2) %!d(string=hai) anos
pai
achega
cd5fb21d63

+ 5 - 4
.idea/workspace.xml

@@ -2,8 +2,9 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
+      <change afterPath="$PROJECT_DIR$/application/common/model/UserDownload.php" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/application/api/controller/Video.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Video.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/api/controller/Datum.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/api/controller/Datum.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -221,7 +222,7 @@
       <workItem from="1665189429149" duration="5358000" />
       <workItem from="1665206979508" duration="7749000" />
       <workItem from="1665276346161" duration="19728000" />
-      <workItem from="1665362529961" duration="6201000" />
+      <workItem from="1665362529961" duration="8559000" />
     </task>
     <servers />
   </component>
@@ -247,10 +248,10 @@
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="1175" y="519" key="#com.intellij.fileTypes.FileTypeChooser/0.0.2560.1400@0.0.2560.1400" timestamp="1659079177590" />
-    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1665368731860">
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1665378755402">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1665368731860" />
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1665378755402" />
     <state x="283" y="145" width="1942" height="1088" key="DiffContextDialog" timestamp="1665216465958">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 58 - 1
application/api/controller/Datum.php

@@ -6,6 +6,7 @@ use app\common\model\DatumLike;
 use app\common\model\DatumUrl;
 use app\common\model\UserCollect;
 use app\common\model\UserDatum;
+use app\common\model\UserDownload;
 use app\common\model\UserLevelRank;
 use app\common\model\UserMessage;
 use app\common\model\UserSearch;
@@ -225,7 +226,27 @@ class Datum extends Base
         DatumUrl::where('id',$url_id)->setInc('transmit_num');
         $this->success('ok');
     }
-    
+
+
+
+    /**
+     * @title 资料下载(资料下载数量统计)
+     * @desc 资料下载
+     * @author qc
+     * @method POST
+     * @url /api/Datum/datumDownload
+     * @header name:Authorization require:1 desc:Token
+     * @param name:datum_id type:int default:-- desc:资料id
+     * @param name:url_id type:int default:-- desc:url_id
+     */
+    public function datumDownload()
+    {
+        $datum_id= input('post.datum_id');
+        $url_id = input('post.url_id',0);
+        Data::save('UserDownload',['user_id'=>$this->user_id,'first_id'=>$datum_id,'url_id'=>$url_id]);
+        $this->success('ok');
+    }
+
     /**
      * @title 资料阅读(阅读数量统计)
      * @desc 资料阅读
@@ -413,4 +434,40 @@ class Datum extends Base
         $this->success('删除成功');
     }
 
+
+    /**
+     * @title 获取下载资料列表
+     * @desc 获取下载资料列表
+     * @author qc
+     * @method GET
+     * @url /api/Datum/getDownloadDatum
+     * @header name:Authorization require:1 desc:Token
+     * @param  name:title type:string default:-- desc:标题
+     * @param  name:page type:int default:0 desc:页数
+     * @param  name:page_num type:int default:20 desc:每页数
+     * @return name:title type:string default:-- desc:标题
+     * @return name:datum_id type:int default:-- desc:资料id
+     * @return name:url_id type:int default:-- desc:item_id
+     * @return name:is_vip type:int default:-- desc:是否vip[0否1是]
+     * @return name:url type:string default:-- desc:资料路径
+     */
+    public function getDownloadDatum()
+    {
+        $sel_where  = [];
+        $title = input('get.title');
+        if($title)  $sel_where[]  = ['i.title','like','%'.$title.'%'];
+        $sel_where[]  = ['t.user_id','=',$this->user_id];
+        $sel_where[]  = ['t.type','=',1];
+        $list = UserDownload::where($sel_where)
+            ->alias('t')
+            ->field('t.id,t.create_at,t.first_id datum_id,t.second_id url_id,i.title,i.is_vip,i.url')
+            ->leftJoin('DatumUrl i','t.second_id = i.id')
+            ->order('id desc')
+            ->limit($this->off_set,$this->page_num)
+            ->select()->toArray();
+        $this->success('ok',['list'=>$list]);
+    }
+
+
+
 }

+ 9 - 0
application/common/model/UserDownload.php

@@ -0,0 +1,9 @@
+<?php
+namespace app\common\model;
+use think\Model;
+// 会员下载
+class UserDownload extends Model
+{
+
+
+}