1
This commit is contained in:
@ -76,8 +76,8 @@ class Index extends AdminController
|
||||
public function get_order()
|
||||
{
|
||||
$this->success('操作成功', [
|
||||
'count'=>(new MallOrder())->where([['create_time','>',strtotime(date('Y-m-d')." 06:00:00")],['status','=',0]])->count(),
|
||||
'rid'=>(new MallOrder())->where([['create_time','>',strtotime(date('Y-m-d')." 06:00:00")],['status','=',0]])
|
||||
'count'=>(new MallOrder())->where([['status','=',0]])->count(),
|
||||
'rid'=>(new MallOrder())->where([['status','=',0]])
|
||||
->order('id desc')->value('id')
|
||||
]);
|
||||
}
|
||||
|
||||
@ -110,6 +110,22 @@ class Order extends AdminController
|
||||
$save ? $this->success('IP拉黑成功') : $this->error('保存失败');
|
||||
}
|
||||
}
|
||||
#[NodeAnnotation(title: '开始操作', auth: true)]
|
||||
public function start_url(Request $request, $id): string
|
||||
{
|
||||
$row = self::$model::find($id);
|
||||
empty($row) && $this->error('数据不存在');
|
||||
if ($request->isPost()) {
|
||||
try {
|
||||
$save = (new \app\admin\model\BlackIp())->save([
|
||||
'type' => $row->type == 1?0:1,
|
||||
]);
|
||||
}catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
}
|
||||
$save ? $this->success('IP拉黑成功') : $this->error('保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
#[MiddlewareAnnotation(ignore: MiddlewareAnnotation::IGNORE_LOGIN)]
|
||||
public function no_check_login(Request $request): string
|
||||
|
||||
@ -12,6 +12,7 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
recharge_url: 'mall.order/recharge',
|
||||
blockip_url: 'mall.order/blockip',
|
||||
recycle_url: 'mall.order/recycle',
|
||||
start_url: 'mall.order/start_url',
|
||||
};
|
||||
|
||||
let checkTimer = null; // 定时器对象
|
||||
@ -40,6 +41,13 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
title: '操作',
|
||||
templet: ea.table.tool,
|
||||
operat: [
|
||||
[{
|
||||
class: 'layui-btn layui-btn-danger layui-btn-xs',
|
||||
method: 'get',
|
||||
field: 'id',
|
||||
text: '开始操作',
|
||||
url: init.start_url,
|
||||
}],
|
||||
[{
|
||||
class: 'layui-btn layui-btn-success layui-btn-xs',
|
||||
method: 'open',
|
||||
@ -68,8 +76,23 @@ define(["jquery", "easy-admin"], function ($, ea) {
|
||||
]],
|
||||
done: (res) => {
|
||||
$.each(res.data, function (idx, item) {
|
||||
|
||||
// ✅ 根据 type 修改“开始操作”按钮文字
|
||||
const $row = $(`tr[data-index="${idx}"]`);
|
||||
const $startBtn = $row.find('a.layui-btn:contains("开始操作")');
|
||||
if (item.type === 1) {
|
||||
$startBtn.text('取消操作')
|
||||
.removeClass('layui-btn-danger')
|
||||
.addClass('layui-btn-warm');
|
||||
} else {
|
||||
$startBtn.text('开始操作')
|
||||
.removeClass('layui-btn-warm')
|
||||
.addClass('layui-btn-danger');
|
||||
}
|
||||
|
||||
// ✅ 根据状态高亮行
|
||||
if (item.status === 1) {
|
||||
$(`tr[data-index="${idx}"]`).css({
|
||||
$row.css({
|
||||
'background': 'linear-gradient(to left, #77eb7c, #bbffbe, #ffffff, transparent)',
|
||||
'border': 'none',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user