SmsRecipient/app/view/sms/index.html
mao a4e5648147 feat: 添加短信应用基本功能- 新增应用管理、短信中心、用户登录注册等功能页面
- 实现应用创建、删除、短信搜索、分页等功能
- 添加用户登录、注册、修改密码等账户管理功能
- 新增通用消息显示模板
2025-04-30 18:00:08 +08:00

223 lines
8.8 KiB
HTML

<?= $header ?>
<div>
<div class="layui-card">
<div class="layui-card-header">短信中心</div>
<div class="layui-card-body">
<form class="layui-form ii" style="display: flex;flex-direction: row;flex-wrap: wrap;">
<div class="layui-input-group">
<div class="layui-input-prefix">
应用名称
</div>
<select name="app_name">
<option value="">请选择</option>
<?php foreach($sms_app as $app): ?>
<?php if(array_key_exists('app_name', $get) && $app['app_name'] == $get['app_name']): ?>
<option value="<?= $app['app_name'] ?>" selected><?= $app['app_name'] ?></option>
<?php else: ?>
<option value="<?= $app['app_name'] ?>"><?= $app['app_name'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<div class="layui-input-group">
<div class="layui-input-prefix">
UUID
</div>
<select name="app_uuid">
<option value="">请选择</option>
<?php foreach($sms_app as $app): ?>
<?php if(array_key_exists('app_uuid', $get) && $app['app_uuid'] == $get['app_uuid']): ?>
<option value="<?= $app['app_uuid'] ?>" selected><?= $app['app_uuid'] ?></option>
<?php else: ?>
<option value="<?= $app['app_uuid'] ?>"><?= $app['app_uuid'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<div class="layui-input-group">
<div class="layui-input-prefix">
from
</div>
<input type="text" name="from" placeholder="模糊搜索"
value="<?= array_key_exists('from', $get) ? $get['from'] : ''?>"
class="layui-input">
</div>
<div class="layui-input-group">
<div class="layui-input-prefix">
content
</div>
<input type="text" name="content" placeholder="模糊搜索"
value="<?= array_key_exists('content', $get) ? $get['content'] : ''?>"
class="layui-input">
</div>
<div class="layui-input-group">
<div class="layui-input-prefix">
IP
</div>
<input type="text" name="ip" placeholder="模糊搜索"
value="<?= array_key_exists('ip', $get) ? $get['ip'] : ''?>"
class="layui-input">
</div>
<div class="layui-input-group">
<div class="layui-input-prefix">
起始时间
</div>
<input type="text" name="receive_time[0]" class="layui-input" id="rt0"
value="<?= array_key_exists('receive_time', $get) ? $get['receive_time'][0] : ''?>"
placeholder="yyyy-MM-dd HH:mm:ss">
</div>
<div class="layui-input-group">
<div class="layui-input-prefix">
结束时间
</div>
<input type="text" name="receive_time[1]" class="layui-input" id="rt1"
value="<?= array_key_exists('receive_time', $get) ? $get['receive_time'][1] : ''?>"
placeholder="yyyy-MM-dd HH:mm:ss">
</div>
<div class="layui-input-group">
<button class="layui-btn" lay-submit>搜索</button>
</div>
<div class="layui-input-group">
<a class="layui-btn" href="/sms">重置</a>
</div>
</form>
<hr>
<table class="layui-table" lay-even>
<colgroup>
<col>
<col>
<col>
<col>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th>#</th>
<th>应用名称</th>
<th>UUID</th>
<th>Headers</th>
<th>From</th>
<th>Content</th>
<th>IP</th>
<th>接收时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($smsContent as $item): ?>
<tr>
<td><?= $item['id'] ?></td>
<td><?= $item['app_name'] ?></td>
<td><?= $item['app_uuid'] ?></td>
<td>
<div>
<?php if(!empty($item['headers'])): ;?>
<?php $headers = json_decode($item['headers'],true);if (json_last_error() !== JSON_ERROR_NONE) {$headers = [];} ?>
<?php if(array_key_exists('accept-language', $headers)) unset($headers['accept-language']); ?>
<?php if(array_key_exists('user-agent', $headers)) unset($headers['user-agent']); ?>
<?php if(array_key_exists('content-type', $headers)) unset($headers['content-type']); ?>
<?php if(array_key_exists('content-length', $headers)) unset($headers['content-length']); ?>
<?php if(array_key_exists('host', $headers)) unset($headers['host']); ?>
<?php if(array_key_exists('connection', $headers)) unset($headers['connection']); ?>
<?php if(array_key_exists('accept-encoding', $headers)) unset($headers['accept-encoding']); ?>
<?php if(array_key_exists('cache-control', $headers)) unset($headers['cache-control']); ?>
<?php foreach ($headers as $key => $value): ?>
<div>
<?= $key ?>: <?= $value ?>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</td>
<td><?= $item['from'] ?></td>
<td><?= $item['content'] ?></td>
<td><?= $item['ip'] ?></td>
<td><?= $item['created_at'] ?></td>
<td>
<a href="/sms/delete?id=<?= $item['id'] ?>" class="layui-btn layui-btn-xs">删除记录</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<hr>
<div id="pn"></div>
</div>
</div>
</div>
<script>
function redirectWithParams(newPage, newLimit) {
// 获取当前URL对象
const currentUrl = new URL(window.location.href);
// 覆盖或新增page和limit参数
currentUrl.searchParams.set('page', newPage);
currentUrl.searchParams.set('limit', newLimit);
// 跳转到新URL
window.location.href = currentUrl.toString();
}
layui.use(function () {
var laydate = layui.laydate;
// 日期时间选择器
laydate.render({
elem: '#rt0',
type: 'datetime'
});
// 日期时间选择器
laydate.render({
elem: '#rt1',
type: 'datetime'
});
var laypage = layui.laypage;
var layer = layui.layer;
// 只显示上一页、下一页、当前页
laypage.render({
elem: 'pn',
count: <?= $smsContent->total() ?>,
curr: <?= $smsContent->currentPage() ?>,
limit: <?= $smsContent->perPage() ?>,
limits: [10, 20, 30, 50, 100],
first: false,
last: false,
layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'],
jump: function (obj, first) {
// 首次不执行
if (!first) {
redirectWithParams(obj.curr,obj.limit)
}
}
});
});
</script>
<?= $footer ?>