wupengfei 2 år sedan
förälder
incheckning
58cfde78a9

+ 13 - 6
.idea/workspace.xml

@@ -2,7 +2,14 @@
 <project version="4">
   <component name="ChangeListManager">
     <list default="true" id="1a36929e-c054-4875-a943-593a74e55fa4" name="Default Changelist" comment="">
-      <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" />
+      <change afterPath="$PROJECT_DIR$/application/nutrition/controller/ArticleComment.php" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/application/nutrition/view/article_comment/form.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/application/nutrition/view/article_comment/index.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/application/nutrition/view/article_comment/index_search.html" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/nutrition/controller/OneArticle.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/nutrition/controller/OneArticle.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/nutrition/controller/VideoComment.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/nutrition/controller/VideoComment.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/application/nutrition/view/one_article/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/nutrition/view/one_article/index.html" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -120,7 +127,7 @@
     <property name="WebServerToolWindowPanel.toolwindow.show.date" value="false" />
     <property name="WebServerToolWindowPanel.toolwindow.show.permissions" value="false" />
     <property name="WebServerToolWindowPanel.toolwindow.show.size" value="false" />
-    <property name="last_opened_file_path" value="$PROJECT_DIR$/../gaoyix_old" />
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/application/nutrition/view" />
     <property name="node.js.detected.package.eslint" value="true" />
     <property name="node.js.detected.package.tslint" value="true" />
     <property name="node.js.path.for.package.eslint" value="project" />
@@ -131,9 +138,9 @@
   </component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
-      <recent name="D:\zs\gaoyixia\application\nutrition\view\video_comment" />
       <recent name="D:\zs\gaoyixia\application\nutrition\view" />
       <recent name="D:\zs\gaoyixia\application\nutrition\controller" />
+      <recent name="D:\zs\gaoyixia\application\nutrition\view\video_comment" />
       <recent name="D:\zs\gaoyixia\vendor" />
       <recent name="D:\zs\gaoyixia\application\api\controller" />
     </key>
@@ -181,7 +188,7 @@
       <workItem from="1660697982291" duration="9650000" />
       <workItem from="1660730926670" duration="1018000" />
       <workItem from="1660783282150" duration="17421000" />
-      <workItem from="1660870368036" duration="11071000" />
+      <workItem from="1660870368036" duration="12108000" />
     </task>
     <servers />
   </component>
@@ -197,10 +204,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="1658907037019">
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog" timestamp="1660893338386">
       <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="1658907037019" />
+    <state x="1106" y="469" key="#com.jetbrains.php.actions.copyPaste.importReferences.PhpImportReferencesDialog/0.0.2560.1400@0.0.2560.1400" timestamp="1660893338386" />
     <state x="283" y="145" width="1942" height="1088" key="DiffContextDialog" timestamp="1660792261626">
       <screen x="0" y="0" width="2560" height="1400" />
     </state>

+ 103 - 0
application/nutrition/controller/ArticleComment.php

@@ -0,0 +1,103 @@
+<?php
+namespace app\Nutrition\controller;
+use app\common\model\DatumIntro;
+use app\common\model\VideoIntro;
+use library\Controller;
+use app\common\model\VideoCate;
+use function AlibabaCloud\Client\value;
+
+/**
+ * 图文评论
+ * Class VideoComment
+ * @package app\Nutrition\controller
+ */
+class ArticleComment extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'ArticleComment';
+    /**
+     * 列表
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function index()
+    {
+        $this->title = '视频列表';
+        $this->article_id = input('article_id');
+        $this->item_id = input('item_id');
+        $sel_where = [];
+        $sel_where[] = ['c.is_deleted','=',0];
+        $sel_where[] = ['c.article_id','=',$this->article_id];
+        $sel_where[] = ['c.item_id','=',$this->item_id];
+        if($content = $this->request->get('content'))$sel_where[] = ['c.content','like','%'.$content.'%'];
+        if($name = $this->request->get('name'))$sel_where[] = ['u.name','like','%'.$name.'%'];
+        $query = $this->_query($this->table)->alias('c')
+            ->field('c.*,u.name,u.headimg')
+            ->leftJoin("store_member u",'u.id = c.user_id')
+            ->where($sel_where)->order('id desc')->page();
+    }
+
+    /**
+     * 数据列表处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(&$data)
+    {
+
+
+    }
+
+    // 回复
+    public function reply()
+    {
+        $this->title = '回复';
+        $this->_form($this->table, 'form');
+    }
+
+
+    /**
+     * 删除
+     * @auth true
+     * @menu true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function del()
+    {
+        $this->_save($this->table, ['is_deleted' => 1]);
+    }
+
+
+    /**
+     * 表单数据处理
+     * @auth true
+     * @menu true
+     * @param array $data
+     */
+    protected function _form_filter(&$data)
+    {
+        if($this->request->isGet()) {
+            $this->source_id = $data['source_id'] ? $data['source_id'] : $data['id'];
+        }
+    }
+
+
+
+
+}

+ 3 - 1
application/nutrition/controller/OneArticle.php

@@ -55,7 +55,9 @@ class OneArticle extends Controller
     protected function _index_page_filter(&$data)
     {
 
-
+        foreach ($data as &$v) {
+            $v['item_id'] = \app\common\model\ArticleItem::where(['article_id'=>$v['id']])->value('id');
+        }
     }
 
 

+ 1 - 1
application/nutrition/controller/VideoComment.php

@@ -63,7 +63,7 @@ class VideoComment extends Controller
     // 回复
     public function reply()
     {
-        $this->title = '编辑分类';
+        $this->title = '回复';
         $this->_form($this->table, 'form');
     }
 

+ 28 - 0
application/nutrition/view/article_comment/form.html

@@ -0,0 +1,28 @@
+<form onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
+
+    <div class="layui-card-body">
+
+        <div class="layui-row margin-bottom-15">
+            <label class="layui-col-xs2 think-form-label">回复内容:</label>
+            <label class="layui-col-xs10">
+                <textarea name="content" rows="10" cols="100"></textarea>
+            </label>
+        </div>
+        <input type="hidden" name="article_id" value="{$vo.article_id|default=0}">
+        <input type="hidden" name="item_id" value="{$vo.item_id|default=0}">
+        <input type="hidden" name="lev" value="{$vo.lev + 1}">
+        <input type="hidden" name="pid" value="{$vo.id}">
+        <input type="hidden" name="source_id" value="{$source_id}">
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    <div class="layui-form-item text-center">
+
+
+        <button class="layui-btn" type='submit'>提交</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-close>取消</button>
+    </div>
+</form>
+<script>
+    window.form.render();
+</script>

+ 75 - 0
application/nutrition/view/article_comment/index.html

@@ -0,0 +1,75 @@
+{extend name='admin@main'}
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='article_comment/index_search'}
+    <table class="layui-table margin-top-20" lay-skin="line">
+        <thead>
+        <tr>
+            <th class='text-left nowrap' >用户</th>
+            <th class='text-left ' style="width: 60%">评论内容</th>
+            <th class='text-left nowrap' >时间</th>
+            <th class="text-left nowrap">操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='text-left nowrap'>
+                <img data-tips-image style="width:50px;height:50px" src="{$vo.headimg|default=''}" class="margin-right-5 text-top">
+                <div class="inline-block">
+                    用户ID:{$vo.user_id|default='--'}<br>
+                    用户昵称:{$vo.name|default='后台回复'}
+                </div>
+            </td>
+            <td class='text-left '>{$vo.content|default=''}</td>
+            <td class='text-left nowrap'>{$vo.create_at|default=''}</td>
+            <td class='text-left' style="width: 20%">
+                <a data-title="回 复" class="layui-btn layui-btn-xs" data-modal='{:url("reply")}?id={$vo.id}'>回 复</a>
+                <span class="layui-btn layui-btn-xs layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+</div>
+<script>
+    function btn_confirm(msg,fun,id) {
+        layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
+            var url = "/nutrition/article_comment/"+fun;
+            layer.closeAll();
+            $.ajax({
+                type: "post",
+                url: url,
+                data: {id:id},
+                dataType: "json",
+                async: false,
+                success: function (data) {
+                    layer.msg(data.info);
+                    setTimeout(function () {
+                        window.location.reload();
+                    },1000)
+                }
+            });
+        });
+    }
+
+    $(document).on("click",'.video_player',function () {
+        vUrl = $(this).data('src');  //获取到播放的url
+        var loadstr = '<video width="100%" height="100%"  controls="controls" autobuffer="autobuffer"  autoplay="autoplay" loop="loop">' +
+            '<source src='+vUrl+' type="video/mp4"></source></video>';
+        layer.open({
+            type: 1,
+            title: false,
+            area: ['730px', '500px'],
+            shade: [0.8, 'rgb(14, 16, 22)'],
+            skin: 'demo-class',
+            content: loadstr
+        });
+        form.render();
+    });
+</script>
+{/block}
+
+
+

+ 24 - 0
application/nutrition/view/article_comment/index_search.html

@@ -0,0 +1,24 @@
+<fieldset>
+    <legend>条件搜索</legend>
+    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
+
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">用户名</label>
+            <div class="layui-input-inline">
+                <input name="name" value="{$Think.get.name|default=''}" placeholder="用户名" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <label class="layui-form-label">内容</label>
+            <div class="layui-input-inline">
+                <input name="content" value="{$Think.get.content|default=''}" placeholder="请输入内容" class="layui-input">
+            </div>
+        </div>
+
+        <div class="layui-form-item layui-inline">
+            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
+        </div>
+    </form>
+    <script>form.render()</script>
+</fieldset>

+ 1 - 0
application/nutrition/view/one_article/index.html

@@ -31,6 +31,7 @@
                 {else}
                 <span class="layui-btn layui-btn-sm layui-btn-sm"  onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
                 {/if}
+                <span data-title="评论" class="layui-btn layui-btn-sm" data-open='{:url("/nutrition/article_comment/index")}?item_id={$vo.item_id}&article_id={$vo.id}'>评 论</span>
                 <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
             </td>
         </tr>