清数据 ip限制

This commit is contained in:
2025-08-11 18:58:23 +08:00
parent d2baceadea
commit 89e6c023db

View File

@@ -8,8 +8,10 @@ use think\Log;
class Ceshi extends Controller
{
//测试 发送各种消息
//设置白名单ip访问本类接口
protected $allowIp = [
'113.201.181.82'
];
//发送群组系统消息
public function send_group_system_notification()
@@ -150,6 +152,13 @@ class Ceshi extends Controller
//清空数据 禁用 慎用
public function clear_data()
{
//ip
$ip = request()->ip();
//白名单
$white_list = $this -> allowIp;
if (!in_array($ip, $white_list)) {
return V(301, '非法访问!');
}
$i = 0;
$res = [];
//开启事务