view->results = $this->getServiceModel()->getExtras($code); return $this->render('extraservice'); } public function execute(array $lines, $client_field = "Client_Code", $debug = false) { $loop = 1; foreach ($lines as $line) { list($clientData, $coupon_cnt) = explode("||", rtrim($line)); try { //고객정보 가져오기 $this->getClientModel()->where([$client_field => $clientData]); $client = $this->getClientModel()->getEntity(); //고객 일회성서비스정보(쿠폰) 가져오기 $this->getServiceModel()->where(["server_code" => $client->Client_Name . "-일회성"]); $service = $this->getServiceModel()->getEntity(); if (isset($service->service_code)) { throw new \Exception("{$loop}번째: [{$client->Client_Name}]고객의 일회성장비가 존재하지 않습니다."); } //쿠폰 설정 $this->getServiceModel()->where(["service_code" => $service->service_code]); $this->getServiceModel()->modify(['coupon' => $coupon_cnt]); printf( "%20s[%20s:%15s]=>쿠폰 %3d개 설정 성공\n", $client->Client_Name, $service->server_code, $service->service_code, $coupon_cnt ); } catch (\Exception $e) { printf( "{$loop}번째: %s 설정 실패:%s\n", rtrim($line), $e->getMessage() ); } $loop++; } } }