add
This commit is contained in:
34
app/api/model/TbUserBlacklist.php
Normal file
34
app/api/model/TbUserBlacklist.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
|
||||
use app\common\library\DatabaseRoute;
|
||||
use think\facade\Log;
|
||||
use think\Model;
|
||||
|
||||
class TbUserBlacklist extends Model
|
||||
{
|
||||
|
||||
public function addBlackUser(int $userId, string $string)
|
||||
{
|
||||
|
||||
Log::info("用户{$userId}加入黑名单,原因:{$string}");
|
||||
$user = DatabaseRoute::getDb('tb_user', $userId)->where([
|
||||
'user_id' => $userId
|
||||
])->find();
|
||||
if ($user && $user['cert_no']) {
|
||||
$this->insert([
|
||||
'real_name' => $user['real_name'],
|
||||
'cert_no' => $user['cert_no'],
|
||||
]);
|
||||
}
|
||||
|
||||
DatabaseRoute::getDb('tb_user', $userId, true)->where([
|
||||
'user_id' => $userId
|
||||
])->update([
|
||||
'status' => 0
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user