dbmsv3 init...1
This commit is contained in:
parent
402c976fde
commit
c71efa7eb5
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin;
|
namespace App\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Entities\BoardEntity;
|
||||||
use App\Services\BoardService;
|
use App\Services\BoardService;
|
||||||
use CodeIgniter\HTTP\RequestInterface;
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
|||||||
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin\Customer;
|
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\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|||||||
@ -71,6 +71,7 @@ class ClientController extends CustomerController
|
|||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
//고객 상세정보
|
||||||
public function detail(mixed $uid): RedirectResponse|string
|
public function detail(mixed $uid): RedirectResponse|string
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin\Customer;
|
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\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|||||||
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Controllers\Admin\Customer;
|
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\RequestInterface;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
@ -27,4 +28,10 @@ class PointController extends CustomerController
|
|||||||
return $this->_service;
|
return $this->_service;
|
||||||
}
|
}
|
||||||
//Index,FieldForm관련.
|
//Index,FieldForm관련.
|
||||||
|
//생성
|
||||||
|
protected function create_proceess(array $formDatas): PointEntity
|
||||||
|
{
|
||||||
|
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||||
|
return parent::create_process($formDatas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,6 +147,8 @@ abstract class CommonController extends BaseController
|
|||||||
}
|
}
|
||||||
protected function create_process(array $formDatas): mixed
|
protected function create_process(array $formDatas): mixed
|
||||||
{
|
{
|
||||||
|
// 관리자 UID는 현재 인증된 사용자로 설정
|
||||||
|
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
||||||
return $this->getService()->create($formDatas);
|
return $this->getService()->create($formDatas);
|
||||||
}
|
}
|
||||||
public function create(): RedirectResponse|string
|
public function create(): RedirectResponse|string
|
||||||
|
|||||||
@ -7,11 +7,11 @@ use App\Entities\BoardEntity;
|
|||||||
class BoardModel extends CommonModel
|
class BoardModel extends CommonModel
|
||||||
{
|
{
|
||||||
const TABLE = "boardinfo";
|
const TABLE = "boardinfo";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
const TITLE = "title";
|
const TITLE = "title";
|
||||||
protected $table = self::TABLE;
|
protected $table = self::TABLE;
|
||||||
protected $primaryKey = self::PK;
|
protected $primaryKey = self::PK;
|
||||||
protected $returnType = BoardEntity::class;
|
protected $returnType = BoardEntity::class;
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"uid",
|
"uid",
|
||||||
"user_uid",
|
"user_uid",
|
||||||
@ -20,7 +20,7 @@ class BoardModel extends CommonModel
|
|||||||
"title",
|
"title",
|
||||||
"content",
|
"content",
|
||||||
"status",
|
"status",
|
||||||
"updated_at"
|
"updated_at",
|
||||||
];
|
];
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -51,10 +51,4 @@ class BoardModel extends CommonModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
final public function create(array $formDatas): BoardEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ use CodeIgniter\Model;
|
|||||||
|
|
||||||
abstract class CommonModel extends Model
|
abstract class CommonModel extends Model
|
||||||
{
|
{
|
||||||
private $_myAuth = null;
|
|
||||||
protected $table = '';
|
protected $table = '';
|
||||||
protected $primaryKey = '';
|
protected $primaryKey = '';
|
||||||
protected $useAutoIncrement = true;
|
protected $useAutoIncrement = true;
|
||||||
@ -65,13 +64,6 @@ abstract class CommonModel extends Model
|
|||||||
// protected $beforeInsert = ['generateUUID'];
|
// protected $beforeInsert = ['generateUUID'];
|
||||||
// allowedFields에는 PK넣으면 않됨, Column Type: CHAR(36)
|
// 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
|
final protected function generateUUID(): string
|
||||||
{
|
{
|
||||||
$data = random_bytes(16);
|
$data = random_bytes(16);
|
||||||
|
|||||||
@ -7,11 +7,11 @@ use App\Entities\Customer\AccountEntity;
|
|||||||
class AccountModel extends CustomerModel
|
class AccountModel extends CustomerModel
|
||||||
{
|
{
|
||||||
const TABLE = "accountinfo";
|
const TABLE = "accountinfo";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
const TITLE = "title";
|
const TITLE = "title";
|
||||||
protected $table = self::TABLE;
|
protected $table = self::TABLE;
|
||||||
protected $primaryKey = self::PK;
|
protected $primaryKey = self::PK;
|
||||||
protected $returnType = AccountEntity::class;
|
protected $returnType = AccountEntity::class;
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"uid",
|
"uid",
|
||||||
"user_uid",
|
"user_uid",
|
||||||
@ -23,7 +23,7 @@ class AccountModel extends CustomerModel
|
|||||||
"issue_at",
|
"issue_at",
|
||||||
"amount",
|
"amount",
|
||||||
"status",
|
"status",
|
||||||
"updated_at"
|
"updated_at",
|
||||||
];
|
];
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -38,7 +38,7 @@ class AccountModel extends CustomerModel
|
|||||||
case "user_uid":
|
case "user_uid":
|
||||||
case "clientinfo_uid":
|
case "clientinfo_uid":
|
||||||
case "amount":
|
case "amount":
|
||||||
$rule = "required|numeric";
|
$rule = "required|numeric";
|
||||||
break;
|
break;
|
||||||
case "bank":
|
case "bank":
|
||||||
case "title":
|
case "title":
|
||||||
@ -58,11 +58,4 @@ class AccountModel extends CustomerModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function create(array $formDatas): AccountEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,10 +68,4 @@ class ClientModel extends CustomerModel
|
|||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
//입력전 코드처리
|
//입력전 코드처리
|
||||||
final public function create(array $formDatas): ClientEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,10 +50,4 @@ class CouponModel extends CustomerModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
final public function create(array $formDatas): CouponEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,10 +50,4 @@ class PointModel extends CustomerModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
final public function create(array $formDatas): PointEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,8 +83,6 @@ class ServiceModel extends CustomerModel
|
|||||||
final public function create(array $formDatas): ServiceEntity
|
final public function create(array $formDatas): ServiceEntity
|
||||||
{
|
{
|
||||||
$formDatas['code'] = $formDatas['site'] . "_s" . uniqid();
|
$formDatas['code'] = $formDatas['site'] . "_s" . uniqid();
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
return parent::create($formDatas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,11 +97,4 @@ class ServerModel extends EquipmentModel
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
//기본기능
|
//기본기능
|
||||||
//입력전 코드처리
|
|
||||||
final public function create(array $formDatas): ServerEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,18 +7,18 @@ use App\Entities\MyLogEntity;
|
|||||||
class MyLogModel extends CommonModel
|
class MyLogModel extends CommonModel
|
||||||
{
|
{
|
||||||
const TABLE = "mylog";
|
const TABLE = "mylog";
|
||||||
const PK = "uid";
|
const PK = "uid";
|
||||||
const TITLE = "title";
|
const TITLE = "title";
|
||||||
protected $table = self::TABLE;
|
protected $table = self::TABLE;
|
||||||
protected $primaryKey = self::PK;
|
protected $primaryKey = self::PK;
|
||||||
protected $returnType = MyLogEntity::class;
|
protected $returnType = MyLogEntity::class;
|
||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
"uid",
|
"uid",
|
||||||
"user_uid",
|
"user_uid",
|
||||||
"title",
|
"title",
|
||||||
"content",
|
"content",
|
||||||
"status",
|
"status",
|
||||||
"updated_at"
|
"updated_at",
|
||||||
];
|
];
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -48,11 +48,4 @@ class MyLogModel extends CommonModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function create(array $formDatas): MylogEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,11 +64,4 @@ class PaymentModel extends CommonModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function create(array $formDatas): PaymentEntity
|
|
||||||
{
|
|
||||||
// 관리자 UID는 현재 인증된 사용자로 설정
|
|
||||||
$formDatas['user_uid'] = $this->getMyAuth()->getUIDByAuthInfo();
|
|
||||||
return parent::create($formDatas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,11 +28,11 @@ abstract class AuthService extends CommonService
|
|||||||
}
|
}
|
||||||
return $this->_session;
|
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']);
|
$authInfo = $this->getSession()->get(SESSION_NAMES['AUTH']);
|
||||||
if ($key) {
|
if ($key) {
|
||||||
return $authInfo[$key] ?? "";
|
return $authInfo[$key] ?? null;
|
||||||
}
|
}
|
||||||
return $authInfo;
|
return $authInfo;
|
||||||
}
|
}
|
||||||
@ -40,19 +40,19 @@ abstract class AuthService extends CommonService
|
|||||||
{
|
{
|
||||||
return ['id', 'passwd'];
|
return ['id', 'passwd'];
|
||||||
}
|
}
|
||||||
final public function getUIDByAuthInfo(): string
|
final public function getUIDByAuthInfo(): string|null
|
||||||
{
|
{
|
||||||
return $this->getAuthInfo('uid');
|
return $this->getAuthInfo('uid');
|
||||||
}
|
}
|
||||||
final public function getIDByAuthInfo(): string
|
final public function getIDByAuthInfo(): string|null
|
||||||
{
|
{
|
||||||
return $this->getAuthInfo('id');
|
return $this->getAuthInfo('id');
|
||||||
}
|
}
|
||||||
final public function getNameByAuthInfo(): string
|
final public function getNameByAuthInfo(): string|null
|
||||||
{
|
{
|
||||||
return $this->getAuthInfo('name');
|
return $this->getAuthInfo('name');
|
||||||
}
|
}
|
||||||
final public function getRoleByAuthInfo(): string
|
final public function getRoleByAuthInfo(): string|null
|
||||||
{
|
{
|
||||||
return $this->getAuthInfo('role');
|
return $this->getAuthInfo('role');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user