Browse Source

'服务管理模块'

Ethan 6 years ago
parent
commit
7edeac114f

+ 6 - 2
application/admin/controller/AdminControl.php

@@ -230,13 +230,17 @@ class AdminControl extends Controller
                         'text' => '服务列表',
                         'url' => url('Server/index'),
                     ),
+                    'fartherList' => array(
+                        'text' => '服务类别列表',
+                        'url' => url('Server/fartherList'),
+                    ),
                     'term' => array(
                         'text' => '服务购买期限',
-                        'url' => url('Recharge/examine'),
+                        'url' => url('Server/renewalList'),
                     ),
                     'serverUser' => array(
                         'text' => '用户服务列表',
-                        'url' => url('Recharge/examine'),
+                        'url' => url('Server/userServer'),
                     ),
                 ),
             ),

+ 2 - 3
application/admin/controller/Homeinfo.php

@@ -57,15 +57,14 @@ class Homeinfo extends AdminControl
                 $files = $files->setSaveName($oldFileName);//设置保存文件名
                 $imgt = $files->move($imgurl, $savename = $oldFileName, $replace = true);
                 if($imgt){
-                    $update_array['site_logowx'] = $oldFileName.'.png';
                     $img = 1;
                 }
             }
             $result = model('homeinformation')->updateHomeInformation($homeinformation_id, $updateData);
             if ($result || $img) {
-                dsLayerOpenSuccess(lang('member_edit_succ'));
+                dsLayerOpenSuccess("编辑成功");
             } else {
-                $this->error(lang('member_edit_fail'));
+                $this->error("操作失败");
             }
         }
     }

+ 282 - 5
application/admin/controller/Server.php

@@ -14,16 +14,12 @@ class Server extends AdminControl
         Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/member.lang.php');
     }
 
-    /**
-     * 充值列表
-     * @return mixed
-     */
     public function index()
     {
         $productModel = Model('Product');
         $fartherProduct = $productModel->getFartherList();
         $this->assign('fartherProduct',  $fartherProduct);
-        $fartherId = input('get.fartherId') ?? $fartherProduct[0]->product_id;
+        $fartherId = input('get.id') ?? $fartherProduct[0]->product_id;
         $this->assign('id',  $fartherId);
         $sonProductWhere['product_pid'] = $fartherId;
         $sonProduct = $productModel->getSonList($sonProductWhere);
@@ -32,5 +28,286 @@ class Server extends AdminControl
 
         return $this->fetch();
     }
+    public function add()
+    {
+        $productModel = Model('Product');
+        $product_pid = input('param.id');
+        if (!request()->isPost()) {
+            return $this->fetch('form');
+        } else {
+            $files = request()->file('product_img');
+            $product_name = input('post.product_name');
+            $product_content = input('post.product_content');
+            $product_money = input('post.product_money');
+            $product_status = input('post.product_status');
+            $product_TypeOne = input('post.product_TypeOne');
+            $product_TypeTwo = input('post.product_TypeTwo');
+            $product_TypeFour = input('post.product_TypeFour');
+            $product_TypeThree = input('post.product_TypeThree');
+            if (!$product_name || !$files || !$product_content || !$product_money || !$product_status
+                || !$product_TypeOne || !$product_TypeTwo || !$product_TypeFour || !$product_TypeThree) {
+                $this->error("操作失败");
+            }
+            $addData = array(
+                'product_name' => $product_name,
+                'product_pid' => $product_pid,
+                'product_content' => $product_content,
+                'product_money' => $product_money,
+                'product_status' => $product_status,
+                'product_TypeOne' => $product_TypeOne,
+                'product_TypeTwo' => $product_TypeTwo,
+                'product_TypeFour' => $product_TypeFour,
+                'product_TypeThree' => $product_TypeThree,
+            );
+            $imgurl = DS_THEME_UPLOADS_URL . '\home';
+            $fileName = ImgName();
+            $files = $files->setSaveName($fileName);//设置保存文件名
+            $imgt = $files->move($imgurl, $savename = $fileName, $replace = true);
+            if($imgt){
+                $addData['product_img'] = '/home/' . $fileName.'.png';
+            }
+            $result = $productModel->addProduct($addData);
+            if ($result) {
+                dsLayerOpenSuccess("新增成功");
+            } else {
+                $this->error("操作失败");
+            }
+        }
+    }
+    public function delete()
+    {
+        $product_id = intval(input('param.product_id'));
+        if ($product_id) {
+            $condition['product_id'] = $product_id;
+            $result = model('Product')->deleteProduct($condition);
+            if ($result) {
+                $this->log(lang('ds_product').'-'.lang('del_succ') . '[' . $product_id . ']', null);
+                ds_json_encode(10000, lang('del_succ'));
+            } else {
+                ds_json_encode(10001, lang('del_fail'));
+            }
+        } else {
+            ds_json_encode(10001, lang('del_fail'));
+        }
+    }
+    public function fartherList()
+    {
+        $productModel = Model('Product');
+        $fartherProduct = $productModel->getFartherList();
+        $this->assign('fartherProduct',  $fartherProduct);
+        return $this->fetch('fartherList');
+    }
+    public function fartherEdit()
+    {
+        $productModel = Model('Product');
+        $product_id = input('post.product_id');
+        $status = input('post.status');
+        $product_name= input('post.product_name');
+        if ($product_id) {
+            $updateData = array(
+                'product_name' => $product_name,
+                'product_status' => $status,
+            );
+            $result = $productModel->updateProduct($product_id, $updateData);
+            if ($result) {
+                return ["msg"=>"编辑成功"];
+            } else {
+                return ["msg"=>"操作失败"];
+            }
+        } else {
+            $nowDate = date('Y-m-d H:i:s');
+            $addData = array(
+                'product_name' => $product_name,
+                'product_status' => $status,
+                'product_content' => '',
+                'product_updatetime' => $nowDate,
+                'product_addtime' => $nowDate,
+                'product_pid' => 0,
+            );
+            $result = $productModel->addProduct($addData);
+            if ($result) {
+                return ["msg"=>"新增成功"];
+            } else {
+                return ["msg"=>"操作失败"];
+            }
+        }
+    }
+    public function edit()
+    {
+        $productModel = Model('Product');
+        $product_id = input('param.product_id');
+        if (!request()->isPost()) {
+            $productWhere['product_id'] = $product_id;
+            $product = $productModel->findProduct($productWhere);
+            $this->assign('product',  $product);
+            return $this->fetch('form');
+        } else {
+            $updateData = array(
+                'product_name' => input('post.product_name'),
+                'product_content' => input('post.product_content'),
+                'product_money' => input('post.product_money'),
+                'product_status' => input('post.product_status'),
+                'product_TypeOne' => input('post.product_TypeOne'),
+                'product_TypeTwo' => input('post.product_TypeTwo'),
+                'product_TypeFour' => input('post.product_TypeFour'),
+                'product_TypeThree' => input('post.product_TypeThree'),
+            );
+            $files = request()->file('product_img');
+            if($files){
+                $imgurl = DS_THEME_UPLOADS_URL . '\home';
+                $fileName = ImgName();
+                $files = $files->setSaveName($fileName);//设置保存文件名
+                $imgt = $files->move($imgurl, $savename = $fileName, $replace = true);
+                if($imgt){
+                    $updateData['product_img'] = '/home/' . $fileName.'.png';
+                }
+            }
+            $result = $productModel->updateProduct($product_id, $updateData);
+            if ($result) {
+                dsLayerOpenSuccess("编辑成功");
+            } else {
+                $this->error("操作失败");
+            }
+        }
+    }
+    public function info()
+    {
+        $productInfoModel = Model('Productinfo');
+        $product_id = input('param.product_id');
+        $productInfoWhere['product_id'] = $product_id;
+        $productInfo = $productInfoModel->getProductInfo($productInfoWhere);
+        $this->assign('productInfo', $productInfo);
+        return $this->fetch('information');
+    }
+    public function deleteInfo()
+    {
+        $productInfo_id = intval(input('param.productInfo_id'));
+        if ($productInfo_id) {
+            $condition['productInfo_id'] = $productInfo_id;
+            $result = model('Productinfo')->deleteProductInfo($condition);
+            if ($result) {
+                $this->log(lang('ds_productinfo').'-'.lang('del_succ') . '[' . $productInfo_id . ']', null);
+                ds_json_encode(10000, lang('del_succ'));
+            } else {
+                ds_json_encode(10001, lang('del_fail'));
+            }
+        } else {
+            ds_json_encode(10001, lang('del_fail'));
+        }
+    }
+    public function addInfo()
+    {
+        $productInfoModel = Model('Productinfo');
+        $product_id = input('param.product_id');
+        if (!request()->isPost()) {
+            return $this->fetch('infoForm');
+        } else {
+            $productInfo_title = input('post.productInfo_title');
+            $productInfo_content = input('post.productInfo_content');
+            $files = request()->file('productInfo_img');
+            if (!$productInfo_title || !$productInfo_content || !$files) {
+                $this->error("操作失败");
+            }
+            $addData = array(
+                'productInfo_title' => $productInfo_title,
+                'productInfo_content' => $productInfo_content,
+                'product_id' => $product_id,
+            );
+            $imgurl = DS_THEME_UPLOADS_URL . '\home';
+            $fileName = ImgName();
+            $files = $files->setSaveName($fileName);//设置保存文件名
+            $imgt = $files->move($imgurl, $savename = $fileName, $replace = true);
+            if ($imgt) {
+                $addData['productInfo_img'] = '/home/' . $fileName . '.png';
+            }
+            $result = $productInfoModel->addProductInfo($addData);
+            if ($result) {
+                dsLayerOpenSuccess("添加成功");
+            } else {
+                $this->error("操作失败");
+            }
+        }
+    }
+    public function editInfo()
+    {
+        $productInfoModel = Model('Productinfo');
+        $productInfo_id = input('param.productInfo_id');
+        if (!request()->isPost()) {
+            $productInfoWhere['productInfo_id'] = $productInfo_id;
+            $productInfo = $productInfoModel->findProductInfo($productInfoWhere);
+            $this->assign('productInfo', $productInfo);
+
+            return $this->fetch('infoForm');
+        } else {
+            $updateData = array(
+                'productInfo_title' => input('post.productInfo_title'),
+                'productInfo_content' => input('post.productInfo_content'),
+            );
+            $files = request()->file('productInfo_img');
+            if($files){
+                $imgurl = DS_THEME_UPLOADS_URL . '\home';
+                $fileName = ImgName();
+                $files = $files->setSaveName($fileName);//设置保存文件名
+                $imgt = $files->move($imgurl, $savename = $fileName, $replace = true);
+                if($imgt){
+                    $updateData['productInfo_img'] = '/home/' . $fileName.'.png';
+                }
+            }
+            $result = $productInfoModel->updateProductInfo($productInfo_id, $updateData);
+            if ($result) {
+                dsLayerOpenSuccess("编辑成功");
+            } else {
+                $this->error("操作失败");
+            }
+        }
+    }
+    public function renewalList()
+    {
+        $renewalModel = Model('Renewal');
+        $renewal = $renewalModel->getRenewal();
+        $this->assign('renewal',  $renewal);
+        return $this->fetch('renewalList');
+    }
+    public function renewalEdit()
+    {
+        $renewalModel = Model('Renewal');
+        $renewal_identity = input('post.renewal_identity');
+        $status = input('post.status');
+        $renewal_name = input('post.renewal_name');
+        $renewal_day = input('post.renewal_day');
+        $updateData = array(
+            'renewal_name' => $renewal_name,
+            'renewal_status' => $status,
+            'renewal_day' => $renewal_day,
+        );
+        $result = $renewalModel->updateRenewal($renewal_identity, $updateData);
+        if ($result) {
+            return ["msg"=>"编辑成功"];
+        } else {
+            return ["msg"=>"操作失败"];
+        }
+    }
+    public function userServer()
+    {
+        $UserProductModel = Model('Userproduct');
+        $userName = input('get.user_name');
+        $productName = input('get.product_name');
+        $userProductIdentity = input('get.userProduct_identity');
+        $userProductWhere = [];
+        if ($userName) {
+            $userProductWhere['user_email'] = $userName;
+        }
+        if ($productName) {
+            $userProductWhere['product_name'] = $productName;
+        }
+        if ($userProductIdentity) {
+            $userProductWhere['userProduct_identity'] = $userProductIdentity;
+        }
+        $userproduct = $UserProductModel->getUserproduct($userProductWhere);
+        $this->assign('userproduct',  $userproduct);
+        $this->assign('show_page',  $userproduct->render());
+
+        return $this->fetch('userServer');
+    }
 
 }

+ 27 - 0
application/admin/model/Product.php

@@ -20,6 +20,33 @@ class Product extends Model
             ->select();
         return $result;
     }
+    public function findProduct($condition)
+    {
+        $result = $this
+            ->where($condition)
+            ->find();
+        return $result;
+    }
+    public function updateProduct($id, $data)
+    {
+        $result = $this
+            ->where(['product_id' => $id])
+            ->update($data);
+        return $result;
+    }
+    public function addProduct($data)
+    {
+        $result = $this
+            ->insert($data);
+        return $result;
+    }
+    public function deleteProduct($condition)
+    {
+        $result = $this
+            ->where($condition)
+            ->delete();
+        return $result;
+    }
 
 
 }

+ 44 - 0
application/admin/model/Productinfo.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+class Productinfo extends Model
+{
+    public function getProductInfo($condition)
+    {
+        $result = $this
+            ->where($condition)
+            ->select();
+        return $result;
+    }
+    public function findProductInfo($condition)
+    {
+        $result = $this
+            ->where($condition)
+            ->find();
+        return $result;
+    }
+    public function updateProductInfo($id, $data)
+    {
+        $result = $this
+            ->where(['productInfo_id' => $id])
+            ->update($data);
+        return $result;
+    }
+    public function deleteProductInfo($condition)
+    {
+        $result = $this
+            ->where($condition)
+            ->delete();
+        return $result;
+    }
+    public function addProductInfo($data)
+    {
+        $result = $this
+            ->insert($data);
+        return $result;
+    }
+
+}

+ 31 - 0
application/admin/model/Renewal.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+class Renewal extends Model
+{
+    public function getRenewal()
+    {
+        $result = $this
+            ->select();
+        return $result;
+    }
+    public function findRenewal($condition)
+    {
+        $result = $this
+            ->where($condition)
+            ->find();
+        return $result;
+    }
+    public function updateRenewal($id, $data)
+    {
+        $result = $this
+            ->where(['renewal_id' => $id])
+            ->update($data);
+        return $result;
+    }
+
+
+}

+ 30 - 0
application/admin/model/Userproduct.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+class Userproduct extends Model
+{
+    public function getUserproduct($condition)
+    {
+        $select = [
+            'userProduct_dayNumber',
+            'userProduct_buyTime',
+            'userProduct_identity',
+            'userProduct_maturityTime',
+            'user_email',
+            'product_name',
+        ];
+        $result = $this
+            ->field($select)
+            ->alias('a')
+            ->join('user b', 'a.user_id = b.user_id')
+            ->join('product c', 'a.product_id = c.product_id')
+            ->where($condition)
+            ->paginate(10);
+        return $result;
+    }
+
+
+}

+ 1 - 1
application/admin/view/index/index.html

@@ -10,7 +10,7 @@
     <link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/layui/css/layui.css">
     <link rel="stylesheet" href="{$Think.ADMIN_SITE_ROOT}/css/admin.css">
     <link rel="stylesheet" href="{$Think.ADMIN_SITE_ROOT}/iconfont/iconfont.css">
-    <link rel="stylesheet" href="http://at.alicdn.com/t/font_1245784_bnygl9xu8eq.css">
+    <link rel="stylesheet" href="http://at.alicdn.com/t/font_1247714_vnxzcw7mpo.css">
     <script src="{$Think.PLUGINS_SITE_ROOT}/jquery-2.1.4.min.js"></script>
     <script src="{$Think.ADMIN_SITE_ROOT}/js/admin.js"></script>
     <script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/layui/layui.js"></script>

+ 141 - 0
application/admin/view/server/fartherList.html

@@ -0,0 +1,141 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    <div class="layui-layer-shade recharge-layui-layer-shade4" id="layui-layer-shade4" times="4" style="display: none;"></div>
+    <div style="display: none;" class="layui-layer layui-layer-dialog recharge-layui-layer2" id="layui-layer3" type="dialog" times="2" showtime="0" contype="string">
+        <div id="layui-layer-content2" class="layui-layer-content"></div>
+        <span class="layui-layer-setwin" onclick="hiddenTips2()"><a class="layui-layer-ico layui-layer-close layui-layer-close2"
+                                                                    href="javascript:;"></a></span>
+        <div class="layui-layer-btn layui-layer-btn-" onclick="hiddenTips2()"><a class="layui-layer-btn0">确定</a></div>
+        <span class="layui-layer-resize"></span>
+    </div>
+    <div style="display: none;" class="layui-layer layui-layer-dialog recharge-layui-layer2" id="layui-layer2" type="dialog" times="2" showtime="0" contype="string">
+        <div class="layui-tab">
+            <div class="layui-tab-content page-tab-content">
+                <div class="layui-tab-item layui-show" style="width: 300px; height: 150px">
+                    <input name="product_id" id="product_id" style="display: none">
+                    <div class="layui-form-item">
+                        <label class="layui-form-label">服务名称</label>
+                        <div class="layui-input-block">
+                            <input type="text" class="layui-input field-name" name="product_name" id="product_name" autocomplete="off" placeholder="请输入服务名称" required />
+                        </div>
+                    </div>
+                    <div class="layui-form-item">
+                        <label class="layui-form-label">状态</label>
+                        <div class="layui-inline">
+                            <select style="width: 90px;" name="type" id="status" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                                <option value="1">启用</option>
+                                <option value="0">停用</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="layui-form-item" style="margin-top: 20px">
+                        <div class="layui-input-block">
+                            <input type="submit" class="layui-btn layui-btn-normal" lay-submit onclick="submit()"
+                                   value="确认"/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <span class="layui-layer-setwin" onclick="hiddenTips()">
+            <a class="layui-layer-ico layui-layer-close layui-layer-close2" href="javascript:;"></a>
+        </span>
+        <span class="layui-layer-resize"></span>
+    </div>
+    <div class="layui-tab-content page-tab-content">
+        <a  onclick="getForm('', '')" class="layui-btn layui-btn-normal"><i class="layui-icon layui-icon-add-circle"></i>新增</a>
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>ID</th>
+                <th>服务类名称</th>
+                <th>状态</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if count($fartherProduct)}
+            {volist name="fartherProduct" id="value"}
+            <tr>
+                <td>{$value.product_id}</td>
+                <td>{$value.product_name}</td>
+                <td>{$value.product_status == 1 ? '启用' : '下线'}</td>
+                <td style="width: 150px">
+                    <a onclick="getForm({$value.product_id}, '{$value.product_name}')" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td colspan="99" style="text-align: center">无数据</td>
+            {/if}
+            </tbody>
+        </table>
+    </div>
+</div>
+<script>
+    const myHost = "http://" + window.location.host;
+    function getForm(product_id, product_name) {
+        $("#product_id").val(product_id);
+        if (product_name) {
+            $("#product_name").val(product_name);
+        }
+        $("#layui-layer2").attr("style","display: block")
+        $("#layui-layer-shade4").attr("style","display: block")
+    }
+    function hiddenTips() {
+        $("#layui-layer2").attr("style","display: none")
+        $("#layui-layer-shade4").attr("style","display: none")
+    }
+    function hiddenTips2() {
+        $("#layui-layer3").attr("style","display: none")
+        $("#layui-layer-shade4").attr("style","display: none")
+        window.location.href = myHost + "/Admin/Server/fartherList.html";
+    }
+    function submit() {
+        let url = myHost + "/Admin/Server/fartherEdit.html";
+        let product_name = $("#product_name").val();
+        let status = $("#status").val();
+        let product_id = $("#product_id").val();
+        hiddenTips();
+        $.ajax({
+            type: "post",
+            url: url,
+            data: {product_name: product_name, status: status, product_id: product_id},
+            dataType: "json",
+            success: function (msg) {
+                $("#layui-layer-content2").html(msg['msg'])
+                $("#layui-layer3").attr("style","display: block")
+                $("#layui-layer-shade4").attr("style","display: block")
+            },
+            error: function () {
+                $("#layui-layer-content2").html("错误:链接不到服务器")
+                $("#layui-layer3").attr("style","display: block")
+                $("#layui-layer-shade4").attr("style","display: block")
+            }
+        });
+    }
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#creatTime' //指定元素
+        });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}
+

+ 119 - 0
application/admin/view/server/form.html

@@ -0,0 +1,119 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<form class="layui-form layui-form-pane" method="post" enctype="multipart/form-data">
+    <div class="layui-tab layui-tab-card">
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">服务名称</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="product_name" id="product_name" value="{$product.product_name|default=''}" autocomplete="off" placeholder="请输入服务名称" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">服务简介</label>
+                    <div class="layui-input-block">
+                        <textarea class="layui-textarea field-name" name="product_content" id="product_content" placeholder="请输入服务简介" autocomplete="off" required>{$product.product_content|default=''}</textarea>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">服务报价</label>
+                    <div class="layui-input-block">
+                        <textarea class="layui-textarea field-name" name="product_money" id="product_money" placeholder="请输入服务报价" autocomplete="off" required>{$product.product_money|default=''}</textarea>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">状态</label>
+                    <div class="layui-input-inline">
+                        <select name="product_status" id="product_status">
+                            <option value="1">启用</option>
+                            <option value="0">停用</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">期限1金额</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="product_TypeOne" id="product_TypeOne" value="{$product.product_TypeOne|default=''}" autocomplete="off" placeholder="请输入期限1金额" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">期限2金额</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="product_TypeTwo" id="product_TypeTwo" value="{$product.product_TypeTwo|default=''}" autocomplete="off" placeholder="请输入期限2金额" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">期限3金额</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="product_TypeThree" id="product_TypeThree" value="{$product.product_TypeThree|default=''}" autocomplete="off" placeholder="请输入期限3金额" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">期限4金额</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="product_TypeFour" id="product_TypeFour" value="{$product.product_TypeFour|default=''}" autocomplete="off" placeholder="请输入期限4金额" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">图片</label>
+                    <div class="layui-input-block" style="display: flex;">
+                        <input id="file" style="border-style: hidden;border-left: 1px solid #ededed;width: 150px;" type="file" class="layui-input field-name" name="product_img"/>
+                        <div style="display: flex;margin-left: 20px;">
+                            所选图片:
+                            <img id="onFile" src="/static/user/images/header.png" style="width: 200px;height: 100px">
+                        </div>
+                        {if isset($product) && $product.product_img}
+                        <div style="display: flex;margin-left: 20px;">
+                            原图片:
+                            <img src="{$Think.UPLOADS_ROOT}{$product.product_img}" style="width: 200px;height: 100px">
+                        </div>
+                        {/if}
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function() {
+        var form = layui.form;
+    });
+    $(function() {
+        $("#file").change(function(e) {
+            var imgBox = e.target;
+            uploadImg(imgBox)
+        });
+
+        function uploadImg(tag) {
+            var file = tag.files[0];
+            var imgSrc;
+            if (!/image\/\w+/.test(file.type)) {
+                alert("您选择的图片格式错误");
+                let fileIput = $("#file").val("");
+                //fileIput.after(fileIput.clone().val(""));
+                $("#onFile").attr("src", '/static/user/images/header.png');
+                //fileIput.remove();
+                return false;
+            }
+            var reader = new FileReader();
+            reader.readAsDataURL(file);
+            reader.onload = function() {
+                imgSrc = this.result;
+                $("#onFile").attr("src", imgSrc);
+            };
+        }
+    })
+
+
+</script>
+{/block}
+
+
+

+ 11 - 13
application/admin/view/server/index.html

@@ -10,6 +10,7 @@
         {/volist}
     </ul>
     <div class="layui-tab-content page-tab-content">
+        <a href="javascript:dsLayerOpen('{:url('Server/add',['id'=>$id])}','新增')" class="layui-btn layui-btn-normal"><i class="layui-icon layui-icon-add-circle"></i>新增</a>
         <table class="layui-table lay-even">
             <colgroup>
                 <col width="150">
@@ -23,6 +24,7 @@
                 <th>服务报价</th>
                 <th>状态</th>
                 <th>图片</th>
+                <th>操作</th>
             </tr>
             </thead>
             <tbody>
@@ -35,9 +37,16 @@
                 <td>{$value.product_status == 1 ? '启用' : '下线'}</td>
                 <td>
                     {if $value.product_img}
-                    <img src="{$Think.HOME_SITE_ROOT}{$value.product_img}" style="width: 100px;height: 100px">
+                    <img src="{$Think.UPLOADS_ROOT}{$value.product_img}" style="width: 100px;height: 100px">
                     {/if}
                 </td>
+                <td style="width: 150px">
+                    <a href="javascript:dsLayerConfirm('{:url('Server/delete',['product_id'=>$value.product_id])}','{$Think.lang.ds_confirm_cancel}')"
+                       class="layui-btn layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>{$Think.lang.ds_del}</a>
+                    <a href="javascript:dsLayerOpen('{:url('Server/edit',['product_id'=>$value.product_id])}','编辑-{$value.product_name}')" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                    <a href="javascript:dsLayerOpen('{:url('Server/info',['product_id'=>$value.product_id])}','详情-{$value.product_name}')" class="layui-btn layui-btn-xs" style="margin-left: 0; margin-top: 10px"><i class="layui-icon layui-icon-file"></i>详情</a>
+                    <a href="javascript:dsLayerOpen('{:url('Server/addInfo',['product_id'=>$value.product_id])}','新增详情-{$value.product_name}')" class="layui-btn layui-btn-xs" style="margin-top: 10px"><i class="layui-icon layui-icon-add-circle"></i>新增详情</a>
+                </td>
             </tr>
             {/volist}
             {else}
@@ -53,18 +62,7 @@
     let current = $("#id").val();
     $("#li-" + current).attr("class","layui-this")
     function showCurrent(id) {
-        if (id) {
-            $("#status").val(id)
-        }
-        let timeRang = $("#timeRang").val();
-        let status = $("#status").val();
-        window.location.href = myHost + "/User/cost/orderManagement.html?timeRang=" + timeRang + "&status=" + status;
-    }
-    function getQueryString(name) {
-        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-        var url=decodeURI(decodeURI(window.location.search))
-        var r = url.substr(1).match(reg);
-        if (r != null) return unescape(r[2]); return null;
+        window.location.href = myHost + "/Admin/Server/index.html?id=" + id;
     }
     layui.use('laydate', function(){
         var laydate = layui.laydate;

+ 80 - 0
application/admin/view/server/infoForm.html

@@ -0,0 +1,80 @@
+{extend name="layout:home" /}
+
+{block name="container"}
+<form class="layui-form layui-form-pane" method="post" enctype="multipart/form-data">
+    <div class="layui-tab layui-tab-card">
+        <div class="layui-tab-content page-tab-content">
+            <div class="layui-tab-item layui-show ">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">标题</label>
+                    <div class="layui-input-block">
+                        <input type="text" class="layui-input field-name" name="productInfo_title" id="productInfo_title" value="{$productInfo.productInfo_title|default=''}" autocomplete="off" placeholder="请输入标题" required />
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">内容</label>
+                    <div class="layui-input-block">
+                        <textarea class="layui-textarea field-name" name="productInfo_content" id="productInfo_content" placeholder="请输入内容" autocomplete="off" required>{$productInfo.productInfo_content|default=''}</textarea>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">图片</label>
+                    <div class="layui-input-block" style="display: flex;">
+                        <input id="file" style="border-style: hidden;border-left: 1px solid #ededed;width: 150px;" type="file" class="layui-input field-name" name="productInfo_img"/>
+                        <div style="display: flex;margin-left: 20px;">
+                            所选图片:
+                            <img id="onFile" src="/static/user/images/header.png" style="width: 200px;height: 100px">
+                        </div>
+                        {if isset($productInfo) && $productInfo.productInfo_img}
+                        <div style="display: flex;margin-left: 20px;">
+                            原图片:
+                            <img src="{$Think.UPLOADS_ROOT}{$productInfo.productInfo_img}" style="width: 200px;height: 100px">
+                        </div>
+                        {/if}
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <input type="submit" class="layui-btn layui-btn-normal" lay-submit value="{:lang('ds_submit')}" />
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</form>
+<script>
+    layui.use('form', function() {
+        var form = layui.form;
+    });
+    $(function() {
+        $("#file").change(function(e) {
+            var imgBox = e.target;
+            uploadImg(imgBox)
+        });
+
+        function uploadImg(tag) {
+            var file = tag.files[0];
+            var imgSrc;
+            if (!/image\/\w+/.test(file.type)) {
+                alert("您选择的图片格式错误");
+                let fileIput = $("#file").val("");
+                //fileIput.after(fileIput.clone().val(""));
+                $("#onFile").attr("src", '/static/user/images/header.png');
+                //fileIput.remove();
+                return false;
+            }
+            var reader = new FileReader();
+            reader.readAsDataURL(file);
+            reader.onload = function() {
+                imgSrc = this.result;
+                $("#onFile").attr("src", imgSrc);
+            };
+        }
+    })
+
+
+</script>
+{/block}
+
+
+

+ 70 - 0
application/admin/view/server/information.html

@@ -0,0 +1,70 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    <div class="layui-tab-content page-tab-content">
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>标题</th>
+                <th>内容</th>
+                <th>图片</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if count($productInfo)}
+            {volist name="productInfo" id="value"}
+            <tr>
+                <td>{$value.productInfo_title}</td>
+                <td><?php echo mb_substr($value->productInfo_content,0,30, 'utf-8');?>...</td>
+                <td>
+                    {if $value.productInfo_img}
+                    <img src="{$Think.UPLOADS_ROOT}{$value.productInfo_img}" style="width: 100px;height: 100px">
+                    {/if}
+                </td>
+                <td>
+                    <a href="javascript:dsLayerOpen('{:url('Server/editInfo',['productInfo_id'=>$value.productInfo_id])}','编辑-{$value.productInfo_title}')"
+                       class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                    <a href="javascript:dsLayerConfirm('{:url('Server/deleteInfo',['productInfo_id'=>$value.productInfo_id])}','{$Think.lang.ds_confirm_cancel}')"
+                       class="layui-btn layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>{$Think.lang.ds_del}</a>
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td colspan="99" style="text-align: center">无数据</td>
+            {/if}
+            </tbody>
+        </table>
+    </div>
+</div>
+<script>
+    const myHost = "http://" + window.location.host;
+    let current = $("#id").val();
+    $("#li-" + current).attr("class","layui-this")
+    function showCurrent(id) {
+        window.location.href = myHost + "/Admin/Server/index.html?id=" + id;
+    }
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#creatTime' //指定元素
+        });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}
+

+ 152 - 0
application/admin/view/server/renewalList.html

@@ -0,0 +1,152 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    <div class="layui-layer-shade recharge-layui-layer-shade4" id="layui-layer-shade4" times="4" style="display: none;"></div>
+    <div style="display: none;" class="layui-layer layui-layer-dialog recharge-layui-layer2" id="layui-layer3" type="dialog" times="2" showtime="0" contype="string">
+        <div id="layui-layer-content2" class="layui-layer-content"></div>
+        <span class="layui-layer-setwin" onclick="hiddenTips2()"><a class="layui-layer-ico layui-layer-close layui-layer-close2"
+                                                                    href="javascript:;"></a></span>
+        <div class="layui-layer-btn layui-layer-btn-" onclick="hiddenTips2()"><a class="layui-layer-btn0">确定</a></div>
+        <span class="layui-layer-resize"></span>
+    </div>
+    <div style="display: none; height: 250px;" class="layui-layer layui-layer-dialog recharge-layui-layer2" id="layui-layer2" type="dialog" times="2" showtime="0" contype="string">
+        <div class="layui-tab">
+            <div class="layui-tab-content page-tab-content">
+                <div class="layui-tab-item layui-show" style="width: 300px; height: 150px">
+                    <input name="renewal_identity" id="renewal_identity" style="display: none">
+                    <div class="layui-form-item">
+                        <label class="layui-form-label">描述</label>
+                        <div class="layui-input-block">
+                            <input type="text" class="layui-input field-name" name="renewal_name" id="renewal_name" autocomplete="off" placeholder="请输入描述" required />
+                        </div>
+                    </div>
+                    <div class="layui-form-item">
+                        <label class="layui-form-label">服务期限</label>
+                        <div class="layui-input-block">
+                            <input type="text" class="layui-input field-name" name="renewal_day" id="renewal_day" autocomplete="off" placeholder="请输入服务期限" required />
+                        </div>
+                    </div>
+                    <div class="layui-form-item">
+                        <label class="layui-form-label">状态</label>
+                        <div class="layui-inline">
+                            <select style="width: 90px;" name="type" id="status" lay-verify="" class="layui-select layui-unselect layui-form-select">
+                                <option value="1">启用</option>
+                                <option value="0">停用</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="layui-form-item" style="margin-top: 20px">
+                        <div class="layui-input-block">
+                            <input type="submit" class="layui-btn layui-btn-normal" lay-submit onclick="submit()"
+                                   value="确认"/>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <span class="layui-layer-setwin" onclick="hiddenTips()">
+            <a class="layui-layer-ico layui-layer-close layui-layer-close2" href="javascript:;"></a>
+        </span>
+        <span class="layui-layer-resize"></span>
+    </div>
+    <div class="layui-tab-content page-tab-content">
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>ID</th>
+                <th>描述</th>
+                <th>服务期限</th>
+                <th>状态</th>
+                <th>操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if count($renewal)}
+            {volist name="renewal" id="value"}
+            <tr>
+                <td>{$value.renewal_identity}</td>
+                <td>{$value.renewal_name}</td>
+                <td>{$value.renewal_day}</td>
+                <td>{$value.renewal_status == 1 ? '启用' : '下线'}</td>
+                <td style="width: 150px">
+                    <a onclick="getForm({$value.renewal_identity}, '{$value.renewal_name}', '{$value.renewal_day}')" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>{$Think.lang.ds_edit}</a>
+                </td>
+            </tr>
+            {/volist}
+            {else}
+            <td colspan="99" style="text-align: center">无数据</td>
+            {/if}
+            </tbody>
+        </table>
+    </div>
+</div>
+<script>
+    const myHost = "http://" + window.location.host;
+    function getForm(renewal_identity, renewal_name, renewal_day) {
+        $("#renewal_identity").val(renewal_identity);
+        if (renewal_name) {
+            $("#renewal_name").val(renewal_name);
+        }
+        if (renewal_day) {
+            $("#renewal_day").val(renewal_day);
+        }
+        $("#layui-layer2").attr("style","display: block; height: 250px;")
+        $("#layui-layer-shade4").attr("style","display: block")
+    }
+    function hiddenTips() {
+        $("#layui-layer2").attr("style","display: none; height: 250px;")
+        $("#layui-layer-shade4").attr("style","display: none")
+    }
+    function hiddenTips2() {
+        $("#layui-layer3").attr("style","display: none")
+        $("#layui-layer-shade4").attr("style","display: none")
+        window.location.href = myHost + "/Admin/Server/renewalList.html";
+    }
+    function submit() {
+        let url = myHost + "/Admin/Server/renewalEdit.html";
+        let renewal_name = $("#renewal_name").val();
+        let status = $("#status").val();
+        let renewal_identity = $("#renewal_identity").val();
+        let renewal_day = $("#renewal_day").val();
+        hiddenTips();
+        $.ajax({
+            type: "post",
+            url: url,
+            data: {renewal_name: renewal_name, status: status, renewal_identity: renewal_identity, renewal_day: renewal_day},
+            dataType: "json",
+            success: function (msg) {
+                $("#layui-layer-content2").html(msg['msg'])
+                $("#layui-layer3").attr("style","display: block")
+                $("#layui-layer-shade4").attr("style","display: block")
+            },
+            error: function () {
+                $("#layui-layer-content2").html("错误:链接不到服务器")
+                $("#layui-layer3").attr("style","display: block")
+                $("#layui-layer-shade4").attr("style","display: block")
+            }
+        });
+    }
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#creatTime' //指定元素
+        });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}
+

+ 80 - 0
application/admin/view/server/userServer.html

@@ -0,0 +1,80 @@
+{extend name="layout:home" /}
+{block name="container"}
+<div class="layui-tab layui-tab-card">
+    <div class="layui-tab-content page-tab-content">
+        <!-- 搜索框开始 -->
+        <div class="search-form">
+            <form class="" method="post">
+                <div class="layui-form-item">
+                    <div class="layui-inline">
+                        <input type="text" name="user_name"  placeholder="输入用户名称" autocomplete="off" class="layui-input">
+                    </div>
+                    <div class="layui-inline">
+                        <input type="text" name="product_name"  placeholder="输入服务名称" autocomplete="off" class="layui-input">
+                    </div>
+                    <div class="layui-inline">
+                        <input type="text" name="userProduct_identity"  placeholder="输入订单号" autocomplete="off" class="layui-input">
+                    </div>
+                    <div class="layui-inline">
+                        <button type="submit" class="layui-btn search-subBtn">搜索</button>
+                    </div>
+                </div>
+            </form>
+        </div>
+        <!-- 搜索框结束 -->
+        <table class="layui-table lay-even">
+            <colgroup>
+                <col width="150">
+                <col width="200">
+                <col>
+            </colgroup>
+            <thead>
+            <tr>
+                <th>服务名称</th>
+                <th>用户名</th>
+                <th>购买总时长</th>
+                <th>购买时间</th>
+                <th>到期时间</th>
+            </tr>
+            </thead>
+            <tbody>
+            {if count($userproduct)}
+            {volist name="userproduct" id="value"}
+            <tr>
+                <td>{$value.product_name}</td>
+                <td>{$value.user_email}</td>
+                <td>{$value.userProduct_dayNumber}</td>
+                <td>{$value.userProduct_buyTime}</td>
+                <td>{$value.userProduct_maturityTime}</td>
+            </tr>
+            {/volist}
+            {else}
+            <td colspan="99" style="text-align: center">无数据</td>
+            {/if}
+            </tbody>
+        </table>
+        {$show_page}
+    </div>
+</div>
+<script>
+    const myHost = "http://" + window.location.host;
+
+    layui.use('laydate', function(){
+        var laydate = layui.laydate;
+
+        //执行一个laydate实例
+        laydate.render({
+            elem: '#creatTime' //指定元素
+        });
+        laydate.render({
+            elem:'#timeRang',
+            range:true,
+            format: 'yyyy/MM/dd',
+            done: function(value, date){
+                /* 时间选择完成后的回调 */
+            }
+        })
+    });
+</script>
+{/block}
+

+ 8 - 0
application/common.php

@@ -65,6 +65,7 @@ define('ATTACH_MEMBER', ATTACH_PATH . '/member');
 
 define('DS_THEME_USER_URL', ROOT_PATH . DIR_PUBLIC .DS. DIR_STATIC . DS .DIR_USER. DS);
 define('DS_THEME_STYLE_URL', ROOT_PATH . DIR_PUBLIC .DS. DIR_STATIC . DS .DIR_HOME. DS);
+define('DS_THEME_UPLOADS_URL', ROOT_PATH . DIR_UPLOAD);
 
 define('ALLOW_IMG_EXT', 'jpg,png,gif,bmp,jpeg');#上传图片后缀
 
@@ -643,3 +644,10 @@ function OrderID($prefix = '') {
     $order = date("YmdHis") . ($s * 1000000) . $num;
     return $prefix . $order;
 }
+
+function ImgName($prefix = '') {
+    $num = mt_rand(100, 999);
+    list($s, $m) = explode(' ', microtime());
+    $order = date("YmdHis") . ($s * 1000000) . $num;
+    return $prefix . $order;
+}

+ 1 - 1
application/home/controller/Product.php

@@ -174,7 +174,7 @@ class Product extends Common
                 $dbUserInfo->updateInfo($userId, ['userInfo_money' => $cashMoney]);
                 $nowDate = date('Y-m-d');
                 $orderID = OrderID();
-                $data['userproduct_identity'] = $orderID;
+                $data['userProduct_identity'] = $orderID;
                 $data['userProduct_buyTime'] = $nowDate;
                 if ($userProduct) {
                     $data['userProduct_dayNumber'] = $userProduct->userProduct_dayNumber + $day;

+ 1 - 1
application/user/controller/Renewal.php

@@ -94,7 +94,7 @@ class Renewal extends UserControl
             $userProduct = model('Userproduct')->findUserProduct(['userProduct_id' => $userProduct_id]);
             $data['userProduct_dayNumber'] = $userProduct->userProduct_dayNumber + $day;
             $orderID = OrderID();
-            $data['userproduct_identity'] = $orderID;
+            $data['userProduct_identity'] = $orderID;
             $data['userProduct_buyTime'] = $nowDate;
             if ($userProduct->userProduct_maturityTime > $nowDate) {
                 $data['userProduct_maturityTime'] = date('Y-m-d', strtotime(intval($day) . " day", strtotime($userProduct->userProduct_maturityTime)));

+ 1 - 1
application/user/view/message/index.html

@@ -41,7 +41,7 @@
             {if count($usermessage)}
             {volist name="usermessage" id="message"}
             <tr>
-                <td>{$message.userproduct_identity}</td>
+                <td>{$message.userProduct_identity}</td>
                 <td>{$message.product_name}</td>
                 <td>{$message.userProduct_buyTime}</td>
                 <td>{$message.userProduct_dayNumber}</td>

File diff suppressed because it is too large
+ 0 - 0
public/static/admin/css/layui.css


Some files were not shown because too many files changed in this diff