diff --git a/application/admin/controller/zy/Participant.php b/application/admin/controller/zy/Participant.php new file mode 100644 index 0000000..5ca75a7 --- /dev/null +++ b/application/admin/controller/zy/Participant.php @@ -0,0 +1,73 @@ +model = new \app\admin\model\zy\Participant; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['user','join','game']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('user')->visible(['username']); + $row->getRelation('join')->visible(['id']); + $row->getRelation('game')->visible(['name']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/lang/zh-cn/zy/participant.php b/application/admin/lang/zh-cn/zy/participant.php new file mode 100644 index 0000000..5a9c83f --- /dev/null +++ b/application/admin/lang/zh-cn/zy/participant.php @@ -0,0 +1,30 @@ + '用户id', + 'Name' => '用户名', + 'Avatar' => '头像', + 'Gender' => '性别', + 'Game_join_id' => '报名id', + 'Game_id' => '赛事id', + 'Team' => '战队', + 'Order' => '排序', + 'Rank' => '排名', + 'Mark' => '说明/备注', + 'Status' => '状态', + 'Signin' => '签到状态', + 'Score' => '得分', + 'Net_score' => '净得分', + 'Win' => '胜局', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'User.username' => '用户名', + 'Game.name' => '赛事名称', + + "Status0" => "候补", + "Status1" => "已报名", + "Status2" => "退坑", + + "Signin0" => "未签到", + "Signin1" => "已签到", +]; diff --git a/application/admin/model/zy/Participant.php b/application/admin/model/zy/Participant.php new file mode 100644 index 0000000..863585f --- /dev/null +++ b/application/admin/model/zy/Participant.php @@ -0,0 +1,56 @@ +belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function join() + { + return $this->belongsTo('app\admin\model\zy\GameJoin', 'game_join_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function game() + { + return $this->belongsTo('Game', 'game_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/validate/zy/Participant.php b/application/admin/validate/zy/Participant.php new file mode 100644 index 0000000..2a2b754 --- /dev/null +++ b/application/admin/validate/zy/Participant.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/zy/participant/add.html b/application/admin/view/zy/participant/add.html new file mode 100644 index 0000000..a0ef011 --- /dev/null +++ b/application/admin/view/zy/participant/add.html @@ -0,0 +1,108 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + + +
    diff --git a/application/admin/view/zy/participant/edit.html b/application/admin/view/zy/participant/edit.html new file mode 100644 index 0000000..e20db6e --- /dev/null +++ b/application/admin/view/zy/participant/edit.html @@ -0,0 +1,108 @@ +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + + +
      diff --git a/application/admin/view/zy/participant/index.html b/application/admin/view/zy/participant/index.html new file mode 100644 index 0000000..20a1135 --- /dev/null +++ b/application/admin/view/zy/participant/index.html @@ -0,0 +1,29 @@ +
      + {:build_heading()} + +
      +
      +
      +
      +
      + + + + + + + +
      + +
      +
      +
      + +
      +
      +
      diff --git a/public/assets/js/backend/zy/participant.js b/public/assets/js/backend/zy/participant.js new file mode 100644 index 0000000..ba199db --- /dev/null +++ b/public/assets/js/backend/zy/participant.js @@ -0,0 +1,70 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'zy/participant/index' + location.search, + add_url: 'zy/participant/add', + edit_url: 'zy/participant/edit', + del_url: 'zy/participant/del', + multi_url: 'zy/participant/multi', + import_url: 'zy/participant/import', + table: 'zy_participant', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + fixedColumns: true, + fixedRightNumber: 1, + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'user_id', title: __('User_id')}, + {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'gender', title: __('Gender')}, + {field: 'game_join_id', title: __('Game_join_id')}, + {field: 'game_id', title: __('Game_id')}, + {field: 'game.name', title: __('Game.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'team', title: __('Team'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'order', title: __('Order')}, + {field: 'rank', title: __('Rank')}, + {field: 'status', title: __('Status')}, + {field: 'signin', title: __('Signin')}, + {field: 'score', title: __('Score')}, + {field: 'net_score', title: __('Net_score')}, + {field: 'win', title: __('Win')}, + {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, + + {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; +});