add:比赛对阵

This commit is contained in:
2025-05-01 10:23:11 +08:00
parent 5765cb21d5
commit 9622062509
10 changed files with 499 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
<?php
namespace app\admin\controller\zy;
use app\common\controller\Backend;
/**
* 匹配对阵
*
* @icon fa fa-circle-o
*/
class GameMatch extends Backend
{
/**
* GameMatch模型对象
* @var \app\admin\model\zy\GameMatch
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\zy\GameMatch;
}
/**
* 默认生成的控制器所继承的父类中有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(['stadium','club','activity','game'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('stadium')->visible(['name']);
$row->getRelation('club')->visible(['name']);
$row->getRelation('activity')->visible(['name']);
$row->getRelation('game')->visible(['name']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@@ -51,6 +51,17 @@ return [
"Rule_type4" => "固搭转",
"Rule_type5" => "固定擂",
"Rule_type6" => "活动擂",
"Rule_type7" => "转转",
"Rule_type8" => "分区转",
"Rule_type9" => "擂台赛",
"Rule_type10" => "守擂赛",
"Rule_type11" => "追分赛",
"Rule_type12" => "固搭追分赛",
"Rule_type13" => "大循环群内赛",
"Rule_type14" => "两队PK赛",
"Rule_type15" => "战队淘汰赛",
"Rule_type16" => "单项淘汰赛",
"Rule_type17" => "分区循环淘汰赛",
"Type0" => "一次性",
"Type1" => "周期性",

View File

@@ -56,6 +56,18 @@ return [
"Rule_type4" => "固搭转",
"Rule_type5" => "固定擂",
"Rule_type6" => "活动擂",
"Rule_type7" => "转转",
"Rule_type8" => "分区转",
"Rule_type9" => "擂台赛",
"Rule_type10" => "守擂赛",
"Rule_type11" => "追分赛",
"Rule_type12" => "固搭追分赛",
"Rule_type13" => "大循环群内赛",
"Rule_type14" => "两队PK赛",
"Rule_type15" => "战队淘汰赛",
"Rule_type16" => "单项淘汰赛",
"Rule_type17" => "分区循环淘汰赛",
"Type0" => "一次性",
"Type1" => "周期性",

View File

@@ -0,0 +1,25 @@
<?php
return [
'Gym_id' => '球馆',
'Club_id' => '俱乐部',
'Act_id' => '活动',
'Game_id' => '比赛',
'Level' => '轮次',
'Turn' => '场次',
'TeamA' => '甲方队员',
'TeamB' => '乙方队员',
'Round1' => '第一局比分
',
'Round2' => '第二局比分',
'Round3' => '第三局比分',
'ScoreA' => '甲方总得分',
'ScoreB' => '乙方总得分',
'Winner' => '胜队',
'Create_time' => '创建时间',
'Update_time' => '修改时间',
'Stadium.name' => '球馆名称',
'Club.name' => '俱乐部名称',
'Activity.name' => '活动名称',
'Game.name' => '赛事名称'
];

View File

@@ -0,0 +1,62 @@
<?php
namespace app\admin\model\zy;
use think\Model;
class GameMatch extends Model
{
// 表名
protected $table = 'zy_game_match';
// 自动写入时间戳字段
protected $autoWriteTimestamp = false;
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
protected $deleteTime = false;
// 追加属性
protected $append = [
];
public function stadium()
{
return $this->belongsTo('Stadium', 'gym_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function club()
{
return $this->belongsTo('Club', 'club_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function activity()
{
return $this->belongsTo('Activity', 'act_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function game()
{
return $this->belongsTo('Game', 'game_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

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

View File

@@ -0,0 +1,94 @@
<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">{:__('Gym_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-gym_id" data-rule="required" data-source="zy/stadium/index" class="form-control selectpage" name="row[gym_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Club_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-club_id" data-rule="required" data-source="zy/club/index" class="form-control selectpage" name="row[club_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Act_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-act_id" data-rule="required" data-source="zy/activity/index" class="form-control selectpage" name="row[act_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Game_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-game_id" data-rule="required" data-source="zy/game/index" class="form-control selectpage" name="row[game_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Level')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-level" data-rule="required" class="form-control" name="row[level]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Turn')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-turn" data-rule="required" class="form-control" name="row[turn]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('TeamA')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-teamA" data-rule="required" class="form-control " rows="5" name="row[teamA]" cols="50">''</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('TeamB')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-teamB" data-rule="required" class="form-control " rows="5" name="row[teamB]" cols="50">''</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Round1')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-round1" class="form-control" name="row[round1]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Round2')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-round2" class="form-control" name="row[round2]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Round3')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-round3" class="form-control" name="row[round3]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('ScoreA')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-scoreA" class="form-control" name="row[scoreA]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('ScoreB')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-scoreB" class="form-control" name="row[scoreB]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Winner')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-winner" class="form-control" name="row[winner]" 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-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,94 @@
<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">{:__('Gym_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-gym_id" data-rule="required" data-source="zy/stadium/index" class="form-control selectpage" name="row[gym_id]" type="text" value="{$row.gym_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Club_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-club_id" data-rule="required" data-source="zy/club/index" class="form-control selectpage" name="row[club_id]" type="text" value="{$row.club_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Act_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-act_id" data-rule="required" data-source="zy/activity/index" class="form-control selectpage" name="row[act_id]" type="text" value="{$row.act_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Game_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-game_id" data-rule="required" data-source="zy/game/index" class="form-control selectpage" name="row[game_id]" type="text" value="{$row.game_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Level')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-level" data-rule="required" class="form-control" name="row[level]" type="number" value="{$row.level|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Turn')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-turn" data-rule="required" class="form-control" name="row[turn]" type="number" value="{$row.turn|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('TeamA')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-teamA" data-rule="required" class="form-control " rows="5" name="row[teamA]" cols="50">{$row.teamA|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('TeamB')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-teamB" data-rule="required" class="form-control " rows="5" name="row[teamB]" cols="50">{$row.teamB|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Round1')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-round1" class="form-control" name="row[round1]" type="text" value="{$row.round1|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Round2')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-round2" class="form-control" name="row[round2]" type="text" value="{$row.round2|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Round3')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-round3" class="form-control" name="row[round3]" type="text" value="{$row.round3|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('ScoreA')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-scoreA" class="form-control" name="row[scoreA]" type="number" value="{$row.scoreA|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('ScoreB')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-scoreB" class="form-control" name="row[scoreB]" type="number" value="{$row.scoreB|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Winner')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-winner" class="form-control" name="row[winner]" type="text" value="{$row.winner|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-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@@ -0,0 +1,29 @@
<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('zy/game_match/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('zy/game_match/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('zy/game_match/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('zy/game_match/edit')}"
data-operate-del="{:$auth->check('zy/game_match/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>