36 lines
907 B
PHP
36 lines
907 B
PHP
<?php
|
||
|
||
namespace App\Cache\Table\Api;
|
||
|
||
use App\Cache\Base\TableBaseCache;
|
||
use App\Models\Api\Customer\CustomerUserModel;
|
||
|
||
//用户缓存用户基础信息(结构自己组装不完全等于数据表)uid为主键
|
||
class TableCustomerUserCache extends TableBaseCache
|
||
{
|
||
|
||
public string $table_class = CustomerUserModel::class;
|
||
public string $primary_prefix = 'TableCustomerUserCache:'; //后面跟uid
|
||
|
||
public string $primary_key_column = 'id';
|
||
public array $get_exclude_columns = [
|
||
'password',
|
||
'google_auth_secret',
|
||
];
|
||
|
||
function loadData(): array|string|null
|
||
{
|
||
|
||
|
||
$oTable = new $this->table_class();
|
||
$oData = $oTable->findItemByWhere([$this->primary_key_column => $this->primary_key], $this->get_columns);
|
||
|
||
if (!$oData) return null;
|
||
|
||
$aData = $oData->toArray();
|
||
if (empty($aData)) return null;
|
||
|
||
return $aData;
|
||
}
|
||
}
|