dbms_init...1
This commit is contained in:
parent
94dc5c933f
commit
e437c1e3cd
@ -59,29 +59,4 @@ class ServiceModel extends CustomerModel
|
|||||||
}
|
}
|
||||||
return $rule;
|
return $rule;
|
||||||
}
|
}
|
||||||
//다음 달로 결제일을 연장합니다.
|
|
||||||
public function extendPaymentDate(int $uid): mixed
|
|
||||||
{
|
|
||||||
$sql = "UPDATE ? SET billing_at = IF(
|
|
||||||
DAY(billing_at) = DAY(LAST_DAY(billing_at)),
|
|
||||||
LAST_DAY(DATE_ADD(billing_at, INTERVAL 1 MONTH)),
|
|
||||||
DATE_ADD(billing_at, INTERVAL 1 MONTH))
|
|
||||||
WHERE uid = ? AND status = ?";
|
|
||||||
$sql = $this->setQuery($sql)
|
|
||||||
->setParameter(1, $this->getTableName())
|
|
||||||
->setParameter(2, $uid)
|
|
||||||
->setParameter(3, DEFAULTS['STATUS'])
|
|
||||||
->getSQL();
|
|
||||||
if (!$sql) {
|
|
||||||
throw new \Exception("SQL문이 생성되지 않았습니다.");
|
|
||||||
}
|
|
||||||
if (!$this->isValidQuery($sql)) {
|
|
||||||
throw new \Exception("SQL문이 유효하지 않습니다: " . $sql);
|
|
||||||
}
|
|
||||||
// 쿼리 실행
|
|
||||||
if (!$this->execute($sql)) {
|
|
||||||
throw new \Exception("SQL문 실행에 실패했습니다: " . $sql);
|
|
||||||
}
|
|
||||||
return $this->query($sql);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ abstract class CommonService
|
|||||||
}
|
}
|
||||||
return $this->setRelatedEntity($entity);
|
return $this->setRelatedEntity($entity);
|
||||||
}
|
}
|
||||||
public function findAllDatas(array $columns = ['*']): mixed
|
protected function findAllDatas(array $columns = ['*']): mixed
|
||||||
{
|
{
|
||||||
return $this->getModel()->select(implode(',', $columns))->findAll();
|
return $this->getModel()->select(implode(',', $columns))->findAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,24 +78,29 @@ class ServiceService extends CustomerService
|
|||||||
{
|
{
|
||||||
return $this->_searchIP;
|
return $this->_searchIP;
|
||||||
}
|
}
|
||||||
public function findAllDatas(array $columns = ['*']): mixed
|
protected function findAllDatas(array $columns = ['*']): mixed
|
||||||
{
|
{
|
||||||
$ip = $this->getSearchIp();
|
$ip = $this->getSearchIp();
|
||||||
if ($ip) {
|
if ($ip) {
|
||||||
$sql = "SELECT serviceinfo.* FROM serviceinfo
|
$sql = "SELECT serviceinfo.* FROM serviceinfo
|
||||||
LEFT JOIN serviceinfo_items ON serviceinfo.uid = serviceinfo_items.serviceinfo_uid
|
LEFT JOIN serviceinfo_items ON serviceinfo.uid = serviceinfo_items.serviceinfo_uid
|
||||||
WHERE serviceinfo_items.item_type='IP'
|
WHERE serviceinfo_items.item_type = ?
|
||||||
AND serviceinfo_items.item_uid IN (SELECT uid FROM ipinfo WHERE ip='{$ip}')";
|
AND serviceinfo_items.item_uid IN (SELECT uid FROM ipinfo WHERE ip = ?)";
|
||||||
return $this->getModel()->query($sql)->getResult(ServiceEntity::class);
|
return $this->getModel()->query($sql, ['IP', $ip])->getResult(ServiceEntity::class);
|
||||||
}
|
}
|
||||||
return parent::findAllDatas($columns);
|
return parent::findAllDatas($columns);
|
||||||
}
|
}
|
||||||
//기본 기능부분
|
//기본 기능부분
|
||||||
|
|
||||||
//다음 달로 결제일을 연장합니다.
|
//다음 달로 결제일을 연장합니다.
|
||||||
public function extendPaymentDate(ServiceEntity $entity): void
|
public function extendBillingAt(ServiceEntity $entity): bool
|
||||||
{
|
{
|
||||||
$this->getModel()->extendPaymentDate($entity->getPK());
|
$sql = "UPDATE serviceinfo SET billing_at =
|
||||||
|
IF(DAY(billing_at) > DAY(LAST_DAY(billing_at)),
|
||||||
|
LAST_DAY(DATE_ADD(billing_at, INTERVAL 1 MONTH)),
|
||||||
|
DATE_ADD(billing_at, INTERVAL 1 MONTH)
|
||||||
|
) WHERE uid = ?";
|
||||||
|
return $this->getModel()->query($sql, [$entity->getPK()]);
|
||||||
}
|
}
|
||||||
public function create(array $formDatas, mixed $entity = null): ServiceEntity
|
public function create(array $formDatas, mixed $entity = null): ServiceEntity
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user