34 lines
762 B
PHP
34 lines
762 B
PHP
<?php
|
|
|
|
namespace app\api\model;
|
|
|
|
|
|
use app\common\library\DatabaseRoute;
|
|
use support\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
|
|
]);
|
|
|
|
}
|
|
} |