|
- <?php
-
- namespace App\Http\Controllers\Web\QRService\Acquisition;
-
- use App\Http\Controllers\Web\WebController;
- use App\Logics\QRService\QRCryptoLogic;
- use App\Models\HtpmsCustomer\QRService\AcquisitionTicketToken;
- use Illuminate\Http\JsonResponse;
- use Illuminate\Http\Request;
- use Str;
-
- class GetAcquisitionTokenController extends WebController
- {
-
- public function name(): string
- {
- return "サービス券取得用トークン取得";
- }
-
- public function description(): string
- {
- return "サービス券取得用トークンを取得する";
- }
-
-
- public function __construct(protected GetAcquisitionTokenParam $param)
- {
- parent::__construct();
- }
-
- protected function run(Request $request): JsonResponse
- {
- $shopId = $this->sessionUser->shopId();
-
- $token = AcquisitionTicketToken::whereShopId($shopId)->first();
-
- if ($token === null) {
- $token = new AcquisitionTicketToken();
- $token->shop_id = $shopId;
- $token->token = Str::uuid()->toString();
- $token->save();
- }
-
- $res = [
- "token" => $token->token,
- "customer_id" => $this->sessionUser->customerId(),
- ];
-
- return $this->successResponse($res);
- }
- }
|