85 lines
2.0 KiB
PHP
85 lines
2.0 KiB
PHP
<?php
|
|
namespace app\adminapi\logic\user;
|
|
|
|
|
|
use app\common\model\user\UserInfo;
|
|
use app\common\logic\BaseLogic;
|
|
use think\facade\Db;
|
|
|
|
|
|
/**
|
|
* 用户信息逻辑
|
|
* Class UserInfoLogic
|
|
* @package app\adminapi\logic\user
|
|
*/
|
|
class UserInfoLogic extends BaseLogic
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 同意实名
|
|
* @param array $params
|
|
* @return bool
|
|
* @author BD
|
|
* @date 2024/06/08 17:51
|
|
*/
|
|
public static function agree(array $params): bool
|
|
{
|
|
Db::startTrans();
|
|
try {
|
|
$record = UserInfo::find($params['id']);
|
|
if ($record->isEmpty()) {
|
|
throw new \Exception('记录不存在');
|
|
}
|
|
if ($record['auth_card']!=2) {
|
|
throw new \Exception('状态异常');
|
|
}
|
|
UserInfo::update([
|
|
'id' => $params['id'],
|
|
'auth_card' => 1
|
|
]);
|
|
|
|
Db::commit();
|
|
return true;
|
|
} catch (\Exception $e) {
|
|
Db::rollback();
|
|
self::setError($e->getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 拒绝实名
|
|
* @param array $params
|
|
* @return bool
|
|
* @author BD
|
|
* @date 2024/06/08 17:51
|
|
*/
|
|
public static function refuse(array $params): bool
|
|
{
|
|
Db::startTrans();
|
|
try {
|
|
$record = UserInfo::find($params['id']);
|
|
if ($record->isEmpty()) {
|
|
throw new \Exception('记录不存在');
|
|
}
|
|
if ($record['auth_card']!=2) {
|
|
throw new \Exception('状态异常');
|
|
}
|
|
UserInfo::update([
|
|
'id' => $params['id'],
|
|
'auth_card' => 3,
|
|
'card_remark' => $params['remark']
|
|
]);
|
|
|
|
Db::commit();
|
|
return true;
|
|
} catch (\Exception $e) {
|
|
Db::rollback();
|
|
self::setError($e->getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |