dbms_primeidc_init...1
This commit is contained in:
parent
98ae65b5e9
commit
a813ea810c
@ -64,17 +64,9 @@ class CouponController extends ClientController
|
||||
}
|
||||
$this->member = $member;
|
||||
//쿠폰내역
|
||||
$this->getServiceService()->getModel()->where("client_code", $client_code);
|
||||
$this->getServiceService()->getModel()->whereNotIn("service_line", ['vpn', 'test', 'soloLine', 'substitution']);
|
||||
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
|
||||
$this->getServiceService()->getModel()->setContinue(true);
|
||||
$this->total = $this->getServiceService()->getCount();
|
||||
//limit, offset 설정
|
||||
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
|
||||
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
|
||||
$this->getServiceService()->getModel()->limit($this->perPage);
|
||||
$this->getServiceService()->getModel()->offset(($this->curPage - 1) * $this->perPage);
|
||||
$this->services = $this->getServiceService()->getEntities();
|
||||
[$this->total, $this->services] = $this->getServiceService()->getEntitiesByClient($this->curPage, $this->perPage, $client_code);
|
||||
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
|
||||
$total_coupon = 0;
|
||||
foreach ($this->services as $service) {
|
||||
@ -114,24 +106,6 @@ class CouponController extends ClientController
|
||||
}
|
||||
$this->member = $member;
|
||||
$this->today = date("Y-m-d");
|
||||
//쿠폰내역
|
||||
$this->getServiceService()->getModel()->where("client_code", $service->getClientCode());
|
||||
$this->getServiceService()->getModel()->whereNotIn("service_line", ['vpn', 'test', 'soloLine', 'substitution']);
|
||||
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
|
||||
$this->getServiceService()->getModel()->setContinue(true);
|
||||
$this->total = $this->getServiceService()->getCount();
|
||||
//limit, offset 설정
|
||||
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
|
||||
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
|
||||
$this->getServiceService()->getModel()->limit($this->perPage);
|
||||
$this->getServiceService()->getModel()->offset(($this->curPage - 1) * $this->perPage);
|
||||
$this->services = $this->getServiceService()->getEntities();
|
||||
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
|
||||
$total_coupon = 0;
|
||||
foreach ($this->services as $service) {
|
||||
$total_coupon += $service->getCoupon();
|
||||
}
|
||||
$this->total_coupon = $total_coupon;
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
|
||||
@ -178,17 +152,17 @@ class CouponController extends ClientController
|
||||
//onetime_request_date 사용일
|
||||
$onetime_request_date = $this->request->get('onetime_request_date') ?? date("Y-m-d");
|
||||
try {
|
||||
$this->getServiceService()->getModel()->setTransaction(true);
|
||||
$this->getServiceService()->beginTransaction();
|
||||
//서비스쿠폰 갯수 수정
|
||||
$this->getServiceService()->useCouponForDomain($service, $coupon);
|
||||
//쿠폰 사용내역 onetime에 등록
|
||||
$this->getOnetimeService()->useCouponForDomain($service, $client, $member, $onetime_case, $coupon, $note, $onetime_request_date);
|
||||
//쿠폰 사용내역 history에 등록
|
||||
$this->getHistoryService()->useCouponForDomain($service, $client, $onetime_case, $coupon, $note, $onetime_request_date);;
|
||||
$this->getServiceService()->getModel()->commit();
|
||||
$this->getServiceService()->commit();
|
||||
return $this->redirect->to(DBMS_SITE_URL . "/IdcCouponUseMK.cup?client_code=" . $this->client->getClientCode());
|
||||
} catch (\PDOException $e) {
|
||||
$this->getServiceService()->getModel()->rollback();
|
||||
$this->getServiceService()->rollback();
|
||||
return $this->redirect->back()->withInput()->with('error', ['message' => '쿠폰 사용에 실패하였습니다.:' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ class DashboardController extends ClientController
|
||||
$dashboard[$service_line] = $this->getServiceService()->getServiceLineCountByClient($client_code, $service_line);
|
||||
} //foreach
|
||||
//서비스상태별(정상,정지,해지등)
|
||||
$dashboard['coupon'] = intval($this->getServiceService()->getCouponCountByClient($client_code));
|
||||
$dashboard['coupon'] = intval($this->getServiceService()->getCouponTotalCountByClient($client_code));
|
||||
$this->dashboard = $dashboard;
|
||||
$this->client_code = $client_code;
|
||||
return $this->render(__FUNCTION__);
|
||||
|
||||
@ -35,8 +35,7 @@ class MemoController extends ClientController
|
||||
throw new \Exception("client_code 값이 정의되지 않았습니다.");
|
||||
}
|
||||
$client_code = $params['client_code'];
|
||||
$this->getClientService()->getModel()->where("Client_Code", $client_code);
|
||||
$entity = $this->getClientService()->getEntity();
|
||||
$entity = $this->getClientService()->getEntityByCode($client_code);
|
||||
if (!$entity) {
|
||||
throw new \Exception("[$client_code]에 해당하는 사용자정보가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ namespace lib\Controllers\DBMS\Client;
|
||||
|
||||
use lib\Services\MemberService;
|
||||
use lib\Services\OnetimeService;
|
||||
use lib\Utils\Pagination;
|
||||
|
||||
class OnetimeController extends ClientController
|
||||
{
|
||||
@ -35,10 +36,11 @@ class OnetimeController extends ClientController
|
||||
public function coupon()
|
||||
{
|
||||
//쿠폰내역
|
||||
$this->getOnetimeService()->getModel()->like(["onetime_case" => "%domain%"]);
|
||||
$this->getOnetimeService()->getModel()->orderBy("onetime_request_date", "DESC");
|
||||
$this->entities = $this->getOnetimeService()->getEntities();
|
||||
//해당 고객정보
|
||||
$this->curPage = intval($params['curPage'] ?? $this->request->get('curPage') ?? 1);
|
||||
$this->perPage = intval($params['perPage'] ?? $this->request->get('perPage') ?? VIEW_LIST_PERPAGE);
|
||||
[$this->total, $this->services] = $this->getOnetimeService()->getEntitiesForDomainCoupon($this->curPage, $this->perPage);
|
||||
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
|
||||
//전체 고객정보
|
||||
$this->clients = $this->getClientService()->getEntities();
|
||||
//전체 관리자정보(등록자)
|
||||
$this->members = $this->getMemberService()->getEntities();
|
||||
|
||||
@ -13,7 +13,7 @@ abstract class CommonService extends Core
|
||||
} //
|
||||
abstract public function getModelClass(): string;
|
||||
abstract public function getEntityClass(): string;
|
||||
final public function getModel(): mixed
|
||||
final protected function getModel(): mixed
|
||||
{
|
||||
if ($this->_model === null) {
|
||||
$modelClass = $this->getModelClass();
|
||||
@ -57,4 +57,18 @@ abstract class CommonService extends Core
|
||||
}
|
||||
return $insertId;
|
||||
} //
|
||||
|
||||
//transaction관련련
|
||||
final public function beginTransaction(): void
|
||||
{
|
||||
$this->getModel()->beginTransaction();
|
||||
}
|
||||
final public function commit(): void
|
||||
{
|
||||
$this->getModel()->commit();
|
||||
}
|
||||
final public function rollBack(): void
|
||||
{
|
||||
$this->getModel()->rollBack();
|
||||
}
|
||||
} //Class
|
||||
|
||||
@ -42,6 +42,20 @@ class OnetimeService extends CommonService
|
||||
return $this->getCount();
|
||||
}
|
||||
|
||||
//Coupon 리스트
|
||||
public function getEntitiesForDomainCoupon(int $curPage, int $perPage): array
|
||||
{
|
||||
$this->getModel()->like(["onetime_case", "%domain%"]);
|
||||
$this->getModel()->orderBy("onetime_request_date", "DESC");
|
||||
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
|
||||
$this->getModel()->setContinue(true);
|
||||
$total = $this->getCount();
|
||||
//limit, offset 설정
|
||||
$this->getModel()->limit($perPage);
|
||||
$this->getModel()->offset(($curPage - 1) * $perPage);
|
||||
return [$total, $this->getEntities()];
|
||||
}
|
||||
|
||||
//도메인쿠폰 사용용
|
||||
public function useCouponForDomain(ServiceEntity $service, ClientEntity $client, MemberEntity $member, string $onetime_case, int $coupon, string $note, string $onetime_request_date): bool
|
||||
{
|
||||
|
||||
@ -34,6 +34,20 @@ class ServiceService extends CommonService
|
||||
$this->getModel()->where('service_code', $key);
|
||||
return $this->getEntity();
|
||||
}
|
||||
//사용자별 서비스리스트트
|
||||
public function getEntitiesByClient(int $curPage, int $perPage, string $client_code): array
|
||||
{
|
||||
$this->getModel()->where("client_code", $client_code);
|
||||
$this->getModel()->whereNotIn("service_line", ['vpn', 'test', 'solo', 'substitution', 'event']);
|
||||
//Query문 Rest여부 -> 같은조건에 Count 받고, 결과값을 받고 싶을때는 continue()
|
||||
$this->getModel()->setContinue(true);
|
||||
$total = $this->getCount();
|
||||
//limit, offset 설정
|
||||
$this->getModel()->limit($perPage);
|
||||
$this->getModel()->offset(($curPage - 1) * $perPage);
|
||||
return [$total, $this->getEntities()];
|
||||
}
|
||||
|
||||
//최근 $day일간 신규서비스 카운트
|
||||
public function getLatestCount(int $day, array $excepts): int|string
|
||||
{
|
||||
@ -114,13 +128,12 @@ class ServiceService extends CommonService
|
||||
return $this->getCount();
|
||||
}
|
||||
//사용자별용 서비스 쿠폰 카운트
|
||||
public function getCouponCountByClient(string $client_code): int
|
||||
public function getCouponTotalCountByClient(string $client_code): int
|
||||
{
|
||||
$this->getModel()->where("client_code", "{$client_code}");
|
||||
$this->getModel()->whereNotIn("service_line", ['vpn', 'test', 'solo', 'substitution', 'event']);
|
||||
return $this->getCount("SUM(coupon) as cnt");
|
||||
}
|
||||
|
||||
//도메인쿠폰 사용용
|
||||
public function useCouponForDomain(ServiceEntity $service, int $coupon): bool
|
||||
{
|
||||
|
||||
@ -31,4 +31,5 @@
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div align='center'><?= $this->pagination->render(DBMS_SITE_URL . "/IdcDomainBuyListMK.cup", ['curPage' => $this->curPage, 'perPage' => $this->perPage]) ?></div>
|
||||
@ -93,7 +93,7 @@ public class IdcCuponFrontController extends HttpServlet {
|
||||
viewPage="DefaultPage.jsp";
|
||||
}
|
||||
//NEW 도메인 구매 목록 조회 - MK
|
||||
if(cmdURI.equals("/IdcDomainBuyListMK.cup"))
|
||||
if(cmdURI.equals("/.cup"))
|
||||
{
|
||||
cmd = new IdcCuponListCmd();
|
||||
cmd.execute(request, response);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user