implement mobile devices in reception
This commit is contained in:
30
mobileapi/manager/ApiManager.php
Normal file
30
mobileapi/manager/ApiManager.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace mobileapi\manager;
|
||||
|
||||
use common\models\Card;
|
||||
use Endroid\QrCode\QrCode;
|
||||
|
||||
class ApiManager
|
||||
{
|
||||
public function getCardPage(){
|
||||
$customer = \Yii::$app->user->getIdentity();
|
||||
|
||||
if ( $customer == null ){
|
||||
throw new \yii\web\NotFoundHttpException();
|
||||
}
|
||||
$card = Card::findOne($customer->id_customer_card);
|
||||
|
||||
if ( $card == null ){
|
||||
throw new \yii\web\NotFoundHttpException();
|
||||
}
|
||||
|
||||
$qrCode = new QrCode($card->number);
|
||||
|
||||
return [
|
||||
'qrcode' => $qrCode->writeDataUri(),
|
||||
'cardNumber' => $card->number,
|
||||
'customerName' => $customer->name
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user