dbmsv3 init...1

This commit is contained in:
choi.jh 2025-10-27 10:29:14 +09:00
parent 402c976fde
commit c71efa7eb5
17 changed files with 38 additions and 87 deletions

View File

@ -2,6 +2,7 @@
namespace App\Controllers\Admin;
use App\Entities\BoardEntity;
use App\Services\BoardService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;

View File

@ -2,8 +2,9 @@
namespace App\Controllers\Admin\Customer;
use App\Services\Customer\AccountService;
use App\Entities\Customer\AccountEntity;
use App\Services\Customer\AccountService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;

View File

@ -71,6 +71,7 @@ class ClientController extends CustomerController
}
return $result;
}
//고객 상세정보
public function detail(mixed $uid): RedirectResponse|string
{
try {

View File

@ -2,8 +2,9 @@
namespace App\Controllers\Admin\Customer;
use App\Services\Customer\CouponService;
use App\Entities\Customer\CouponEntity;
use App\Services\Customer\CouponService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;

View File

@ -2,8 +2,9 @@
namespace App\Controllers\Admin\Customer;
use App\Services\Customer\PointService;
use App\Entities\Customer\PointEntity;
use App\Services\Customer\PointService;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
@ -27,4 +28,10 @@ class PointController extends CustomerController
return $this->_service;
}
//Index,FieldForm관련.
//생성
protected function create_proceess(array $formDatas): PointEntity
{
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create_process($formDatas);
}
}

View File

@ -147,6 +147,8 @@ abstract class CommonController extends BaseController
}
protected function create_process(array $formDatas): mixed
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return $this->getService()->create($formDatas);
}
public function create(): RedirectResponse|string

View File

@ -7,11 +7,11 @@ use App\Entities\BoardEntity;
class BoardModel extends CommonModel
{
const TABLE = "boardinfo";
const PK = "uid";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = BoardEntity::class;
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = BoardEntity::class;
protected $allowedFields = [
"uid",
"user_uid",
@ -20,7 +20,7 @@ class BoardModel extends CommonModel
"title",
"content",
"status",
"updated_at"
"updated_at",
];
public function __construct()
{
@ -51,10 +51,4 @@ class BoardModel extends CommonModel
}
return $rule;
}
final public function create(array $formDatas): BoardEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -6,7 +6,6 @@ use CodeIgniter\Model;
abstract class CommonModel extends Model
{
private $_myAuth = null;
protected $table = '';
protected $primaryKey = '';
protected $useAutoIncrement = true;
@ -65,13 +64,6 @@ abstract class CommonModel extends Model
// protected $beforeInsert = ['generateUUID'];
// allowedFields에는 PK넣으면 않됨, Column Type: CHAR(36)
//
final public function getMyAuth(): mixed
{
if (!$this->_myAuth) {
$this->_myAuth = service('myauth');
}
return $this->_myAuth;
}
final protected function generateUUID(): string
{
$data = random_bytes(16);

View File

@ -7,11 +7,11 @@ use App\Entities\Customer\AccountEntity;
class AccountModel extends CustomerModel
{
const TABLE = "accountinfo";
const PK = "uid";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = AccountEntity::class;
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = AccountEntity::class;
protected $allowedFields = [
"uid",
"user_uid",
@ -23,7 +23,7 @@ class AccountModel extends CustomerModel
"issue_at",
"amount",
"status",
"updated_at"
"updated_at",
];
public function __construct()
{
@ -38,7 +38,7 @@ class AccountModel extends CustomerModel
case "user_uid":
case "clientinfo_uid":
case "amount":
$rule = "required|numeric";
$rule = "required|numeric";
break;
case "bank":
case "title":
@ -58,11 +58,4 @@ class AccountModel extends CustomerModel
}
return $rule;
}
final public function create(array $formDatas): AccountEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -68,10 +68,4 @@ class ClientModel extends CustomerModel
return $rule;
}
//입력전 코드처리
final public function create(array $formDatas): ClientEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -50,10 +50,4 @@ class CouponModel extends CustomerModel
}
return $rule;
}
final public function create(array $formDatas): CouponEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -50,10 +50,4 @@ class PointModel extends CustomerModel
}
return $rule;
}
final public function create(array $formDatas): PointEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -83,8 +83,6 @@ class ServiceModel extends CustomerModel
final public function create(array $formDatas): ServiceEntity
{
$formDatas['code'] = $formDatas['site'] . "_s" . uniqid();
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -97,11 +97,4 @@ class ServerModel extends EquipmentModel
return $value;
}
//기본기능
//입력전 코드처리
final public function create(array $formDatas): ServerEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -7,18 +7,18 @@ use App\Entities\MyLogEntity;
class MyLogModel extends CommonModel
{
const TABLE = "mylog";
const PK = "uid";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = MyLogEntity::class;
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = MyLogEntity::class;
protected $allowedFields = [
"uid",
"user_uid",
"title",
"content",
"status",
"updated_at"
"updated_at",
];
public function __construct()
{
@ -48,11 +48,4 @@ class MyLogModel extends CommonModel
}
return $rule;
}
final public function create(array $formDatas): MylogEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -64,11 +64,4 @@ class PaymentModel extends CommonModel
}
return $rule;
}
final public function create(array $formDatas): PaymentEntity
{
// 관리자 UID는 현재 인증된 사용자로 설정
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
return parent::create($formDatas);
}
}

View File

@ -28,11 +28,11 @@ abstract class AuthService extends CommonService
}
return $this->_session;
}
private function getAuthInfo(string $key = ""): array|string
private function getAuthInfo(string $key = ""): array|string|null
{
$authInfo = $this->getSession()->get(SESSION_NAMES['AUTH']);
if ($key) {
return $authInfo[$key] ?? "";
return $authInfo[$key] ?? null;
}
return $authInfo;
}
@ -40,19 +40,19 @@ abstract class AuthService extends CommonService
{
return ['id', 'passwd'];
}
final public function getUIDByAuthInfo(): string
final public function getUIDByAuthInfo(): string|null
{
return $this->getAuthInfo('uid');
}
final public function getIDByAuthInfo(): string
final public function getIDByAuthInfo(): string|null
{
return $this->getAuthInfo('id');
}
final public function getNameByAuthInfo(): string
final public function getNameByAuthInfo(): string|null
{
return $this->getAuthInfo('name');
}
final public function getRoleByAuthInfo(): string
final public function getRoleByAuthInfo(): string|null
{
return $this->getAuthInfo('role');
}