xxxrrrdddd 3 年之前
父節點
當前提交
0deb62b8db
共有 37 個文件被更改,包括 352 次插入50 次删除
  1. 43 0
      application/admin/controller/Ad.php
  2. 1 1
      application/admin/controller/Ajax.php
  3. 10 0
      application/admin/lang/zh-cn/ad.php
  4. 45 0
      application/admin/view/ad/add.html
  5. 51 0
      application/admin/view/ad/edit.html
  6. 37 0
      application/admin/view/ad/index.html
  7. 14 0
      application/admin/view/layout/fu.html
  8. 36 0
      application/common/model/Ad.php
  9. 3 0
      application/common/model/UserOrder.php
  10. 3 0
      application/common/model/UserOrderLog.php
  11. 27 0
      application/common/validate/Ad.php
  12. 1 2
      public/assets/css/backend.css
  13. 1 2
      public/assets/css/bootstrap.css
  14. 1 2
      public/assets/css/fastadmin.css
  15. 1 2
      public/assets/css/frontend.css
  16. 0 1
      public/assets/css/lesshat.css
  17. 1 2
      public/assets/css/skins/_all-skins.css
  18. 1 2
      public/assets/css/skins/skin-black-blue.css
  19. 1 2
      public/assets/css/skins/skin-black-green.css
  20. 1 2
      public/assets/css/skins/skin-black-light.css
  21. 1 2
      public/assets/css/skins/skin-black-pink.css
  22. 1 2
      public/assets/css/skins/skin-black-purple.css
  23. 1 2
      public/assets/css/skins/skin-black-red.css
  24. 1 2
      public/assets/css/skins/skin-black-yellow.css
  25. 1 2
      public/assets/css/skins/skin-black.css
  26. 1 2
      public/assets/css/skins/skin-blue-light.css
  27. 1 2
      public/assets/css/skins/skin-blue.css
  28. 1 2
      public/assets/css/skins/skin-green-light.css
  29. 1 2
      public/assets/css/skins/skin-green.css
  30. 1 2
      public/assets/css/skins/skin-purple-light.css
  31. 1 2
      public/assets/css/skins/skin-purple.css
  32. 1 2
      public/assets/css/skins/skin-red-light.css
  33. 1 2
      public/assets/css/skins/skin-red.css
  34. 1 2
      public/assets/css/skins/skin-yellow-light.css
  35. 1 2
      public/assets/css/skins/skin-yellow.css
  36. 1 2
      public/assets/css/user.css
  37. 58 0
      public/assets/js/backend/ad.js

+ 43 - 0
application/admin/controller/Ad.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+
+/**
+ * 
+ *
+ * @icon fa fa-circle-o
+ */
+class Ad extends Backend
+{
+    protected $noNeedLogin=['pos'];
+    /**
+     * Ad模型对象
+     * @var \app\common\model\Ad
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\common\model\Ad;
+        $this->view->assign('pos',\app\common\model\Ad::$pos);
+    }
+
+    public function import()
+    {
+        parent::import();
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    public function pos(){
+        return \app\common\model\Ad::$pos;
+    }
+
+}

+ 1 - 1
application/admin/controller/Ajax.php

@@ -110,7 +110,7 @@ class Ajax extends Backend
                 $this->error($e->getMessage());
             }
 
-            $this->success(__('Uploaded successful'), '', ['url' => $attachment->url, 'fullurl' => cdnurl($attachment->url, true)]);
+            $this->success(__('Uploaded successful'), '', ['url' => cdnurl($attachment->url, true), 'fullurl' => cdnurl($attachment->url, true)]);
         }
     }
 

+ 10 - 0
application/admin/lang/zh-cn/ad.php

@@ -0,0 +1,10 @@
+<?php
+
+return [
+    'Pos'        => '轮播位置',
+    'Img'        => '图片链接',
+    'Link_type'  => '链接类型',
+    'Link_id'    => '链接id',
+    'Created_at' => '创建时间',
+    'Updated_at' => '更新时间'
+];

+ 45 - 0
application/admin/view/ad/add.html

@@ -0,0 +1,45 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pos')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select name="row[pos]" class="form-control">
+                {foreach name='pos' item='a' key='b'}
+                <option value="{$b}">{$a}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    {include file="layout/fu" label="图片" name="img" value="" rule="required"}
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link_type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link_type" class="form-control" name="row[link_type]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link_id" data-rule="required" data-source="link/index" class="form-control selectpage" name="row[link_id]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Created_at')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-created_at" class="form-control" name="row[created_at]" type="number">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Updated_at')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-updated_at" class="form-control" name="row[updated_at]" type="number">
+        </div>
+    </div>>-->
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div
+</form>

+ 51 - 0
application/admin/view/ad/edit.html

@@ -0,0 +1,51 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pos')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select name="row[pos]" class="form-control">
+                {foreach name='pos' item='a' key='b'}
+                <option value="{$b}" {:$row.pos==$b?'selected':''}>{$a}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    {include file="layout/fu" label="图片" name="img" value="$row.img" rule="required"}
+    <!--<div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Img')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-img" class="form-control" name="row[img]" type="text" value="{$row.img|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link_type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link_type" class="form-control" name="row[link_type]" type="text" value="{$row.link_type|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link_id" data-rule="required" data-source="link/index" class="form-control selectpage" name="row[link_id]" type="text" value="{$row.link_id|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Created_at')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-created_at" class="form-control" name="row[created_at]" type="number" value="{$row.created_at|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Updated_at')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-updated_at" class="form-control" name="row[updated_at]" type="number" value="{$row.updated_at|htmlentities}">
+        </div>
+    </div>-->
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 37 - 0
application/admin/view/ad/index.html

@@ -0,0 +1,37 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('ad/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('ad/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('ad/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+<!--
+                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('ad/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
+-->
+
+                        <div class="dropdown btn-group {:$auth->check('ad/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('ad/edit')}" 
+                           data-operate-del="{:$auth->check('ad/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 14 - 0
application/admin/view/layout/fu.html

@@ -0,0 +1,14 @@
+<div class="form-group">
+    <label class="control-label col-xs-12 col-sm-2">[label]:</label>
+    <div class="col-xs-12 col-sm-8">
+        <div class="input-group">
+            <input id="c-[name]" class="form-control" size="50" name="row[[name]]" type="text" value="[value]" data-rule="[rule]">
+            <div class="input-group-addon no-border no-padding">
+                <span><button type="button" id="plupload-avatar" class="btn btn-danger plupload" data-input-id="c-[name]" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-avatar"><i class="fa fa-upload"></i> 上传</button></span>
+                <span><button type="button" id="fachoose-avatar" class="btn btn-primary fachoose" data-input-id="c-[name]" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择</button></span>
+            </div>
+            <span class="msg-box n-right" for="c-[name]"></span>
+        </div>
+        <ul class="row list-inline plupload-preview" id="p-avatar"></ul>
+    </div>
+</div>

+ 36 - 0
application/common/model/Ad.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+
+class Ad extends Model
+{
+    // 表名
+    protected $table = 'ad';
+
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = true;
+
+    // 定义时间戳字段名
+    protected $createTime = 'created_at';
+    protected $updateTime = 'updated_at';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+
+    ];
+    public static $pos=[
+        'ps_top'=>'科普顶部',
+    ];
+    
+
+
+
+
+
+
+
+}

+ 3 - 0
application/common/model/UserOrder.php

@@ -13,6 +13,9 @@ use traits\model\SoftDelete;
 class UserOrder extends Model
 {
     use SoftDelete;
+    protected $autoWriteTimestamp=true;
+    protected $createTime = 'created_at';
+    protected $updateTime = 'updated_at';
     protected $deleteTime='deleted_at';
     protected $type=[
         'get_time'=>'array',

+ 3 - 0
application/common/model/UserOrderLog.php

@@ -6,6 +6,9 @@ use think\Model;
 
 class UserOrderLog extends Model
 {
+    protected $autoWriteTimestamp=true;
+    protected $createTime = 'created_at';
+    protected $updateTime = false;
     public static $status=[
         UserOrder::STATUS_WAIT_GETTING=>'已接单正在取宠',
         UserOrder::STATUS_SENDING=>'已取宠正在运输',

+ 27 - 0
application/common/validate/Ad.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\common\validate;
+
+use think\Validate;
+
+class Ad extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 1 - 2
public/assets/css/backend.css

@@ -1198,5 +1198,4 @@ table.table-nowrap thead > tr > th {
   -ms-transform: rotate(-90deg);
   -o-transform: rotate(-90deg);
   transform: rotate(-90deg);
-}
-/*# sourceMappingURL=backend.css.map */
+}

+ 1 - 2
public/assets/css/bootstrap.css

@@ -6723,5 +6723,4 @@ button.close {
   .hidden-print {
     display: none !important;
   }
-}
-/*# sourceMappingURL=../css/bootstrap.css.map */
+}

+ 1 - 2
public/assets/css/fastadmin.css

@@ -5885,5 +5885,4 @@ fieldset[disabled] .btn-yahoo.active {
   .table-responsive > .table tr td {
     white-space: normal !important;
   }
-}
-/*# sourceMappingURL=fastadmin.css.map */
+}

+ 1 - 2
public/assets/css/frontend.css

@@ -600,5 +600,4 @@ main.content {
   margin-right: 5px;
   text-align: center;
   display: inline-block;
-}
-/*# sourceMappingURL=frontend.css.map */
+}

+ 0 - 1
public/assets/css/lesshat.css

@@ -1 +0,0 @@
-/*# sourceMappingURL=lesshat.css.map */

+ 1 - 2
public/assets/css/skins/_all-skins.css

@@ -3660,5 +3660,4 @@
     background: #f5549f;
     color: #fff;
   }
-}
-/*# sourceMappingURL=_all-skins.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black-blue.css

@@ -239,5 +239,4 @@
     background: #4e73df;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-black-blue.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black-green.css

@@ -239,5 +239,4 @@
     background: #18bc9c;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-black-green.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black-light.css

@@ -186,5 +186,4 @@
     background: #222d32;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-black-light.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black-pink.css

@@ -239,5 +239,4 @@
     background: #f5549f;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-black-pink.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black-purple.css

@@ -239,5 +239,4 @@
     background: #605ca8;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-black-purple.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black-red.css

@@ -239,5 +239,4 @@
     background: #e74c3c;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-black-red.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black-yellow.css

@@ -239,5 +239,4 @@
     background: #f39c12;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-black-yellow.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-black.css

@@ -209,5 +209,4 @@
     background: #fff;
     color: #374850;
   }
-}
-/*# sourceMappingURL=skin-black.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-blue-light.css

@@ -171,5 +171,4 @@
     background: #4e73df;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-blue-light.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-blue.css

@@ -220,5 +220,4 @@
     background: #fff;
     color: #7995e7;
   }
-}
-/*# sourceMappingURL=skin-blue.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-green-light.css

@@ -171,5 +171,4 @@
     background: #18bc9c;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-green-light.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-green.css

@@ -165,5 +165,4 @@
     background: #18bc9c;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-green.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-purple-light.css

@@ -171,5 +171,4 @@
     background: #605ca8;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-purple-light.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-purple.css

@@ -210,5 +210,4 @@
     background: #fff;
     color: #807dba;
   }
-}
-/*# sourceMappingURL=skin-purple.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-red-light.css

@@ -171,5 +171,4 @@
     background: #e74c3c;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-red-light.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-red.css

@@ -165,5 +165,4 @@
     background: #e74c3c;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-red.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-yellow-light.css

@@ -171,5 +171,4 @@
     background: #f39c12;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-yellow-light.css.map */
+}

+ 1 - 2
public/assets/css/skins/skin-yellow.css

@@ -165,5 +165,4 @@
     background: #f39c12;
     color: #fff;
   }
-}
-/*# sourceMappingURL=skin-yellow.css.map */
+}

+ 1 - 2
public/assets/css/user.css

@@ -69,5 +69,4 @@ body.sidebar-open .sidenav {
 }
 body.sidebar-open .sidebar-toggle i:before {
   content: "\f00d";
-}
-/*# sourceMappingURL=user.css.map */
+}

+ 58 - 0
public/assets/js/backend/ad.js

@@ -0,0 +1,58 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'ad/index' + location.search,
+                    add_url: 'ad/add',
+                    edit_url: 'ad/edit',
+                    del_url: 'ad/del',
+                    multi_url: 'ad/multi',
+                    import_url: 'ad/import',
+                    table: 'ad',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id'), operate: false},
+                        {field: 'pos', title: __('Pos'), operate: false,searchList:$.getJSON('ad/pos'),formatter: function (a, b, c) {
+                                console.log(a,b,c)
+                            }},
+                        {field: 'img', title: __('Img'), operate: false,formatter: Table.api.formatter.image},
+                        /*{field: 'link_type', title: __('Link_type'), operate: false},
+                        {field: 'link_id', title: __('Link_id'), operate: false},*/
+                        {field: 'created_at', title: __('Created_at'), operate: false,formatter: Table.api.formatter.datetime},
+                        {field: 'updated_at', title: __('Updated_at'), operate: false,formatter: Table.api.formatter.datetime},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});