From 3213a01287ab03d0642ab3e9c6a201edae84fbbf Mon Sep 17 00:00:00 2001 From: xiadc <251308692@qq.com> Date: Wed, 30 Apr 2025 18:22:27 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=8A=A5=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/zy/GameJoin.php | 74 +++++++++++++++++++ application/admin/lang/zh-cn/zy/game_join.php | 20 +++++ application/admin/model/zy/GameJoin.php | 62 ++++++++++++++++ application/admin/validate/zy/GameJoin.php | 27 +++++++ .../admin/view/general/attachment/select.html | 2 +- application/admin/view/zy/game_join/add.html | 46 ++++++++++++ application/admin/view/zy/game_join/edit.html | 47 ++++++++++++ .../admin/view/zy/game_join/index.html | 29 ++++++++ public/assets/js/backend/zy/game_join.js | 58 +++++++++++++++ 9 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 application/admin/controller/zy/GameJoin.php create mode 100644 application/admin/lang/zh-cn/zy/game_join.php create mode 100644 application/admin/model/zy/GameJoin.php create mode 100644 application/admin/validate/zy/GameJoin.php create mode 100644 application/admin/view/zy/game_join/add.html create mode 100644 application/admin/view/zy/game_join/edit.html create mode 100644 application/admin/view/zy/game_join/index.html create mode 100644 public/assets/js/backend/zy/game_join.js diff --git a/application/admin/controller/zy/GameJoin.php b/application/admin/controller/zy/GameJoin.php new file mode 100644 index 0000000..be5f38a --- /dev/null +++ b/application/admin/controller/zy/GameJoin.php @@ -0,0 +1,74 @@ +model = new \app\admin\model\zy\GameJoin; + + } + + + + /** + * 默认生成的控制器所继承的父类中有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(['activity','game','user','order']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('activity')->visible(['name']); + $row->getRelation('game')->visible(['name']); + $row->getRelation('user')->visible(['username']); + $row->getRelation('order')->visible(['order_sn']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/lang/zh-cn/zy/game_join.php b/application/admin/lang/zh-cn/zy/game_join.php new file mode 100644 index 0000000..a1bc8ad --- /dev/null +++ b/application/admin/lang/zh-cn/zy/game_join.php @@ -0,0 +1,20 @@ + '活动id', + 'Game_id' => '赛事id', + 'User_id' => '用户id', + 'Order_id' => '订单id', + 'Users' => '参与用户', + 'Status' => '状态', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'Activity.name' => '活动名称', + 'Game.name' => '赛事名称', + 'User.username' => '用户名', + 'Order.order_sn' => '订单号', + + "Status0" => "待支付", + "Status1" => "已支付", + "Status2" => "报名成功", +]; diff --git a/application/admin/model/zy/GameJoin.php b/application/admin/model/zy/GameJoin.php new file mode 100644 index 0000000..9be2413 --- /dev/null +++ b/application/admin/model/zy/GameJoin.php @@ -0,0 +1,62 @@ +belongsTo('Activity', 'act_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function game() + { + return $this->belongsTo('Game', 'game_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function order() + { + return $this->belongsTo('app\admin\model\shopro\order\Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/validate/zy/GameJoin.php b/application/admin/validate/zy/GameJoin.php new file mode 100644 index 0000000..ec577d8 --- /dev/null +++ b/application/admin/validate/zy/GameJoin.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/general/attachment/select.html b/application/admin/view/general/attachment/select.html index 352f362..f692365 100644 --- a/application/admin/view/general/attachment/select.html +++ b/application/admin/view/general/attachment/select.html @@ -11,7 +11,7 @@ {foreach name="categoryList" item="vo"}