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; } } }