This commit is contained in:
kulawawa 2025-04-30 16:31:09 +08:00
parent 91ed6fa4d7
commit 550b67bb40
3 changed files with 156 additions and 0 deletions

View File

@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------
// | 作者:修缘 联系QQ278896498 QQ群1054861244
// | 声明:未经作者许可,禁止倒卖等商业运营,违者必究
// | 另接php业务网站制作、代理后台、gm后台、支付对接等
// +----------------------------------------------------------------------
// | 创建时间: 2022/1/1 2:54
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\admin\model\Notice;
use think\Db;
use think\db\Connection;
use think\facade\Config;
use think\Request;
class NoticeController extends Controller
{
protected function initialize(): void
{
parent::initialize(); // TODO: Change the autogenerated stub
}
public function index(Notice $model, Request $request)
{
$param = $request->param();
// $son_agency_invite = $this->son_agency_invite . ",{$this->user->invite}";
$model = $model
->field('text,type,serverid,time')
->order('time');
// ->withJoin([
//// 'account' => function ($query) use($son_agency_invite) {
//// $query->whereIn('invite', $son_agency_invite);
//// }
// ])->scope('where', $param);
$data = $model->paginate($this->admin['per_page'], false, ['query' => $request->get()]);
// dump($data);
$this->assign($request->get());
$this->assign([
'data' => $data->toArray()['data'],
'page' => $data->render(),
'total' => $data->total(),
]);
return $this->fetch();
}
public function del($id, Notice $model)
{
$result = $model->where('text', $id)->delete();
return $result ? admin_success(lang('delete_success'), URL_RELOAD) : admin_error(lang('delete_error'));
}
}

View File

@ -0,0 +1,18 @@
<?php
// +----------------------------------------------------------------------
// | 作者:修缘 联系QQ278896498 QQ群1054861244
// | 声明:未经作者许可,禁止倒卖等商业运营,违者必究
// | 另接php业务网站制作、代理后台、gm后台、支付对接等
// +----------------------------------------------------------------------
// | 创建时间: 2022/1/19 19:31
// +----------------------------------------------------------------------
namespace app\admin\model;
class Notice extends Model
{
protected $table = 'qy_notice';
}

View File

@ -0,0 +1,80 @@
{extend name="public/base" /}
{block name='content'}
{include file='public/content_header' /}
<!--数据列表页面-->
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box">
<!--数据列表顶部-->
<div class="box-header">
<div>
<a class="btn btn-success btn-sm ReloadButton" data-toggle="tooltip" title="刷新">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="box-body table-responsive">
<table class="table table-hover table-bordered datatable" width="100%">
<thead>
<tr>
<th>内容</th>
<th>类型</th>
<th>server</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{foreach name='data' id='item' key='data_key'}
<tr>
<td>{$item.text}</td>
<td>{$item.type}</td>
<td>{$item.serverid}</td>
<td>{$item.time}</td>
<td class="td-do">
<a class="btn btn-danger btn-xs AjaxButton" data-toggle="tooltip" title="删除"
data-id="{$item.text}" data-confirm-title="删除确认"
data-confirm-content='您确定要删除 <span class="text-red">{$item.text}</span> 的广播吗'
data-url="{:url('del')}">
<i class="fa fa-trash"></i>
</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
<!-- 数据列表底部 -->
<div class="box-footer">
{$page|raw}
<label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;">
<small>{$total}条记录</small>&nbsp;
<small>每页显示</small>
&nbsp;
<select class="input-sm" onchange="changePerPage(this)">
<option value="10" {if $admin.per_page==10}selected{/if}>10</option>
<option value="20" {if $admin.per_page==20}selected{/if}>20</option>
<option value="30" {if $admin.per_page==30}selected{/if}>30</option>
<option value="50" {if $admin.per_page==50}selected{/if}>50</option>
<option value="100" {if $admin.per_page==100}selected{/if}>100</option>
</select>
&nbsp;
<small>条记录</small>
</label>
</div>
</div>
</div>
</div>
</section>
{/block}