implement feature 'put to cart ticket installment request'
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace console\controllers;
|
||||
|
||||
use backend\components\ContractManager;
|
||||
use common\models\Card;
|
||||
use common\models\Contract;
|
||||
use common\models\Customer;
|
||||
@@ -15,6 +16,17 @@ use yii\console\Exception;
|
||||
class ContractController extends Controller
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param $requestId
|
||||
* @throws \Throwable
|
||||
* @throws \yii\web\NotFoundHttpException
|
||||
*/
|
||||
public function actionRequestToCart($requestId){
|
||||
$contractManager = new ContractManager();
|
||||
$contractManager->openRequestAndPutItItoCart($requestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cardNumber
|
||||
* @throws Exception
|
||||
@@ -84,15 +96,15 @@ class ContractController extends Controller
|
||||
);
|
||||
} else if ($part->isStatusAccepted()) {
|
||||
$this->info("loading ticket: #" .$part->id_ticket);
|
||||
/** @var \common\models\Ticket $ticket */
|
||||
$ticket = null;
|
||||
try{
|
||||
/** @var \common\models\Ticket $ticket */
|
||||
// $ticket = Ticket::findOne(['id_ticket' => $part->id_ticket]);
|
||||
try {
|
||||
$ticket = Ticket::findOne(['id_ticket' => $part->id_ticket]);
|
||||
}catch (\Throwable $e){
|
||||
\Yii::info("Failed to load ticket: " . $e->getMessage());
|
||||
}
|
||||
if (isset($ticket)) {
|
||||
$this->info("Ticket found: " . $ticket->id_ticket . "/" . $ticket->ticetType->name);
|
||||
$this->info("Ticket found: " . $ticket->id_ticket . "/" . $ticket->ticketType->name);
|
||||
if ($ticket->status == Ticket::STATUS_DELETED) {
|
||||
$ticket->status = Ticket::STATUS_ACTIVE;
|
||||
$ticket->save(false);
|
||||
@@ -148,4 +160,4 @@ class ContractController extends Controller
|
||||
echo $msg . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user