wupengfei 2 years ago
parent
commit
a92c6d7722

+ 7 - 3
.idea/workspace.xml

@@ -4,6 +4,8 @@
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
       <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/nutrition/controller/VideoManage.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/nutrition/controller/VideoManage.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/nutrition/view/video_manage/form.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/nutrition/view/video_manage/form.html" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -194,7 +196,9 @@
       <workItem from="1661562002670" duration="630000" />
       <workItem from="1661603228299" duration="3000" />
       <workItem from="1661751927270" duration="2529000" />
-      <workItem from="1661820078372" duration="7810000" />
+      <workItem from="1661820078372" duration="10320000" />
+      <workItem from="1661907613254" duration="3462000" />
+      <workItem from="1661993127835" duration="9335000" />
     </task>
     <servers />
   </component>
@@ -242,10 +246,10 @@
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
     <state x="459" y="215" width="1942" height="1088" key="com.intellij.history.integration.ui.views.FileHistoryDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1658395058691" />
-    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog" timestamp="1661821184606">
+    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog" timestamp="1661995719738">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>
-    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1661821184606" />
+    <state x="1059" y="515" key="com.intellij.ide.util.TipDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1661995719738" />
     <state x="1166" y="605" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1661761449593">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 48 - 0
application/api/controller/Video.php

@@ -169,6 +169,54 @@ class Video extends Base
     }
 
     /**
+     * @title 获取推荐视频列表【不分页】
+     * @desc 获取推荐视频列表【不分页】
+     * @author qc
+     * @method GET
+     * @url /api/Video/getRecommendVideoList
+     * @header name:Authorization require:1 desc:Token
+     * @param  name:title type:string default:-- desc:标题
+     */
+    public function getRecommendVideoList()
+    {
+        $app_name = sysconf('app_name');
+        $app_logo = sysconf('app_logo');
+        $where_str = 'id > 0';
+        $search_log =  UserSearch::getSearchTitle($this->user_id,1);
+        $search_arr = [];
+        foreach ($search_log as $t){
+            $search_arr[] =  " title like '".'%'.$t."%'" .' ';
+        }
+        if(!empty($search_arr)) $where_str  =  implode(' OR ',$search_arr);
+        $list = VideoUrl::where($where_str)->order('id desc')->limit(0,20)->select()->toArray();
+        $rand_num = 0;
+        if(count($list) < 20)$rand_num =  20 - count($list);
+        if($rand_num > 0) {
+            $rand_list = VideoUrl::where(function ($query)use($rand_num,$list){
+                if(!empty($search_ids)){
+                    $search_ids = array_column($list,'id');
+                    $all_ids = VideoUrl::where(['is_deleted'=>0])->where('id not in '.implode(',',$search_ids))->column('id,title','id');
+                    $rand_ids = array_keys($all_ids);
+                    if(count($all_ids) > $rand_num) $rand_ids = array_rand($all_ids,$rand_num);
+                    return $query->where('id','in',implode(',',$rand_ids));
+                }
+            })->limit(0,$rand_num)->toArray();
+           if(!empty($rand_list)) $list = array_merge($list,$rand_list);
+        }
+
+        array_walk($list,function (&$v,$k)use ($app_name,$app_logo){
+            $v['is_collect'] = UserCollect::checkCollectByType($this->user_id,1,$v['video_id'],$v['id']);
+            $v['label_name'] = explode(',',trim($v['label'],','));
+            $v['app_name']  = $app_name;
+            $v['app_logo']  = $app_logo;
+        });
+
+
+    }
+
+
+
+    /**
      * @title 获取视频详情(平台)
      * @desc 获取视频详情
      * @author qc

+ 1 - 0
application/nutrition/controller/VideoManage.php

@@ -212,6 +212,7 @@ class VideoManage extends Controller
                     'datum_item'=>input('post.datum_item'),
                     'up_type'=>input('post.up_type'),
                     'ppt'=>input('post.ppt'),
+                    'label'=>input('post.label'),
                 ],'video_id',['video_id'=>$result]);
                 $up = [];
                 $up['video_url'] = $url;

+ 2 - 1
application/nutrition/view/video_manage/form.html

@@ -122,8 +122,9 @@
             <div class="layui-form-item">
                 <label class="layui-form-label label-required">标签</label>
                 <div class="layui-input-block">
-                    <input name="label" maxlength="100"  value='{$vo.label|default=""}' placeholder="请输入标签" class="layui-input">
+                    <input name="label" maxlength="100"  value='{$video_url.label|default=""}' placeholder="请输入标签" class="layui-input">
                 </div>
+                <span>多个用逗号隔开(半角)</span>
             </div>
 
             <input type="hidden" name="type" value="{$type}">