WIN-2308041133\Administrator 8 months ago
parent
commit
6e9dd25042

+ 71 - 0
application/admin/controller/platform/Videoplatforms.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace app\admin\controller\Videoplatform;
+
+use app\common\controller\Backend;
+
+/**
+ * 第三方平台列表
+ *
+ */
+class Videoplatforms extends Backend
+{
+
+    protected $relationSearch = true;
+
+
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+//        $this->model = new \app\admin\model\third\Videoplatform;
+        $this->model = new \app\common\model\Videoplatform;
+//        $this->model = model('Videoplatform');
+    }
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //设置过滤方法
+
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $total = $this->model
+                ->where($where)
+                ->order($sort, $order)
+                ->count();
+            $list = $this->model
+                ->where($where)
+                ->order($sort, $order)
+                ->limit($offset, $limit)
+                ->select();
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = NULL)
+    {
+        $row = $this->model->get($ids);
+        if (!$row)
+            $this->error(__('No Results were found'));
+        return parent::edit($ids);
+    }
+    public function add()
+    {
+        return parent::add();
+    }
+
+}

+ 27 - 0
application/admin/view/platform/videoplatforms/add.html

@@ -0,0 +1,27 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    <div class="form-group">
+        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('第三方平台名称')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-company" class="control-label col-xs-12 col-sm-2">{:__('所属公司')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-company" data-rule="required" class="form-control" name="row[company]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-url" class="control-label col-xs-12 col-sm-2">{:__('网址')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-url" data-rule="required" class="form-control" name="row[url]" type="text" value="">
+        </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>

+ 27 - 0
application/admin/view/platform/videoplatforms/edit.html

@@ -0,0 +1,27 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    <div class="form-group">
+        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('第三方平台名称')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-company" class="control-label col-xs-12 col-sm-2">{:__('所属公司')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-company" data-rule="required" class="form-control" name="row[company]" type="text"  value="{$row.company|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-url" class="control-label col-xs-12 col-sm-2">{:__('网址')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-url" data-rule="required" class="form-control" name="row[url]" type="text" value="{$row.url|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>

+ 28 - 0
application/admin/view/platform/videoplatforms/index.html

@@ -0,0 +1,28 @@
+<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">
+                        {:build_toolbar('refresh,add,edit,del')}
+                        <div class="dropdown btn-group {:$auth->check('platform/videoplatforms/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" 
+                           data-operate-edit="{:$auth->check('platform/videoplatforms/edit')}"
+                           data-operate-del="{:$auth->check('platform/videoplatforms/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 64 - 0
public/assets/js/backend/platform/videoplatforms.js

@@ -0,0 +1,64 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'platform/videoplatforms/index',
+                    add_url: 'platform/videoplatforms/add',
+                    edit_url: 'platform/videoplatforms/edit',
+                    del_url: 'platform/videoplatforms/del',
+                    multi_url: 'platform/videoplatforms/multi',
+                    table: 'video_platform',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                // sortName: 'user.id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('ID'), sortable: true},
+                        // {field: 'videolist.name', title: __('短剧名称'), operate: false},
+                        // {field: 'platform.name', title: __('平台名称'), operate: false},
+                        {field: 'vid', title: __('短剧名称'), sortable: true},
+                        {field: 'platform_id', title: __('平台名称'), sortable: true},
+                        {field: 'max', title: __('收益上限'), sortable: true},
+                        {field: 'min', title: __('收益下限'), sortable: true},
+                        {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime},
+                        {field: 'operate', title: __('操作'), 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]"));
+            },
+            // formatter: {
+            //     paytype: function (value) {
+            //         return value==2 ? '<span class="label label-danger">' + __("已支付") + '</span>': '<span class="label label-default">'+ __('未支付')+ '</span>';
+            //     },
+            //     type: function (value) {
+            //         return value==2 ? '<span class="label label-danger">' + __("已使用") + '</span>': '<span class="label label-default">'+ __('未使用')+ '</span>';
+            //     }
+            // }
+        }
+    };
+    return Controller;
+});