实时记录限制记录

This commit is contained in:
wong
2025-07-23 18:01:20 +08:00
parent 89b27ea293
commit 5dc9faf1be

View File

@@ -3,6 +3,7 @@
namespace app\api\controller; namespace app\api\controller;
use app\api\model\FriendTaskModel; use app\api\model\FriendTaskModel;
use app\common\model\WechatRestricts;
use think\facade\Request; use think\facade\Request;
class FriendTaskController extends BaseController class FriendTaskController extends BaseController
@@ -153,11 +154,39 @@ class FriendTaskController extends BaseController
// 使用taskId作为唯一性判断 // 使用taskId作为唯一性判断
$task = FriendTaskModel::where('id', $item['id'])->find(); $task = FriendTaskModel::where('id', $item['id'])->find();
if ($task) { if ($task) {
$task->save($data); $task->save($data);
} else { } else {
FriendTaskModel::create($data); FriendTaskModel::create($data);
} }
//创建非法记录
if ($item['status'] == 2){
$data = [
'level' => 2,
'taskId' => $item['id'],
'reason' => '',
'memo' => '',
'wechatId' => $item['wechatId'],
'companyId' => '',
'restrictTime' => time(),
'recoveryTime' => time() + 3600 * 72,
];
if (strpos('操作过于频繁', $item['extra']) !== false){
$data['reason'] = '频繁添加好友';
$data['memo'] = '操作过于频繁,请稍后再试';
}
if (strpos('当前账号存在安全风险', $item['extra']) !== false){
$data['reason'] = '账号风险';
$data['memo'] = '当前账号存在安全风险,需先到「微信团队」进行安全验证后才能继续使用当前功能';
}
$res = WechatRestricts::where('taskId', $item['id'])->find();
if (empty($res)) {
WechatRestricts::create($data);
}
}
} }
} }