544782275@qq.com 3 years ago
parent
commit
a464d7c194

+ 95 - 0
application/store/controller/Comment.php

@@ -0,0 +1,95 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | ThinkAdmin
+// +----------------------------------------------------------------------
+// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
+// +----------------------------------------------------------------------
+// | 官方网站: http://demo.thinkadmin.top
+// +----------------------------------------------------------------------
+// | 开源协议 ( https://mit-license.org )
+// +----------------------------------------------------------------------
+// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
+// | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
+// +----------------------------------------------------------------------
+
+namespace app\store\controller;
+
+use library\Controller;
+use library\tools\Data;
+use think\Db;
+
+/**
+ * 评论列表
+ * Class GoodsCate
+ * @package app\store\controller
+ */
+class Comment extends Controller
+{
+    /**
+     * 绑定数据表
+     * @var string
+     */
+    protected $table = 'StoreComment';
+
+    /**
+     * 评论管理
+     * @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()
+    {
+        $goods_id = input('goods_id');
+        if(empty($goods_id)){
+            $this->error('非法操作');
+        }
+        $this->title = '评论列表管理';
+        $query = $this->_query($this->table);
+        $where[]=['a.status','=',1];
+        $where[]=['a.forum_id','=',$goods_id];
+        $where[]=['a.forum_type','=',1];
+        if($this->request->request('phone')){
+            $where[]=['m.phone','like','%'.$this->request->request('phone').'%'];
+        }
+        if($this->request->request('name')){
+            $where[]=['m.name','like','%'.$this->request->request('name').'%'];
+        }
+        if($this->request->request('content')){
+            $where[]=['a.content','like','%'.$this->request->request('content').'%'];
+        }
+        $query
+            ->alias('a')
+            ->join('store_member m','a.user_id = m.id')
+            ->where($where)
+            ->order('a.id desc')
+            ->page();
+    }
+
+    /**需求列表处理
+     * @param array $data
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    protected function _index_page_filter(array &$data)
+    {
+        $mids = array_unique(array_merge(array_column($data, 'user_id'), array_column($data, 'from_mid')));
+        $memberList = Db::name('StoreMember')->whereIn('id', $mids)->select();
+        foreach ($data as &$vo) {
+            if($vo['images']){
+                $vo['images'] = image_path($vo['images']);
+            }
+            list($vo['member'], $vo['from_member'], $vo['list']) = [[], [], []];
+
+            foreach ($memberList as $member) if ($member['id'] === $vo['user_id']) {
+                $vo['member'] = $member;
+            }
+        }
+    }
+
+}

+ 58 - 0
application/store/view/comment/index.html

@@ -0,0 +1,58 @@
+{extend name='admin@main'}
+
+{block name="content"}
+<div class="think-box-shadow">
+    {include file='comment/index_search'}
+    <table class="layui-table margin-top-10" lay-skin="line">
+        {notempty name='list'}
+        <thead>
+        <tr>
+            <th class='list-table-check-td think-checkbox'>
+                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
+            </th>
+            <th class="text-left nowrap">用户信息</th>
+            <th class='text-left nowrap'>评论内容</th>
+            <th class='text-left nowrap'>评论类型</th>
+            <th class='text-left nowrap'>回复那条评论的内容</th>
+            <th class='text-left nowrap'>时间</th>
+            <th class='text-left nowrap'>操作</th>
+        </tr>
+        </thead>
+        {/notempty}
+        <tbody>
+        {foreach $list as $key=>$vo}
+        <tr>
+            <td class='list-table-check-td think-checkbox'><input class="list-check-box" value='{$vo.id}' type='checkbox'></td>
+            <td class="text-left nowrap relative">
+                {notempty name='vo.member.headimg'}
+                <img data-tips-image style="width:40px;height:40px" src="{$vo.member.headimg|default=''}" class="margin-right-5 text-top">
+                {/notempty}
+                <div class="inline-block">
+                    姓名:{$vo.member.name|default='--'}<br>
+                    手机号:{$vo.member.phone|default='--'}<br>
+                </div>
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.content}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.type_name}
+            </td>
+            <td class='text-left nowrap'>
+                {$vo.apply_content|default='--'}
+            </td>
+            <td class='text-left nowrap'>
+               {$vo.create_at}
+            </td>
+            <td class='text-center nowrap'>
+                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
+            </td>
+        </tr>
+        {/foreach}
+        </tbody>
+    </table>
+
+    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
+
+</div>
+{/block}

+ 32 - 0
application/store/view/comment/index_search.html

@@ -0,0 +1,32 @@
+<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="phone" value="{$Think.get.phone|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="nickname" value="{$Think.get.nickname|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="question" value="{$Think.get.question|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>
+        window.form.render();
+    </script>
+</fieldset>

+ 1 - 1
application/store/view/goods/index.html

@@ -69,7 +69,7 @@
                         <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1">上 架</a>
                     {/if}
 
-                    <a data-title="余额列表" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("store/worker_balance/index")}?worker_id={$vo.id}'>余额列表</a>
+                    <a data-title="评论列表" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("store/comment/index")}?goods_id={$vo.id}'>评论列表</a>
 
                     {if auth("store/goods/remove")}
                         <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>