페이지 접속·로그인 시 세션토큰/접속시각 갱신이 '로그인'으로 잔뜩 기록되던 노이즈 제거. Auditable에 auditSkipUpdateOnlyFields 추가, MemberModel에서 세션/로그인 필드 지정. (로그인 자체는 '로그인 이력'에서 별도 확인) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class MemberModel extends Model
|
|
{
|
|
use \App\Models\Traits\Auditable;
|
|
|
|
/** 로그인/세션 갱신만 있는 update는 활동 로그에 남기지 않음(로그인 이력은 별도 기록) */
|
|
protected array $auditSkipUpdateOnlyFields = ['mb_latestdate', 'mb_login_fail_count', 'mb_locked_until', 'mb_session_token'];
|
|
|
|
protected $table = 'member';
|
|
protected $primaryKey = 'mb_idx';
|
|
protected $returnType = 'object';
|
|
protected $useTimestamps = false;
|
|
protected $allowedFields = [
|
|
'mb_id',
|
|
'mb_passwd',
|
|
'mb_totp_secret',
|
|
'mb_totp_enabled',
|
|
'mb_name',
|
|
'mb_email',
|
|
'mb_phone',
|
|
'mb_lang',
|
|
'mb_level',
|
|
'mb_group',
|
|
'mb_lg_idx',
|
|
'mb_state',
|
|
'mb_regdate',
|
|
'mb_latestdate',
|
|
'mb_leavedate',
|
|
'mb_login_fail_count',
|
|
'mb_locked_until',
|
|
'mb_session_token',
|
|
];
|
|
|
|
/**
|
|
* mb_id로 회원 조회
|
|
*/
|
|
public function findByLoginId(string $mbId): ?object
|
|
{
|
|
return $this->where('mb_id', $mbId)->first();
|
|
}
|
|
|
|
/**
|
|
* mb_id 중복 여부
|
|
*/
|
|
public function isIdExists(string $mbId): bool
|
|
{
|
|
return $this->where('mb_id', $mbId)->countAllResults() > 0;
|
|
}
|
|
}
|